Repository navigation
Respect NI liability in Carer's Allowance earnings - #2444
Merged
Merged
Conversation
vahid-ahmadi
left a comment
Collaborator
There was a problem hiding this comment.
Looks right, fine to approve.
@juaristi22, this does what #2360 asked, and the three new cases are correct. Two small points.
- should,
policyengine_uk/variables/gov/dwp/carers_allowance_earnings.py:101-109: #2490 rewrites the sametrading_class_4expression to readclass_4.contribution_scale. Whichever merges second will conflict, and theni_class_4_liablefactor must survive the rebase. Worth a note on #2490 so it is not dropped. - nit,
policyengine_uk/variables/gov/dwp/carers_allowance_earnings.py:26: the reflowed documentation line is 92 characters. Ruff passes, so this is cosmetic, but the rest of the string wraps at 88.
What I checked
- Read SI 1996/2745 reg. 14 (current text) and SI 2001/1004 reg. 91(a). Read
ni_class_4_liable, which applies the start-of-tax-year test, so Case 20 (State Pension age reached in September 2026) correctly keeps the Class 4 deduction. - Hand-computed the cases. Case 18 (2018): no tax below the £11,850 allowance, no Class 4 below £8,424, Class 2 removed; £7,000 - £700 = £6,300, £121.15 a week, over £120. Case 19 (2026): £15,000 - £486 tax - £3,850 = £10,664, £205.08 a week, over £204; deducting Class 4 (6% of £2,430 = £145.80) would give £202.27. Case 20 equals Case 19 less that £145.80, £10,518.20. All match.
policyengine-core test .../carers_allowance_earnings_limit.yaml: 20 passed. With the formula reverted to main: 2 failed, 18 passed.- Applied #2442's 2016-17 personal allowance change on top: still 20 passed, so the two PRs do not interact in this file.
ruff checkandruff format --checkon the changed file: clean.- Reproducer and axiom lines are present;
fixedfragment type is right. CI is green on the current head.
🤖 Generated with Claude Code
vahid-ahmadi
approved these changes
Oct 18, 2026
vahid-ahmadi
left a comment
Collaborator
There was a problem hiding this comment.
Approving, per my review above. The shoulds and nits can follow.
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 #2360
Self-employed carers over State Pension age could incorrectly pass the Carer's Allowance earnings limit because the model deducted notional National Insurance they were not liable to pay. Apply the existing, separate Class 2 and Class 4 liability rules to those deductions, preserving the notional profit calculation.
For example, the 2018 regression has £7,000 profit and £1,400 pension contributions. At age 70 its earnings are £6,300 (£121.15 a week), above the £120 limit. This removes underlying Carer's Allowance entitlement and the Pension Credit carer addition even where State Pension already reduces cash Carer's Allowance to zero.
The fix retains the existing annual age approximations. Class 4 remains deductible for the tax year in which State Pension age is reached; Class 2 uses its existing separate liability flag.
Reproducer: policyengine_uk/tests/policy/baseline/gov/dwp/carers_allowance_earnings_limit.yaml
Validation:
make formatpassed, including Ruff lint.Local tests used Python 3.13 / policyengine-core 3.32.27 in an existing environment with imports from this checkout. Hosted CI will verify the locked environment.
axiom: needed
A maintainer still needs to confirm or implement the matching Axiom provision and companion cases. No encoded-correct claim or encoder run is included.