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

iOS: use the same Talk and the game door's write window and lock (#18247) #18328

opened this

Parked 14h 23m ago

The iOS app can now read the game door, lock it, set the window length and open a write window with a passkey. All of it goes through five new JSON routes under /api/v1/games/ /door. The new door-API tests, the existing write-window tests and the gate pass, and tsc is clean.

Notes

opened this

The iOS app can now read the game door, lock it, set the window length and open a write window with a passkey. All of it goes through five new JSON routes under /api/v1/games/<box>/door. The new door-API tests, the existing write-window tests and the gate pass, and tsc is clean. I did not run the full suite. The one gap in the tests is the passkey success path: no test signs a real WebAuthn assertion, so only the refusals are covered.

Talk and held actions. Talk and a held action's yes or no already ride POST /api/v1/conversation/messages and POST /api/v1/conversation-confirms/:id. A build held in game can therefore already be answered from the app, and the answer shows on the web and in game. I changed nothing there, apart from the shared check below.

The routes. Only the box's owner can use them, on their own session or their own rw token. A run, app or Talk via token cannot. A stranger who cannot see the box gets 404, an operator gets 403, and a browser from another origin gets 403.

  • GET …/door returns the state, the one-line words every door shows, why the window is as long as it is, and whether the owner has a passkey.
  • POST …/door/lock locks the door at once.
  • POST …/door/minutes with {minutes} sets the next window's length (5 to 720 whole minutes).
  • POST …/door/options returns a passkey challenge, rpId and the owner's key ids.
  • POST …/door/open takes the signed answer and opens the window. Missing fields give 422, and a bad or already-used challenge gives 403 with the door unchanged. A token alone never opens a window.

What moved where.

  • One action for page and routes. The page's lock, length and passkey-open logic moved from src/web/pages/games_door.ts into src/actions/game_door.ts, so the page and the routes share one implementation. The routes are in src/http/api/game_door.ts.
  • Shared own-credential check. The "this is the person's own credential" check from the held-action yes route moved into src/http/own_credential.ts, and that route and the door routes both use it.
  • Docs and registration. The five routes have OpenAPI entries and are in the lazy route list. A paragraph in docs/features/games.md describes the door on iOS.

What I chose not to do.

  • Terminal. The terminal already shows the door and locks it with w. A passkey can only be signed in a browser or the app, so I added nothing there. The commit says No door: for this.
  • Swift client. The iOS app's Swift code is not in this repository. This pull is the server side the app calls.
  • Automatic lock on leaving the network. The issue's "flip it automatically" setting belongs to #18247's other items, not this split.
  • Page look. The page renders as before, so the commit says No look:.

How to try it. As the box's owner, with an rw token on the preview: curl -H "authorization: Bearer $TOKEN" https://<preview>/api/v1/games/<box>/door. Then POST …/door/lock, or POST …/door/options for a challenge. The tests are in test/game-door-api.test.ts.

Closes #18311

3 earlier comments · 1 event
commented

The iOS app can now read the game door, lock it, set the window length and open a write window with a passkey. All of it goes through five new JSON routes under /api/v1/games/<box>/door. The new door-API tests, the existing write-window tests and the gate pass, and tsc is clean. I did not run the full suite. The one gap in the tests is the passkey success path: no test signs a real WebAuthn assertion, so only the refusals are covered.

Talk and held actions. Talk and a held action's yes or no already ride POST /api/v1/conversation/messages and POST /api/v1/conversation-confirms/:id. A build held in game can therefore already be answered from the app, and the answer shows on the web and in game. I changed nothing there, apart from the shared check below.

The routes. Only the box's owner can use them, on their own session or their own rw token. A run, app or Talk via token cannot. A stranger who cannot see the box gets 404, an operator gets 403, and a browser from another origin gets 403.

  • GET …/door returns the state, the one-line words every door shows, why the window is as long as it is, and whether the owner has a passkey.
  • POST …/door/lock locks the door at once.
  • POST …/door/minutes with {minutes} sets the next window's length (5 to 720 whole minutes).
  • POST …/door/options returns a passkey challenge, rpId and the owner's key ids.
  • POST …/door/open takes the signed answer and opens the window. Missing fields give 422, and a bad or already-used challenge gives 403 with the door unchanged. A token alone never opens a window.

What moved where.

  • One action for page and routes. The page's lock, length and passkey-open logic moved from src/web/pages/games_door.ts into src/actions/game_door.ts, so the page and the routes share one implementation. The routes are in src/http/api/game_door.ts.
  • Shared own-credential check. The "this is the person's own credential" check from the held-action yes route moved into src/http/own_credential.ts, and that route and the door routes both use it.
  • Docs and registration. The five routes have OpenAPI entries and are in the lazy route list. A paragraph in docs/features/games.md describes the door on iOS.

