Public: anyone can read this; the crew can change it.

Access 4b: the 'Who may do what' page, linked from settings, by person and by resource #18131

opened this

Merged 6h 3m ago, live in production

This adds Settings › Who may do what at /settings/who-can, with a row for it in the settings nav that everyone sees. A forge admin sees every grant on the forge, grouped by person or, with ?by=resource, by what it reaches. Anyone else sees their role first, then only the grants they hold themselves.

Notes

opened this

This adds Settings › Who may do what at /settings/who-can, with a row for it in the settings nav that everyone sees. A forge admin sees every grant on the forge, grouped by person or, with ?by=resource, by what it reaches. Anyone else sees their role first, then only the grants they hold themselves. An account with no grants sees just its role. Each row names the grant, who granted it and when (or "not recorded"), and links to the page where that grant is changed.

  • One gate for both doors: src/actions/who_can.ts reads everyGrant from Access 4a's core/grants_view.ts. An admin who is a person gets every row; anyone else gets only rows where they are the grantee; a visitor gets nothing. The page and the new terminal screen both go through it, so a non-admin can't see another person's grants on either side.
  • Where each grant is changed: grants tied to a repository link to that repository's settings, and a pull's run grant links to the pull. Other grants link to their own settings page (People, Devices, Hosted forges, Cloud, Telemetry, Secrets, Subscriptions, a crew team). Grants in the team-member table and model budgets go to Settings › People, which is the closest page, not an exact one.
  • Terminal: a "Who may do what" entry in the palette (src/tui/screens/whocan.ts) shows the same rows and words; an admin presses v to switch between by person and by resource. The how-to is docs/features/who-can.md.
  • Wiring: the route is marked open in src/http/marks/settings.json, registered in settings_routes.ts, and lazy_lists.ts is regenerated. grants_view.ts now has a caller, so I took it off both allow-lists.
  • Tests: test/who-can.test.ts checks that:
    • the admin sees one grant from every table, the right links, and the by-resource grouping;
    • HTML in the data comes out escaped;
    • a person sees only their own grants;
    • an account with no grants sees only its role;
    • /settings links to the page;
    • the terminal follows the same gate.

    test/palette-roster.test.ts lists every palette entry, so I added the new one to its three lists. The test was right to fail there.

The pages and test reuse rowList, seg, row and accountShell from the web UI, and the shared terminal test helpers (quietCtx, sessionFor, screenText). Not done here: the MCP tool, which is #18106.

The gate reports 0 failures; one note remains, that the test's small page-fetch helper looks like the one in test/forks.test.ts. bun x tsc --noEmit and bun scripts/design-lint.ts are clean, and the tests around this change pass. I did not run the full suite: scripts/fast.ts named 3,114 test files, so I picked the relevant ones and the forge's check runs the rest.

Try: sign in on the preview and open Settings › Who may do what. As an admin, switch to By resource. As a person with no grants, you see only your role line.

[{"go":"/settings","look":"the settings nav, Account group","expect":"a 'Who may do what' link to /settings/who-can"},
 {"go":"/settings/who-can","look":"the page as a forge admin","expect":"the role line, By person / By resource tabs, grants grouped under headings, each row linking to where it is changed"},
 {"go":"/settings/who-can?by=resource","look":"the grouping","expect":"headings name what is reached (host, app, repo...), rows name who holds it"},
 {"go":"/settings/who-can","look":"the page as a non-admin with no grants","expect":"only 'Person: your own repositories…' and 'You hold no grants', no tabs, no one else's rows","ask":"Is the role line clear enough on its own?"}]

🤖 Generated with Claude Code

Closes #18105

4 earlier comments
commented

This adds Settings › Who may do what at /settings/who-can, with a row for it in the settings nav that everyone sees. A forge admin sees every grant on the forge, grouped by person or, with ?by=resource, by what it reaches. Anyone else sees their role first, then only the grants they hold themselves. An account with no grants sees just its role. Each row names the grant, who granted it and when (or "not recorded"), and links to the page where that grant is changed.

  • One gate for both doors: src/actions/who_can.ts reads everyGrant from Access 4a's core/grants_view.ts. An admin who is a person gets every row; anyone else gets only rows where they are the grantee; a visitor gets nothing. The page and the new terminal screen both go through it, so a non-admin can't see another person's grants on either side.
  • Where each grant is changed: grants tied to a repository link to that repository's settings, and a pull's run grant links to the pull. Other grants link to their own settings page (People, Devices, Hosted forges, Cloud, Telemetry, Secrets, Subscriptions, a crew team). Grants in the team-member table and model budgets go to Settings › People, which is the closest page, not an exact one.
  • Terminal: a "Who may do what" entry in the palette (src/tui/screens/whocan.ts) shows the same rows and words; an admin presses v to switch between by person and by resource. The how-to is docs/features/who-can.md.
  • Wiring: the route is marked open in src/http/marks/settings.json, registered in settings_routes.ts, and lazy_lists.ts is regenerated. grants_view.ts now has a caller, so I took it off both allow-lists.
  • Tests: test/who-can.test.ts checks that:
    • the admin sees one grant from every table, the right links, and the by-resource grouping;
    • HTML in the data comes out escaped;
    • a person sees only their own grants;
    • an account with no grants sees only its role;
    • /settings links to the page;
    • the terminal follows the same gate.

    test/palette-roster.test.ts lists every palette entry, so I added the new one to its three lists. The test was right to fail there.

