Skip to content

Fix children receiving negative Marriage Allowance (#1666)#1667

Merged
MaxGhenis merged 1 commit into
mainfrom
vahid-ahmadi/issue-1666-marriage-allowance-children
May 9, 2026
Merged

Fix children receiving negative Marriage Allowance (#1666)#1667
MaxGhenis merged 1 commit into
mainfrom
vahid-ahmadi/issue-1666-marriage-allowance-children

Conversation

@vahid-ahmadi
Copy link
Copy Markdown
Collaborator

Summary

  • Closes Children can receive negative Marriage Allowance and income tax in married benefit units #1666. Children in a married benefit unit were being assigned MaritalStatus.MARRIED and tax band NONE, so they cleared every Marriage Allowance gate. partners_unused_personal_allowance then went negative for them (their own £12,570 PA minus zero adult-summed unused PA), marriage_allowance did not clamp the negative through, and earned_taxable_income ended up adding £12,570 of phantom income — taxed at 20% = £2,514 per child.
  • Fix is defence-in-depth at two points:
    • marriage_allowance: gate eligibility on is_adult and clamp the eligible amount at >= 0.
    • partners_unused_personal_allowance: subtract the person's own PA only when they are an adult (mirrors how the benunit sum is built), so non-adults get 0 rather than -pa.
  • Leaves marital_status and eligible_bands semantics unchanged so other variables that depend on them are not affected.

Test plan

  • New YAML case in marriage_allowance.yaml: a married benunit with two adults (£55k / £35k) and two children (ages 8, 3) — marriage_allowance is [0, 0, 0, 0] and income_tax is [9432, 4486, 0, 0].
  • Existing marriage_allowance.yaml cases still pass (no regression for the basic married-couple scenarios).
  • All other YAML tests in gov/hmrc/income_tax/allowances/ pass — the one failure (meets_marriage_allowance_income_conditions/regression for Add parameter for marriage allowance-eligible tax bands  #395) reproduces on main without these changes, so it is not caused by this PR.
  • Manual repro from the issue body now returns marriage_allowance = [0, 0, 0, 0], income_tax = [9432, 4486, 0, 0].

🤖 Generated with Claude Code

Children in a married benefit unit are assigned MaritalStatus.MARRIED and have
tax_band == NONE, so they passed the Marriage Allowance eligibility checks. The
transferable amount calculation then produced a negative value (their full PA
minus zero adult-summed unused PA), which flowed into earned_taxable_income and
generated phantom basic-rate income tax of 20% × £12,570 per child.

Guard marriage_allowance with is_adult, clamp the eligible amount at zero, and
fix partners_unused_personal_allowance to subtract the person's own unused PA
only when they are an adult (mirrors the inclusion in the benunit sum).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vahid-ahmadi vahid-ahmadi self-assigned this May 8, 2026
@vahid-ahmadi vahid-ahmadi requested review from anth-volk May 8, 2026 14:20
@MaxGhenis MaxGhenis merged commit 732fa08 into main May 9, 2026
9 checks passed
@MaxGhenis MaxGhenis deleted the vahid-ahmadi/issue-1666-marriage-allowance-children branch May 9, 2026 04:17
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.

Children can receive negative Marriage Allowance and income tax in married benefit units

2 participants