Repository navigation
Conversation
scripts/check_uk_candidate.py sets POLICYENGINE_SKIP_COUNTRY_IMPORTS=1, which binds policyengine.uk to None. The wrapper.household route reached calculate_household through it, so every household row errored and every UK candidate was rejected (2.134.5-1.58.2). Import the country module directly; it exposes the same function regardless of the flag. Fixes #645 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Local verification at e820bef (Python 3.13, locked env: policyengine-uk 2.130.1): |
…hold-route-skip-flag # Conflicts: # tests/test_uk_budget_reform_contract.py
Contributor
Author
Contributor
Author
|
Closing as a duplicate of #651, which W1 (owner of the contract runner) opened for the same root cause, with an equivalent fix and a stricter test (household rows must pass). This PR's CI was green at 7fa30ea (Test 3.11–3.14), and its local runs (136 passed on the merged file; the new test failed on main with the production error) corroborate #651's diagnosis. Issue #645 is the same bug as #650. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #645
What was wrong
scripts/check_uk_candidate.pysetsPOLICYENGINE_SKIP_COUNTRY_IMPORTS=1at startup, which makespolicyengine/__init__.pybindpolicyengine.uk = None. The contract's_WrapperHouseholdRoute._callreached the wrapper aspe.uk.calculate_household(...), so in thegatesrun everywrapper.householdrow raisedAttributeError: 'NoneType' object has no attribute 'calculate_household'. Candidate2.134.5-1.58.2(#639) was rejected on exactly those 16 rows (15 errors, plusunknown_path's rejection check failing on the same error). No UK candidate could qualify throughcertify-uk-release.Change
policyengine.tax_benefit_models.ukdirectly. It exposes the samecalculate_householdthatpolicyengine.ukbinds, and depends only onpolicyengine_ukbeing installed, not on the skip flag.evaluate_case(april_rate_change, "wrapper.household")in a subprocess with the flag set. It first assertspolicyengine.uk is None, so it exercises the failing condition, then requires noerrorrows.Verification (local, Python 3.13, locked env: policyengine-uk 2.130.1)
'NoneType' object has no attribute 'calculate_household') and passes with the fix (23 s).tests/test_uk_budget_reform_contract.pyin full: see the comment below once it finishes.ruff format --checkandruff checkpass on both changed files. Repo-wideruff checkexits 1 on main too with the local ruff, so that isn't from this change.Invariant
For any caller environment, a
wrapper.householdrow's status depends on the model's answer, not on whetherPOLICYENGINE_SKIP_COUNTRY_IMPORTSwas set beforepolicyenginewas imported.After merge
The next scheduled
certify-uk-releaserun qualifies the newest pe-uk (2.134.7) on the fixed contract. Candidates #639 and #644 were staged on the old code, and the catch-up should supersede them.🤖 Generated with Claude Code