Gap
A grep of the repo finds no comparison or parity-validation code between the Rust engine and Python policyengine-uk. There is currently no automated way to detect when a Rust output drifts from Python.
Why it matters
Proposal
A script (Python preferred, can live in scripts/ or interfaces/python/policyengine_uk_compiled/parity.py) that:
- Loads the same FRS slice into Python
policyengine-uk and Rust policyengine_uk_compiled
- Computes a fixed list of key outputs in both:
income_tax, national_insurance, universal_credit, child_benefit, tax_credits, housing_benefit, state_pension, household_net_income, total_tax, total_benefits
- Diffs cell-for-cell at the household level (not just aggregates — aggregates can mask offsetting errors)
- Reports max abs diff, mean abs diff, and the top-N largest-diff households per variable
- Runs in CI weekly (full FRS) and on PRs (small sampled slice) and fails if diffs exceed configurable tolerances
Why this is high-leverage
This is S–M effort but pays for itself on every subsequent port. Recommend landing this before the next batch of variable ports so they land with parity already verified.
References
- Python wrapper:
interfaces/python/policyengine_uk_compiled/engine.py
- Python truth:
policyengine_uk/microsimulation.py, policyengine_uk/simulation.py
- Rust outputs:
src/main.rs simulate endpoint, src/engine/
Effort
Small to medium. Most of the wiring already exists in interfaces/python/policyengine_uk_compiled/; the new code is the pairing + diff logic + CI integration.
Gap
A
grepof the repo finds no comparison or parity-validation code between the Rust engine and Pythonpolicyengine-uk. There is currently no automated way to detect when a Rust output drifts from Python.Why it matters
src/data/calibrate.rs) is meaningless if individual-variable outputs diverge from Python pre-aggregationProposal
A script (Python preferred, can live in
scripts/orinterfaces/python/policyengine_uk_compiled/parity.py) that:policyengine-ukand Rustpolicyengine_uk_compiledincome_tax,national_insurance,universal_credit,child_benefit,tax_credits,housing_benefit,state_pension,household_net_income,total_tax,total_benefitsWhy this is high-leverage
This is S–M effort but pays for itself on every subsequent port. Recommend landing this before the next batch of variable ports so they land with parity already verified.
References
interfaces/python/policyengine_uk_compiled/engine.pypolicyengine_uk/microsimulation.py,policyengine_uk/simulation.pysrc/main.rssimulate endpoint,src/engine/Effort
Small to medium. Most of the wiring already exists in
interfaces/python/policyengine_uk_compiled/; the new code is the pairing + diff logic + CI integration.