mix pd.replay (PropertyDamage v0.2.0)

View Source

Replay a saved PropertyDamage failure against the System Under Test.

Loads a .pd failure file and re-executes its shrunk command sequence through the real engine, printing each step and a final verdict. This is a thin CLI shell over PropertyDamage.load_failure/1 and PropertyDamage.replay/2; for anything beyond what the flags expose (custom adapter config, stutter), use those functions directly.

Usage

mix pd.replay path/to/failure.pd [--verbose]

The failure file already records which model and adapter produced it, so no --model / --adapter flags are needed. Those modules must be compiled and loadable in the current project, otherwise the file cannot be decoded.

Exit code

The exit code answers a single question: does the bug still reproduce?, but splits "no" into two cases so the task composes with git bisect run (which reads 0 = good, 1 = bad, 125 = skip):

  • 0 when every command passes: the failure no longer reproduces and the bug appears fixed (good).
  • 1 when the failure reproduces: a command failed its check or errored during execution (bad).
  • 125 when the replay could not run at all: the project does not compile, the file fails to load, it records no model/adapter, or the sequence is branching. The outcome is indeterminate, not a reproduction, so git bisect treats it as skip rather than wrongly blaming the commit (skip). 125 is still non-zero, so the headline "non-zero means not-confirmed-fixed" contract holds.

A usage error (missing or surplus path, unknown option) exits 2 and is not part of the reproduction question.

Note the asymmetry: a per-command {:error, reason} during execution is a reproduction (exit 1, it can be the regression). Only pre-execution failures, which leave the bug's presence undetermined, are 125. This makes mix pd.replay usable as a regression gate and is the contract mix pd.bisect consumes per commit.

Options

--verbose    Print the events and projection state after each step

Examples

# Check whether a saved bug still reproduces
mix pd.replay failures/2025-12-26T14-30-00-check_failed-NonNegativeBalance-seed512902757.pd

# Show per-step events and state
mix pd.replay failures/currency-bug.pd --verbose