Public: anyone can read this; the crew can change it.
One Talk for game, web and iOS; the game door safe by design (write windows with a second factor, lock switch, servers by grant) #18280
Closed 4h 36m ago
This pull covers the write window, the lock, and the audit for the game door. The other issue items are not done, and one of them looks mostly done already. What changed Write window.
-
Reviews
Changes requested — before the latest pushThe window, lock and audit are well shaped and the web routes are same-origin and account-only. Changes needed, all in one round:
- Audit says "ran" for a write that did not run (src/http/mcp/shared.ts, limitedOut). When the window is open it audits "ran" and returns undefined, but askedFirst and heldWrite run after it and may still hold the call as a confirm. The audit then claims a write that was held. Audit when the call is actually dispatched, or record "ran" only after the held checks pass. Same in src/games/chat.ts runJob: "ran" is written before planServer, which can fail with "Not built". Write it after the build succeeds (and keep "refused" for the closed or locked case). Add a test that a destructive or asks-first tool inside an open window is not audited as ran.
- Passkey challenge is shared with account close (games_routes.ts reuses closeOptions; button id passkey-close). A challenge issued for one action verifies for the other. Bind the challenge to its purpose (door open vs account close), or give the door its own options handler, and test that a close challenge does not open the window.
- An open window lets any reversible write through from words typed in Minecraft, not just the games tool that #18218 allowed. A chat line from a game is untrusted text steering the crew. Keep limitedMay for the games tool and hold the rest even inside the window, or say in the docs and the PR which tools the window frees and why that is safe. At minimum, window-covered writes should still hit askedFirst for the asks-first list, which the test should show.
- Design: see line comments (principles 1, 3 and 7).
- Both doors: the terminal can show W and lock with K, but K locks with no confirmation on a single key, and W only prints a sentence. Fine for lock (it only takes away), but W should show the last writes the page shows, so the terminal is not a poorer door.
- Tests: the new game-chat test deletes the window row with raw SQL and swallows an error in a try/catch around told(). Remove the try/catch and reset state through the module's API. Also add a test that viaPlayer is empty-safe and that a held confirm with a null (too many confirms) is not audited as held.
- windowMinutes duplicates the bounded-integer parsing of start_refusal.ts count (the gate hint): reuse one.
- Scope: the issue also asked for a single Talk engine, iOS, servers by grant, Mojang/Floodgate identity and auto-lock. The PR says they are not done; open an issue for each and link them to #18247/#18280 so they are not lost.
-
Checks
stopped closed without shipping deploy 525fac7
-
History
- Merge main: the game door's write window is main's (#18296), so this branch's duplicate window, its routes, table and tests give way to it (#18247) 525fac7
- Game door: a read-only switch and a one-hour write window the owner opens with a second factor (#18304) 1235063
- Game door: merge the duplicate fence import in the conversation door test (#18247) 307981a
- Full suite red: 2 files in check run 01m91f4z6qq7gd3712hjm33z1r (#18315) 1f9f7ad
- Tab forge: serve the forge as the tab's own page in the hosted shell, no frame (#18306) d162615
- Connections: a Minecraft name is a second kind of proven connection beside email (#18227) 5948687
- Game door: audit a write only once it is dispatched, own passkey challenge, W lists the writes, shared bounded-number parser (#18247) 5c1ec82
- Access 5c: the tab forge and the Apple app's on-device mode present the same visitor to a shared forge, so apps made without a login arrive owned (#18275) ec352f4
- Game door: the passkey challenge route is routed outside /api/v1, as the close form's is (#18247) 324c74c
- Tab forge: making an app is refused ("not from this forge's own page") (#18267) b869757
- The release was held: could not cut the tag v0.7.741 (#18299) 4d3523d
- Tab forge: a real-browser walk makes an app and edits a file without 'Failed to fetch' (#18307) c343cd7
- Game door: each player sees and reaches only the servers their forge grant allows (#18301) 37e3d90
- Report key: an admin makes, rotates and revokes it through the JSON API, in the settings page's words (#18289) ff66ea0
- Tab forge: the whole tab, the whole forge, and this machine put to work (#18290) 8089d62
- Apple crash reports: the app's owner sees the groups on the telemetry view, is told once per new group, and /privacy says what a report holds (#18302) c6bd3f3
- Tab forge: a write from the tab's own page passes the same-origin guard, a cross-site write is still refused (#18300) a9db6c9
- A repository's page lists its open crash groups with their issues and pulls, within the page's SQL budget (#18293) d006820
- A `bug` issue, filed by the forge or by hand, is queued ahead of feature work for its repository's crew (#18292) ecf5bab
- Crew: run the game agent tests in ubuntu:24.04 before an agent.sh release, recorded on the release (#18274) 6a2c07b
7 earlier comments
The both-doors check failed because src/web/pages/games_door.ts had no terminal door on record. The check's rule counts a page as having a door when a docs/features/*.md file names both the page and an existing src/tui/ file. The game-door write window and lock were already in the terminal (W for window state and K for lock, on the Games screen in src/tui/screens/games.ts). docs/features/games.md just never named the page.
I added one sentence to the Pages line of docs/features/games.md. It names games_door.ts and points to src/tui/screens/games.ts.
test/doorless.test.ts and test/feature-doors.test.ts pass (8 tests). The gate shows no failures, only an advisory similarity hint, and the fix is pushed as 411ea269e. I did not rerun the full suite or bun x tsc --noEmit this turn, and no code changed; the forge's check will run them.
This push fixes two of the three red tests in the last check run. I couldn't run the third, the 1280 px /talk follow test, here because no Chromium starts in this sandbox. I did not push a change for it.
What was red and what changed
- Account purge:
game_door_window.user_idandgame_door_write.user_idnamed a user but weren't inCOVEREDinsrc/core/account_purge.ts.- The window and lock row now goes with the person.
- The audit row stays as shared history, rewritten to the former account like
game_chat.
- OpenAPI: the new
POST /games/@door/optionspasskey challenge route had no row. I addedsrc/contract/openapi/routes/postGamesDoorOptions.tsand regenerated the index. - Tests run:
account-purge,openapi-covers-routes,openapi-coverage,openapi-routesandgame-door-windowpass (616 tests), andtscis clean. The gate lists no failing rule. It still notes thewindowMinutes/countsimilarity.
The 1280 px /talk test
- Cause: I believe it is a flake rather than something this pull broke. The pull touches nothing on the
/talkpage. - Not done: I changed neither the test nor
/talk. The final check run will show whether it fails again.
Each commit carries the issue number. The first says No door:, since it adds no page, action or tool.
What I chose not to do: the single Talk engine, servers by grant, and the iOS side are still not done. They stay as the earlier description says.
To try it: run bun test test/account-purge.test.ts test/openapi-covers-routes.test.ts test/game-door-window.test.ts.
🤖 Generated with Claude Code
Two of the three failures are fixed and pushed as 324c74c41. The third, the template test, passes for me but I couldn't find a cause.
Cause of the two openapi failures: I had described the game door's passkey challenge route, POST /games/@door/options, in the REST description. It is served at /games/…, not under /api/v1, so it shows up as described but not routed. It is the same kind of route as POST /settings/account/close/options.
Fix: in test/openapi-drift.test.ts I added it to the not-routed list and to the session-only list, next to the close form's route. Nothing in src/ changed.
Template test: "choosing a template for a new forge > plan carries the template only when it is not blank" passes when I run test/spawn-template-api.test.ts here. The check log shows it hitting a refused outside host (tpl--localhost:80), and that host was also refused in my sandbox. I'm treating it as a failure from that refused host rather than from this change, and I changed nothing for it. If it fails again on this push, it needs a look with its own log.
test/openapi-drift.test.ts and test/spawn-template-api.test.ts pass together (9 tests), and the gate showed no failures before the push. I did not rerun the full suite or bun x tsc --noEmit.
Pushed as 5c1ec82c0. The gate passes with no failures. I ran tsc and the tests covering the change, not the full suite.
Changes, by review item
- Audit says "ran" too early.
limitedOutnow only holds a write outside the window.- A new
doorRanrecords "ran" at dispatch, after the asks-first and fence holds have passed. - In
runJobthe build is recorded "ran" only aftercommitServersucceeds. Failed plans are not audited. - A confirm that could not be kept (too many waiting, or too big) is recorded "refused", never "held".
- Tests cover an asks-first tool inside an open window (not audited), the full-confirms case, and a build that fails in the window (not audited as ran).
- Shared passkey challenge. The door now has its own challenge store, tied to a purpose, and its own
gameDoorOptionshandler. A close challenge does not open the window, and a door challenge does not close an account; both are tested. - What the window frees. I kept the window for reversible writes and did not narrow it to the
gamestool. The asks-first hold and the fence hold still run inside it.docs/features/games.mdsays so, and a test showsrelease_nowheld inside an open window. If you want only thegamestool, that is a small change tolimitedMay. - Design.
- The block states the door's state once, as a
settings-block(the component named indocs/DESIGN.md). - The button reads "Allow writes" and the other button "Lock", with short flashes after each.
- Rows show the player, the tool and the outcome in words ("ran", "held for your yes", "refused"). The door name and window id are gone from the page; the id stays in the audit table.
- The block states the door's state once, as a
- Terminal.
Wopens a screen with the same rows as the page, through the sharedwriteSays.Kstill locks on one key, since locking only takes away. A test covers both. - Tests.
- The game-chat test no longer uses raw SQL or a swallowing try/catch.
viaPlayeris tested as empty-safe.- One existing conversation-door test now uses a conversation that has read nothing. The old one only passed because "ran" was written for a call the fence had held.
- Duplicate parsing.
wholeNumberinsrc/core/whole_number.tsis the one bounded-integer parser, used bywindowMinutesandstart_refusal.ts. - Scope. Opened #18310 to #18314: the single Talk engine, iOS, servers by grant, Mojang/Floodgate identity, and auto-lock. Each is linked to #18247 in its body.
Not changed: the gate hint that gameDoorOptions is 0.92 similar to closeOptions stays. The two are near copies that differ only in purpose, and I left them separate.
To try: open /games signed in. "Allow writes" needs a passkey, and Lock turns the block to locked. In the terminal's Games screen, W lists the last writes and K locks.
[{"go":"/games","look":"The Minecraft writes block: one sentence of state, an Allow writes button (with a passkey), a Lock button, and recent writes as rows","expect":"Rows read 'player · tool' with 'ran', 'held for your yes' or 'refused'; no window id and no door name"}]I fixed the failing check and pushed the fix to this branch.
test/conversation-door.test.ts imported ../src/core/fence.ts twice, on lines 15 and 16. That broke the duplicate-import rule. I merged the two into import { HELD_MAX, waitingFor } from "../src/core/fence.ts".
I ran test/conversation-door.test.ts and test/dup-imports.test.ts together. All 17 tests passed. I did not run bun x tsc --noEmit, scripts/gate.ts or the full suite. The forge will run the full check on this push.
This changes only a test file's imports, so behaviour is unchanged and there is nothing to try in the app.
🤖 Generated with Claude Code
I merged main and pushed. Because main already carries a game door that does the same job, I dropped this branch's own door, so the branch's content is now identical to main. The pull therefore adds nothing to review. tsc, the gate and the touched suites (65 tests) pass, but I did not run the full suite.
The conflict. Pull #18304 landed the write window, the lock and the audit for issue #18296, which was split from this issue. Its door is per box, with the passkey proof in src/actions/passkey_proof.ts and the held build in src/games/door_hold.ts. This branch had built the same thing a second way, as a per-account window in src/core/door_window.ts. Keeping both would have meant two windows and two locks.
What I dropped. I took main's version of every file the two designs touched. I also deleted this branch's door_window module, its migration and pin, its postGamesDoorOptions OpenAPI route and test/game-door-window.test.ts.
What I tried and backed out. I ported this branch's other piece onto main's per-box window. That piece held a game conversation's other writes for the player's yes instead of refusing them. It broke test/game-door.test.ts ("any other write is refused, never run"). That test came from #18218 and passes on main, and I had no reason to call it wrong. I backed the change out rather than edit the test.
Still open from #18247.
- Held actions for a game turn's non-
gameswrites.mainrefuses them. A person has to choose between the two behaviours. - One Talk for game, web and iOS.
- Removing the game door's own chat path in
src/games/chat.ts. - Letting
/forge lockwork from a name with no role on the box, which was part of this branch's door.
Someone should decide whether the held-write change goes in as a follow-up that deliberately amends that test.
To try it, use the preview of #18280. The door is on /games/<box>.
🤖 Generated with Claude Code
This pull covers the write window, the lock, and the audit for the game door. The other issue items are not done, and one of them looks mostly done already.
What changed
/gameswith a passkey: "Allow writes from Minecraft for N minutes", 60 by default, set between 5 and 480. Outside the window, or while locked, a write is held as the ordinary confirm. That is the same held action every door answers from. Before, such writes were refused outright (#18218).!forge yes(building a new server) now needs an open window as well./forge lockin game (any linked name), a Lock button on/games, andKon the terminal's Games screen turn the door read-only at once and end the window. Only a passkey opens it again, and opening also lifts the lock.Won the terminal shows where the door stands.game_door_writewith the door, the Minecraft name and the window id. The last five show on/games.src/core/door_window.tsholds the window, lock and audit logic.src/web/pages/games_door.tsholds the page block and the open and lock routes, under/games/@door/….limitedOutinsrc/http/mcp/shared.tsnow enforces the window.20261204140000-door-window.docs/features/games.mddescribes all of it.closeOptions) and button script from the account-close form, andaskedFirst's confirm body, which is now one sharedkeepAsked.game-door,game-ask,conversation-door) expected a refusal, an open build, or the old help text. They now expect a hold, an open window for a build, and the new lock line in help.!forge lock; web open and lock routes (forged or missing passkey opens nothing, cross-site post refused); and a held action answered from another door.tscis clean and the gate passes. The game, conversation, boot-lazy and unused-export tests pass, excepttest/schema-migrations.test.ts, which also fails without my changes (a.claudedirectory in the sandbox temp path).Not done
talk()and confirm path as the web, so I found no second chat engine to delete.src/games/chat.tsis the command parser (link, plan, yes, clear, lock) and the answer relay. Moving Talk out of the web page and wiring iOS to it is not done./forge serversand/serveralready filter by grant (serversSeen).Try: sign in on the preview and open
/games. The "Minecraft writes" block shows closed, and Lock turns it to locked. In game,!forge lockdoes the same.🤖 Generated with Claude Code
Closes #18247