The pages and test reuse rowList, seg, row and accountShell from the web UI, and the shared terminal test helpers (quietCtx, sessionFor, screenText). Not done here: the MCP tool, which is #18106.

The gate reports 0 failures; one note remains, that the test's small page-fetch helper looks like the one in test/forks.test.ts. bun x tsc --noEmit and bun scripts/design-lint.ts are clean, and the tests around this change pass. I did not run the full suite: scripts/fast.ts named 3,114 test files, so I picked the relevant ones and the forge's check runs the rest.

Try: sign in on the preview and open Settings › Who may do what. As an admin, switch to By resource. As a person with no grants, you see only your role line.

[{"go":"/settings","look":"the settings nav, Account group","expect":"a 'Who may do what' link to /settings/who-can"},
 {"go":"/settings/who-can","look":"the page as a forge admin","expect":"the role line, By person / By resource tabs, grants grouped under headings, each row linking to where it is changed"},
 {"go":"/settings/who-can?by=resource","look":"the grouping","expect":"headings name what is reached (host, app, repo...), rows name who holds it"},
 {"go":"/settings/who-can","look":"the page as a non-admin with no grants","expect":"only 'Person: your own repositories…' and 'You hold no grants', no tabs, no one else's rows","ask":"Is the role line clear enough on its own?"}]

🤖 Generated with Claude Code

commented

While this pull waited, main shipped the same feature under #18062 (5ba07c89c): the /settings/who-can page with look-ups by person and by resource, actions/grants_view.ts, the whocan terminal screen, the MCP access grants action, and their tests. In this merge main's version wins every conflict. This branch's duplicate src/actions/who_can.ts, page, screen, palette command and allow-list edits are dropped.

What this pull still adds is the issue's "linked from settings" item. Main links the page only from the admin page /settings/access, so a person who is not an admin could not reach it from settings.

  • src/web/pages/origins.ts adds Account › Who may do what to the account settings nav for every signed-in role.
  • src/web/pages/who-can.ts now passes accountSections("who-can", …), so the page marks that nav row as current instead of the Access row.
  • test/who-can.test.ts has a new test: a non-admin's /settings links /settings/who-can, and the page marks the row aria-current.

There is no new terminal change. Main's palette entry who-can already offers the screen to every signed-in role, and the merge commit says so in a No door: line. bun x tsc --noEmit, the design lint and the gate pass. test/who-can.test.ts, test/palette-roster.test.ts and test/grants-view.test.ts pass: 32 tests.

[{"go":"/settings","look":"the Account group in the settings nav, signed in as a person who is not an admin","expect":"a 'Who may do what' row linking /settings/who-can"},
 {"go":"/settings/who-can","look":"the settings nav and the page body","expect":"'Who may do what' is the current nav row; the body names your role and lists your own grants, or 'No grants match.'"},
 {"go":"/settings/who-can?person=<name>","look":"as a forge admin","expect":"that person's grants, each row linking to where it is changed","ask":"Does the nav row belong under Account, or under Admin as well?"}]

🤖 Generated with Claude Code

commented

Every account's settings nav now has a "Who may do what" row linking to /settings/who-can, and the row is marked as current on that page. The page itself came from #18062 on main. This pull links it from settings and fixes the two things the check failed on last time.

  • Dead link (the "findings are the known ones" failure): a member opening the page saw their own membership grant linking to /settings/people, which turns them away. Now, in a person's own view, whoMayDoWhat in src/actions/grants_view.ts drops the link for grants changed on admin-only pages: People, Crew, Cloud, Subscriptions and Secrets. The page shows "an admin changes it" instead of a link, and so does the terminal screen (src/tui/screens/whocan.ts). An admin's view still links every row. docs/features/who-can.md says so.
  • First-view budget: the new nav row adds four words to Settings, so docs/design/attention-budget.json raises it from 149 to 153, with a note in the same style as earlier rows.
  • Tests: a new test in test/who-can.test.ts checks that a member's page and terminal never link to an admin-only page and say "an admin changes it", while an admin still gets the People link. Another checks that a non-admin reaches the page from /settings.

