Regenerate published weekly puzzles when a release's prices break them

--check now re-solves every week not over yet and, when its budget no longer
verifies, regenerates it deterministically: the same puzzle with a new budget
if that works, else a fresh one for the key. A regenerated file carries rev 2,
3...; the game keeps stars per revision, so only that week's stars reset.
Past weeks are left alone unless the game rejects them. release.yml runs it
before the tests on every deploy, weekly-puzzle.yml before making the new
week; either fails only if a week cannot be regenerated.
This commit is contained in:
Frederic Jung 2026-10-29 10:03:20 +01:00
parent 77ec31d1a0
commit 7cbe0ec09b
No known key found for this signature in database
10 changed files with 135 additions and 23 deletions

View file

@ -45,7 +45,8 @@ steps.
release tag** with `weekly=true`. That run rebuilds exactly the live release, with every weekly file from `main`
added, checks them with `scripts/weekly-puzzle.js --check`, and deploys it in the same `pages` concurrency group.
Players get no update banner (the version does not change). Every release build also copies all weekly files from
`main`, so a release never drops a published week. Weekly files are plain JSON the game fetches only when the
`main`, so a release never drops a published week, and regenerates (in the build, deterministically) any week
not over yet that the release's prices no longer fit. Weekly files are plain JSON the game fetches only when the
Puzzles list opens and never trusts; the service worker serves them network-first. See `docs/ARCHITECTURE.md`.
## Before you hand back a change that touches the build, deploy or loading

View file

@ -21,6 +21,13 @@ version for a weekly puzzle. To publish or fix one by hand: `node scripts/weekly
`gh workflow run release.yml --ref <live tag> -f tag=<live tag> -f weekly=true`). A release includes every weekly
file on `main` when it builds.
**Prices change, weeks follow.** `--check` re-solves every week not over yet with the game it runs; a week whose
budget no longer verifies is regenerated deterministically (the same puzzle with a new budget if that works, else a
fresh one for the same key) with `rev` + 1, which resets players' stars for that week only. Past weeks are left alone
unless the game rejects them. `release.yml` runs it before the tests on every deploy and fails only if a week cannot be
regenerated. A change to prices, cables or cities fails `npm test` until you run `node scripts/weekly-puzzle.js --check`
and commit the regenerated files with it.
## Only release when Frederic says so
Never bump the version on your own. Finished work is committed and pushed with its