feat(lifecycle): replay retained offspring plans with explicit trace version
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 12m39s
Foundation / checks (client) (push) Canceled after 12m44s
Foundation / checks (checks) (push) Canceled after 12m48s
Foundation / checks (tsan) (push) Canceled after 10m18s
Foundation / checks (postgres) (push) Canceled after 12m44s

This commit is contained in:
dingo
2026-10-19 14:04:52 -04:00
parent 2c3a3c65a6
commit c0c66fa11a
15 changed files with 673 additions and 35 deletions
+15
View File
@@ -1,5 +1,20 @@
# Project status and next steps
## Portable inherited-plan replay - 2026-10-19
[ADR-0166](adr/0166-retained-plan-replay-traces.md) adds raw trace 4 exclusively
for owner format 8/rules 10. Recorded selections, same-tick funded offspring,
declines and later plan changes reproduce direct execution exactly. Action
matching uses the inherited offer even when it differs from the parent's body.
Failed batches expose no candidate or partial mutation outcome list.
Both full MSVC/GCC Release suites pass **87/87**. Fresh-process replay produces
identical final bytes on both compilers; analysis, formatting and focused
ASan/UBSan checks pass. [Validation](engineering/VALIDATION.md) records scope.
Trace 3 remains the default. Durable plan/bundle admission, population/census/
migration integration, control succession, retained NPC behavior and choice UI
remain open; this portable prerequisite does not complete M12.
## Portable retained offspring plans - 2026-10-19
[ADR-0165](adr/0165-retained-cellular-offspring-plans.md) implements an opt-in
@@ -0,0 +1,68 @@
# ADR-0166: Retained-plan replay traces
## Status and scope
Accepted portable replay segment of ADR-0163/0165, 2026-10-19. No new biology,
durable bundle, SQL admission, worker default, control handoff or UI contract.
## Context
Owner format 8/rules 10 retains inherited plans separately from expressed bodies.
Trace 3 describes the earlier in-life mutation path. Admitting the new owner
under that trace would make the same recorded selection have two meanings.
Matching an inherited offer to the expressed genome would also reject legitimate
later plan selections. Portable replay is needed before durable qualification.
## Decision
Add explicit raw cellular trace format 4, paired exclusively with owner format
8/rules 10. Keep formats 1-3 and the default trace-3 constant unchanged. Trace 4
uses the same bounded header, life/birth/selection layouts and canonical ordering
as trace 3, but its selections edit inherited plans under rules 10. No client
supplies the selected genome or biological outcome. Mixed/unknown owner/trace
versions refuse, including action matching; in-memory replay must enforce the
same version-specific payload shape as the codec.
Replay restores a detached predecessor, applies each complete tick and derives
actual plan selection outcomes, funded births, archive history and inventory.
Selection precedes budding; allocator-authorized primitive births remain after
the tick. Return the complete candidate and mutation outcomes only on full
success. Any later refusal leaves the predecessor unchanged and clears the
outcome vector, rather than exposing a partial accepted prefix. This tightens
failure reporting for earlier traces without changing successful old bytes or
biology. Outcomes are derived, not trusted trace assertions.
Reuse the existing canonical action blocks. Authoritative accounts, exact
standing offers, event/offer tick, operators and reserved identities remain
required. Under rules 10, match the offer parent to the retained offspring plan;
earlier owners fall back to their expressed genome. Choices must already be
available at the predecessor cut, as in the existing action contract. This does
not authorize choices for offers first earned midway through a recorded batch.
Existing SQL publishers/bundles, population traces, census and migration remain
unchanged and refuse this new combination. Portable decoding/replay is not
publication authority; result 4 (`offspring_plan_applied`) is not admitted by the
old durable result contract. Durable support requires a later explicit versioned
upgrade, retained-source replay, fences and fault qualification.
## Alternatives, consequences and risks
Reusing trace 3 would overload saved meaning. Changing its default would silently
move existing callers onto an unsupported durable version. Duplicating the entire
codec would add two implementations of identical bounded fields. A new semantic
version with shared field handling preserves compatibility at small cost.
Risks include accidental durable admission, mismatched action authority and
partial results surviving a failed replay. Exact allowlists, complete candidate
comparison and adversarial multi-tick tests address those risks. This supplies
replay evidence only; it does not supply account control succession or NPC policy.
## Qualification
Require direct-versus-recorded equality for earned structural selections,
selection plus same-tick funded offspring, later plan changes, declines and
active offspring with a suspended parent. Test action mismatches after a plan
differs from the body, malformed codecs, both cross-version directions, stale
choices and a failure after a successful selection prefix. A fresh process must
restore the predecessor, decode the trace and reproduce complete expected bytes.
Run Release/NDEBUG, analysis/formatting and ASan/UBSan; preserve all old goldens.
+2
View File
@@ -1,5 +1,7 @@
# Architecture decision records
- [ADR-0166: Retained-plan replay traces](0166-retained-plan-replay-traces.md) - explicit raw trace 4 for owner 8/rules 10, inherited-offer action matching and complete-result replay; durable admission remains separate.
- [ADR-0165: Retained cellular offspring plans](0165-retained-cellular-offspring-plans.md) - portable owner format 8/rules 10 keeps expressed bodies separate from earned inherited plans, repeated births and selection history; durable/control/UI integration pending.
- [ADR-0164: Distinct-genome offspring funding](0164-distinct-genome-offspring-funding.md) - pure funded reproduction separates the expressed parent's investment from the inherited child's anatomy and provision; old same-genome behavior retained, owner/control integration pending.
@@ -1,5 +1,11 @@
# Persistence and region authority
[ADR-0166](../adr/0166-retained-plan-replay-traces.md) adds portable raw trace 4
exclusively for the retained-plan owner 8/rules 10. Replay and action matching
preserve expressed/inherited meanings and return outcomes only after the entire
candidate succeeds. Existing trace defaults, SQL bundles, population traces and
result admission remain unchanged. This is not a durable upgrade or live entry.
ADR-0158/schema 53 admits the explicit same-profile bundle-10 -> 11 maturation
upgrade through the existing immutable version journal and lease/head fence.
Recovery rederives the complete retained transformation; raw trace 3 and population
+4 -2
View File
@@ -49,8 +49,10 @@ and dead-parent history, and logout freezes the controlled parent's biology.
This scoped mode edits inherited plans only. The future operator catalog still
needs to distinguish traits that can also change during an existing life. Existing
durable bundles, census, population, migration and batch replay refuse the new
owner until their plan semantics are qualified. The birth-time control choice,
durable bundles, census, population and migration refuse the new owner until
their plan semantics are qualified. [Trace 4](../../schemas/cellular-region-batch-v4.md)
supplies portable replay and inherited-offer action matching; old traces refuse
this owner. The birth-time control choice,
persistent NPC behavior and UI remain unimplemented; default/DEV rules do not
opt into this owner.
+3 -1
View File
@@ -17,7 +17,9 @@ evidence does not close that gap or establish the intended generational gameplay
pure biological funding step with distinct parent/offspring genomes and exact
closure. [ADR-0165](../adr/0165-retained-cellular-offspring-plans.md) adds portable
retained plans and earned selections, unchanged expressed parents and repeated
funded births. Existing same-genome behavior remains. Durable plan/trace/bundle,
funded births. [ADR-0166](../adr/0166-retained-plan-replay-traces.md) adds portable
raw trace-4 replay, action matching and exact process restart. Existing same-genome
behavior remains. Durable plan/trace/bundle,
population/migration/census admission, the in-life expression catalog, authority
handoff and NPC/UI integration are still required.
+58
View File
@@ -1,5 +1,63 @@
# Validation report
## 2026-10-19 - Portable retained-plan trace replay
[ADR-0166](../adr/0166-retained-plan-replay-traces.md) adds explicit raw trace 4
for owner format 8/rules 10. The trace-3 default and successful old canonical
bytes/biology remain unchanged. Codec and in-memory replay enforce versioned
payload shapes; both action matchers enforce owner/trace compatibility and
mutation matching uses the inherited plan. Replay now publishes its outcome
vector only after the complete candidate succeeds, including for older traces.
Decode also checks cross-tick identity/account uniqueness already required by
the encoder. No SQL or durable version admission changed.
Executed locally:
- MSVC 19.44 Release full CTest **87/87 passed, 23.95 s**, with NDEBUG.
- GCC 14.2 Release full CTest **87/87 passed, 16.98 s**, with NDEBUG.
- Clang 19.1 Debug new replay and actual process-restart tests **2/2 passed,
0.96 s**, built with clang-tidy 19 enabled. Changed implementation and tests
compiled under analysis; repository clang-format 19 and diff checks pass.
- Clang 19.1 ASan/UBSan legacy cellular owner, retained plans, new replay and
actual replay process restart **4/4 passed, 44.64 s**, without reports.
- Optional GCC persistence library and cellular session adapter rebuilt; the
session adapter contract passed **1/1, 0.14 s**. No private PostgreSQL runtime
suite was rerun; durable bundle and SQL admission are unchanged.
The new contract compares 64 directly executed ticks to encoded/decoded replay,
including an earned structural selection and real funded offspring in its first
tick, then active offspring while the parent freezes. Later selections match
standing offers whose inherited genome differs from the expressed body; decline
does not admit a genome. It covers action account/life/event/tick/operator/input
mismatches, missing actions, both owner/trace mismatch directions, malformed
counts/reserved bytes/versions, truncation, trailing bytes and stale selections.
A canonically valid trace with an incorrect second-tick living set fails after
a successful selection prefix, leaving the predecessor unchanged and the output
outcome list empty. Two ordinary allocator births reproduce through trace 4;
cross-tick reserved-identity reuse refuses during decode.
The same-tick fixture initially requested birth before enough reserve had been
acquired. It now retains the earned offer, feeds from the unchanged finite
habitat, and waits for a genuine funded birth proposal; no free resources or
biology changes were added. Initial analysis also caught a test optional access;
an explicit runtime guard fixes it. All checks above ran after those corrections.
The process test saves a predecessor with an inherited plan different from its
body, a trace selecting a later plan and the direct expected final owner. A fresh
process restores that predecessor and replays the trace, checking its derived
selection result and complete final bytes. MSVC and GCC expected checkpoints
share SHA-256
`7d6091c4460e0ebcf57e0b0557c7c97a16561c941a83389068db73651e7e758a`.
This is deterministic replay evidence, not durable publication, account authority
or NPC behavior continuity. Existing SQL bundles/results, population traces,
census and migration remain unadmitted for owner 8/rules 10. No private database,
target-host, TSan, actual-days, client/UI or M12 completion evidence is claimed.
The refreshed DEV window expires **2026-10-19 22:04:17 UTC**. Rendered deployment
policy passes: 75 objects in 74 files, 138 rendered objects in 17 overlays, zero
failures. The unchanged policy self-test matrix was not repeated. No deployment
or World0 operation occurred; unrelated untracked work was preserved.
## 2026-10-19 - Portable retained cellular offspring plans
[ADR-0165](../adr/0165-retained-cellular-offspring-plans.md) adds opt-in owner