Skip to content

Respect NI liability in Carer's Allowance earnings - #2444

Merged
juaristi22 merged 1 commit into
mainfrom
fix-2360-carer-national-insurance
Oct 19, 2026
Merged

juaristi22 merged 1 commit into
mainfrom
fix-2360-carer-national-insurance

Conversation

@juaristi22

Copy link
Copy Markdown
Collaborator

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:

  • New pension-age cases reproduced both errors before the fix (2 failed, 18 passed).
  • 307 focused YAML tests passed across Carer's Allowance, Pension Credit and National Insurance.
  • 78 Python property/statute tests passed.
  • make format passed, including Ruff lint.
  • Independent source and code reviews completed with no findings.

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.

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right, fine to approve.

@juaristi22, this does what #2360 asked, and the three new cases are correct. Two small points.

  1. should, policyengine_uk/variables/gov/dwp/carers_allowance_earnings.py:101-109: #2490 rewrites the same trading_class_4 expression to read class_4.contribution_scale. Whichever merges second will conflict, and the ni_class_4_liable factor must survive the rebase. Worth a note on #2490 so it is not dropped.
  2. 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 check and ruff format --check on the changed file: clean.
  • Reproducer and axiom lines are present; fixed fragment type is right. CI is green on the current head.

🤖 Generated with Claude Code

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, per my review above. The shoulds and nits can follow.

@juaristi22
juaristi22 added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit ef0bf0f Oct 19, 2026
14 checks passed
@juaristi22
juaristi22 deleted the fix-2360-carer-national-insurance branch October 19, 2026 17:38
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.

Carer's Allowance earnings deduct notional Class 2 and Class 4 from carers over State Pension age

2 participants