One minter per kind of identity: Room code, Game id, Guest, secret #428

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

Parent

#421

What to build

Each kind of identity the API mints comes from its own provider, so a test fixes one kind without touching the others.

  • Four minters:
    • Room code (room);
    • Game id (games);
    • Guest (common/, beside the Guest functions);
    • secret for Sessions, refresh tokens and reset links (common/).
  • Each minter is a provider defined by its owning feature, defaulting to randomBytes or Math.random, and injected in place of the random, randomBytes and mintGuest options.
  • The Room fixtures pass the Room-code and Guest minters directly.

After this ticket, rule 2 as rewritten by the rules ticket holds everywhere.

Blocked by the clock ticket only because both rewrite the same constructors.

Seam: S1, the wire; S2, the Room through its services.

Acceptance criteria

  • No service takes random, randomBytes or mintGuest. Each injects the minter it uses.
  • Only minter defaults call randomBytes or Math.random in the API.
  • A new integration test forces a Game-id collision and shows two Guests minted in the same test as distinct.
  • The Room-code collision, Game-id collision and fixed-Guest tests pass, changed only in how they fix the value.
## Parent #421 ## What to build Each kind of identity the API mints comes from its own provider, so a test fixes one kind without touching the others. - Four minters: - Room code (room); - Game id (games); - Guest (`common/`, beside the Guest functions); - secret for Sessions, refresh tokens and reset links (`common/`). - Each minter is a provider defined by its owning feature, defaulting to `randomBytes` or `Math.random`, and injected in place of the `random`, `randomBytes` and `mintGuest` options. - The Room fixtures pass the Room-code and Guest minters directly. After this ticket, rule 2 as rewritten by the rules ticket holds everywhere. Blocked by the clock ticket only because both rewrite the same constructors. Seam: S1, the wire; S2, the Room through its services. ## Acceptance criteria - [ ] No service takes `random`, `randomBytes` or `mintGuest`. Each injects the minter it uses. - [ ] Only minter defaults call `randomBytes` or `Math.random` in the API. - [ ] A new integration test forces a Game-id collision and shows two Guests minted in the same test as distinct. - [ ] The Room-code collision, Game-id collision and fixed-Guest tests pass, changed only in how they fix the value.
root commented 2026-10-15 14:46:11 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #421

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

marked this issue as related to #426

marked this issue as related to #426
root commented 2026-10-15 16:04:32 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit a6ea5c88ec

mentioned in commit a6ea5c88ec5917139dd3d517e50e6ee6b1afc05b
root commented 2026-10-15 16:04:47 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !536

mentioned in merge request !536
root commented 2026-10-15 16:07:36 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 27a252165c

mentioned in commit 27a252165c096841bcf6c40dd9b71e3270496681
root (Migrated from gitlab.core-project.space) closed this issue 2026-10-15 19:01:51 +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#428
No description provided.