Skip to content

feat(policy): add the analyst role below member - #2543

Merged
Makisuo merged 2 commits into
mainfrom
observer/policy
Nov 13, 2026
Merged

Makisuo merged 2 commits into
mainfrom
observer/policy

refactor(policy): name the lowest role analyst

6fab3c2
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review completed Nov 13, 2026 in 2m 21s

Confidence 6/10 · 1 issue to address

🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open.
1 warning −1 · tests covered · risk high −1

Adds an analyst role below member and makes an unknown Clerk role read as analyst instead of member, with an empty role list still reading as member. The ladder change is sound and well tested; the Members page still mislabels the role until #2549.

  • Role gains analyst at rank 0, below member
  • roleOf reads an unknown Clerk role as analyst, not member
  • highestRole takes Arr.max(byRank); an empty role list still reads as member
  • holdersPhrase("member") now names admins, engineers and members

Before merge

  • Manual · Create the org:analyst Clerk org role before #2549 assigns it: roleOf matches the key exactly

Still open from earlier reviews

What was checked
  • roleOf only ever sees Clerk keys: tenant.roles carries org:* (packages/auth/src/index.ts:780), pinned key roles too (apps/api/src/routes/v2/api-keys.http.ts:138)
  • Arr.max returns the element, as its existing callers assume (packages/alerting-core/src/oncall.ts:331), so highestRole still returns Role
  • No permission has min: "analyst", so the new holdersPhrase branch changes no denial message today

6fab3c2 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.