Docs/Guarantees and recipes
How to Investigate a Parity Issue
A practical runbook for "I think FrankenNumPy and NumPy disagree on something."
- Reproduce minimally. Reduce the input to the smallest array that still shows the divergence. Most parity issues survive on 4-element arrays.
- Run the operation under both with the same explicit RNG seed if any randomness is involved:
let mut rng = fnp_random::Generator::from_pcg64_dxsm(42)?; let fnp_out = rng.<op>(...);rng = numpy.random.Generator(numpy.random.PCG64DXSM(42)) np_out = rng.<op>(...) - Capture the oracle via the conformance harness:Add a fixture row to the relevant
FNP_REQUIRE_REAL_NUMPY_ORACLE=1 cargo run -p fnp-conformance --bin capture_numpy_oracle*_input_cases.jsonso the divergence is reproducible from a clean checkout. - Run the differential gate for the relevant family:The output names the fixture, the expected value, and the observed value.
cargo run -p fnp-conformance --bin run_ufunc_differential # for ufunc ops - Check the divergence ledger (
docs/DIVERGENCES.md):If the case is already known ascargo run -p fnp-conformance --bin run_divergence_ledger -- --fail-on-missingparity_debtorintentional, the ledger row tells you why and what's planned. - If new, the divergence is one of three things:
- Bug in FrankenNumPy: fix the kernel, regenerate witnesses if applicable, add a regression fixture.
- Behavior we want to keep but document: add a
parity_debtrow todocs/DIVERGENCES.mdwith bead ID and follow-up. - Bug in NumPy: extremely rare, but it happens. Document with upstream issue link.
- Regression-guard. Whatever the resolution, leave a fixture, a witness, or a ledger row behind so the next agent (or your future self) doesn't re-investigate from scratch.
The whole loop is built so investigation produces a permanent regression test, not just a one-off fix.