33. Replay and snapshots
Note: This feature is planned and not available in
coax0. The syntax shown follows the Coax specification and may change before it's built. This is roadmap R16 (spec stage 10).
A replay runs a recorded session again and must reach the same states. A snapshot saves a run so it can resume. Chapter 16 plans #test replay; this chapter plans what a recording holds, what a snapshot holds, and how a replay reports the first place it diverges.
What this chapter will cover
- The observation boundaries a recording keeps.
- Snapshots with versioned schemas and an inventory.
- Exact comparison and first-divergence reports.
- Trajectory contracts for tolerant simulations.
- Qualified replay profiles.
- Omniscient and observation-level replay.
Outline
- Recording. Record every observation boundary: input acceptance order, asset publication, R13 clock readings (chapter 30), random-stream state, executable identity and the R15 numeric and runtime profile.
- Snapshots. A snapshot saves logical state, entity identities and generations, pending structural commands, accepted future inputs, and solver integration or warm-start state, through versioned schemas with R5 stable identities.
- The inventory. Each snapshot lists what it includes and which external resources (graphics devices, network connections, device interfaces) you must reconstruct rather than restore.
- Divergence. Replay compares state exactly where the profile promises exact results, and reports the first divergence by tick, field, system and source operation.
- Tolerant simulation. A numerically tolerant simulation uses a separate trajectory contract. A per-kernel tolerance is not an end-to-end trajectory guarantee.
- Qualified profiles. A replay profile names its scope (build, worker count, target and architecture) and refuses operations outside it.
- Physical inventory. Recordings also name ephemeris and rotation-model versions, integrator and tolerance settings, and, once R20 defines them, the fidelity profile and active rule modules (chapter 37).
- Two levels. Omniscient replay shows the authoritative state. Observation replay shows what each agent had received when it acted (chapter 35), so you can ask what a controller knew when it issued a command.
The consumer and the gate
- Record and replay the simulated robot's closed loop, including the Psionic deterministic solver's state (Psionic chapter 170).
- Record and replay one Metaverse session.
- Restore from a mid-run snapshot and match the uninterrupted run.
- Replay the spacecraft scenario at two warp factors and get the same events and final state.
- Fixtures omit each inventory item in turn and must show the divergence it causes. A replay under a different profile is refused, not silently compared.
Done when
- R16 ships with those fixtures and consumers.
#test replayin chapter 16 runs, and its planned note is removed.- This chapter's examples, including a refused replay with a
.statusfile, run undercheck-examples.sh.
Dependencies
- R5 stable identities (chapter 13), R13 recorded clocks (chapter 30) and R15 strict profiles (chapter 32).
- Used by Metaverse Engine chapters 5 and 36.