Skip to content

Count only the filer's and spouse's payroll taxes in the refundable CTC and Additional Medicare Tax, and in the CRFB surtax base - #9825

Merged
MaxGhenis merged 7 commits into
mainfrom
fix-ctc-ss-tax-filer-spouse
Oct 7, 2026
Merged

MaxGhenis merged 7 commits into
mainfrom
fix-ctc-ss-tax-filer-spouse

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The refundable child tax credit's "social security taxes", the Additional Medicare Tax and the CRFB AGI surtax's expanded base all summed every tax unit member. So a dependent's own payroll taxes, wages and contributions landed on the parent's return. This PR restricts each to the head and spouse. It follows up #9801 (dependents' above-the-line deductions), which has merged; this branch now includes it.

Round 2: review r1

Statute and sources

26 U.S.C. 24(d)(1)(B)(ii) (LII): with 3 or more qualifying children, the refundable credit can use "the excess (if any) of— (I) the taxpayer's social security taxes for the taxable year, over (II) the credit allowed under section 32".

24(d)(2)(A): "The term 'social security taxes' means, with respect to any taxpayer for any taxable year— (i) the amount of the taxes imposed by sections 3101 and 3201(a) on amounts received by the taxpayer during the calendar year in which the taxable year begins, (ii) 50 percent of the taxes imposed by section 1401 on the self-employment income of the taxpayer for the taxable year, and (iii) 50 percent of the taxes imposed by section 3211(a) on amounts received by the taxpayer". (B) excludes taxes the taxpayer is entitled to have refunded under section 6413(c).

Schedule 8812 (2024) Part II-B (form, p. 2):

  • Line 21: "Withheld social security, Medicare, and Additional Medicare taxes from Form(s) W-2, boxes 4 and 6. If married filing jointly, include your spouse's amounts with yours."
  • Line 22: Schedule 1 line 15 (the deductible part of SE tax) plus Schedule 2 lines 5, 6 and 13 (unreported and uncollected FICA).
  • Line 24: the EITC plus Schedule 3 line 11 (excess social security tax withheld).

The 2020 form (Part II, lines 9 to 13) has the same structure. A dependent's Form W-2 is on the dependent's own return, so it never reaches the parent's line 21.

Additional Medicare Tax. The instructions' Additional Medicare Tax and RRTA Tax Worksheet (i1040s8 2024, p. 9) take it from the return's own Form 8959, line 7. Form 8959 line 1 counts "your Medicare wages and tips … If you are filing a joint return, also include your spouse's wages and tips" (i8959 2024, p. 3). So additional_medicare_tax, a component of these taxes, must also leave out a dependent's wages. It summed them: a couple with $240,000 of wages and a 16-year-old earning $20,000 was charged $90.

