Centralize role comparison logic
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- authorization
Research direction
Start with app/api/roles.ts at the linked roleOrder and getEffectiveRole definitions, then search the repository for inline roleOrder comparisons. Centralize those boolean comparisons behind a clearly named helper and confirm that every affected call site preserves the intended role-strength semantics.
Written by the indexing model from the issue text.
Description
roleOrder gives each role a number where lower = stronger (admin is 0). That makes direct comparisons on it read backwards: roleOrder[a] <= roleOrder[b] means "a is at least as strong as b", the opposite of what the <= looks like it's saying.
We do role strength comparison using roleOrder inline at several call sites. I don't think call sites should be doing the order comparison directly. We already have getEffectiveRole (strongest of a list); the boolean comparisons want a helper with a name clear enough that it would be hard to use backwards — roleIsAtLeast(a, b) or a compareRoles comparator.
- Dominant language
- TypeScript
- Stars
- 228
- Forks
- 22
- Avg merge
- 19h 42m
- Merged PRs (30d)
- 32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from oxidecomputer/console
-
Disks: Disable 'Size' field when selecting 'Make disk read-only' and 'Image'/'Snapshot' as a source Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxidecomputer/console#3391 · 1 comment ·
-
Alerting > Receivers: Error message for subscriptions gets hidden by empty dropdown when zoomed out Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oxidecomputer/console#3390 ·
-
Difficulty 2/5 Half a day Newbie friendliness 72/100
oxidecomputer/console#3375 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
oxidecomputer/console#3338 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxidecomputer/console#3327 · 2 comments ·
All issues in oxidecomputer/console
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·