feat(engine,deploy): seed-drift guard + track current dictionary release
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 14s
CI / ui (pull_request) Successful in 54s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m12s

The dictionary release moved to v1.2.1 while DICT_VERSION stayed pinned at
v1.0.0 in CI and the image/compose seed defaults. Two problems:

1. CI validated against a stale dictionary.
2. The contour seed could be bumped on a live volume, which silently relabels
   the already-seeded bytes — voiding games pinned to the prior label and
   serving the wrong dictionary for new ones. The flat DAWGs carry no embedded
   version, so this drift was undetectable.

Changes:

- Seed-drift guard: OpenWithVersions records the flat dir's version in a
  .seed_version marker on first boot and refuses to start when a later
  BACKEND_DICT_VERSION disagrees. DICT_VERSION is now the seed for a *fresh*
  volume only; a live contour migrates through the admin console (old versions
  stay resident, in-progress games keep replaying).
- Track the current release: CI's DICT_VERSION centralised to one workflow-level
  env (v1.2.1); image/compose/.env seed defaults bumped to v1.2.1. The deploy
  job keeps reading the per-contour vars.TEST_DICT_VERSION.
- Docs: ARCHITECTURE §5 (decision record), backend/deploy READMEs, PRERELEASE
  tracker (DV row).

Verified locally against the v1.2.1 artifact: gofmt, build, vet, unit and
integration (-tags=integration) all green.
This commit is contained in:
Ilia Denisov
2026-06-20 19:26:32 +02:00
parent c739f12d3d
commit a5db10c46e
12 changed files with 164 additions and 24 deletions
+12 -3
View File
@@ -273,9 +273,18 @@ Key points:
skipping the `.staging/` upload area) and restores the active pointer from
`dictionary_state`. The volume preserves uploaded versions across redeploys;
once seeded it is not re-seeded, so after bootstrap dictionary changes go through
the console rather than a rebuild. (The dictionaries ship as a versioned
**release artifact** from the `scrabble-dictionary` repo; the build's
`DICT_VERSION` selects only the seed.)
the console rather than a rebuild. Because the flat DAWGs carry no embedded
version, `OpenWithVersions` records the version the flat directory was first
opened at in a `.seed_version` marker on the volume and **refuses to boot** when a
later `BACKEND_DICT_VERSION` disagrees — the **seed-drift guard**: it stops a
bumped build seed on a live volume from relabelling the already-seeded bytes,
which would silently serve the wrong dictionary and void games pinned to the prior
label. A running contour therefore moves to a new release **through the console**
(the prior version stays resident, so its games keep replaying); `DICT_VERSION` is
the seed for a **fresh** volume only, set per contour from the deploy's
`TEST_`/`PROD_DICT_VERSION`. (The dictionaries ship as a versioned **release
artifact** from the `scrabble-dictionary` repo; the build's `DICT_VERSION` selects
only the seed.)
- Move generation/validation/scoring use `Solver.GenerateMoves` (ranked),
`Solver.ValidatePlay` and `Solver.ScorePlay`; board mutation uses
`scrabble.Apply`. The engine adds its own deterministic, seeded tile **bag**