ONNX parity (5 tests)
Source:test_onnx_parity.py::test_onnx_parity (parametrized across 5 models)
Assertion: for each model, |booster.predict(sample) − ort.session.run(sample)| ≤ 1e-5 on both a clean row and a NaN-bearing row
What it catches: divergence between the XGBoost native scorer (used in Python training) and the ONNX runtime (used in the React app). The divergence would be silent the browser would show wrong numbers with no error. The NaN-bearing sample (the ~47% of laps where cliff_candidate_flag or cliff_onset_passed is null) is the critical case: XGBoost learns the optimal missing-value split direction during training, and that direction must survive the ONNX conversion.
- Parity status
- Why atol=1e-5
All five models pass
atol=1e-5 parity, including NaN-bearing samples.Predict schema (3 tests)
Source:test_predict.py (3 test functions)
What these catch: changes to the output parquet that would silently break downstream consumers (the app, the mart, the model card) by dropping a column, changing a type, or violating a business rule.
- Output schema (17 columns)
- Holdout & envelope flags
- Quantile monotonicity & prob normalisation
Source:
test_predict.py::test_output_schemaAssertion: the written parquet has exactly the 17 columns in PREDICTIONS_ARROW_SCHEMA, with matching types.The 17 columns are:Target synthesis (1 test)
Source:test_targets.py::test_stint_life_synthesis
Assertion: remaining_stint_life_laps ≥ 0 for all rows; the synthesis stint_length_laps − lap_in_stint is non-negative everywhere.
What it catches: the stint-life target is synthesised in features.py at load time, not read from the mart. A bug in the synthesis (e.g. a subtraction with wrong column alignment) would produce negative “remaining laps”, which has no physical meaning and would cause the regressor to learn from impossible targets. The test gates the synthesised values before any training can start.
Relationships
ONNX export
The export stage and why parity must be exact in depth.
CI overview
All 40 tests where these nine sit in the full contract.
Features & Targets
Target synthesis and why
stint_length_laps is never in the feature matrix.Evaluation gates
The other seven tests beats-baseline, calibration, cohorts.