Lockstep.Strategy.Replay (Lockstep v0.1.0)

Copy Markdown View Source

Re-runs the schedule recorded in a saved trace.

PIDs in the original trace are not the same #PID<...> values you'll see during replay (they're recreated by spawn). Instead the strategy matches them positionally: each spawned process gets a 1-based registration index in the order it calls hello, and the recorded schedule says "at step K, pick whichever pid is at position P". This works because both the original run and the replay register pids in the same order — provided the user code is deterministic.

Divergence (a position pointing at a pid that isn't currently in the ready set, or the trace running out before the test finishes) raises a clear error so you know the replay isn't faithful to the original.

Options

  • :replay_pid_order — list of position indexes (1-based) per step, as serialized into the .lockstep trace file by Lockstep.Trace.
  • :fallback:raise (default) or :random. When :random, reaching the end of the recorded schedule (or hitting a position that isn't currently ready) switches to uniform random selection over the ready set instead of raising. Used by Lockstep.Shrink to test partial-prefix schedules.
  • :fallback_seed — RNG seed for the random tail (only meaningful with fallback: :random). Default 0.