FrankenTerm

Recorder and Replay

267 words1 min read4 subsectionsFrom the README at ft 0.15.21

On this page4
RecorderReplayWhat replay catchesReplay invariants

Beyond delta capture, ft has a separate recorder subsystem that produces high-fidelity execution traces, and a replay harness that runs those traces back deterministically. Together they enable post-incident reconstruction and regression testing.

Recorder

  • Append-log backend (current shipped default) — newline-delimited JSON events appended to a per-session log file.
  • frankensqlite backend (rollout/test only; live bootstrap pending): a structured-row backend for tighter querying.
  • The recorder owns its own invariants checker (recorder_invariants.rs) and audit surface (recorder_audit.rs); the migration story (recorder_migration.rs) handles upgrading old session logs into the current event schema.

Replay

The replay subsystem is its own crate (frankenterm-core-replay, ~40k LOC, 31 source files). It accepts a recorded session and produces:

  • A normalized event DAG (decision graph with causal edges)
  • A virtual-clock harness so timing-dependent steps can be replayed deterministically
  • A diff engine that compares two replays, useful for catching nondeterminism in workflow handlers
  • A replay-assessment scorer that produces pass / fail / degraded verdicts per scenario

What replay catches

  • Nondeterministic workflow handlers — handlers that read the wall clock, generate random IDs without a seeded RNG, or depend on iteration order over a HashMap.
  • Off-by-N in event causality — events that should be downstream of a trigger but get persisted out of order under load.
  • Regressions in policy decisions — a recorded session can be replayed against a newer policy ruleset to see whether previously-allowed actions are now blocked (or vice versa).

Replay invariants

  • The VirtualClock validator rejects NaN and NEG_INFINITY for time inputs (br-ft-p2xmz / br-ft-gldyy, see CHANGELOG).
  • ReplayConfig::validate rejects non-finite numeric inputs at the boundary.
  • Replays are byte-equal across machines when the recorded session is byte-equal; this is the project's definition of replay determinism.