Files
chess-endgame-trainer/docs/adr/0006-public-code-for-player-urls.md
owenrees 49736d186c Add public codes for player URLs and admin endgame search
Player-facing endgame links now use a 10-character Crockford base32 public code instead of the database UUID; admin routes keep the UUID. Existing rows are backfilled by migration, and the admin Show page displays and copies the code.

The admin endgame index gains its own search box: exact database id, exact public code, or a FEN / FEN fragment. A single match opens the endgame; multiple matches list below; nothing found says so.

Closes #44
Closes #45
2026-11-03 22:46:38 +01:00

909 B

Player-facing endgame URLs use a public code

Player links address an endgame by a short random public code rather than its database UUID. The UUID stays the admin identity: admin routes mount by id and the Show page displays both. The code is stable for the row's lifetime and unguessable, so a shared play link neither exposes a primary key nor invites enumeration. Keys were rejected as the handle because many endgames share one (that is how the list groups them), and Key-plus-ordinal would break when endgames are added or removed. A FEN hash was rejected as longer and derivable without hiding anything new.

Consequences

  • Admin URLs and the admin list keep the UUID, so debugging still lines up with the database. Admin search accepts either identifier plus a FEN or FEN fragment.
  • A public code is generated on insert and backfilled by migration; it is never regenerated on update.