Skip to content

Import the UK model module directly in the contract's household route - #651

Merged
MaxGhenis merged 1 commit into
mainfrom
fix-contract-household-import
Oct 17, 2026
Merged

MaxGhenis merged 1 commit into
mainfrom
fix-contract-household-import

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #650

Independent review: an Opus 5.5 review approved 9799449 (the Codex lanes were closed), in review-out.md. It reproduced the CI failure under the switch and the fix. It also found that the sampled property routes_agree_and_baselines_hold calls the same route and is fixed by the same change. That accounts for CI's 15 errors plus 1 fail.

Reproducer: tests/test_uk_budget_reform_contract.py::test_the_household_route_runs_where_country_imports_are_skipped

What broke

The reform-contract gate rejected every UK candidate since it went live: 2.134.5, 2.134.6 and 2.134.7 (#639, #644, #647).

  • Symptom: in the 2.134.7 attempt's report, every wrapper.household row errored: AttributeError: 'NoneType' object has no attribute 'calculate_household'. That is 15 errors, plus 1 fail where unknown_path expected a new_credit error.
  • Cause: scripts/check_uk_candidate.py sets POLICYENGINE_SKIP_COUNTRY_IMPORTS=1 when it is imported, so policyengine/__init__.py sets policyengine.uk = None. The route called pe.uk.calculate_household.
  • Why it wasn't seen locally: without the switch, the same route and versions pass. The full 1.1.0 contract on policyengine-uk 2.134.7, with no dataset, gives 773 pass, 0 fail and 0 error (log: full-1.1.0-run-pe-uk-2.134.7-no-flag.log).

The fix

The route imports policyengine.tax_benefit_models.uk, the module policyengine.uk names, directly. So it runs whatever the switch says. No check, verdict or report shape changes.

Tests

  • New: test_the_household_route_runs_where_country_imports_are_skipped sets policyengine.uk to None, as the gate's process leaves it, and runs april_rate_change on the household route. Every row passes, apart from the parameter checks the route reports unsupported by design. It fails on main's route.
  • End to end: with POLICYENGINE_SKIP_COUNTRY_IMPORTS=1, run_budget_reform_contract(routes=["wrapper.household"]) gives 70 pass and 0 error. CI's run gave 15 errors.
  • Locally: test_uk_budget_reform_contract.py and test_uk_candidate_gates.py give 414 passed. ruff is clean.

After this

The next certify run should no longer fail these rows. Candidates may still be held by other gates, which this doesn't touch: the 2.134.7 receipt also shows replay: construction_inert, and budget_inputs and metrics_review needing review.

🤖 Generated with Claude Code

scripts/check_uk_candidate.py sets POLICYENGINE_SKIP_COUNTRY_IMPORTS,
which leaves policyengine.uk as None, so every household-route row of
the reform-contract gate errored ('NoneType' object has no attribute
'calculate_household') and every candidate since the gate went live
was rejected. Fixes #650.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 17, 2026 02:30
@MaxGhenis
MaxGhenis merged commit 3a1eca6 into main Oct 17, 2026
12 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merge audit (W1, session local_37646626): merged at 9799449, pinned with --match-head-commit. The merge commit is 3a1eca6.

  • CI: gh pr checks exited 0, with all 12 checks passing (Test 3.11–3.14, Lint, Mypy, smoke-import, changelog, release inputs). The PR was MERGEABLE and CLEAN, and not a draft.
  • Review: an independent Opus 5.5 review approved 9799449 (the Codex lanes were closed). The report is ~/reviews/w1-contract-household-import-650/review-out.md. It reproduced the gate's AttributeError with POLICYENGINE_SKIP_COUNTRY_IMPORTS=1 on main's contract file, and on the branch got 70 pass and 0 error, matching main's output row for row.
  • No CHANGES_REQUESTED review is outstanding.
  • Effect: the reform-contract gate's household-route rows run again in the qualification process. Candidates may still be held by the replay, budget-input and metrics gates.

@MaxGhenis
MaxGhenis deleted the fix-contract-household-import branch October 17, 2026 13:25
MaxGhenis added a commit that referenced this pull request Oct 18, 2026
… lease

#627 is not part of the cause: attempts with #651 but not #627 also timed
out. The four-hour staging lease is shorter than the new limit; #662 tracks
raising it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Budget reform contract's household route errors in the qualification gate: policyengine.uk is None

1 participant