Skip to content

Fix qualifying surviving spouse eligibility and related filing statuses - #10273

Draft
MaxGhenis wants to merge 9 commits into
mainfrom
surviving-spouse-gross-income-test
Draft

MaxGhenis wants to merge 9 commits into
mainfrom
surviving-spouse-gross-income-test

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Draft. The 2025 and 2026 default-dataset impact remains pending. Household tests use synthetic inputs.

The bug

surviving_spouse_eligible required tax_unit_child_dependents > 0. That sums is_child_dependent, which accepts a qualifying child, a permanently disabled dependent, or is_qualifying_relative_dependent. That last path applies the IRC 152(d)(1)(B) gross income test (dependent_gross_income < gov.irs.income.exemption.amount, $5,200 in 2025). So an adult child with gross income of $5,200 or more left a widowed parent filing as single.

The same rule also let any low-income dependent qualify the filer, including a parent, a grandparent or an unrelated household member.

The law

Pub. L. 108-311 §207(1) added the three §152 exceptions to 26 U.S.C. 2(a)(1)(B)(i). Section 208 applies the amendment to tax years beginning after December 31, 2004. The proposed Treasury preamble (REG-137604-07, I.R.B. 2017-7) reads clause (ii) consistently with clause (i). The 2025 Form 1040 instructions, page 15 apply those waivers.

The fix

A widowed tax-unit head qualifies through a confirmed co-resident child or stepchild who meets the remaining dependency conditions.

  • An explicit CHILD or OTHER value of surviving_spouse_dependent_relationship takes precedence.
  • A parent ID naming the head confirms a child.
  • The fallback excludes encoded parents, grandparents, siblings, grandchildren, nieces, nephews, and unrelated people. An otherwise unknown relationship must pass the ordinary dependency test.
  • An otherwise qualifying child who files jointly in a separate tax unit can qualify through surviving_spouse_joint_return_child_id. The input confirms the relationship and remaining dependency conditions.
  • Household membership and represented remarriage affect eligibility.
  • The ordinary head-of-household fallback checks the dependent's household and preserves the dependent-parent exception.
  • Cohabiting spouses heading two separate returns file as SEPARATE.

tax_unit_child_dependents and is_child_dependent are unchanged. Vermont's EITC, New York's exemptions and Pell still read them.

