feat: claim a Guest into an Account, new or existing #529
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amaurycoudr/chess-project!529
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/implement-spec-365-7d333a"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
An Account claims the browser's Guest, and its Games, only when the Player confirms (ADR 0035): on the sign-up form, in a dialog after sign-in, or from a banner on "My games".
The front, all in
auth/:A self-game (both Colors owned by one Account) gets the new value
"both"in the listing,game.get's viewer and the export. It is listed once, shows both sides as "You", and reads "White won" / "Black won" / "Drawn".Contract changes the spec didn't list:
ResultCountsSchemabecomes{ all, won, lost, drawn }. A self-game that one Color won counts as neither won nor lost, so "All games" can no longer be the sum of the other three.lib/my-games-query.ts, besidelib/account-query.ts, soauth/can invalidate "My games" without importinggames/. Front rule 6 wants keys from the owning vertical'sservices/. Consider a line about this placement in ADR 0011's exceptions.bannerslot.Supporting refactors:
codeOfmoves intorpc.fixtures.ts.tests/accounts.tsandtests/my-games.ts.Evidence
rpc-guest-claims.integration.test.ts,claim-banner.test.tsx,apps/e2e/tests/claim.spec.tsand the self-game cases did not exist.After: all pass, and the gate (lint, typecheck, test, build, format:check) is green on each ticket's branch. The new e2e spec covers two flows:
Limit: "two Accounts claim at once" and "a claim races a Game write" run on single-connection PGlite. They assert the outcome but run one transaction after the other, so they never exercise the row lock itself.
Merge Danger
Door: one-way
The migration adds
guests.claimed_by_account_id(cascades on Account delete) andguests.claimed_at. A claim rewrites the owner columns of existinggamesrows and is never undone. Rolling back the code leaves the claimed Games on their Accounts.Blast Radius: wide
room.createandseat.takewithout a Session can mint a fresh Guest in place of a claimed one.Closes #365
Closes #385
Closes #386
Closes #387
Closes #388
Screenshots
Before is production, after is this merge request's review app at
1d6e6ab.Desktop
Mobile
added 3 commits
b932efad- feat(front): let the browser forget the Guest it holds170eba1d- feat(front): offer to claim this browser's Guest on My gamescc58f109- feat(front): forget a Guest this Account claimed on sign-out and on Account deletionCompare with previous version
added 5 commits
f5ae7056- feat(front): offer to add the Guest's Games to the Account on the sign-up form8327b5fd- feat(front): ask after sign-in whether to add the Guest's Games to the Accountad4275b0- test(e2e): share the sign-up, sign-in and My games helpers across specs61d9afd2- test(e2e): walk a Guest's Game into an Account on sign-up and after sign-in,...7bbfe6e0- fix(front): hand the sign-in mutation a callback that returns nothingCompare with previous version
added 2 commits
39a244d8- feat(api): list, read and export a self-game as both Colors0958e19b- feat(front): show a self-game with both sides as YouCompare with previous version
added 16 commits
e707d6d0- 1 commit from branchmaina6952f40- feat(front): forget a Guest this Account claimed on sign-out and on Account deletion930b23c2- feat(front): offer to add the Guest's Games to the Account on the sign-up formca4c7565- feat(front): ask after sign-in whether to add the Guest's Games to the Accountbf995b62- test(e2e): share the sign-up, sign-in and My games helpers across specs234a0715- test(e2e): walk a Guest's Game into an Account on sign-up and after sign-in,...582e317d- fix(front): hand the sign-in mutation a callback that returns nothingc148c83d- feat(api): list, read and export a self-game as both Colorsa516c333- feat(front): show a self-game with both sides as You23e764fd- refactor(api): decide in RoomService whether a claimed Guest arrives as no one1d6e6ab0- refactor(front): slot the claim banner into My games, and forget a Guest where its status is readCompare with previous version
marked this merge request as ready
changed the description
mentioned in issue #406
mentioned in issue #388
mentioned in commit
215cdba4c9mentioned in merge request !537