Add replay-backed retained session checkpoints

This commit is contained in:
Meta Vens 2026-07-15 08:08:02 +01:00
commit 949f98af52
15 changed files with 707 additions and 43 deletions

View file

@ -56,11 +56,13 @@ step, and disposal operations. It emits revisioned receipts and typed
Begin/Hit/End facts with stable Ymir identities. Ordinary retained steps do not
accept complete body snapshots.
The current CLI still has no named session registry, CultMesh command
lowerings, durable receipt ledger, or reconstruction
checkpoint. Its CultCache and Eve output is a regenerated diagnostic
projection. The sections marked as target contract describe that daemon cut;
they are not advertisements of current CLI capability.
The embedded retained-session library now has a replay-backed reconstruction
checkpoint and durable-in-checkpoint command receipt ledger. Host-owned private
incremental journal storage and atomic frame/resume commits remain integration
work. Complete replay history is not product state and must not ride in public
client frames. The current CLI still has no named session registry or CultMesh
command lowerings; its CultCache and Eve output remains a regenerated
diagnostic projection.
## Target Inputs
@ -175,6 +177,17 @@ lifecycle identity are binary contracts, not tolerance checks. Authoritative
contact facts resume only after canonical history has been replayed through the
checkpoint tick; a checkpoint alone cannot emit gameplay contact facts.
`gamecult.ymir.session_checkpoint.replay.v1` implements that promise. It stores
the initial definitions, complete typed command journal, logical session
generation, command digest, body-generation counter, world verification
projection, active contact-episode verification records, and pinned runtime
fingerprint. Restore replays into a new Box3D world with outward publication
suppressed, then compares the reconstructed boundary exactly before returning a
live session. The bounded binary codec rejects incompatible, corrupt, or
trailing data and checksums the complete encoded payload. ABI v5 validates the
exact pinned native build id, not merely Box3D's public version. Native Box3D
identities never enter the checkpoint.
`gamecult.ymir.world_state.v2` appends Box3D body type, bullet,
field-participation, and collision filter arrays to the v1 layout. The v1 and
v0 readers are explicit migration paths; keys are not reassigned. Torque is
@ -200,7 +213,8 @@ Box3D-backed sessions prove:
3. overlap and shape-cast lowering;
4. continuous collision event timing and same-step Box3D cast witnesses;
5. transient force and torque application;
6. checkpoint reconstruction and replay;
6. checkpoint reconstruction and replay (implemented; journal compaction and
long-running storage remain operational work);
7. Aetheria gravity, tractor, pickup, and payload smokes.
There is no managed fallback after that cut. A native load or compatibility
@ -213,9 +227,9 @@ failure fails closed and reports the missing capability.
session facts.
- Negative source checks prove custom solver and spatial-index authorities are
absent after cutover.
- Aetheria smokes must prove gravity, contact-gated destruction loot, tractor
attraction, pickup collection, and fast payload hits through the retained
contract. Current gravity, pickup-contact, cast, and overlap witnesses cover
only the snapshot/query compatibility path.
- Aetheria smokes prove gravity, tractor attraction, contact-gated pickup
collection/rejection, physical payload hits, and restart continuation through
the retained contract. Destruction loot remains Aetheria gameplay state
gated by Ymir contact facts where collection occurs.
- Released-client witnesses prove generic Eve clients only observe Ymir and
Aetheria provider contracts, never native implementation details.

View file

