Public: anyone can read this; the crew can change it.
An account's link to an outside identity is one table keyed by kind, with a prover per kind #18536
Merged 50m ago, live in production
This adds accountlink (account, kind, outside id, proved at, how) beside gamelink, which stays for now. It also gives the kind interface a prover, and Minecraft's is the first. Step 1 of 2 is only the expand.
-
Reviews
Changes requested — before the latest pushThe shape is right: expand-only, a table keyed by kind, and a real prover interface. One correctness gap in the triggers, and one duplicate path, need fixing before this lands.
Fix first:
chat.tswritesgame_linkwithINSERT OR REPLACE. SQLite does not fire DELETE triggers for rows removed by REPLACE conflict resolution unlessrecursive_triggersis on. Re-linking the same (box, player) with a new UUID or a different account leaves the oldaccount_linkrow behind. The stale row says an account proved a UUID it no longer holds, andprovenAsandownerswill read it. The tests only use plain INSERT/UPDATE/DELETE, so they do not catch this. Make the insert trigger handle it, for example a BEFORE INSERT trigger that removes the account_link row for any game_link row the new one would replace. Or have chat.ts delete explicitly before it inserts. Then add a test that does the realINSERT OR REPLACEwith a changed uuid and a changed user_id and expects the old row gone.Also fix:
identity.provein chat.ts is a second write of what the insert trigger already wrote. It is a no-op because of INSERT OR IGNORE, and its Result is discarded. There should be one way to do this. Either drop the call until step 2 moves the writes, or make the prover the writer and drop the insert trigger's duty for the new release. Say which in the migration comment.Smaller:
provenAsused to be true for any non-emptygame_link.uuid. It is now true only if the uuid passescleanUuid, and the backfill silently skips others. Confirm that every uuid the server lists matches the regex, or backfill them as they are.Boxes 1-3 stay open until the REPLACE case is covered, because the claim that the previous release runs on the changed database is not yet true for it.
ApprovedBoth earlier asks are met. (1) Re-link leaves no stale row: the BEFORE INSERT trigger clears the account_link row of the game_link row being replaced, and keeps it when the same account still holds the UUID on another box. The new INSERT OR REPLACE test covers a changed UUID and a changed account. (2) One writer: the prove call is gone from chat.ts, so the triggers are the only writer, and the migration comment says so. The pin is re-stamped. The account-link, kinds and schema-migrations tests pass here (35 pass). No page, route or tool changed, so there is no door to mirror. Next, not blocking: (a) in step 2, when the writes move, make the prover the single writer and drop the triggers in the same release as game_link. (b) Settle whether every UUID the server lists passes cleanUuid. Triggers keep non-empty UUIDs unfiltered, but owners() cleans its input, so a UUID that fails the regex would be stored and never found. Merge cleanUuid with cleanMinecraft's duplicate in step 2.
-
Checks
shipped production is serving it deploy e9eb675
-
History
- Re-linking a game name clears the account link it replaces; the triggers are the one writer ece0d84
- Stamp the account-link migration at the time it was written and pin it 6ddf426
- An account's link to an outside identity is one table keyed by kind, with a prover per kind (#18490) a3fc5ab
- forge.json declares jobs: steps, needs (macos, xcode, docker), on (pull, land) and secrets, read and validated at the boundary (#18512) 85e7b4f
- Lending speaks the versioned agent protocol, and each machine's page shows when it last used the old sync route (#18521) 7db7ea2
- A pull that changes an MCP tool's schema runs mcp-size.test.ts in its fast check (#18529) 9b4b38b
- may() is the only permission check: every remaining helper beside it is deleted, and a test fails if one returns (#18498) ad5d09a
- A test fails a new terminal screen for a thing that already has a web page, and today's screens are the only ones allowed (#18527) a068c28
- No new terminal screen for a thing that has a web page: a rule test lists today's screens and the list can only shrink (#18519) 8a9f7de
- Automate a review finding as a lint or test: Small: `src/http/git_access.ts` ends with a stray blank line. (#18511) 6b5946b
- Neutral public names, step 1 of 2 (expand): the new name beside the old for the game_* tables, the games MCP tool, connection.kind and the game and design: minecraft plan options (#18513) 6368d15
- The runners page is live: connected, busy, the run it holds, its log and last seen, updated as they change (#18497) 24da6e3
- A rule test fails any page whose form answers with a full page, and the list of today's pages can only shrink (#18495) c10b305
- A new account's home offers three things it can do, each one click away, and an empty page says what goes there and how (#18496) bf74994
- An invite carries a bundle: the owner picks Use, Host or Build, each with a line saying what it allows (#18473) d231856
- A machine agent that does not check in after its update goes back to the version before, and the forge says so (#18483) 49c1b5a
- A machine stays trustworthy under load: power cycle, live status, a memory check, a patient healer (#18472) a7825b4
- Main red: plan tool's `owner` description is 91 bytes, over mcp-size's 60-byt… (#18494) 09902a4
- A repository's crew page adds a member to a slot in place: no reload, and the scroll position stays (#18474) 99ed63c
- A list is one line a row and detail opens on demand: crew member descriptions first (#18481) 324c098
This adds account_link (account, kind, outside id, proved at, how) beside game_link, which stays for now. It also gives the kind interface a prover, and Minecraft's is the first. Step 1 of 2 is only the expand. The write path has not moved, and game_link is not dropped. The gate, bun x tsc --noEmit and the covering tests pass, including the new test/account-link.test.ts. I did not run the whole suite.
Migration
20261206183000-account-linkcreates the table and backfills it from everygame_linkrow that names a UUID.- Triggers on
game_link(insert, update, delete) keepaccount_linkin step. - The previous release writes only
game_link, so it runs unchanged on the changed database, and its links show in the new table. - One UUID linked on several boxes is one
account_linkrow. That row goes when the account's last box link for that UUID goes. - A link with no UUID proves nothing, so it gets no row.
- Dropping
game_linkand moving the writes is left for the next release (contract). This keeps rollback safe.
Prover
IdentityProverinsrc/kinds/kind.tsis now a real interface instead of a stub:kind,clean,prove,provedandowners.- Minecraft's is
src/kinds/minecraft/prover.ts. Its outside id is the UUID the game server lists, andcleanUuidvalidates it. src/core/account_link.tsholds the plain table functions.
Where it is reached
- The
!forgelink insrc/games/chat.tscallsidentity.proveafter it writesgame_link. provenAsinsrc/core/proven_identities.tsreadsaccount_link.provenAsgoes throughcore/account_link.tsinstead of the prover. Importingkinds/fromcore/proven_identities.tsmade an import cycle that brokeverify.tsat load.
Tests
test/account-link.test.tscovers three things:- A pre-change snapshot restores, boots with only the new migration applied, and keeps its links.
- The old release's writes show up in the new table and clear it again, including the cascade when an account is deleted.
- The prover accepts a UUID and refuses a name.
test/kinds.test.tsnow expects two stub parts instead of three, since identity moved.
Not done
- No page, action, API route or tool changes, so the commit says
No door. bun scripts/similar.tsflaggedcleanUuidas 1.00 likecleanMinecraftinsrc/core/identities.ts. They validate different things (a UUID versus a name), so I kept both.
To try
bun test test/account-link.test.ts test/kinds.test.ts test/schema-migrations.test.ts
Both of juniper's requested fixes are in and pushed. The tests I ran pass: test/account-link.test.ts and test/schema-migrations.test.ts, and bun x tsc --noEmit is clean. I did not run the full suite or the budget and duplicate-import tests the check named. I did not run bun scripts/design-lint.ts, because no src/web/ file changed.
What changed
- Re-link leaves no stale row.
INSERT OR REPLACEremoves a row without firing the DELETE trigger, soaccount_linkkept the old claim. A newBEFORE INSERTtrigger ongame_linknow clears theaccount_linkrow of thegame_linkrow about to be replaced. It keeps that row if the same account still holds the same UUID on another box. - One writer. I dropped the
identity.provecall and its import fromsrc/games/chat.ts. The triggers are the only writer while the previous release is still running. The prover'sprovebecomes the writer in step 2, when the writes move. The migration comment says this. - Re-pinned. I edited the migration in place and re-stamped its pin. This pull is its only home, so nothing has applied it yet.
- New test. It runs the real
INSERT OR REPLACEthatchat.tsuses, once with a changed UUID and once with a changeduser_id. It expects no stale row, and it keeps the shared row when another box still holds the UUID. I did not run the test against the old trigger to confirm it fails there.
UUID check (not settled)
- The backfill and triggers never filtered with
cleanUuid. They keep every non-empty UUID, lowercased. - Whether every UUID the server lists passes
cleanUuidis not confirmed. The only evidence in the repo is a comment insrc/games/metrics.tsshowinglist uuidsasAlice (069a79f4-44e9-4726-a5be-fca90e38aaf5). - A UUID that fails the regex still gets a row, but the prover's
ownerslookup cleans its input and would not find it.
Not done
- The gate reports that
cleanUuidinsrc/kinds/minecraft/prover.tsis a near-duplicate ofcleanMinecraftinsrc/core/identities.ts. I did not merge them. - The gate also notes a comment line over 100 columns in
src/games/chat.ts. It said the nightly rewrap handles that on main.
There is no door change: the work is storage only. The commit says No door: with that reason.
This adds
account_link(account, kind, outside id, proved at, how) besidegame_link, which stays for now. It also gives the kind interface a prover, and Minecraft's is the first. Step 1 of 2 is only the expand. The write path has not moved, andgame_linkis not dropped. The gate,bun x tsc --noEmitand the covering tests pass, including the newtest/account-link.test.ts. I did not run the whole suite.Migration
20261206183000-account-linkcreates the table and backfills it from everygame_linkrow that names a UUID.game_link(insert, update, delete) keepaccount_linkin step.game_link, so it runs unchanged on the changed database, and its links show in the new table.account_linkrow. That row goes when the account's last box link for that UUID goes.game_linkand moving the writes is left for the next release (contract). This keeps rollback safe.Prover
IdentityProverinsrc/kinds/kind.tsis now a real interface instead of a stub:kind,clean,prove,provedandowners.src/kinds/minecraft/prover.ts. Its outside id is the UUID the game server lists, andcleanUuidvalidates it.src/core/account_link.tsholds the plain table functions.Where it is reached
!forgelink insrc/games/chat.tscallsidentity.proveafter it writesgame_link.provenAsinsrc/core/proven_identities.tsreadsaccount_link.provenAsgoes throughcore/account_link.tsinstead of the prover. Importingkinds/fromcore/proven_identities.tsmade an import cycle that brokeverify.tsat load.Tests
test/account-link.test.tscovers three things:test/kinds.test.tsnow expects two stub parts instead of three, since identity moved.Not done
No door.bun scripts/similar.tsflaggedcleanUuidas 1.00 likecleanMinecraftinsrc/core/identities.ts. They validate different things (a UUID versus a name), so I kept both.To try
bun test test/account-link.test.ts test/kinds.test.ts test/schema-migrations.test.tsCloses #18490