Public: anyone can read this; the crew can change it.
Access 4b-2: an admin sees who can reach what, by person and by resource #18179
Merged 4h 47m ago, live in production
On "Who may do what" (/settings/who-can), an admin can now switch between Every grant · By person · By resource (?by=person, ?by=resource). For anyone who isn't an admin, asking for someone else's view gets exactly the same 404 as asking for a person who doesn't exist.
-
Reviews
ApprovedClean. Grouping is a pure function over the existing everyGrant read, so no new table and no new query. The admin gate is one line in whoMayDoWhat. Non-admins get not_found for any
by, and the page gives an unknown?by=the same 404, so the parity test holds. Names go through html escaping, and a test covers it. The terminalbkey, the MCPbyargument and docs/features/who-can.md all cover the same view, and README is untouched. Child rows sit outside the nav anchor, so there are no nested links. The page works without JavaScript. Two small things for later, neither blocking: the twonarrowbranches in groupGrants build the same object and could be one condition, and the resource link is a contains-match, which the pull already says. What I saw of the preview:/answered 200 at this head, and/settings/who-can?by=personanswered 303 to a request without a signed-in session. The pictures sit outside the directory my file tools may read, so I did not see them. The grouped page itself I judged from the code and the tests, not by looking at it. -
Checks
shipped production is serving it deploy a338207
-
History
- Look: who-can is not among app.looks, which is full at 32 (#18159) d2d76e4
- Try: as an admin open /settings/who-can and pick By person, then By resource (#18159) 60c226c
- Rewrap comments (#18159) c02c6ed
- Who may do what: an admin groups every grant by person or by resource (#18159) a93fcec
- Automate a review finding as a lint or test: One high finding, then smaller ones, all for one round. (#18167) f6eb779
- A spark profile decodes to a summary: call tree, slowest ticks, per-mod time, GC and memory (#18144) e30e2b6
- Access 4b: the 'Who may do what' page, linked from settings, by person and by resource (#18131) 3ecccb5
- "asks ledger failed: database is locked" two minutes after a release (v0.7.733) (#18169) 009df15
- Traces 4: a Claude Code session file imports as a trace and is listed beside the others (#18129) 68f0754
- A game box stores spark profiles in the forge: POST /post gives a Location, reads need the box's game grants (#18146) b992c0d
- Games survival step 3: quality-of-life mods tried on a copy first (graves, essential-commands, sleep, harvest, vein miner, styled-chat) (#18145) f058287
- Spend 1: a monthly budget per cloud account, one notice at 80% and one at 100% (#18121) 3382c40
- Games: a proxy plugin update can wait until nobody has been on for 30 minutes (#18039) 9a5eb31
- Traces 5: compare two traces, and share one with secrets redacted (#18017) 7a17314
- AWS writes for mail setup are a named allowlist beside the read rule, and nothing else (#18142) 93c7c3d
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18128) 077bab0
- A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in (#18143) f7e559b
- Access 4c: the grants view as an MCP tool and a terminal screen (#18130) 89afadf
- small: the Absorb findings say they are ready for the owner to send to Ben (#18132) d41ec43
- Games survival step 2a: BlueMap behind login at /games/<box>/<server>/map, no published box port (#18100) 1132c91
2 earlier comments
On "Who may do what" (/settings/who-can), an admin can now switch between Every grant · By person · By resource (?by=person, ?by=resource). For anyone who isn't an admin, asking for someone else's view gets exactly the same 404 as asking for a person who doesn't exist.
What changed
- Grouping (
src/core/grants_view.ts): a new function,groupGrants, groups the grants thateveryGrantalready reads, by holder or by resource. There is no new table and no new query. Each group carries the look-up that narrows the page to it:person=for an account,resource=for a resource. A holder that isn't an account (a repository, a device, a pull) gets no person link. - Rules (
src/actions/grants_view.ts):whoMayDoWhatacceptsby. A non-admin who sends anybygetsnot_found, the same as asking for another person.grantsBychecks the value at each entry point, and an unknown?by=is a 404. - Page (
src/web/pages/who-can.ts): the switch uses the existingsegcontrol. Each group is a row linking to its look-up, showing its kind and count, with its grants under it as tree rows; each grant still links to where it is changed. All names go throughhtmlescaping. The search form keepsbywhen you look someone up. - Terminal (
src/tui/screens/whocan.ts): thebkey cycles by person → by resource → off. The count line says how many groups there are. - MCP: the
accesstool'sgrantsaction takesbyand returnsgroups. - How-to:
docs/features/who-can.mdis updated.
Tests (test/who-can.test.ts, 4 new):
- An admin sees dave's telemetry grant in the dave group and dave's
app_membergrant underalice/yard, on the page with links to each look-up and to where each grant changes. Every grant lands in exactly one group. - When bob, who isn't an admin, asks for
person=dave,by=person,by=resource, a resource, or the two combined, he gets status and body identical toperson=nobody-here, apart from the request id. - A host name containing
<img …>shows up escaped in the grouped view. - The terminal's
bkey shows the same groups.
bun x tsc --noEmit, bun scripts/design-lint.ts and bun scripts/gate.ts --explain are clean. scripts/fast.ts named 425 test files (about 29 minutes), so I ran 27 chosen suites instead (who-can, grants-view, the MCP doc/argument/fuzz suites, palette, route marks, 404 parity, unused exports, module state, doors, page budget): all 453 tests pass. The forge's check runs the rest.
Reused everyGrant, provenance, seg, row with children, rowList and notFoundPage. similar.ts flagged the terminal's changedAt as like the page's row: they render the same words for two different doors, so I left them separate.
Chose not to:
- Let a non-admin group their own grants. Any
byfrom a non-admin isnot_found, which keeps the rule to one line. - Make the resource link an exact match. It uses the existing contains-match look-up, so
alice/yardwould also matchalice/yard2.
Try it: sign in as an admin, open /settings/who-can and pick By person, then By resource. Sign in as someone who isn't an admin and open /settings/who-can?by=person or ?person=<someone>: you get the same 404 as for a name that doesn't exist.
[
{"go": "/settings/who-can?by=person", "look": "the switch and the first group rows", "expect": "By person is current; each person row links to /settings/who-can?person=<name> and lists their grants under it, each linking to where it changes"},
{"go": "/settings/who-can?by=resource", "look": "group rows", "expect": "one row per resource with its kind and grant count, linking to ?resource=<name>"},
{"go": "/settings/who-can?by=person", "look": "as a person who is not an admin", "expect": "the same 404 page as /settings/who-can?person=nobody-here", "ask": "Is the not-found answer indistinguishable?"}
]
🤖 Generated with Claude Code
<!-- look-pages 60c226c3ace5 --> Look pages for 60c226c, from the gate:
look pages (none): "Looks: /settings/who-can" is not a page of app.looks in forge.json; this pull changes src/web/pages/who-can.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
An admin can now group every grant on Who may do what (/settings/who-can) by person or by resource. ?by=person or ?by=resource shows one row per holder or resource, linked to its look-up page. The grants sit under each row, and each links to the place where it is changed. Anyone who isn't an admin and asks for a grouping, or asks about another person, gets the same 404 as a person who doesn't exist. The terminal has the same switch (b), and so does the MCP access tool (by). The grouping is groupGrants in src/core/grants_view.ts, built on the existing everyGrant read, so there is no new table.
Look pages: the last commit says No look:. /settings/who-can is not in app.looks, and that list can't grow: test/forge-looks.test.ts caps it at 32 paths, and it already has 32. The nearest listed page, /settings/grants, doesn't show this change, so naming it would mean before/after pictures that show nothing. Adding this page means dropping another one from the list, and that is the owner's choice, so I left the list as it is.
Checks: bun scripts/gate.ts passes. It prints two advisory notes that the switcher and href helpers in who-can.ts are 0.58 alike, but it does not fail on them. I did not re-run bun x tsc --noEmit or the tests after this last commit, because it is empty and changes no code.
What I chose not to do: no export of the grouped view; the flat list's existing CSV/JSON is still the source.
[
{"go": "/settings/who-can?by=person", "look": "the list as an admin", "expect": "one row per account or app, each linking to its look-up, with its grants beneath linking to where they change"},
{"go": "/settings/who-can?by=resource", "look": "the same list grouped by resource", "expect": "one row per repository or resource, with who holds what on it"},
{"go": "/settings/who-can?by=person", "look": "the page as a non-admin", "expect": "404, the same as for a missing person", "ask": "Is a plain 404 right for non-admins, or should they see their own grants?"}
]
🤖 Generated with Claude Code
On "Who may do what" (
/settings/who-can), an admin can now switch between Every grant · By person · By resource (?by=person,?by=resource). For anyone who isn't an admin, asking for someone else's view gets exactly the same 404 as asking for a person who doesn't exist.What changed
src/core/grants_view.ts): a new function,groupGrants, groups the grants thateveryGrantalready reads, by holder or by resource. There is no new table and no new query. Each group carries the look-up that narrows the page to it:person=for an account,resource=for a resource. A holder that isn't an account (a repository, a device, a pull) gets no person link.src/actions/grants_view.ts):whoMayDoWhatacceptsby. A non-admin who sends anybygetsnot_found, the same as asking for another person.grantsBychecks the value at each entry point, and an unknown?by=is a 404.src/web/pages/who-can.ts): the switch uses the existingsegcontrol. Each group is a row linking to its look-up, showing its kind and count, with its grants under it as tree rows; each grant still links to where it is changed. All names go throughhtmlescaping. The search form keepsbywhen you look someone up.src/tui/screens/whocan.ts): thebkey cycles by person → by resource → off. The count line says how many groups there are.accesstool'sgrantsaction takesbyand returnsgroups.docs/features/who-can.mdis updated.Tests (
test/who-can.test.ts, 4 new):app_membergrant underalice/yard, on the page with links to each look-up and to where each grant changes. Every grant lands in exactly one group.person=dave,by=person,by=resource, a resource, or the two combined, he gets status and body identical toperson=nobody-here, apart from the request id.<img …>shows up escaped in the grouped view.bkey shows the same groups.bun x tsc --noEmit,bun scripts/design-lint.tsandbun scripts/gate.ts --explainare clean.scripts/fast.tsnamed 425 test files (about 29 minutes), so I ran 27 chosen suites instead (who-can, grants-view, the MCP doc/argument/fuzz suites, palette, route marks, 404 parity, unused exports, module state, doors, page budget): all 453 tests pass. The forge's check runs the rest.Reused
everyGrant,provenance,seg,rowwithchildren,rowListandnotFoundPage.similar.tsflagged the terminal'schangedAtas like the page'srow: they render the same words for two different doors, so I left them separate.Chose not to:
byfrom a non-admin isnot_found, which keeps the rule to one line.alice/yardwould also matchalice/yard2.Try it: sign in as an admin, open
/settings/who-canand pick By person, then By resource. Sign in as someone who isn't an admin and open/settings/who-can?by=personor?person=<someone>: you get the same 404 as for a name that doesn't exist.🤖 Generated with Claude Code
Closes #18159