Thanks for taking the time to contribute. This document captures the rules that keep ferray's NumPy-parity claim honest. Read it before you add or change a public function.
For project conventions (Rust edition, MSRV, import paths, error handling,
SIMD strategy, naming, dependency versions, and code-quality rules), see
CLAUDE.md.
ferray enforces a strict surface-coverage gate on every crate. CI fails if any pub fn / pub struct / pub trait is added without one of:
- A conformance test reference in
<crate>/tests/conformance_<category>.rsthat mentions the function's full path (canonical inner path + re-export path). - An exclusion entry in
<crate>/tests/conformance/_surface_exclusions.tomlwith non-emptyreasonandcovered_byfields. - A divergence entry in
<crate>/tests/conformance/_divergences.toml(for cases where ferray intentionally returns a more mathematically correct value than numpy/scipy, with cited justification).
- Regenerate the surface inventory:
cargo run -p ferray-test-oracle --bin surface-inventory -- <crate>. - The gate will fail; the error message lists each uncovered path.
- Either:
- Add a conformance test in
tests/conformance_<category>.rsthat loads a fixture fromfixtures/<crate>/<name>.json(generate viascripts/generate_fixtures.py) and asserts against numpy/scipy output. Tolerances come fromdocs/conformance-suites.mdStage 1 table (1 ULP for arithmetic, 1e-12 rel for f64 transcendentals, etc.). DO NOT relax tolerance to silence failure — escalate as aTOLERANCE_GAPissue. - Add an exclusion entry with a cited
covered_bytest path (NOT generic "covered elsewhere"). - Add a divergence entry with citation + tracking issue (for ferray-more-correct cases).
- Add a conformance test in
- Re-run the gate; it should pass.
- Commit.
See docs/conformance-suites.md for the full four-layer pattern and docs/conformance-suites.md#per-finding-classification-taxonomy for how to classify first-run failures (MATCH / BUG / DIVERGENCE / TOLERANCE_GAP / FIXTURE_BUG).
When a conformance test reveals a real numerical divergence:
- File a tracking issue (
crosslink quick "..." -p high -l "bug,cascade,conformance"). - Mark the test with
#[ignore = "...; tracking #N"]so the suite stays green. - DO NOT fix bugs inline during the dispatch that surfaces them — separate dispatches own bug fixes.
- Reference the umbrella issue #748 (the rollout) when filing if related.