Limitations.

  • For an unknown relationship, age, disability, and income can still affect the ordinary dependency classification. An unmarked non-disabled adult sibling with $12,000 of wages is ineligible.
  • Household membership is a snapshot.
  • The model still lacks the two-year death window (Surviving-spouse filing status has no two-year limit (26 U.S.C. 2(a)(1)(A)) #10059), death-year joint-return eligibility, household upkeep, full-year residence and its exceptions, and reliable detection of an unrepresented spouse living elsewhere.
  • This PR does not check the default dataset's fields, frequencies, or aggregate effects.

Before and after

The confirmed adult child with $12,000 of synthetic wages qualifies the widow despite the $5,200 threshold and yields a $31,500 basic deduction. The separate $7,800 taxable disability-benefit case also qualifies. The deceased-parent-only, stepchild, and co-resident-mother examples supply CHILD. A $0-income grandmother has one ordinary child-dependent count in the widow's unit and cannot qualify her for surviving-spouse status.

A supported adult son filing jointly can qualify the widow, a child living elsewhere all year gives SINGLE in the test household, and cohabiting remarried spouses filing separate returns both receive SEPARATE.

surviving_spouse_eligible.yaml, filing_status.yaml and head_of_household_eligible.yaml contain 31, 23, and 16 passing cases, respectively.

Invariants

test_surviving_spouse_eligible_properties.py builds a grid of 1,876 focal tax units, 2,308 total tax units, and 5,118 people. It uses ages 10, 31, and 88, and incomes of $0, $3,000, $5,199, $5,200, $12,000, and $50,000. The relationship setups distinguish CHILD, OTHER, and UNKNOWN.

The six tests check eligibility, income invariance for confirmed children, exclusion of known other relationships, required conditions within the in-unit grid, filing-status agreement, and the differential from ordinary child-dependent counts. The cross-return route has a separate YAML case.

Why Python. The relationship examples are YAML cases. This test adds invariants that named YAML cases cannot state: income invariance across grouped units, a reference rule, and a differential against tax_unit_child_dependents, all over a mixed, vectorized population.

Cost. The six property tests passed in 36 seconds of Linux runner wall time.

Interaction with #10185 and #9932

#10185 counts taxable employment disability benefits in gross income. It and #9932 have merged, and both squash commits are ancestors of this branch. The $7,800 synthetic taxable disability-benefit case verifies that the benefits enter gross income and a confirmed child still qualifies. A trial merge with main at 8e81d6637f had no conflicts.

Impact

Pending: default-dataset effects for 2025 and 2026, main vs this head.

Tests run

On Linux, 744 cases in 42 selected YAML files passed at b978042d29 and again on a trial merge with main at 8e81d6637f. Six property tests and 251 source-conflict guard checks passed. Ruff formatting and lint checks passed for the changed Python files. Tests ran one file per process with a 900-second timeout.

axiom: TheAxiomFoundation/rulespec-us#1814 queued (26 USC 2(a); the module us/statutes/26/2/a.yaml is deferred with rules: [] and blocked on TheAxiomFoundation/rulespec-us#1399)

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 19, 2026 08:42
IRC 2(a)(1)(B) determines the surviving spouse's son or daughter's
dependency "without regard to subsections (b)(1), (b)(2), and (d)(1)(B)"
of section 152. surviving_spouse_eligible counted tax_unit_child_dependents,
which sums is_child_dependent and so applied the 152(d)(1)(B) qualifying
relative gross income test. An adult child with gross income at or above
the exemption amount ($5,200 in 2025) therefore left the parent filing
single.

The formula now counts any tax unit dependent who is the head's child.
2(a)(1)(B)(i) requires a son, stepson, daughter or stepdaughter. Where the
household has parent ids, the child is a dependent whose parent_1_id or
parent_2_id names the head (natural, adoptive or step). Without parent ids,
it is any dependent not marked as a parent or grandparent of the filer or
as unrelated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of bd9545e found that switching to parent ids for a whole
household removed surviving spouse status from a real child whose own ids
were unknown, whenever the head or a housemate had any parent id. A parent
id of 0 is unknown, so it cannot show that the filer is not the parent.

Each dependent is now judged on its own ids: a dependent is the head's
child when an id names the head, and is not when two different parents are
named and neither is the head, when an id names another household member,
or when the head's own ids name the dependent as the head's parent or
grandparent. Otherwise the relationship flags decide, as before.

Adds YAML regressions for each case the review reproduced, a sibling and a
two-generation ancestor case, and widens the property grid to ten
relationship setups. Fixes the grid's has_dependent field, which counted the
four units without a dependent as having one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of 5661605 found two remaining defects:

- Naming another parent was treated as proof that the head is not a
  parent. A widower's daughter who named only her co-resident mother, and a
  stepchild naming both biological parents, lost the status. A parent id of
  0 is unknown and two ids cannot list every step parent, so neither settles
  the relationship.
- Ancestor links stopped at tax unit boundaries, so a grandmother linked
  through a mother filing separately still qualified the head.

A dependent is still the head's child when an id names the head. The ids
now rule a dependent out only when they show another relationship: the
head's parent or grandparent, a sibling (a shared parent id), a grandchild
(the dependent's parent names the head) or a niece or nephew (the
dependent's parent shares a parent id with the head). Parents are resolved
among both household and tax unit members, and shared ids identify siblings
even when the parent lives elsewhere.

Adds YAML for both review cases, an absent-parent sibling and a nephew, and
widens the property grid to thirteen relationship setups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 6 commits November 30, 2026 12:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Waive the gross income test for confirmed children and stepchildren. Retain the ordinary dependency test for unknown relationships, exclude identified foster children, require a shared household, and account for couples filing separate returns.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recognize an otherwise qualifying child who files jointly. Require household membership for the ordinary head-of-household route, preserve the dependent-parent exception, and recognize cohabiting spouses who file separately.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis MaxGhenis changed the title Disregard the gross income test for surviving spouse filing status (IRC 2(a)(1)(B)) Fix qualifying surviving spouse eligibility and related filing statuses Dec 1, 2026

This branch has not been deployed

No deployments
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.

1 participant