Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CI Integration

Check an already-recorded file

foldback ci-check session.foldback

Exit codes: 0 clean, 1 divergence found (report on stderr), 2 couldn’t read the file. See the full contract in CLI Reference.

Example GitHub Actions step

- name: Check for desync
  run: |
    cargo run --release --bin my-sim -- --replay fixtures/match.log --record out.foldback
    foldback ci-check out.foldback

The in-process pattern (no CLI needed)

If your test harness already runs the simulation twice in-process (the GGRS::SyncTestSession pattern, generalized), skip the file entirely and compare finish() directly:

#![allow(unused)]
fn main() {
let mut a = Session::builder().peer_count(1).build()?;
let mut b = Session::builder().peer_count(1).build()?;

for tick in 0..NUM_TICKS {
    run_one_tick(&mut world_a, tick);
    run_one_tick(&mut world_b, tick);
    a.hash_tick(tick, &serialize(&world_a))?;
    b.hash_tick(tick, &serialize(&world_b))?;
}

assert_eq!(a.finish(), b.finish());
}

This is a plain Rust assert_eq! — wire it into whatever test runner you already use (cargo test, a custom harness), no foldback-cli involved. See Sessions, Files, and Live Mode.