Overview
Issue #83 โ save a finished run and let players revisit it โ already shipped its substance: durable, subject-owned run snapshots (run_snapshots), the read-only "your runs" list and detail, a typed and versioned snapshot contract, and the same-id carry-over when an anonymous player creates a new account. This PR closes the issue's last two items: the discriminating test for that carry-over, and a final call on the existing-account path.
The whole diff is two files: a new unit test, and a four-line doc edit. Blast radius is nil for runtime behavior โ no production code path changes. What changes is what's proven (a test) and what's promised (a comment).
The mechanism the test rests on
A run is owned by its account SUBJECT, and the read routes resolve that subject with currentSubject. Carry-over across signup is therefore not a data migration โ it falls out of one fact: attaching an email to an anonymous user keeps the same Supabase user id (sub), so currentSubject returns the same string before and after.
server/utils/auth.ts ยท 64 lines
โฏ 39 lines hidden (lines 1โ39)
The carry-over test
The new spec wires the REAL currentSubject and the REAL InMemoryRunSnapshotStore โ not mocks of the thing under test โ and drives the Supabase user per phase. Test 1 is the AC3 promise; test 2 is the existing-account non-goal.
tests/unit/server/account-linking.spec.ts ยท 105 lines
The doc cleanup
The only non-test change. sign-in.ts previously framed the anonymous -> existing-account re-key as deferred future work ('left behind', 'a separate change', 'the same deferral applies...'). The game is pre-launch, so that cross-account merge is a deliberate non-goal, not a to-do. The comment now states the returning-player behavior as fact.
utils/sign-in.ts ยท 80 lines
โฏ 61 lines hidden (lines 20โ80)
Verification
The enforced gates stay green, and an independent adversarial review (three lenses plus a fresh regression-guard check) signed off.
| Check | Result |
|---|---|
| npx vitest run | 890 pass (incl. 2 new) |
| npx nuxt typecheck | clean |
| knip (dead-code) | no findings on changed files |
| adversarial review | SHIP โ test is a real guard; deferral fully removed; AC4 satisfied |