feat(admin): live tuning revisions adopted at recorded ticks (schema 66)
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (checks) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m42s
Foundation / image (push) Successful in 5m55s

ADR-0182 section 13. The admin portal's Tuning page edits the world's
rules-13 tuning (the Git revamp file format); the admin API checks it,
stores an append-only revision and queues an adopt_tuning admin command
(kind 7: revision and rules digest) for every region of the world.

- Lifecycle: adopt_tuning replaces the region's rules after births when
  a resolver names the rules for that revision and digest; the safety
  revision cannot change live. At most one adoption per batch.
- Host: fetches the revision text, rebuilds and digests the rules before
  appending the command; publication and recovery name the rules from
  the successor state, checked against the recorded digest.
- Schema 66: tuning_revisions, admin_set_tuning_v1, load_tuning_revision_v1
  (runtime), admin_tuning_revisions_v1, admin_tuning_text_v1.
- OpsServer: optional bounded request bodies (Content-Length, 413).
- Region view: rules_sha256, so the portal shows each region's revision.
- Portal: Tuning page; baseline from the mounted cellular-revamp.tuning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-27 19:35:09 -04:00
co-authored by Claude Opus 5.5
parent 7041c947a9
commit 7273b157d6
33 changed files with 1241 additions and 97 deletions
+45 -6
View File
@@ -2,11 +2,11 @@
## Status and scope
Accepted direction, 2026-10-27, from the maintainer's decisions in chat; implementation
pending. DEV (world 100) only; stage and World0 need their own review. Applies to a new owner
format and new openings only:
regions 12-16 keep their recorded rules and Git-mounted tuning. Supersedes, for that new
format, ADR-0181's "Git tuning affects future openings only. No live retune."
Accepted direction, 2026-10-27, from the maintainer's decisions in chat; delivered in parts
(sections 8-13). DEV (world 100) only; stage and World0 need their own review. Supersedes, for
rules-13 regions, ADR-0181's "Git tuning affects future openings only. No live retune": since
schema 66 (section 13) a running rules-13 region adopts tuning revisions at recorded ticks.
Regions on older rules keep their recorded rules.
## Context
@@ -230,7 +230,46 @@ no ticks) accumulates nothing. Versions are append-only; the newest decides.
The spent pool's own drip (interval, bubble caps, bubbles per drip, per-channel scale) is a
rules setting and stays with the tuning amendments.
Still pending from this ADR: tuning amendments (sections 1-2, including the drip rules),
### 13. Tuning amendments (delivered, schema 66)
Sections 1-2 are delivered without a new owner format or opening, so running rules-13 regions
(region 16 included) can be retuned:
- **Revisions.** Append-only `tuning_revisions(revision, world, text, rules_sha256, author,
reason, created_at)`. The text is the Git revamp tuning file format, kept as the admin wrote
it (comments included); `rules_sha256` is the SHA-256 of `encode_cellular_revamp_rules` for
the rules it produces, the same canonical bytes the owner snapshot stores. The admin API
parses and validates the text (`parse_cellular_revamp_tuning`, `cellular_revamp_rules`,
`cellular_revamp_valid`) before storing it, and `admin_set_tuning_v1` queues the adoption
in every region of the world in the same transaction.
- **Adoption is an admin command.** Kind 7 `adopt_tuning` carries the revision as its target
and the rules digest in its four amount words (little-endian; `other` zero). It is queued
only through a revision, never by kind. The region fetches the revision's text
(`load_tuning_revision_v1`), rebuilds the rules with its own parser and appends the command
only when the digest matches; a text it cannot parse or a mismatch is logged and the command
stays pending (section 2's `tuning_refused`). Applied at a tick after births, the command
replaces the region's rules; it is recorded in trace 5 and bound once like any command.
- **Replay and recovery.** Applying or replaying an adoption needs whoever does it to name
the rules for that revision and digest (`CellularTuningResolver`): the host from its
verified revisions, the publisher and recovery from the successor state, checked against
the recorded digest. A batch carries at most one adoption, so its successor names exactly
one set of rules. Nothing reads "the latest" revision.
- **What cannot change live.** `reproduction.safety_version` is a law of the opening
(ADR-0181): the admin API refuses a text that changes it, and a region would refuse the
command. `playtest.*` only matters when a region opens. Heritable values already in genomes
are not rewritten.
- **Portal.** A Tuning page: the editor starts from the newest revision or the baseline file
the regions opened with (`--baseline-tuning`, the mounted Git revamp file), Check reports
the line, key and kind of a problem, Adopt stores the revision with a reason, the revision
list shows how many regions adopted each, and each region shows which revision its live
rules match (`rules_sha256` in the region view).
Live today: everything the revamp file holds, including the drip (`spent.drip_interval_ticks`,
`spent.drip_bubble_pj`, `spent.drip_bubble_fg`). Section 4's new drip settings (bubbles per
drip, per-channel scale) are new rules fields, so they need a rules format change; the
resource schedules of section 12 cover the game source meanwhile.
Still pending from this ADR: section 4's new drip settings,
data-defined mutations (section 5) and the account's current mutations; opening new regions
or worlds from the portal (a later gate: Git-generated manifests through the Gitea API and an
Argo sync for one more region in the world; several concurrent regions or worlds need