@ -21,16 +21,16 @@ the overlap, cast, pair-step, torque-lifetime, version, and ABI-layout
operations used by the harness. This keeps Box3D's alpha C ABI out of Ymir's
public managed contracts.
Production ABI version 4 uses caller-owned blittable buffers, explicit cdecl,
Production ABI version 5 uses caller-owned blittable buffers, explicit cdecl,
fixed-width status/count values, compile-time C layout assertions, and a
managed/native layout sentinel before opening a session. It adds explicit
managed/native layout and pinned-build-identity sentinel before opening a session. It adds explicit
retained body mutations, one-shot force and torque operations, and a
session-owned Begin/Hit/End event buffer. The private buffer retains Box3D's
stored contact key only long enough to correlate its separate event arrays;
public Ymir facts never expose native contact identity. Planar direction maps to Box3D
rotation about Y; angular velocity and transient torque remain Box3D state and
commands rather than managed integration.
ABI v4 additionally carries Box3D static/kinematic/dynamic selection, bullet
ABI v5 additionally carries Box3D static/kinematic/dynamic selection, bullet
CCD, category/mask/group filtering, and per-body radial-field participation.
`tests/Ymir.Box3D.Parity` builds that facade through CMake and invokes it with

View file

@ -85,9 +85,21 @@ chronology.
- Aetheria cargo, damage, loot, feedback, and scoring remain gameplay state
derived from Ymir facts.
The current in-process receipt ledger is not a durable reconnect ledger. It is
kept for the lifetime of the session and is intentionally not advertised as a
reconnect or checkpoint guarantee.
The replay checkpoint preserves the logical session generation, complete typed
command journal, receipt ledger, body-generation counter, world projection, and
active contact episodes. Restore creates a fresh native Box3D world and replays
that journal through the checkpoint boundary before facts may leave the
session. The world and episode records verify replay; they do not replace it or
infer contact continuity from body proximity.
`gamecult.ymir.session_checkpoint.replay.v1` is encoded by the bounded binary
`YmirSessionCheckpointCodec`. The checkpoint carries the pinned Box3D/ABI/
precision fingerprint and fails closed on incompatible provenance, corrupt or
trailing data, journal divergence, world divergence, or contact-lineage
divergence. A SHA-256 checksum binds session identity, provenance, journal,
world verifier, and active episodes. ABI v5 independently validates the exact
pinned native build id before opening a session. It contains no native Box3D
handle or contact key.
## Forbidden Writers
@ -102,10 +114,9 @@ reconnect or checkpoint guarantee.
## Shared Paths
Direct commands, agent commands, and spawns use the same explicit in-process
session operations. Imports, reconnects, and replay must lower through those
operations after the owning product's registry and reconstruction contract exist.
Restore will establish initial state; it will not remain a parallel writer.
Direct commands, agent commands, spawns, and checkpoint replay use the same
explicit session operations. Restore establishes a fresh native world through
those operations; it is not a parallel state writer.
Retained queries will observe a named revision without mutating it. Snapshot
reads cannot be fed back without an explicit restore, teleport, velocity, or
configuration operation.
@ -133,10 +144,11 @@ is derived process state: it never appears in a public fact or checkpoint.
2. Public managed retained session with no ordinary full synchronization:
done.
3. Revision-checked retained-session overlap and cast queries: done.
4. Embed one retained session per Aetheria run and zone, then delete its process-wide
simulator identity, manual tractor geometry, per-projectile mini-worlds,
and tuple contact dedup.
5. For optional standalone hosting, add a session registry, generation-bearing
4. One embedded retained world and physical-payload session per Aetheria run
and zone: done.
5. Persist replay journals privately and incrementally behind a bounded resume
descriptor; complete history must not ride in public product frames.
6. For optional standalone hosting, add a session registry, generation-bearing
routed commands, idempotent Create, durable receipts, and CultMesh lowering.
The isolated `YmirSimulator` remains a compatibility API. It is never the
@ -160,5 +172,5 @@ End fact.
- different insertion orders produce the same semantic fact order.
- queries observe the requested retained revision and cannot inject bodies.
- disposed or stale session generations fail closed.
- restored continuation must reproduce bodies and fact identity before Ymir
advertises retained-session checkpoint support.
- restored continuation reproduces command receipts, bodies, active contact
identity, and subsequent Begin/End facts before authoritative publication.