Store each decided Online game once, owned by the Guest in each Seat #373
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.
Blocks
Depends on
#374 Read stored Games over the wire: the caller's list and one Game by id
amaurycoudr/chess-project
Reference
amaurycoudr/chess-project#373
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Parent
#355
What to build
When an Online game is decided, the server stores it once. The Room stamps when its current Game started, from its injected clock, at open and at each restart. It gains a constructor option: a callback it calls exactly once when the current Game becomes decided. That happens by a Move that leads to
checkmateordraw, byresign, or by accepting adrawOffer.The record holds:
checkmateorresignationwith the winner, ordrawwith its reason,agreedincluded;A Game cut short by a restart, an eviction or a redeploy is never reported. The Room stays framework-free.
How a Game ended is defined once in the contracts, reusing the engine's Draw reasons plus
agreed.RoomOutcomeshares it. A brandedGameIdjoins the contracts.A new
games/feature module in the API owns storage, andRoomServicewires the Room's callback to it. The write is asynchronous and the Room never waits for it, so the deciding call answers and fans out at once. A failure is logged and dropped. The module keeps track of writes still in flight, ready for the list to wait on. The Game id is minted server-side through a constructor option: at least 128 random bits, unguessable.The schema adds a migration on top of #354's baseline:
guests: id, unique secret hash, created at. A row is upserted by hash in the same transaction as the first Game that Guest owns.games: id; a nullable reference toguestsfor White and one for Black, emptied if that Guest is deleted; line; winner, set exactly when the ending is not a draw; ending; draw reason, set exactly fordraw; started at and ended at as timestamptz.Seam: the
Roomwith its fixtures (a decided Game reported exactly once, for every ending); the RPC wire with the in-process app on the in-process database (storage failure, what the database holds).Acceptance criteria
gamesrow and the Guest rows it needs. No secret is stored, only its hash (story 22).games/folder is declared in the API's layer order and framework-import rules (the owner ruled on the accounts breakdown that declaring a folder the spec creates counts as the requested lint change; nothing else in lint config changes)mentioned in issue #374
mentioned in issue #355
mentioned in issue #372
marked this issue as related to #355
marked this issue as related to #372
marked this issue as related to #374
mentioned in merge request !515