Add cellular replay trace and recovery lookup
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 41s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 1m46s
Foundation / checks (network) (push) Canceled after 1m9s
Foundation / checks (ecs) (push) Canceled after 1m38s

This commit is contained in:
dingo
2026-10-10 23:16:46 -04:00
parent ba97c41ad0
commit 2133e5086e
17 changed files with 546 additions and 10 deletions
+47
View File
@@ -0,0 +1,47 @@
# ADR-0113: Cellular replay trace
## Status
Accepted engineering contract for M11.3d (2026-10-10). This records already
selected cellular intentions for recovery; it does not change their biological
meaning or add gameplay rules.
## Context
Profile 4 stores the complete post-tick cellular closure, but recovery also needs
to prove that the committed head follows from its predecessor. The existing
environmental trace cannot represent the changing set of cellular lives,
movement intentions, and optional patch targets. Durable v7 action records bind
player actions but do not by themselves describe the complete per-life inputs
needed to replay every tick in a batch.
## Decision
- Add a separate canonical profile-4 batch format. Its 112-byte header binds the
format, profile, world, region, frame, predecessor commit and digest, and the
batch tick range. It carries one record set for each simulated tick in
`(begin_tick, end_tick]`, in order.
- Each tick has a u32 life-intent count followed by at most 256 records, strictly
ordered by nonzero stable life ID. Each record is 24 bytes: life ID (u64 LE),
movement X/Y (signed i16 LE), target-present flag (u8), three zero reserved
bytes, and target patch X/Y (u32 LE). Absent targets encode zero coordinates.
- A batch covers 1–64 ticks. Decode validates the header, count bounds, ordering,
movement limits, flags, reserved bytes, absent-target encoding, and exact total
length before allocation. The caller binds the trace header's identity,
predecessor commit/digest, and tick range to trusted manifests before replay.
Replay clones the immutable predecessor through its canonical snapshot,
advances `CellularLives` once per tick, and refuses unless every tick's intents
cover its living set exactly. Recovery compares the resulting complete snapshot
byte for byte with the committed head.
- Maximum trace size is `112 + ticks * (4 + 256 * 24)` bytes; PostgreSQL validates
the minimum and maximum for the manifest's tick count. The exact durable v7
action block is loaded under the current region lease and checked against the
relevant player-life intents and action result rows during recovery.
## Consequences
Each checkpoint batch may retain at most 393,584 bytes of replay inputs. Replay is
deterministic and bounded, while the complete post-tick checkpoint remains the
authoritative recovery state. Profile 1–3 trace formats and manifest size rules
remain unchanged. Process-level uncertain-commit and restart tests are still
required before M11.3d can close.
+1
View File
@@ -13,6 +13,7 @@
- [ADR-0110: Cellular checkpoint payload bound](0110-cellular-checkpoint-payload-bound.md) - raises profile-4's maximum object size so the complete retained archive and corpse limits fit.
- [ADR-0111: Durable identity for cellular player inputs](0111-cellular-durable-action-identity.md) - specifies the reliable v7 action identity needed for commit-bound cellular outcomes and exact retries.
- [ADR-0112: Durable cellular action input records](0112-cellular-action-ledger-records.md) - specifies canonical retry bytes, persisted result identity and the isolated profile-4 publisher needed before v7 admission.
- [ADR-0113: Cellular replay trace](0113-cellular-replay-trace.md) - specifies bounded per-tick life intentions for deterministic profile-4 replay and durable action reconciliation.
- [ADR-0058: Region durability contract](0058-region-durability-contract.md) - accepted M7.1 full checkpoint batches and explicit state closure; storage implementation follows.