Checked: test/who-can.test.ts, test/deadends.test.ts, test/attention.test.ts and test/attention-stamped.test.ts pass. The gate, tsc --noEmit and design-lint are clean.

Not fully run: scripts/fast.ts picked 442 test files, and that run timed out after about 10 minutes. Two failures appeared in it:

  • test/pages-budget.test.ts passes on its own.
  • test/scripts-fast.test.ts also fails on its own: its "clean tree and a docs-only diff exit 3" test hits its 5-second timeout. I changed nothing it tests.

Not done: the admin-only pages are a fixed list in the action rather than read from each page's own check, so a page that later becomes admin-only must be added there. /settings/telemetry is left linked.

To try it: sign in as a member who holds a grant, open Settings › Who may do what, and look for "an admin changes it" on their membership row. Then open ?person=<them> as an admin and the same row links to People.

[{"go":"/settings","look":"the settings side nav, signed in as a member","expect":"a 'Who may do what' row under Account"},{"go":"/settings/who-can","look":"the member's own grant rows","expect":"the membership row says 'an admin changes it' and is not a link; the nav row is marked current"},{"go":"/settings/who-can?person=dave","look":"as an admin, the same person's membership row","expect":"it links to /settings/people"}]

🤖 Generated with Claude Code

commented

In a person's own view of Settings → Who may do what (/settings/who-can), a grant that only an admin can change no longer links to a page that would turn them away. That covers grants changed on People, Crew, Cloud, Subscriptions or Secrets: the row now says "an admin changes it". A forge admin's view still links every row to the page where it is changed. The page is on every account's settings nav.

This push merges the latest main. The only conflict was in docs/features/who-can.md. The Web line keeps this branch's wording about admin-only grants. The MCP line takes main's version, which adds whoami_can with kind: "grants" for anyone; a forge admin's access tool still takes person or resource.

What passed after the merge:

  • bun x tsc --noEmit is clean.
  • The tests that cover this feature pass: who-can, the grants view, the terminal's grants, whoami and the docs tests.
  • bun scripts/gate.ts --explain passes all 33 of its rules.

I did not run the whole suite. bun scripts/fast.ts named 443 test files (about 30 minutes) because the merge brings in all of main's changes, so the forge's check covers the rest. The sandbox also refused outbound requests to *--forge.test during the runs; no test failed from it.

To try it: sign in as a non-admin who holds a crew or subscription grant, open /settings/who-can, and check that those rows read "an admin changes it" instead of linking away. Then open the same page as an admin, look up that person, and check that every row links.

🤖 Generated with Claude Code

commented

Adds Settings → Who may do what (/settings/who-can) to every account's settings nav. In a person's own view, a grant whose page only a forge admin can open shows no link. The row reads "an admin changes it (People)" and names the page, so the person knows where it is changed even without a link.

What changed after review: the hand-kept list of admin-only pages in src/actions/grants_view.ts is gone. reachableBy now asks isAdminRoute from src/http/route_marks.ts, which reads the same marks the admin gate uses, so the list can't drift. That fixes the rows the old list missed: a person's own telemetry_grant (/settings/telemetry) and device_grant (/settings/devices) no longer link to a page that turns them away. If a page is marked admin-only later, its rows lose their link without another edit.

Page name on unlinked rows: Grant gains an optional adminPage field, set only in a person's own view. The web page (src/web/pages/who-can.ts) and the terminal screen (src/tui/screens/whocan.ts) both show it as "an admin changes it (Telemetry)". An admin's view is unchanged and still links every row.

Tests: test/who-can.test.ts now checks that the telemetry grant has no link and names "Telemetry". It adds /settings/telemetry and /settings/devices to the list of pages a person's view must not link to, and expects "an admin changes it (People)" on both the web page and the terminal screen. The old assertion that the telemetry link stays was wrong, and is flipped.

bun x tsc --noEmit, the gate's 33 rules and the design lint pass, as do the who-can, grants-view, tui-grants, whoami and route-marks tests. I didn't run the whole suite; the forge's check does.

To try it: sign in as a non-admin who holds a telemetry grant and open /settings/who-can. The row should read "an admin changes it (Telemetry)" with no link. As an admin, look up ?person=<them>: the same row should link to /settings/telemetry.

[{"go":"/settings/who-can","look":"a non-admin's own telemetry or device grant row","expect":"no link; the row ends 'an admin changes it (Telemetry)' or '(Devices)'"},
 {"go":"/settings/who-can?person=<that person>","look":"the same rows as a forge admin","expect":"each row links to the page where it is changed"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs