Page, filter and count a Player's Games, and say whether they own any #401

Closed
opened 2026-10-14 14:37:14 +00:00 by root · 10 comments
root commented 2026-10-14 14:37:14 +00:00 (Migrated from gitlab.core-project.space)

Parent

#400

Seam: S5 — the game.list and account.me procedures through RPC against a real database

What to build

A Player can reach every Game they own, not only the latest 50, and the site can tell, from the one read it makes on every page, whether the Player owns any Game.

  • game.list takes an optional result (won | lost | drawn, from the caller's side) and an optional opaque cursor. It answers one page, newest first, with nextCursor when more remain. It also answers the caller's counts per result across all their Games, whatever the filter.
  • The cursor is the last row's end time and Game id, so Games that ended at the same instant page stably. The page size is a server constant (20).
  • account.me answers hasGames beside kind: for a browser with no Session, whether its Guest owns a Game; for an Account, whether it owns one. A claimed Guest's Games count as the Account's (ADR 0035).
  • Today's My games page reads the new shape and shows the first page; its layout waits for the My games ticket.

Shape agreed in the grilling on #399 (names may be refined):

input:  { result?: "won" | "lost" | "drawn"; cursor?: string }
output: { games: GameSummary[]; nextCursor: string | null;
          counts: { won: number; lost: number; drawn: number } }

Acceptance criteria

  • game.list pages through more than one page of Games newest first, ending with nextCursor: null, with no Game repeated or skipped, even when two Games share an end time.
  • result narrows the pages to that result from the caller's side; the counts are the same with and without a filter.
  • A Guest, an Account and a browser with neither each get their own Games and counts; a browser with neither gets no Games and zero counts.
  • account.me answers hasGames false for a browser with no Guest and no Session, and true for a Guest or an Account that owns a Game, including through a claim.
  • The existing My games page and its tests still pass on the new shape.
  • The gate is green.
## Parent #400 Seam: S5 — the `game.list` and `account.me` procedures through RPC against a real database ## What to build A Player can reach every Game they own, not only the latest 50, and the site can tell, from the one read it makes on every page, whether the Player owns any Game. - `game.list` takes an optional `result` (`won` | `lost` | `drawn`, from the caller's side) and an optional opaque `cursor`. It answers one page, newest first, with `nextCursor` when more remain. It also answers the caller's counts per result across all their Games, whatever the filter. - The cursor is the last row's end time and Game id, so Games that ended at the same instant page stably. The page size is a server constant (20). - `account.me` answers `hasGames` beside `kind`: for a browser with no Session, whether its Guest owns a Game; for an Account, whether it owns one. A claimed Guest's Games count as the Account's (ADR 0035). - Today's My games page reads the new shape and shows the first page; its layout waits for the My games ticket. Shape agreed in the grilling on #399 (names may be refined): ```ts input: { result?: "won" | "lost" | "drawn"; cursor?: string } output: { games: GameSummary[]; nextCursor: string | null; counts: { won: number; lost: number; drawn: number } } ``` ## Acceptance criteria - [ ] `game.list` pages through more than one page of Games newest first, ending with `nextCursor: null`, with no Game repeated or skipped, even when two Games share an end time. - [ ] `result` narrows the pages to that result from the caller's side; the counts are the same with and without a filter. - [ ] A Guest, an Account and a browser with neither each get their own Games and counts; a browser with neither gets no Games and zero counts. - [ ] `account.me` answers `hasGames` false for a browser with no Guest and no Session, and true for a Guest or an Account that owns a Game, including through a claim. - [ ] The existing My games page and its tests still pass on the new shape. - [ ] The gate is green.
root commented 2026-10-14 14:37:50 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #404

mentioned in issue #404
root commented 2026-10-14 14:37:51 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #405

mentioned in issue #405
root commented 2026-10-14 14:37:54 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #400

marked this issue as related to #400
root commented 2026-10-14 14:37:59 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #404

marked this issue as related to #404
root commented 2026-10-14 14:38:00 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #405

marked this issue as related to #405
root commented 2026-10-14 14:52:27 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !527

mentioned in merge request !527
root commented 2026-10-14 14:57:57 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit f2c462ebedf79d6a7116907ed58fd24822fecf41

mentioned in commit f2c462ebedf79d6a7116907ed58fd24822fecf41
root commented 2026-10-14 14:57:57 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit c1ce200cb4cb88b9f25c5587a39327ac7cf82b48

mentioned in commit c1ce200cb4cb88b9f25c5587a39327ac7cf82b48
root commented 2026-10-14 15:05:41 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 2f4b2c5db9

mentioned in commit 2f4b2c5db97c2aac6b029d1ddca1584a0ceddc42
root commented 2026-10-14 15:56:43 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 53a8ba8c22

mentioned in commit 53a8ba8c224e8d6269b81b777a5ef8158f91e66f
root (Migrated from gitlab.core-project.space) closed this issue 2026-10-14 16:05:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
amaurycoudr/chess-project#401
No description provided.