The fix

  • ctc_social_security_tax: replaced adds/subtracts with a formula. It sums the parameter lists with tax_unit_non_dep_add, which adds person-level variables over the head and spouse only and tax-unit-level variables as they are.
  • gov.irs.credits.ctc.refundable.social_security.add: replaced self_employment_tax_ald with the person-level self_employment_tax_ald_person, so the head-and-spouse filter is applied once, here. (Keep dependents' above-the-line deductions off the filer's AGI #9801 also narrows the tax-unit self_employment_tax_ald; reading the person-level amount does not depend on that.) unreported_payroll_tax, additional_medicare_tax and excess_payroll_tax_withheld are tax-unit-level and describe the return.
    • subtracts checked: excess_payroll_tax_withheld is a tax-unit input (Schedule 3 line 11 of this return), so it is unchanged.
  • additional_medicare_tax: sums payroll_tax_gross_wages and taxable_self_employment_income over the head and spouse (Form 8959 lines 1 and 8). The Biden budget reform's copy of this formula gets the same change.
  • pr_refundable_ctc_social_security_tax: used the same parameter list with adds. It now uses the same head-and-spouse sum.
  • Wyden-Smith CTC reform: had a hard-coded copy of the list summed with add. It now reads ctc_social_security_tax.
  • CRFB AGI surtax (reforms/crfb/agi_surtax.py): the expanded base adds p.increased_base.sources with tax_unit_non_dep_add. tax_exempt_social_security (tax_unit_social_security − tax_unit_taxable_social_security) carried a dependent's whole benefit, because only the head's and spouse's benefits enter section 86. The source list now uses a new filer_tax_exempt_social_security: tax_unit_social_security_for_taxability − tax_unit_taxable_social_security. tax_exempt_social_security itself is unchanged. It has 11 other consumers: Medicaid's MAGI modification, the federal sales-tax-table income, income lists for six state programs (CO, ME, RI, WA, WI, WV), MO's property tax credit, VT's renter credit and the WATCA reform. Two of them, the sales-tax-table income and WATCA's alternative-tax MAGI, measure one return's income and still count a dependent's whole benefit (follow-ups below). This PR changes none of the 11 and has not checked the other nine.

With #9801

AGI and the expanded base now agree. #9801 keeps a dependent's above-the-line deductions off the filer's AGI, and this PR keeps the same dependent's contributions out of the add-backs. Each needs the other: the table under "Round 2" shows the surtax with either fix alone.

Methodology note

The CRFB surtax base starts from CRFB's published proposal. Footnote 2 of CRFB's "Break Glass: A Plan for the Next Economic Shock" reads: "On the individual side, the surtax is applied to a broad definition of income that includes Adjusted Gross Income (AGI) plus retirement contributions, HSA/MSA contributions, deductible student loan interest, Social Security income not counted toward AGI, interest income on tax-free bonds, and the value of employer-provided health insurance." The footnote sets rates on "individual income". The paper says its estimate is "based largely on numbers from PolicyEngine, who estimated a 1% tax on individual AGI between $100,000 and $1 million and a 2% tax on individual AGI above $1 million".

The paper does not discuss dependents. Counting only the head's and spouse's add-backs is an inference: the base starts from AGI, a per-return amount (§62), and the paper frames it as individual income, which supports counting the same filers' amounts. A dependent's 401(k) deferral, tax-exempt interest or Social Security benefit belongs to a return whose AGI the surtax never sees. Review r1 found no separate household-pooling choice to make. Which items belong in the base, and which variable stands for each, is a separate question. #9763 tracks the health insurance and retirement entries, and the footnote does not list the foreign earned income exclusion, which the source list includes. The sources.yaml comment now says so.

Invariants

These hold for every input the property test draws: filers aged 25 to 64 in Texas, with one to five dependents aged 0 to 17, all qualifying children. (For a qualifying relative, the dependent's own gross income decides whether they are a dependent and whether the filer may file as head of household, so their income can rightly change the filer's return.)

  1. A tax unit dependent's wages, self-employment income, retirement contributions, tax-exempt interest, Social Security benefits and health insurance premiums never change ctc_social_security_tax, pr_refundable_ctc_social_security_tax, additional_medicare_tax or the surtax's additions to AGI. The test gives AGI and taxable Social Security as inputs for this one.
  2. A dependent's wages, traditional IRA contributions, 401(k) and 403(b) deferrals and Social Security benefits never change the filer's AGI, refundable CTC, non-refundable CTC, federal income tax or CRFB surtax, with everything calculated. None of these enters the filer's AGI or deductions. This full calculation leaves out three kinds of dependent amount, which invariant 1 covers instead:
  3. Differential: ctc_social_security_tax, the Puerto Rico version, additional_medicare_tax and agi_surtax equal an independent numpy sum of the model's person-level amounts (payroll taxes, wages, contributions, benefits) over the head and spouse, with the Additional Medicare Tax and the surtax rates applied from the parameters.
  4. Tax units without dependents are unchanged when their payroll taxes and self-employment deduction are derived by the model, since the head-and-spouse sum then equals the old all-member sum. One exception: a caller who supplies the tax-unit self_employment_tax_ald directly now has it replaced by the person-level amounts. With Social Security $100, Medicare $100, a supplied tax-unit SE deduction of $50, Additional Medicare $25 and excess withholding $200, a unit with no dependents gets $75 on main and $25 here (Sol review, P3). In the 2026 microsimulation below, none of the 53,537 tax units without dependents changed by more than half a cent in any compared tax-unit variable (the largest difference among them is $0.004); all 3,469 that changed have dependents.

Tests

New:

  • ctc_social_security_tax_dependents.yaml, with hand-computed amounts:

    • head of household with three children in 2020 and 2026;
    • a joint return in 2019, showing the spouse's taxes count.

    In each, a 16-year-old child earns $8,000, the EITC is barred by $46,000 of interest, and the alternative formula decides the refund.

  • ctc_social_security_tax.yaml: a person-level case. The existing cases now set self_employment_tax_ald_person.

  • additional_medicare_tax.yaml: joint wages and a dependent's wages.

  • contrib/crfb/agi_surtax.yaml:

    • the dependent's IRA contribution, the dependent's Social Security, and a mixed case where the spouse's items count and the dependent's don't, each with AGI given;
    • (round 2) the derived-AGI case above.
  • tests/core/test_dependent_payroll_taxes_ctc_and_surtax_invariants.py: two Hypothesis properties over batches of 1 to 12 tax units, in 2019, 2020, 2024 and 2026. Each unit is calculated with and without its dependents' amounts in one simulation, under the baseline and under the CRFB reform with the expanded base. A fixed-household test asserts that the alternative formula decides each low-wage family's refund and that the surtax applies.

Round 2:

  • CI at c6914e7d39: all 35 checks pass (gh pr checks 9825 exits 0), including every Full Suite shard, the microsimulation suite, Household API Partners and Lint.
  • Locally, one process at a time (policyengine-core 3.32.15, Hypothesis 6.168.4 on the path):
    • The derived-AGI case on the four trees in the "Round 2" table: it fails at 34e3dc974d and 4732913a0e (AGI $145,000) and at 47ab53e0fb (surtax $550), and passes at 16891ef47b.
    • The property test file as committed: 3 passed at 16891ef47b. At the old head 34e3dc974d, 2 failed and 1 passed: a dependent's IRA deduction still moved the filer's AGI. At main 47ab53e0fb, 3 failed on ctc_social_security_tax.
    • At this head (c6914e7d39), each touched YAML file on its own: ctc_social_security_tax.yaml 4 passed, ctc_social_security_tax_dependents.yaml 3 passed, additional_medicare_tax.yaml 5 passed, contrib/crfb/agi_surtax.yaml 14 passed.

Round 1, at 34e3dc974d:

  • The new and changed YAML files, contrib/crfb and gov/irs/credits/ctc: 162 passed.
  • tests/core/test_dependent_payroll_taxes_ctc_and_surtax_invariants.py and tests/code_health: 139 passed.
  • Before the fix, on main: the new YAML cases fail (8 failed, 17 passed in the new files); the property test fails (3 failed); the refundable cases fail (3 failed).

Impact

Default dataset (populace_us_2024.h5@populace-us-2024-spm-20260909), policyengine-core 3.32.15, through the hub's locked runner. Main with #9801 (47ab53e0fb) against this head (c6914e7d39), one run each, compared record by record on the same records; a record counts as changed when it moves by more than half a cent. All three years ran on the restored main tree (each base run imports /tmp/ctcss-r2/main, the exact tree at 47ab53e0fb).

Weighted change from main 2024 2025 2026
ctc_social_security_tax (summed over tax units) −$10.31bn (3,468 units, 8.65M weighted) −$10.83bn (3,468 units, 8.73M weighted) −$11.30bn (3,469 units, 8.80M weighted)
ctc_phase_in −$20.2M (34 units, 21.9k weighted) −$21.5M (33 units, 23.0k weighted) −$23.7M (33 units, 23.2k weighted)
refundable_ctc −$13.1M (25 units, 18.5k weighted) −$13.7M (20 units, 18.7k weighted) −$14.3M (20 of those units, 18.8k weighted)
ctc (total credit) $0 $0 $0
non_refundable_ctc (nominal: ctc − refundable_ctc) +$13.1M (same 25 units) +$13.7M (same 20 units) +$14.3M (same 20 units)
Usable CTC (ctc_value) −$13.1M (same 25 units) −$13.7M (same 20 units) −$14.3M (same 20 units)
income_tax +$13.1M (same 25 units) +$13.7M (same 20 units) +$14.3M (same 20 units)
additional_medicare_tax / employee_payroll_tax −$107.7M (524 units, 774.8k weighted) −$121.7M (543 units, 821.4k weighted) −$140.0M (581 units, 913k weighted)
household_net_income +$94.6M (547 households: 523 gain, 24 lose) +$107.9M (561 households: 542 gain, 19 lose) +$125.7M (599 households: 580 gain, 19 lose)
adjusted_gross_income, eitc, ctc_qualifying_children $0 (no record changes) $0 (no record changes) $0 (no record changes)
  • Refundable CTC. For 20 tax units the alternative formula (§24(d)(1)(B)(ii)) no longer counts a dependent's payroll taxes, so their refundable CTC falls by $14.3M. The total ctc does not change, so non_refundable_ctc, the nominal remainder ctc − refundable_ctc, rises by the same amount. These families cannot use it: for each of the 20 units, ctc_value = min(ctc, ctc_limiting_tax_liability + refundable_ctc) falls by exactly the refundable decrease, $14.3M in all, and income tax after refundable credits rises by the same amount. For 13 more units (4.4k weighted), ctc_phase_in falls by $9.4M in all but the refundable credit does not change: refundable_ctc is the lesser of the refundable maximum and the part of the credit the phase-in amount unlocks above tax liability. For each of these units, either tax liability plus the lower phase-in amount still covers the whole credit, or the refundable maximum is still no more than what that amount unlocks (for one unit the credit is $0).
  • Round 1 against main before Keep dependents' above-the-line deductions off the filer's AGI #9801. Round 1 measured −$43.3M in 2026 against 4613f8c792. One tax unit (weight 7,455) accounts for the $29.0M difference. On that main, its $3,892 refundable CTC rested entirely on a dependent's payroll taxes. On main with Keep dependents' above-the-line deductions off the filer's AGI #9801, its ctc_social_security_tax is already $0, so this PR no longer changes it. The other 20 units, and the Additional Medicare Tax figures, are the same in both rounds.
  • Additional Medicare Tax. It now applies to the head's and spouse's wages only (Form 8959 is per return), so a dependent's wages no longer push the filer over the threshold. A dependent's own Additional Medicare Tax isn't modeled, because dependents' returns aren't (Compute a tax-unit dependent's own income tax return #9618).
  • State income tax changes for 10 units by up to $38.47 each; their combined weight is 0.03, so the weighted change is $0.17.
  • CRFB AGI surtax. This is a contributed reform with no baseline effect, and the runs above don't switch it on. The YAML cases and the property test cover it.

Follow-ups (not in this PR)

  • The Additional Medicare Tax worksheet counts one-half of the Additional Medicare Tax on self-employment income (Form 8959 line 13). ctc_social_security_tax counts all of it through additional_medicare_tax.
  • section_22_income (Schedule R) subtracts tax_unit_social_security − tax_unit_taxable_social_security, so a dependent's benefits reduce the parents' elderly or disabled credit. It also sums pension_income and total_disability_payments over all members. filer_tax_exempt_social_security is the head-and-spouse amount it needs.
  • A dependent's own Additional Medicare Tax, on wages over $200,000, is not computed anywhere, because dependents' own returns are not modeled (Compute a tax-unit dependent's own income tax return #9618).
  • A dependent's own CRFB surtax is not modeled. Before this PR, a dependent's add-backs were pooled onto the parent's base; now they leave the surtax, because dependents' own returns are not modeled (Compute a tax-unit dependent's own income tax return #9618).
  • The federal sales-tax-table income (state_sales_tax_income_bracket; Schedule A instructions: Form 1040 AGI "plus any nontaxable items") adds tax_exempt_social_security, which holds a dependent's whole benefit, and sums the person-level nontaxable items (tax-exempt interest, veterans' benefits, workers' compensation, SSI, tax-exempt pension and retirement distributions) over every member. WATCA's alternative-tax MAGI (Section 1A(d)) adds tax_exempt_social_security; it sets both eligibility for the alternative maximum tax and the tax itself. Both count a dependent's benefits on the filer's return; filer_tax_exempt_social_security is the per-return amount.
  • The qualified business income deduction sums every member's qbid_amount, so a dependent's self-employment income raises the filer's deduction. At this head, a 16-year-old's $30,000 of self-employment income gives a parent with $60,000 of wages a $5,576 deduction and cuts the parent's 2024 income tax from $2,241 to $1,572.

axiom: us:statutes/26/24/d#ctc_social_security_tax encoded-correct (companion test three_children_social_security_excess_is_greater_than_earned_income_phase_in in us/statutes/26/24/d.test.yaml; the module takes the taxpayer's own §3101/§3201(a)/§1401 taxes as tax-unit inputs and never sums persons); us:statutes/26/3101/b/2#additional_medicare_tax encoded-correct (wages is the return's own; companion test joint_above_threshold, $300,000 joint → $450, the same figure as this PR's YAML case); CRFB surtax n/a: contributed reform, not law

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 5, 2026 15:34
26 U.S.C. 24(d)(2)(A) defines the refundable credit's social security taxes
as the taxpayer's own, and Schedule 8812 line 21 adds the spouse's on a joint
return. ctc_social_security_tax summed every tax unit member, dependents
included. It now sums the person-level taxes over the head and spouse with
tax_unit_non_dep_add, and takes the deductible part of self-employment tax
per person, so it is right whether or not #9801 lands first.

The Additional Medicare Tax it counts comes from the return's own Form 8959,
which counts the head's and spouse's wages only, so additional_medicare_tax
(and the Biden budget reform's copy of it) now leaves dependents' wages out.
The Puerto Rico refundable CTC and the Wyden-Smith reform used the same sum;
the latter now reads ctc_social_security_tax.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d base

The CRFB AGI surtax's expanded base adds retirement contributions,
tax-exempt interest, health insurance premiums, the HSA and student loan
deductions, the foreign earned income exclusion and tax-exempt Social
Security to AGI. It summed every tax unit member, so a dependent's 401(k)
deferrals, tax-exempt interest and IRA contributions were added to a return
whose AGI never held them. tax_exempt_social_security also carried a
dependent's whole benefit, since only the head's and spouse's benefits enter
the section 86 calculation.

The base now adds the person-level sources over the head and spouse with
tax_unit_non_dep_add, and takes Social Security from a new
filer_tax_exempt_social_security: the head's and spouse's benefits less the
taxable part. The YAML cases give AGI as an input, so they test the
additions alone, before or after #9801.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ler's return

Hypothesis draws batches of tax units in 2019, 2020, 2024 and 2026 and runs
each with and without its dependents' amounts in one simulation:

- A dependent's wages, 401(k) and 403(b) deferrals and Social Security never
  change the filer's AGI, CTC, income tax or CRFB surtax.
- With AGI given, no dependent amount changes the CTC's payroll taxes, the
  Additional Medicare Tax or the surtax's additions.
- Each of these equals an independent numpy sum over the head and spouse.

A fixed-household case checks that the alternative refundable formula decides
the refund. All three tests fail on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (909176a) to head (34e3dc9).
⚠️ Report is 202 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #9825   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           76        53   -23     
  Branches         2         0    -2     
=========================================
- Hits            76        53   -23     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

MaxGhenis and others added 4 commits October 6, 2026 04:52
A 2024 head of household earns $150,000; a dependent earns $10,000 and
contributes $5,000 to an IRA. The dependent's IRA deduction is on the
dependent's own return, so AGI is $150,000 and the expanded base adds
nothing for it: the surtax is $500. The case fails at the old head of
this branch (AGI $145,000, surtax $450), on main before #9801 (AGI
$145,000) and on main without this branch (surtax $550).

With #9801 in, the property test's full-pipeline invariant also covers a
dependent's IRA contribution. Self-employment income stays out: the
qualified business income deduction still sums every member's
qbid_amount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Footnote 2 of "Break Glass: A Plan for the Next Economic Shock" defines
the individual surtax base as AGI plus retirement contributions, HSA/MSA
contributions, deductible student loan interest, Social Security not
counted toward AGI, tax-free bond interest and employer-provided health
insurance. The plan does not address dependents; the comments now say
the head-and-spouse attribution is inferred from the base starting at
the return's AGI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The list includes the foreign earned income exclusion, which footnote 2
of CRFB's Break Glass plan does not name, and #9763 tracks how the
health insurance and retirement entries map to variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit 3266705 into main Oct 7, 2026
35 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

US + core hub merge audit, us#9825 at c6914e7d39979f520e879e1fbd28afa9176bb163 (squash)

  • Review: independent review (Subfleet --task review, Opus 5.5 because Codex had no lanes). APPROVE at c6914e7, METHODOLOGY_CHOICE no, no P1 or P2.
    • Every r1 and r2 finding is confirmed resolved.
    • Its one P3, qualifying invariant 4's wording for a supplied tax-unit self_employment_tax_ald, is applied to the body. That was a description-only edit; the head is unchanged.
  • Gates checked live at merge:
    • gh pr checks exits 0;
    • MERGEABLE;
    • not a draft;
    • no CHANGES_REQUESTED review;
    • head pinned with --match-head-commit.
  • Impact: real microsims, main 47ab53e0fb (with Keep dependents' above-the-line deductions off the filer's AGI #9801) against this head, on the default dataset. Each base run imported the exact 47ab53e0fb tree, as its recorded module shows.
    • Household net income: +$94.6M (2024), +$107.9M (2025), +$125.7M (2026).
    • Federal income tax: +$13.1M, +$13.7M and +$14.3M.
    • Additional Medicare Tax: −$107.7M, −$121.7M and −$140.0M.
    • AGI, the EITC and qualifying children are unchanged.
    • This is a bug fix: only the filer's and spouse's payroll taxes count, per Schedule 8812 and Form 8959. It lands on the gates whatever the size of the change.
  • --admin: used only because a required approving review is the sole block.
  • Follow-ups: the two per-return consumers and the nine unchecked consumers are in the hub's FOLLOWUPS.md. Nothing is filed without Max's go.

@MaxGhenis
MaxGhenis deleted the fix-ctc-ss-tax-filer-spouse branch October 7, 2026 00:12
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