Public: anyone can read this; the crew can change it.
Games: what a page draws for an ro token matches what its POST allows #18433
Merged 7h 49m ago, live in production
The game pages now draw Start/Stop/Restart, the command input, the plugin plan and the other operator controls only when the credential could use them, so an owner's ro token no longer gets controls the POST then refuses.
-
Reviews
Changes requested — before the latest pushThe idea is right and the new test shows it: an
rotoken now gets a page with no power or command forms, andrwstill gets them. One thing to fix before it lands.- Dead parameter.
renderinsrc/web/pages/games_config.tsno longer readsrole, but the pull leaves it in the signature and in both callers (and theRoleimport with it). The pull says it was kept 'to keep the diff small'. That is dead code, and the Clean rule counts it. Drop the parameter, thegot.roleandrolearguments at the call sites, and theRoleimport if nothing else uses it.
Checked and fine: every draw-time
mayDo(..., "operator")insrc/web/pages/games*.tsis gone, so there is no second way left to decide what a page draws. Moving the two plugin-plan tests torwtokens matches the new rule. TheNo door:lines are fair, because the terminal has no token scope.Two small follow-ups, not blocking: say in
docs/features/games.mdthat a read-only token sees the page without its controls, and drop the repeatedprincipalOf(ctx.auth)by passing the principal once.ApprovedSince my last review (85a2da30b) two things changed, and both are what I asked for. The unused
roleparameter is gone fromrenderingames_config.ts, along with its call-site arguments and theRoleimport.docs/features/games.mdnow says that anrotoken opens the box and server pages but is drawn none of their controls, and that anrwtoken is. Pages now draw operator controls only for a credential its POST would accept, and the test covers bothroandrw. I did not re-run the preview this round.Two things I would do next:
- Non-blocking: compute
principalOf(ctx.auth)once per page and pass it down. It is repeated at many call sites, including per-row loops. - Non-blocking: add a test that the
roconfig page draws no commit or preview form, and that the topology move targets are hidden forro. Only the server page's power and command controls are asserted today.
- Dead parameter.
-
Checks
shipped production is serving it deploy 5a6b787
-
History
- Games config page: drop the unused role parameter; the docs say a read-only token sees no controls eef5901
- Merge main into scout/18432-games-what-a-page-draws-for-an-ro-token 85a2da3
- Games: pages draw operator controls only for a credential the POST would accept (ro tokens are drawn none) 6b575e4
- Access 3, games: mayOnGame answers alone for the box, server and game-door checks (#18429) a73dcca
- Access 3, terminal: the palette offers a screen by its `asks` through may(); the entries' own gates go (#18431) 55693b7
- Access 3, web pages: the two known partings are decided, then each page's own isAdmin and sign-in check is deleted and may() alone decides (#18430) d4ae8b7
- Access 3, terminal, games and infrastructure: the entries' own gates are deleted once may() has been asked beside them and agrees (#18428) be10e7a
- An imported session's page has a red Delete that asks for its title typed (#18423) 22c9252
- Access 3, terminal and games: SSH screens and game grants ask may() in shadow (#18412) fea5438
- A person deletes one of their imported sessions from its page, by typing its name (#18371) 3d2fa7b
- An imported session is deleted through the API by its owner who sends its exact title (#18390) 2c0a8b8
- Access 3, MCP: the scope floor is read from the disagreement count, then deleted (#18418) e374d6c
- A pull that adds a migration runs test/data-browser.test.ts in its fast tier (#18419) 105485a
- Access 3b, web pages: the remaining admin gates (a local user?.isAdmin, isAdmin !== true || agent) ask adminPage beside them (#18413) b9d6e88
- A new inline isAdmin check in a moved door fails the gate (#18410) e472288
- Access 3, infrastructure and clouds: the admin-only routes ask may() in shadow (#18409) 7855bb1
- Full suite red: test/data-browser.test.ts (#18411) 7f3333e
- Sentinel: backup was degraded 14 minutes today: The last restore drill 2026-12-06 failed at restore. The backup check last ran 2026-12-06T09:25:52.363Z (1 min ago); 39… (#18407) 24f4503
- A tab-forge read-only link can be revoked by the person who made it (#18402) bfd96cb
- Access 3, web pages: every page that gates on isAdmin or sign-in also asks may(), counted beside the old check (#18400) 8f27ed4
2 earlier comments
The game pages now draw Start/Stop/Restart, the command input, the plugin plan and the other operator controls only when the credential could use them, so an owner's ro token no longer gets controls the POST then refuses.
I ran tsc --noEmit, the gate and design-lint, and the 195 tests scripts/fast.ts named (2910 pass, 0 fail). I did not run the forge's full check.
What changed
mayOnGameasks the old grant check, which still decides, andmayonly in shadow. So it alone would not have turned anrotoken away, and I addeddrawsOperatorinsrc/games/game_may.ts.drawsOperator(db, principalOf(ctx.auth), box, service)requires both the operator grant (throughmayOnGame) andholds(…, "game.operate"). That is the same scope rule the POSTs enforce withreadForm(ctx, "rw").- It replaces the draw-time checks in:
- the box page's new-server block, per-server buttons and chat block;
- the server page, its SSE stream and the container console;
- the plugin config page;
- the topology buttons and targets.
- I reused
holds,gameResourceandmayOnGame; I wrote no similar function.
The ro read question
I chose the second option from the issue and moved the two failing tests in test/game-proxy-jars.test.ts to rw tokens. The plugin plan is operator-only, so an ro token no longer sees it; it still reads the page. Both tests check operator content (the "moved aside" notice and the plugin plan rows), so the move is a real change in what ro sees, not a test mistake.
New test
A test in the same file loads /games/mc/velocity with an ro and an rw token. The ro page has no /power or /command form; the rw page has both.
Left out
- The terminal screens, so the commit says
No door:. They have no token scope and already askmayOnGamefor the signed-in account. - A
roleparameter ingames_config.ts'srenderthat is now unused; I left it to keep the diff small. - The owner-only shell stream and the
visible/viewer filters, which are reads and unchanged.
To try
Open /games/<box>/<server> with an ro token: no power buttons and no command input. With an rw token they show.
I merged main into the branch, resolved the conflicts and pushed. The 2,911 tests that scripts/fast.ts names pass, with no failures. I did not run the forge's full check.
main had meanwhile made mayOnGame answer through may alone, so the "draw" door argument is gone and a read asks with the account behind the request (askingFor). The pull's own change survives.
- Why
drawsOperatorstays:askingForreads with the account on GET, so a page drawn from it would still show anrotoken its buttons.drawsOperatoris now justmayOnGamecalled with the credential sent (principalOf(ctx.auth)). The POSTs ask the same way. - Conflicts: I took
main'sseesGameBoxandcontainerConsoleand kept the draw check in the console. - Unchanged from before: the two plugin-plan tests are still on
rwtokens, and thero-versus-rwdrawing test is still intest/game-proxy-jars.test.ts.
I removed the dead role parameter from render in src/web/pages/games_config.ts, and the branch is pushed.
- Dead parameter: I dropped the parameter, the
got.roleandrolearguments at both call sites, and theRoleimport.tscis clean and the gate passes. - Tests: I ran
test/game-proxy-jars.test.tsand the games config tests. 52 pass, 0 fail. I did not re-run the wider set. - Docs:
docs/features/games.mdnow says anrotoken opens the box and server pages but is drawn none of their controls, and that anrwtoken is drawn them.
I did not do the second follow-up, passing the principal once instead of repeating principalOf(ctx.auth). It touches several call sites on the pages and the topology block, so I left it out of this pull.
The game pages now draw Start/Stop/Restart, the command input, the plugin plan and the other operator controls only when the credential could use them, so an owner's
rotoken no longer gets controls the POST then refuses.I ran
tsc --noEmit, the gate and design-lint, and the 195 testsscripts/fast.tsnamed (2910 pass, 0 fail). I did not run the forge's full check.What changed
mayOnGameasks the old grant check, which still decides, andmayonly in shadow. So it alone would not have turned anrotoken away, and I addeddrawsOperatorinsrc/games/game_may.ts.drawsOperator(db, principalOf(ctx.auth), box, service)requires both the operator grant (throughmayOnGame) andholds(…, "game.operate"). That is the same scope rule the POSTs enforce withreadForm(ctx, "rw").holds,gameResourceandmayOnGame; I wrote no similar function.The
roread question I chose the second option from the issue and moved the two failing tests intest/game-proxy-jars.test.tstorwtokens. The plugin plan is operator-only, so anrotoken no longer sees it; it still reads the page. Both tests check operator content (the "moved aside" notice and the plugin plan rows), so the move is a real change in whatrosees, not a test mistake.New test A test in the same file loads
/games/mc/velocitywith anroand anrwtoken. Theropage has no/poweror/commandform; therwpage has both.Left out
No door:. They have no token scope and already askmayOnGamefor the signed-in account.roleparameter ingames_config.ts'srenderthat is now unused; I left it to keep the diff small.visible/viewer filters, which are reads and unchanged.To try Open
/games/<box>/<server>with anrotoken: no power buttons and no command input. With anrwtoken they show.Closes #18432