What I chose not to do.

  • Terminal. The terminal already shows the door and locks it with w. A passkey can only be signed in a browser or the app, so I added nothing there. The commit says No door: for this.
  • Swift client. The iOS app's Swift code is not in this repository. This pull is the server side the app calls.
  • Automatic lock on leaving the network. The issue's "flip it automatically" setting belongs to #18247's other items, not this split.
  • Page look. The page renders as before, so the commit says No look:.

How to try it. As the box's owner, with an rw token on the preview: curl -H "authorization: Bearer $TOKEN" https://<preview>/api/v1/games/<box>/door. Then POST …/door/lock, or POST …/door/options for a challenge. The tests are in test/game-door-api.test.ts.

commented

The iOS app can now read the game door, lock it, set the window length and open a write window with a passkey, through five new routes under /api/v1/games/<box>/door. The failing check is fixed: the budget fixture could not fill GET /api/v1/games/:box/door. I added test/budgets/unfixtured/api-games-box-door.json to name it, and test/pages-budget.test.ts now passes. I did not re-run the full suite, and the forge's check will run it on this push.

Talk and held actions. Talk and a held action's yes or no already ride POST /api/v1/conversation/messages and POST /api/v1/conversation-confirms/:id. So a build held in game can be answered from the app, and the answer shows on the web and in game. The one change there is that the "this is the person's own credential" check moved to src/http/own_credential.ts, which that route and the door routes both use.

The routes. They are for the box's owner only, on their own session or their own rw token. A run, app or Talk via token cannot use them. A stranger gets 404, an operator gets 403, and a browser from another origin gets 403.

  • GET …/door returns the door's state, the one-line words every door shows, why the window is as long as it is, and whether the owner has a passkey.
  • POST …/door/lock locks the door at once.
  • POST …/door/minutes with {minutes} sets the next window's length, 5 to 720 whole minutes.
  • POST …/door/options returns a passkey challenge, rpId and the owner's key ids.
  • POST …/door/open takes the signed answer and opens the window. Missing fields give 422. A bad or already-used challenge gives 403 and the door stays as it was. A password or a token alone never opens a window.

What moved where.

  • Shared action: the page's lock, length and passkey-open logic moved from src/web/pages/games_door.ts into src/actions/game_door.ts. The page and the routes in src/http/api/game_door.ts share it, so there is one implementation.
  • Docs: the five routes have OpenAPI entries and a paragraph in docs/features/games.md.

What I chose not to do.

  • Terminal: it already shows the door and locks it with w. A passkey can only be signed in a browser or the app, so I added nothing there.
  • Swift client: the iOS app's Swift code is not in this repository. This pull is the server side the app calls.
  • Automatic lock on leaving the network: that setting from #18247 is not part of this split.
  • Passkey success path: no test signs a real WebAuthn assertion. The new tests cover only the refusals; the signing itself is untested here.

How to try it. As the box's owner with an rw token on the preview: curl -H "authorization: Bearer $TOKEN" https://<preview>/api/v1/games/<box>/door. Then POST …/door/lock, or POST …/door/options for a challenge. The route tests are in test/game-door-api.test.ts.

🤖 Generated with Claude Code

commented

I fixed both failing tests and pushed. The two suites that failed (test/security-floor-routes.test.ts and test/openapi-errors.test.ts) pass locally, along with test/game-door-api.test.ts and tsc. I did not run the full suite, and the gate's only note is an over-long comment in src/http/games_routes.ts, which I left.

  • Floor walk: /api/v1/games/:box/door needs a game box, and the seed makes none. I added it to UNSEEDED in test/security-floor-routes.test.ts with that reason, pointing at test/game-door-api.test.ts.
  • Declared refusals: GET /api/v1/games/{box}/door declared a 403, but the probe never gets one, because the seed has no box and it only sees 404 and 401. I removed 403 from refuses in getApiV1GamesBoxDoor.ts and wrote the 403 into the route's detail text instead. The handler is unchanged, so a non-owner who can see the box still gets 403 forbidden.

The catch is that the machine-readable contract no longer lists that 403. The alternative is to keep it declared and make the probe seed a box, which is a bigger change to the shared fixture. I didn't do that.

the crew's run was interrupted: provider limit, resumes 03:11 UTC — every subscription this repository may use is resting (API Error: 402 This request requires more credits, or fewer max_tokens. You requested up to 128000 tokens, but can only afford 4000. To increase, visit https://)
commented

Closed by the crew: main moved under it 2 times and the branch could not be brought up to date. Conflicting files: src/web/pages/games_door.ts.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs