Skip to content

Keep dependents' above-the-line deductions off the filer's AGI - #9801

Merged
MaxGhenis merged 6 commits into
mainfrom
fix/dependent-above-the-line-deductions
Oct 6, 2026
Merged

MaxGhenis merged 6 commits into
mainfrom
fix/dependent-above-the-line-deductions

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Follows #9646/#9647, whose "Not in this PR" list named the other above-the-line deductions, starting with self_employment_tax_ald.

What changes

irs_gross_income already leaves out every tax unit dependent's income. The above-the-line deductions did not. A dependent with Schedule C income added nothing to the parent's gross income, but half of the dependent's self-employment tax came off the parent's AGI. The same was true of these items of the dependent's:

  • self-employed health insurance;
  • self-employed retirement plan deductions;
  • IRA contributions;
  • early withdrawal penalty;
  • educator expenses;
  • alimony paid.
Item in gov.irs.ald.deductions Level Before After
self_employment_tax_ald, self_employed_health_insurance_ald, self_employed_pension_contribution_ald tax unit, adds its _person variable every member tax_unit_non_dep_sum of the _person variable
alimony_expense_ald tax unit formula over members every member non-dependents' alimony_expense_ald_person (new)
early_withdrawal_penalty, educator_expense, traditional_ira_contributions person summed over every member by above_the_line_deductions' adds head and spouse only
qualified_adoption_assistance_expense, us_bonds_for_higher_ed person every member every member, deliberately: new parameter gov.irs.ald.filer_amounts_recorded_on_dependents
capped_qualified_tuition_expenses_ald tax unit sums every member's tuition unchanged (a parent takes a dependent's tuition: Form 8917)
student_loan_interest_ald person already 0 for dependents (§221(c)) unchanged
loss_ald tax unit already masked (#9647) unchanged
health_savings_account_ald, domestic_production_ald, specified_possession_income, puerto_rico_income tax-unit inputs as is unchanged

above_the_line_deductions is now a formula: tax_unit_non_dep_add(tax_unit, period, gov.irs.ald.deductions, include_dependents=gov.irs.ald.filer_amounts_recorded_on_dependents). tax_unit_non_dep_add gained the include_dependents argument and still adds the variables in the order given.

Two amounts belong to the filer wherever they are recorded:

  • Employer adoption assistance is the adopting employee's exclusion (§137(a)), but the Ohio adoption credit reads it on the adopted child (oh_adoption_credit_person).
  • Education savings bond interest is excluded only for the bond's owner, who must have been at least 24 when the bond was issued, and the expenses may be a dependent's: "A bond bought by a parent and issued in the name of his or her child under age 24 does not qualify for the exclusion by the parent or child" (Form 8815, 2025, p. 3). By convention, an amount recorded on a dependent is a parent-owned bond's exclusion recorded on the student whose expenses it paid.

Masking either would drop the parent's exclusion.

The _person variables keep each person's own amount, and none is renamed. A dependent's own return reads them in dependent_taxable_ss_magi, which now also counts the dependent's own pre-2019 alimony.

Metadata. above_the_line_deductions and the three SE aggregates now have formulas instead of adds, so their adds metadata (exported by policyengine-api and read by policyengine.py) is empty. policyengine-core rejects a variable that declares both a formula and adds.

Readers

These sum the ALD list themselves and now use the same non-dependent sum:

  • taxable_ss_magi;
  • taxable_uc_agi;
  • student_loan_interest_ald_magi;
  • adjusted_gross_income_person, which also masks dependents' _person SE deductions, so a dependent's per-person AGI is 0 rather than negative;
  • ma_part_b_agi.

These had to change with it:

  • mo_adjusted_gross_income subtracted an all-member personal-ALD total from above_the_line_deductions. Without this change, a dependent's Schedule SE deduction would raise the head's Missouri AGI, to 40,706.48 in the test case. It now takes personal ALDs over non-dependents.
  • medicaid_adjusted_gross_income_person gave a dependent's IRA contribution, early withdrawal penalty and alimony to the head. It now subtracts a dependent's own person-level deductions from the dependent's own AGI, as 42 CFR 435.603(e) takes each person's AGI. The head's Medicaid AGI rises accordingly; the sharing rule between head and spouse is unchanged. The SE deductions and alimony are attributed through person_share_of_tax_unit_amount, and only when they are in the active gov.irs.ald.deductions list. A tax-unit input or a reform that removes one therefore reaches the per-person AGI; before, the SE _person amounts were subtracted even when a reform removed them from the list.
  • ma_gross_income_loss_adjustment added back every member's business losses, while the federal gross income it adjusts leaves dependents out. The property tests found this. It now uses tax_unit_non_dep_add.
  • Alabama (al_agi) and New Jersey (nj_medical_expense_deduction) count every member's income, dependents included. They now also subtract the new dependents_self_employed_health_insurance_ald and dependents_self_employed_pension_contribution_ald, so both match main.
  • Mississippi (ms_agi_adjustments) is a per-person adds. It projected the tax unit's SE health insurance and plan deductions onto every member, so each spouse subtracted both spouses' amounts. It now lists ms_self_employed_health_insurance_adjustment and ms_self_employed_retirement_adjustment, built with the new person_share_of_tax_unit_amount helper. Each person gets their own _person amount. When a tax-unit input or a reform of the aggregate makes it differ from the head's and spouse's own amounts, their amounts are scaled in proportion to sum to it. With non-negative amounts, as for these deductions, no share turns negative. If they have no own amount, the head takes all of it. Either way, the aggregate counts once. This also changes Mississippi for spouses without dependents (finding 9 of review r1).
  • Minnesota M1PR (mn_homestead_credit_refund_household_income) starts from federal AGI, but added back every member's IRA contributions. Its retirement additions, contributions and compensation now count the head and spouse only.

Checked, consistent with no edit:

  • mt_applicable_ald_deductions, mn_social_security_subtraction, mn_walz_hf1938;
  • pa_property_tax_or_rent_rebate_income (AGI plus ALDs, so the net is unchanged);
  • mn_marriage_credit, nd_mpc, eitc_earned_income;
  • the per-person AGI readers: KY, MT, DE, VA, OH, DC, MN renters, UT renter relief (adult dependents already count with AGI 0), withholding.

mi_household_resources is left to #9790's stack.

Law

Statutes are from the pinned Axiom corpus (axiom-corpus 8f7d60aac), which matches OLRC. IRS PDFs were extracted with pdftotext -layout.

  • Only spouses aggregate on one return. §6013(a): "A husband and wife may make a single return jointly of income taxes under subtitle A, even though one of the spouses has neither gross income nor deductions".
  • Each deduction belongs to the individual who has it.
    • §164(f)(1): "In the case of an individual, ... there shall be allowed as a deduction for the taxable year an amount equal to one-half of the taxes imposed by section 1401".
    • §219(a): "In the case of an individual, there shall be allowed as a deduction an amount equal to the qualified retirement contributions of the individual for the taxable year."
    • §62(a)(6) allows §404 "In the case of an individual who is an employee within the meaning of section 401(c)(1)".
  • Each person files their own Schedule SE. Schedule SE (Form 1040) 2025 is headed "Name of person with self-employment income". Line 13: "Deduction for one-half of self-employment tax. Multiply line 12 by 50% (0.50). Enter here and on Schedule 1 (Form 1040), line 15" (https://www.irs.gov/pub/irs-prior/f1040sse--2025.pdf).
  • The one election that moves a child's income does not move the child's deductions. Instructions for Form 8814 (2025), p. 2, "Tax benefits you cannot take": "you cannot take certain deductions that your child could take on his or her own return such as: ... Penalty on early withdrawal of child's savings" (https://www.irs.gov/pub/irs-prior/i8814--2025.pdf). Dependents' losses reduce the filer's AGI and raise the filer's §461(l) limit (loss_ald, limited_capital_loss) #9646 quotes §1(g)(7)(B) in full: it moves gross income only.
  • The worksheets read the filer's own Schedule 1. Line 6 of the 2025 Social Security Benefits Worksheet and line 3 of the Student Loan Interest Deduction Worksheet say "Enter the total of the amounts from Schedule 1, lines 11 through 20, and 23 and 25" (https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=32, #page=99).
  • The parent takes a dependent's tuition. Form 8917 (Rev. January 2020): "in order to claim the deduction for education expenses for a dependent, you must have paid the expenses in the current year and must claim the student as a dependent on your current year tax return".

Tests

dependent_above_the_line_deductions.yaml: 9 cases. Expected values are Schedule SE, Schedule 1, Form 1040 and Form 8917 arithmetic in cents, with each line commented. The first six fail on main. The last three pin amounts that stay on the parent's return, and pass on both.

Case Output main This PR = forms
HoH parent wages 40,000; child aged 17, Schedule C 10,000 adjusted_gross_income 39,293.52 40,000
child's Schedule SE line 12 / line 13 1,412.96 / 706.48 1,412.96 / 706.48 (on the child's return)
Joint: wages 60,000; spouse Schedule C 20,000; child Schedule C 8,000, SE health insurance 1,000, SEP 500 self_employment_tax_ald 1,978.14 1,412.96 (spouse only)
adjusted_gross_income 76,521.86 78,587.04
HoH parent 50,000; student dependent aged 23: IRA 2,000, early withdrawal penalty 100, educator 300 adjusted_gross_income 47,600 50,000
Dependent mother pays pre-2019 alimony of 3,000 adjusted_gross_income 47,000 50,000
Grandparent: Social Security 24,000, pension 20,000; grandchild Schedule C 10,000 tax_unit_taxable_social_security 3,146.76 3,500 (worksheet lines 1–18)
Parent wages 91,000, student loan interest 2,500; dependent's IRA 2,000 student_loan_interest_ald 1,833.33 1,500 (worksheet lines 1–9)
TY2020: dependent student's tuition 3,000 capped_qualified_tuition_expenses_ald 3,000 3,000 (Form 8917 lines 1–6)
Adoption assistance 5,000 recorded on the adopted child adjusted_gross_income 45,000 45,000
Bond interest 1,000 recorded on the student adjusted_gross_income 51,000 51,000

Reader cases (TY2025):

Case main This PR
mo_adjusted_gross_income, parent and child as in the first case [40,000, 0] [40,000, 0]; reverting the MO change gives 40,706.48
ma_part_b_agi, child with SE health insurance 1,000 39,000 40,000
ma_gross_income, child's Schedule C loss −3,000 39,000 42,000
medicaid_adjusted_gross_income_person, student as in the third case [47,600, 6,500] [50,000, 4,100] (each person's own Form 1040 line 11)
medicaid_adjusted_gross_income_person, dependent mother: pension 4,000, alimony 3,000 [47,000, 4,000] [50,000, 1,000]
al_agi, child with Schedule C 10,000, SE health insurance 1,000, SEP 500 48,500 48,500
nj_medical_expense_deduction, the same child 1,000 1,000
ms_agi, the same child (the child's income goes to the parent) [46,293.52, 0] [47,793.52, 0]; the child's 2,206.48 of adjustments subtracted once
ms_agi, joint without dependents: head with Schedule C 30,000 and SE health insurance 3,000 [24,880.57, 17,000] [24,880.57, 20,000]
mn_homestead_credit_refund_household_income, dependent's IRA 2,000 45,720 45,720

contrib/taxsim/taxsim_v10.yaml, tax unit 16, now expects 252,502 (joint wages). The 500 of Schedule C income belongs to a dependent, whose deduction is on their own return, and TAXSIM's own record has no self-employment income.

tests/core/test_dependent_above_the_line_deductions_invariants.py also has five deterministic tests:

  • a tax-unit alimony, SE health insurance and SEP input reaches Medicaid AGI and the Mississippi adjustments;
  • a reform that drops alimony from the ALD list removes it from both federal and Medicaid AGI;
  • a joint Mississippi couple's tax-unit SE health insurance deduction set to 0, and set to 500 below the spouse's own 1,000, gives non-negative shares;
  • a reform that zeroes the aggregate's formula does the same.

In the last two, Mississippi AGI, Medicaid MAGI and Medicaid household income all equal those of a couple whose own amount is that deduction. The first two fail at 49d6476; the last two fail at 49c9a3a. The original ms_agi_adjustments.yaml inputs (tax-unit aggregates, 500) are unchanged from main and pass.

The property tests. It runs Hypothesis (5 batches of 10–40 tax units) and a seeded population of 200 units, for TY2020 and TY2025:

  • units are single, head of household or joint, with and without 1–2 dependents aged 5–23;
  • states are TX, MO, MA and MN;
  • each batch runs twice, with the dependents' own-return deduction inputs as drawn and set to zero.

The invariants hold for every unit:

  1. Dependents never reach the filer's return. The dependents' deduction inputs never change any of the filer's:
    • filing status, AGI and above_the_line_deductions;
    • SE and alimony aggregates;
    • Social Security and unemployment MAGIs, and taxable Social Security;
    • MA gross income and Part B AGI;
    • MN M1PR household income;
    • the head's and spouse's per-person AGI, student loan interest MAGI and deduction, Medicaid AGI and Missouri AGI.
  2. Accounting identities. Members' adjusted_gross_income_person sum to AGI, and so do the head's and spouse's Medicaid AGIs.
  3. Differential. The checks run against independent numpy sums:
    • above_the_line_deductions = loss_ald + tuition + the head's and spouse's person-level deductions + every member's adoption and bond amounts;
    • each aggregate = its head-and-spouse sum;
    • AGI = Σ irs_gross_income minus that reference;
    • for units without dependents, above_the_line_deductions equals the previous all-member sum;
    • otherwise it lies between 0 and that sum.
  4. A dependent's own amounts survive.
    • self_employment_tax_ald_person = ½ × self_employment_tax for everyone.
    • alimony_expense_ald_person = alimony × (divorce before 2019).
    • A dependent's Medicaid AGI = their own gross income less their own deductions.

Mutation check (head 1a97062). Each changed source file was reverted to main one at a time:

Reverted to main Seeded property tests (2020, 2025) Touched YAML cases
self_employment_tax_ald 2 of 2 fail 4 fail
self_employed_health_insurance_ald 2 of 2 fail 2 fail
self_employed_pension_contribution_ald 2 of 2 fail 1 fail
alimony_expense_ald 2 of 2 fail 1 fail
above_the_line_deductions 2 of 2 fail 2 fail
adjusted_gross_income_person 2 of 2 fail 3 fail
student_loan_interest_ald_magi 2 of 2 fail 1 fail
taxable_ss_magi 2 of 2 fail 0 fail
taxable_uc_agi 2 of 2 fail 0 fail
ma_part_b_agi 2 of 2 fail 0 fail
ma_gross_income_loss_adjustment 2 of 2 fail 1 fail
mo_adjusted_gross_income 2 of 2 fail 1 fail
medicaid_adjusted_gross_income_person 2 of 2 fail 1 fail

The taxable_ss_magi, taxable_uc_agi and ma_part_b_agi YAML cases read the SE aggregates, which are already masked upstream. Only the person-level items in the property tests reach those three files on their own.

Local runs at 7bcaed0.

  • Property and input/reform tests: 9 passed.
  • test_ald_determinism.py: 9 passed. It now intercepts tax_unit_non_dep_add, so it checks that the tax-unit sums go through it in sorted, deduplicated order. Its float32 hash-seed probe is unchanged.
  • YAML: 1,137 passed across:
    • gov/irs/income/taxable_income/adjusted_gross_income;
    • AL, MS and MA income, NJ deductions, MN M1PR, MO AGI;
    • hhs/medicaid;
    • contrib/taxsim/taxsim_v10.yaml.

Population effect

PE-US at this branch (7bcaed0) against main (e8f9487). Both runs use the default dataset (populace_us_2024.h5@populace-us-2024-spm-20260909) for TY2025 with policyengine-core 3.32.12. All figures are engine output, weighted.

  • AGI rises in 391 tax units (1.12M weighted), by $1.074bn. No unit's AGI falls. Every unit whose AGI changes has a dependent with one of these deductions. The dependents' amounts in the data are:
    • Schedule SE deductions, $273M in 132 units;
    • IRA contributions, $120M in 140 units;
    • alimony, $657M in 3 units;
    • educator expenses, $24M in 121 units;
    • SE health insurance, $0.14M in 5 units.
  • Federal income tax rises by $217M in 307 units (0.92M weighted). Refundable CTC falls by $27.6M in 26 units. ctc_social_security_tax, which adds self_employment_tax_ald (§24(d)(2)), falls by $273M. The EITC falls by $0.6M in 15 units.
  • Taxable Social Security rises by $0.25M in 5 units.
  • State income tax rises by $56.7M in 228 units and falls in 5; CA accounts for $49.2M of the rise. Twelve of those units have no dependent deduction amounts:
    • 11 are Mississippi's double-count fix (+$0.33M);
    • 1 is a Massachusetts unit (weight 0.003). The only Massachusetts change outside the deductions is the business-loss adjustment.
  • Medicaid AGI: heads and spouses +$801M, dependents −$800M. Medicaid eligibility changes for 6 people with a combined weight of 0.002. 1,249 units without dependent amounts differ by at most $0.50 (+$6,667 weighted). This is float32 rounding: the per-person split now follows the parameter list's order and reconciles to the tax-unit amount.
  • Peak memory: 12.3 GB on main and 15.5 GB on this branch.

Scripts and outputs: ~/reviews/pe-us-dependent-ald-2026-10-05/{scripts,microsim}.

These figures are from a run at 7bcaed0; the final head, dd9a054, changes only a docstring. An earlier run at 49d6476, before the per-person reconciliation, gave identical values for every tax output above. Only Medicaid AGI differed: head-and-spouse totals by at most $0.50, and one dependent's by less than $0.001. The dataset (populace-us-2024-spm-20260909) stores none of self_employment_tax_ald, self_employed_health_insurance_ald, self_employed_pension_contribution_ald, alimony_expense_ald or above_the_line_deductions.

Invariants (stated for review)

  • For every tax unit, a dependent's own-return deduction inputs never change the filer's AGI or any tax-unit ALD sum.
  • adjusted_gross_income = Σ irs_gross_income − above_the_line_deductions, and Σ adjusted_gross_income_person = adjusted_gross_income, without the taxable UBI reform.
  • 0 ≤ above_the_line_deductions ≤ the previous all-member sum, with equality for units without dependents.

Not in this PR (routed to the US + core hub)

axiom: TheAxiomFoundation/rulespec-us#1494 queued. rulespec-us us/statutes/26/62.yaml takes the return's deduction total as an input and defers the §62(a) composition. 164/f.yaml gives the per-person §164(f) deduction. The issue asks to sum the individual deductions over taxpayer_or_spouse_of_tax_unit, with companion tests from the same Schedule SE and Form 1040 arithmetic.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 5, 2026 13:49
irs_gross_income leaves tax unit dependents' income off the filer's
return, but self_employment_tax_ald, self_employed_health_insurance_ald
and self_employed_pension_contribution_ald summed every member's
person-level amount, and above_the_line_deductions summed every member's
IRA contributions, early withdrawal penalty, educator expenses, adoption
assistance and education bond interest. A dependent's Schedule SE and
Schedule 1 deductions belong on the dependent's own return.

- The three self-employment aggregates sum their _person variables over
  non-dependents; alimony_expense_ald masks dependents.
- above_the_line_deductions sums gov.irs.ald.deductions with
  tax_unit_non_dep_add.
- Readers that sum the ALD list themselves do the same: taxable_ss_magi,
  taxable_uc_agi, student_loan_interest_ald_magi,
  adjusted_gross_income_person and ma_part_b_agi.
- mo_adjusted_gross_income takes personal ALDs over non-dependents, so its
  remaining-ALD allocation never goes negative.
- medicaid_adjusted_gross_income_person attributes a dependent's own
  person-level deductions to the dependent instead of the head.
- ma_gross_income_loss_adjustment leaves out dependents' losses, as the
  federal gross income it adjusts does.

The _person variables keep each person's own amount, which a dependent's
own return (dependent_taxable_ss_magi) uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 5, 2026
…-resources-claimant-spouse

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 5, 2026
…e member lists

Review r1:
- Line 30 reads the tax-unit adjustments as they are, so supplied inputs
  and reforms of self_employment_tax_ald and the other aggregates are
  respected. #9801 (merged in) makes those aggregates and
  alimony_expense_ald leave dependents out.
- The every-member sources (lines 21, 22 and 27) move to a parameter,
  gov.states.mi.tax.income.household_resources_all_members, and a source
  defined for a group larger than the tax unit (an SPM unit amount) is
  aggregated as a household amount, so a reform cannot hit an entity error.
- gi_cash_assistance counts only for the claimant and spouse: nothing shows a
  pilot payment is public assistance paid to the claimant's household.
- Tests: dependent alimony and guaranteed income YAML cases; property tests
  always have a dependent and a positive-resources household; a reform test.

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 98.12%. Comparing base (909176a) to head (1a97062).
⚠️ Report is 199 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main    #9801      +/-   ##
===========================================
- Coverage   100.00%   98.12%   -1.88%     
===========================================
  Files            4       13       +9     
  Lines           76      266     +190     
  Branches         2        7       +5     
===========================================
+ Hits            76      261     +185     
- Misses           0        3       +3     
- Partials         0        2       +2     
Flag Coverage Δ
unittests 98.12% <100.00%> (-1.88%) ⬇️

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.

- Fix the stale TAXSIM v10 expectation for tax unit 16: the 500 of
  Schedule C income is a dependent's, so AGI is the joint wages 252,502.
- Alabama and New Jersey count dependents' income, so they now add the new
  dependents_self_employed_health_insurance_ald and
  dependents_self_employed_pension_contribution_ald to the filer's
  aggregates; both match main again.
- Mississippi subtracts each person's own _person SE health insurance and
  plan deductions, which also removes a double count: every member used
  to subtract the tax unit's total.
- Minnesota's property tax refund household income adds back and
  subtracts retirement contributions of the head and spouse only, as its
  starting federal AGI does.
- Employer adoption assistance and education savings bond interest are
  the filer's even when recorded on a dependent (26 USC 137(a); Form
  8815), so gov.irs.ald.filer_amounts_recorded_on_dependents lists them
  and tax_unit_non_dep_add sums them over every member.
- New alimony_expense_ald_person: a dependent's pre-2019 alimony reduces
  the dependent's own Medicaid AGI and dependent_taxable_ss_magi.
- Tests: TY2020 tuition, adoption and bond cases; AL, MS, NJ, MN and
  Medicaid alimony cases; the property tests draw tuition, cover MN and
  sum the filer amounts over every member.
- self_employed_pension_contribution_ald_person cites 62(a)(6) and 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits October 6, 2026 02:24
Review r2 found two regressions from r1's person-level attribution:
Mississippi read only the _person SE variables, dropping a supplied
tax-unit self_employed_health_insurance_ald or
self_employed_pension_contribution_ald (the original test's 500 became
200), and Medicaid subtracted alimony_expense_ald_person unconditionally,
ignoring a tax-unit alimony input and a reform that removes alimony from
gov.irs.ald.deductions.

- New tools helper person_share_of_tax_unit_amount: each person's own
  amount, with any difference between the tax-unit amount and the head's
  and spouse's own amounts going to the head; dependents keep their own.
- Mississippi lists the new ms_self_employed_health_insurance_adjustment
  and ms_self_employed_retirement_adjustment, built with it. The original
  ms_agi_adjustments test inputs are restored and pass (500).
- Medicaid attributes each listed deduction with a person-level
  equivalent through the helper, and only when it is in the active list.
- Tests: a tax-unit alimony input (YAML and Python) and a reform that
  drops alimony from the list; both fail at 49d6476 and pass here.
- The bond entry in filer_amounts_recorded_on_dependents describes the
  input convention (a parent-owned bond's exclusion recorded on the
  student) instead of implying every dependent's amount is the parent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r3: when a tax-unit deduction (an input or a reformed formula)
was below the head's and spouse's own amounts, the helper put the whole
negative residual on the head. The spouse's own deduction then drove
their Mississippi AGI and Medicaid MAGI below the per-person floors, and
the head's negative share added income, inflating Mississippi AGI and
Medicaid household income (by 70.65 in the reviewer's joint case).

person_share_of_tax_unit_amount now keeps own amounts when they sum to
the tax-unit amount (compared in its float32 precision), and otherwise
scales the head's and spouse's own amounts to sum to it, giving the head
the whole amount only when they have none.

Tests: a joint Mississippi couple with the tax-unit SE health insurance
deduction set to 0 and to 500 below the spouse's 1,000, and a reform
that zeroes the aggregate's formula; each matches a couple whose own
amount is that deduction in Mississippi AGI, Medicaid MAGI and Medicaid
household income. All three fail at 49c9a3a.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r4: the proportional split keeps every share non-negative only
when the own amounts and the tax-unit amount are non-negative, as they
are for the deductions that use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 6, 2026 07:05
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Hand-off to the US + core hub. Head dd9a0542443adfed87b2f8d51c97b447e59efd2d. Only CI remains.

Review. Independent review, all rounds at ~/reviews/pe-us-dependent-ald-2026-10-05/review/:

Round Head Verdict Report
r1 1a97062 REQUEST_CHANGES review-r1.md
r2 49d6476 REQUEST_CHANGES review-r2-full.md
r3 49c9a3a REQUEST_CHANGES review-r3-full.md
r4 7bcaed0 APPROVE review-r4-full.md
r5 dd9a054 APPROVE review-r5-full.md
  • r1 was Opus 5.5; r2–r5 were GPT-6.1 Sol, because the Claude lanes were rate-limited.
  • r5 is a delta review: dd9a054 changes only a docstring, per r4's P3 note.
  • Every finding was fixed: the AL/MS/NJ/MN readers, the TAXSIM expectation, the adoption and bond amounts recorded on dependents, per-person alimony, and the Mississippi/Medicaid reconciliation to tax-unit inputs and reforms. No negative shares remain.

Passed.

  • CI was fully green at 49d6476: 35/35, including the previously cancelled contrib shard and taxsim_v10. CI at dd9a054 is pending.

  • Locally at 7bcaed0:

    • 9 property and input/reform tests;
    • 1,137 YAML cases (federal AGI, AL, MS, MA, NJ, MN M1PR, MO, Medicaid, TAXSIM v10);
    • test_ald_determinism.py 9/9.
  • Mutation check: reverting each of the 13 original changed files fails at least one test.

  • Microsim at 7bcaed0, TY2025, default dataset:

    • AGI +$1.074bn in 391 units, none falls;
    • federal income tax +$217M;
    • state income tax +$56.7M.

    Scripts and outputs are in ~/reviews/pe-us-dependent-ald-2026-10-05/{scripts,microsim}.

Merge order and dependencies.

Axiom parity. TheAxiomFoundation/rulespec-us#1494 is queued (pe-parity), with population numbers in a comment.

No Max decision needed. This is a bug fix that moves aggregates, which merges on the gates.

New follow-ups for the hub, both pre-existing and outside this PR:

  • Mississippi still projects the tax-unit health_savings_account_ald onto every member's ms_agi_adjustments. It is a double count for couples, and there is no person-level HSA variable.
  • qualified_business_income_deduction sums every member's qbid_amount, dependents included (r1 finding 9).

@MaxGhenis
MaxGhenis merged commit 1f9d85a into main Oct 6, 2026
35 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged by the US + core hub on its merge gates. Audit:

@MaxGhenis
MaxGhenis deleted the fix/dependent-above-the-line-deductions branch October 6, 2026 08:29
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
Delta review r2 asked for the r1 household as a regression once #9801 (keep
dependents' above-the-line deductions off the filer's AGI) was in this
branch. Claimant aged 70 with a 4,000 long-term gain; dependent with 1,600
wages and a 200 traditional IRA contribution: federal AGI 4,000, line J
5,600, no credit (Schedule 2 limit 5,501).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
…ive Schedule C and F income

With #9801 on main: line 30 sums gov.irs.ald.filer_amounts_recorded_on_dependents
over every member, as above_the_line_deductions does, and the losses test now
draws positive dependent Schedule C and F income, whose self-employment tax
deduction is on the dependent's own return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
Review r5: since #9801, the federal above-the-line total leaves dependents'
person-level items out, but line 30 summed educator_expense,
early_withdrawal_penalty and traditional_ira_contributions over every member
with add. It now uses tax_unit_non_dep_add, as above_the_line_deductions does.
Regression case: a dependent's IRA 2,000, penalty 100 and educator expenses
300 gave 47,600; the form gives 50,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
Brings in #9841 (28 percent rate gain and unrecaptured section 1250 gain
netted against losses), #9801, #9790, #9779, #9768, #9741 and #9630. Only
test_section_911_tax_stacking.py changed on both sides, in different
functions, and git merged it without conflict. #9841 passes Schedule D
lines 18 and 19 entered already netted through unchanged, and this
branch's capital_gains_tax, reforms and tests read the section 911
amounts and Schedule D inputs that #9841 keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
#9801 (keep dependents' above-the-line deductions off the filer's AGI) has
landed, so this PR lands second.

- medicaid_adjusted_gross_income_person: main now maps each tax-unit
  deduction to its person-level amount and attributes it with
  person_share_of_tax_unit_amount. educator_expense_ald joins that map as
  educator_expense_ald_person. The helper keeps a dependent's own amount
  and gives the head and spouse their own amounts whenever those sum to the
  tax-unit amount, which educator_expense_ald always does unless it is an
  input or a reform changes it.
- test_dependent_above_the_line_deductions_invariants.py: PERSON_DEDUCTIONS
  builds the reference deduction sum from educator_expense_ald_person, the
  capped amount, instead of the raw educator_expense. Its 2020 draws reach
  $300, above 2020's $250 cap. DEPENDENT_DEDUCTION_INPUTS keeps the raw
  input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
…icaid split

test_dependent_above_the_line_deductions_invariants.py now lists
educator_expense_ald among its AGGREGATES, so the harness checks that a
dependent's educator expenses never change the filer's educator_expense_ald
and that it equals the numpy sum of the head's and spouse's
educator_expense_ald_person.

A Medicaid AGI case supplies educator_expense_ald directly, at 250 against
own amounts of 300 and 200, so person_share_of_tax_unit_amount scales the
head's and spouse's shares to 150 and 100 while the dependent keeps their own
300. Without the educator entry in the Medicaid map this case and the
existing one both fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
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>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
Conflicts resolved keeping both sides:
- student_loan_interest_ald_magi: #9801's tax_unit_non_dep_add (with
  filer_amounts_recorded_on_dependents) for the tax unit deduction sum,
  and this branch's section_911_excluded_income add-back.
- foreign_earned_income_exclusion documentation: both notes (modified
  AGIs add back section_911_excluded_income; NIIT adds back only the
  section 911(a)(1) part, niit_magi_section_911_addition).

taxable_ss_magi and test_ald_determinism merged cleanly with both changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
42 U.S.C. 1395r(i)(4) reads the beneficiary's own return. After #9801,
adjusted gross income sums person-level deductions over the head and
spouse, plus every member for gov.irs.ald.filer_amounts_recorded_on_
dependents. The IRMAA MAGI now sums its person-level add-backs with the
same rule (tax_unit_non_dep_add):

- Tax-exempt interest counts for the head and spouse only. A dependent's
  interest is on the dependent's own return, like the rest of the
  dependent's income; main summed it over every member.
- The section 135 exclusion counts for every member, because #9801 lists
  it: a bond in a child's name does not qualify (135(c)(1)(B), Form
  8815), so an amount recorded on a dependent is the parent's exclusion,
  and AGI deducts it. Head and spouse only would give 99,000 for a parent
  with 100,000 of wages and 1,000 recorded on the child.
- The 2015-2016 fallback applies the same rule with the benefit year's
  roles, reading stored values only.

Tests: YAML cases for a dependent's tax-exempt interest in a modeled and
an unmodeled lag year; the Hypothesis IRMAA identity now draws spouse and
dependent tax-exempt interest and sets lag-year ages in both paths (age
defaults to 40, which would make a child a second adult).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
…2(a)(2)(D)) (#9833)

* Add tests for the per-educator cap on the educator expense deduction

YAML cases at, below and above the cap for 2021 ($250), 2022 and 2025
($300) and 2026 ($350); joint returns with one and two educators; a
dependent's expenses. A Hypothesis property checks the bound, a numpy
differential, monotonicity and the AGI identity.

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

* Cap the educator expense deduction per eligible educator (26 USC 62(a)(2)(D))

gov.irs.ald.deductions listed the raw educator_expense input, so the
federal deduction was uncapped. Add gov.irs.ald.educator_expense.cap with
each year's IRS value ($250 for 2002-2021, $300 for 2022-2025, $350 for
2026 per Rev. Proc. 2025-32 sec. 4.12), uprated after 2026 to the nearest
$50 as 62(d)(3) rounds. educator_expense_ald_person caps each person's
own expenses; educator_expense_ald adds the head's and spouse's amounts
and replaces the raw input in the ALD list. A dependent's own capped
amount feeds dependent_taxable_ss_magi and the dependent's Medicaid AGI.

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

* Test the capped educator amount on a dependent's MAGI and in Medicaid AGI

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

* Sum the educator deduction over non-dependents, as irs_gross_income does

A member flagged as a tax unit dependent has their income left off the
filer's return by irs_gross_income, which masks on is_tax_unit_dependent;
mask their deduction the same way (tax_unit_non_dep_sum, as #9801 does
for the other person-level deductions). Make the dependent test case's
roles explicit.

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

* Project the educator expense cap from the statutory $250 base (26 USC 62(d)(3))

Core's metadata uprating chained from the rounded 2026 value ($350), which
put the projected cap at $400 in 2030-2031. 62(d)(3) indexes the $250
amount with a 2014 base year and rounds the increase to the nearest $50, so
on the repo's CPI the cap stays $350 through 2031 and reaches $400 in 2032.

extend_educator_expense_cap computes each year after the last published
value from the statute, with get_irs_cola(parameters, year, 2014), as the
dependent standard deduction extension does. The published 2002-2026 values
stay explicit and take precedence.

Tests: the 62(d)(3) computation reproduces every published cap from 2016 to
2026; projected years 2027-2100 equal it, are multiples of $50 and never
fall; a synthetic index pins nearest rounding in both directions; and a
2030 YAML case expects $350.

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

* Document early childhood educators' eligibility from 2026 (Pub. L. 119-111)

Pub. L. 119-111, division B, section 1, adds early childhood educators to
the 62(d)(1) eligible educator definition for expenses paid or incurred in
taxable years beginning after 2025. The model has no educator-status input
and takes any positive educator_expense as an eligible educator's, so the
input's documentation now gives the effective-year split, and both groups
share the same cap.

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

* Check the educator deduction in #9801's dependent ALD harness and Medicaid split

test_dependent_above_the_line_deductions_invariants.py now lists
educator_expense_ald among its AGGREGATES, so the harness checks that a
dependent's educator expenses never change the filer's educator_expense_ald
and that it equals the numpy sum of the head's and spouse's
educator_expense_ald_person.

A Medicaid AGI case supplies educator_expense_ald directly, at 250 against
own amounts of 300 and 200, so person_share_of_tax_unit_amount scales the
head's and spouse's shares to 150 and 100 while the dependent keeps their own
300. Without the educator entry in the Medicaid map this case and the
existing one both fail.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 6, 2026
Filing status is a policy calculation, so the model computes it from the
household's facts, as on main. Supplied data may set who is head, spouse
or dependent, but not the filing status.

- filing_status.py returns to main's formula; no supplied status is read.
- Remove filing_status_input and its YAML tests. The Populace build's
  filing_status_input column now matches no variable, so the loader skips it.
- Revert the romney remove_head_of_household cases, which tested only how
  the repeal re-derived a supplied status.
- Keep tax_unit_role_input, tax_unit_roles_supplied and the head/spouse
  formulas composed with #9630's inference.
- Unit tests: drop the supplied-status tests; add a dataset test showing a
  filing_status_input column that disagrees with the rules is not read, in
  the data year and an extended year.
- Property tests: roles only. Filing status is joint exactly when there is
  a spouse; the role input matches pinning the role flags (neither side
  pins filing_status); a new property composes supplied roles with input
  dependents, against an oracle that skips them as #9630 does.
- Microsim test: check the build's roles only.
- Docs: roles only, the fallback as it stands after #9630, and dependents'
  above-the-line deductions after #9801.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 7, 2026
…TC and Additional Medicare Tax, and in the CRFB surtax base (#9825)

* Count only the head's and spouse's payroll taxes in the refundable CTC

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>

* Add only the head's and spouse's amounts to the CRFB surtax's expanded 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>

* Test that dependents' payroll taxes and contributions stay off the filer'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>

* Test the CRFB surtax with AGI calculated, now that #9801 is in

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>

* Cite CRFB's Break Glass plan for the surtax's expanded base

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>

* Point the surtax source list at #9763 for which items belong

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>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 7, 2026
…AGIs (student loan interest and 11 siblings) (#9817)

* Figure student-loan MAGI as 26 U.S.C. 221(b)(2)(C) says

Section 221(b)(2)(C) defines modified AGI as adjusted gross income
determined "(i) without regard to this section and sections 85(c), 911,
931, and 933, and (ii) after application of sections 86, 135, 137, 219,
and 469". The model got three parts wrong:

- Section 931 (specified_possession_income) was subtracted like any other
  above-the-line deduction. It is now in excluded_alds with section 933.
- Section 911: income inputs are net of foreign_earned_income_exclusion,
  and nothing added it back. The formula now adds it, split between
  spouses like the tax unit's deductions.
- Unemployment compensation was dropped entirely (excluded_gross_income_
  sources), a misreading of "without regard to section 85(c)": only the
  2020 exclusion is disregarded, so all of it counts. The formula reads
  the untaxed amount, which also avoids the cycle through AGI that the
  old exclusion side-stepped. The parameter is removed.

excluded_alds also follows the amendment history: section 222 until 2020
(Pub. L. 116-260) and section 199 from 2005 through 2017 (Pub. L.
108-357, Pub. L. 115-97).

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

* Phase out on AGI plus income excluded under sections 911, 931 and 933

Ten provisions phase out on "adjusted gross income increased by any
amount excluded from gross income under section 911, 931, or 933":
24(b)(1) (CTC, and the 2021 ARPA phase-out through Schedule 8812 line 3),
25A(d)(2) (education credits), 25B(e) (saver's credit), 25E(b)(3) and
30D(f)(10)(C) (clean vehicle credits), 151(d)(5)(C) (senior deduction),
163(h)(4)(C) (car loan interest), 164(b)(7)(B) (SALT cap), 224(b)(2)(B)
(tips) and 225(b)(2)(B) (overtime). Only the senior deduction added the
exclusions back; the rest read plain AGI.

agi_plus_section_911_931_933_exclusions computes the amount once
(Schedule 1-A line 3), and every one of them reads it.

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

* Add back section 911 in the Social Security, NIIT and IRMAA MAGIs

- Taxable Social Security, 26 U.S.C. 86(b)(2)(A): determined without
  regard to section 911. The revoked-deductions list already covered
  sections 931 and 933; the 911 exclusion is netted out of the income
  inputs, so taxable_ss_magi adds it back.
- Net investment income tax, 26 U.S.C. 1411(d): adds back the section
  911(a)(1) exclusion (Form 8960 line 13 worksheet). The model's one
  exclusion input also holds the housing amounts, which the worksheet
  leaves out; niit_magi documents that.
- Medicare IRMAA, 42 U.S.C. 1395r(i)(4)(A): determined without regard to
  IRC sections 135, 911, 931 and 933, plus tax-exempt interest. All four
  are added back, for both the modeled and the provided lag years.

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

* Test the modified AGI add-backs on random households

Differential: on every return, student-loan MAGI (built from gross income
sources) equals AGI plus the student loan interest deduction, the section
911, 931 and 933 amounts and any unemployment compensation section 85(c)
excluded; the shared modified AGI equals AGI plus the three amounts.

Shifting income into an excluded category at otherwise fixed AGI raises
student-loan MAGI and taxable_ss_magi by exactly the amount shifted,
never raises the student loan interest deduction, and moves every phase-
out the shared modified AGI feeds in one direction only.

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

* Leave the NIIT modified AGI to #9808

#9808 adds the section 1411(d) add-back with a
separate, overridable section 911(a)(1) amount, which is more precise than
adding the whole foreign_earned_income_exclusion input. Restore niit_magi
and its tests to main and drop the NIIT assertion from the property test.

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

* Address review r1: Form 2555 amounts, clean vehicle prior year, IRMAA 135

- Modified AGIs add back section 911 in full: Form 2555 lines 45 and 50
  (Schedule 8812 line 2b, Schedule 1-A lines 2b and 2c, Pub. 970
  Worksheet 4-1, Form 8936 lines 1c and 1d, Form 8962 Worksheet 1-1
  line 3). New input section_911_excluded_income carries that amount; it
  defaults to foreign_earned_income_exclusion, which stays the section
  911(f) stacking amount net of disallowed deductions. The shared modified
  AGI, student-loan MAGI, Social Security MAGI, IRMAA MAGI and the
  Medicaid/ACA modification list use it.
- Clean vehicles: 30D(f)(10) and 25E(b) allow the credit when the lesser
  of this year's and the preceding year's modified AGI is within the
  limit. New inputs clean_vehicle_credit_prior_year_magi (defaults to this
  year's modified AGI) and clean_vehicle_credit_prior_year_filing_status
  (defaults to this year's status); each year is tested against its own
  status's limit (26 CFR 1.30D-4(b)(3), 1.25E-1(c)(3)).
- IRMAA keeps adding back the section 135 exclusion wherever it is
  recorded, because AGI deducts it there: a bond in a child's name does
  not qualify (135(c)(1)(B), Form 8815), so an amount on a dependent is
  the filer's. A filer-only add-back would leave the dependent-recorded
  deduction in AGI and give 99,000 for 100,000 of wages.
- Tests: the reviewer's reproductions as YAML cases, Hypothesis
  invariants for the gross and net section 911 amounts, the lesser-of
  test and the IRMAA identity on provided and computed AGI.

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

* Sum IRMAA add-backs over the members AGI counts

42 U.S.C. 1395r(i)(4) reads the beneficiary's own return. After #9801,
adjusted gross income sums person-level deductions over the head and
spouse, plus every member for gov.irs.ald.filer_amounts_recorded_on_
dependents. The IRMAA MAGI now sums its person-level add-backs with the
same rule (tax_unit_non_dep_add):

- Tax-exempt interest counts for the head and spouse only. A dependent's
  interest is on the dependent's own return, like the rest of the
  dependent's income; main summed it over every member.
- The section 135 exclusion counts for every member, because #9801 lists
  it: a bond in a child's name does not qualify (135(c)(1)(B), Form
  8815), so an amount recorded on a dependent is the parent's exclusion,
  and AGI deducts it. Head and spouse only would give 99,000 for a parent
  with 100,000 of wages and 1,000 recorded on the child.
- The 2015-2016 fallback applies the same rule with the benefit year's
  roles, reading stored values only.

Tests: YAML cases for a dependent's tax-exempt interest in a modeled and
an unmodeled lag year; the Hypothesis IRMAA identity now draws spouse and
dependent tax-exempt interest and sets lag-year ages in both paths (age
defaults to 40, which would make a child a second adult).

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

* Account for SALT phaseout in section 911 interaction properties

Section 164(b)(7)(B)(iv) and the 2025 Schedule A worksheet add Form 2555 lines 45 and 50 to SALT MAGI. An exclusion can reduce itemized deductions even when the choice to itemize holds, so fixed taxable income was an invalid premise.

Preserve equality for election changes and unchanged deductions, assert nondecreasing taxable income for same-choice exclusion pairs, and reuse the grid simulation for a hand-calculated SALT regression and independent form comparisons. Production formulas are unchanged.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 8, 2026
* Honor dataset-supplied tax-unit roles and filing status

Populace's tax-unit constructor (microunit) writes each person's role
(tax_unit_role_input: HEAD, SPOUSE, DEPENDENT) and each unit's filing
status (filing_status_input) into the certified build, but no variable
read them, so the loader dropped both and the role variables fell back to
age ordering. Add the two input variables under the producer's exact
column and member names, with an UNSPECIFIED default, and make
is_tax_unit_head, is_tax_unit_spouse and filing_status defer to them when
supplied. Malformed supplied values raise instead of falling back.

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

* Let a reform switch off only the status whose rule it removes

Review found that neutralizing filing_status_input in
remove_head_of_household re-derived every supplied status, moving 158
non-head-of-household units on the certified build, and that the
gov.abolitions parameters for head_of_household_eligible and
surviving_spouse_eligible did nothing to supplied statuses. filing_status
now re-derives a supplied HEAD_OF_HOUSEHOLD or SURVIVING_SPOUSE only when
that rule is neutralized or abolished, using core's own switch-off test,
and the reform is back to its original single neutralization.

Also: check a supplied JOINT status against the supplied roles so
abolishing a role variable cannot raise; keep an explicit head out of the
supplied spouse role; document precedence, the fallback's separation gate,
and that supplied adult dependents' income counts toward no return.

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

* Test the role and filing-status invariants with Hypothesis

State seven properties of supplied tax-unit roles and filing statuses
(partition, supplied roles hold, age-ordering fallback, supplied statuses
hold, equivalence with the explicit-pin workaround, switch-off locality,
error contract) and check each over generated households. Adds hypothesis
to the dev extra; uv.lock regenerated with CI's uv 0.12.13 so it changes
only by that package.

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

* Guarantee each abolition property case holds its target status

Independent review of d8b02c1 found the switch-off-locality property
could generate no unit supplied with the abolished status, so it never
exercised the re-derivation it claims to check. Each example now holds
one forced target unit beside other supplied units.

Also narrow the docs and changelog: a dependent's income is left out of
the claiming return's gross income, but the deductible share of a
dependent's self-employment tax still lowers the filer's AGI through
self_employment_tax_ald.

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

* Honor supplied tax-unit roles only; compute filing status

Filing status is a policy calculation, so the model computes it from the
household's facts, as on main. Supplied data may set who is head, spouse
or dependent, but not the filing status.

- filing_status.py returns to main's formula; no supplied status is read.
- Remove filing_status_input and its YAML tests. The Populace build's
  filing_status_input column now matches no variable, so the loader skips it.
- Revert the romney remove_head_of_household cases, which tested only how
  the repeal re-derived a supplied status.
- Keep tax_unit_role_input, tax_unit_roles_supplied and the head/spouse
  formulas composed with #9630's inference.
- Unit tests: drop the supplied-status tests; add a dataset test showing a
  filing_status_input column that disagrees with the rules is not read, in
  the data year and an extended year.
- Property tests: roles only. Filing status is joint exactly when there is
  a spouse; the role input matches pinning the role flags (neither side
  pins filing_status); a new property composes supplied roles with input
  dependents, against an oracle that skips them as #9630 does.
- Microsim test: check the build's roles only.
- Docs: roles only, the fallback as it stands after #9630, and dependents'
  above-the-line deductions after #9801.

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

* Describe the role fallback with #9630's all-dependent case

The age-ordered fallback skips adults input as tax unit dependents unless
every adult in the unit is one, in which case every adult stays a
candidate. Say so in tax_unit_role_input's documentation.

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

* Rewrite the changelog fragment for roles only

Per Max's ruling d318, the dataset supplies tax-unit roles but not filing
status, so the fragment no longer says filing_status_input sets
filing_status. It drops the 2024 aggregates measured with supplied filing
status, which no longer describe this change.

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

* Let a tax unit with no members fall back instead of raising

The loader declares every tax unit in a dataset's tax_unit_id column,
members or not, and all() is True over no members. So
tax_unit_roles_supplied counted a memberless unit as supplied with no
HEAD and raised, where main gives the unit no head. It now needs at least
one supplied member. The certified default build has no memberless units,
so its results do not change.

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

* docs: clarify filing status input overrides

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 9, 2026
…40CR line 30) (#9795)

* Net capital gain distributions inside the capital loss limit

A filer with capital losses or other capital gains enters capital gain
distributions on Schedule D line 13 (2025 Instructions for Schedule D), so
they net against the losses before the 26 U.S.C. 1211(b) limit on line 21.
The model added distributions (non_sch_d_capital_gains) to gross income and
deducted min(3,000, losses) separately: a 5,000 long-term loss with 3,000 of
distributions gave 0 in AGI instead of -2,000.

- capital_losses_allowed_against_gains (new): losses allowed up to the
  gains in gross income, distributions included (1211(b), first part).
- limited_capital_loss: the net loss up to the limit (1211(b)(1)-(2),
  Schedule D line 21). loss_ald deducts both. This also nets spouses'
  gains and losses on a joint return.
- loss_limited_net_capital_gains (+ person version): Form 1040 line 7a,
  max(-limit, LT + ST + distributions). Net investment income no longer
  adds the distributions separately (Form 8960 line 5a).
- has_qdiv_or_ltcg: qualified dividends, or Schedule D lines 15 and 16
  both above zero (Form 1040 instructions, line 16).
- dependent_taxable_ss_magi: the same netting on the dependent's return.
- dc_self_employment_loss_addition: subtracts both capital parts of
  loss_ald.

Tests: YAML cases with form line comments; grid, Hypothesis property and
monotonicity tests.

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

* Count distributions inside Schedule D in the NII invariant reference

filer_loss_limited_net_capital_gains (from #9784) now nets the head and
spouse's capital gain distributions with their Schedule D gains and losses
before the 1211(b) limit, and net investment income no longer adds the
distributions separately. The invariant test's reference computation
follows: distributions move from the person-level Form 8960 amounts to
the Schedule D inputs.

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

* Test the netting when a reform drops a gross income source

capital_losses_allowed_against_gains counts only the capital gains that
gov.irs.gross_income.sources includes, and dependent_taxable_ss_magi nets
distributions only when both sources are listed. Cover both branches with
reforms that drop non_sch_d_capital_gains or capital_gains.

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

* Address review: Michigan adjustments, filer-only worksheet test, floors

From the independent review of #9788:
- mi_household_resources subtracted all above-the-line deductions,
  including the capital loss already netted in the capital gains line
  (MI-1040CR line 30 is U.S. Schedule 1 adjustments only). It now leaves
  out capital_losses_allowed_against_gains and limited_capital_loss. The
  two existing loss-limit cases double counted the loss: 44,000 -> 47,000
  and 47,000 -> 48,500.
- has_qdiv_or_ltcg figures Schedule D lines 15 and 16 over the head and
  spouse, so a dependent's loss cannot switch off the filer's worksheet.
- Distributions are floored at zero per person in every line 7a variable
  (box 2a is not negative), as irs_gross_income does.
- Capital losses are deductible only while capital_gains is a gross income
  source, matching dependent_taxable_ss_magi under such a reform.
- Test that the two loss-limit parameters agree; rename the #9784
  invariant test that no longer compares with the pre-change formula.
- loss_ald label: "Business and capital loss ALD".

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

* Follow 1211(b) in the #9647 invariant and a Maryland surtax test

CI caught two tests written against the old capital loss formula:
- test_dependent_losses_agi_invariants (#9647) compared limited_capital_loss
  with min(cap, sum of losses), which does not net one spouse's gains
  against the other's losses. Its reference now splits 1211(b) the same
  way: losses allowed up to the gains, plus the excess up to the cap.
  Renamed ..._match_all_member_formula.
- md_capital_gains_surtax "partial offset" set capital_losses (a formula
  variable, max(0, -capital_gains)) to 50,000 next to 150,000 of net gains,
  a state no inputs can produce, and its comment applied the $3,000 cap to
  losses within gains. It now inputs the short-term loss directly
  (30,000 gains less 50,000 losses = -20,000): Schedule D line 16 and Form
  502CG line 1 are 100,000, surtax 2,000 (same on main).

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

* Net Michigan business and rental losses on MI-1040CR lines 16 and 17

MCL 206.508(4) adds back "any net business loss after netting all business
income and loss" and "any net rental or royalty loss". The MI-1040CR nets
line 16 (Schedule C, Form 4797 Part II, Schedule E Parts II and III,
Schedule F) and line 17 (Schedule E Parts I and V) and floors each total at
zero. Line 30 is the U.S. Schedule 1 adjustments, so loss_ald, which holds
business, rental and capital losses, is no longer subtracted there.

Estate and trust income and Form 4797 ordinary gains now count on line 16.

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

* Keep dependents' business and rental items off Michigan lines 16 and 17

MCL 206.508(3): "'Household' means a claimant and spouse." Netting every
tax unit member's sources let a dependent's business or rental loss offset
the claimant's income (a 15-year-old's Schedule C loss of 20,000 took the
claimant's household resources from 70,000 to 50,000). Lines 16 and 17 now
sum only non-dependents, as loss_ald and irs_gross_income do.

Tests: three dependent YAML cases and a deterministic dependent property
test. The loss_ald reform check now runs once, on the grid, instead of on
every Hypothesis example; test_properties drops from 931 s in CI to about
8 s. The deterministic tests no longer need hypothesis. Small inputs are
drawn at $100 or more, the tolerance docstring is corrected, and comments
list Schedule E Part IV (REMIC) on line 17.

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

* Subtract only Schedule 1 adjustments on MI-1040CR line 30

Line 30 is "total adjustments from your U.S. Form 1040, Schedule 1". It
used the federal above-the-line list without loss_ald, which still held
four exclusions from gross income: us_bonds_for_higher_ed (IRC 135),
qualified_adoption_assistance_expense (137), specified_possession_income
(931) and puerto_rico_income (933). Total household resources include
"all income exempt or excluded from AGI" (2025 MI-1040 book, page 26), and
the excluded amounts already sit in the line 14 and 15 sources (line 15
is "All interest and dividend income (including nontaxable interest)";
adoption benefits are reported on Form W-2, box 12 code T), so line 30
took them back out.

A new parameter, gov.states.mi.tax.income.household_resources_adjustments,
lists the federal above-the-line deductions that are Schedule 1 Part II
adjustments. Line 30 sums those the federal list deducts, so a federal
reform that drops one drops it here too.

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

* Tighten MI line 30 property tests and describe the input convention

Review r1 on #9795:
- The formula comment stated as model behaviour what is an input
  convention: because the federal list subtracts each exclusion from gross
  income, the excluded amount is entered in the income it comes from.
- The differential reference took line 30's variables from the parameter
  under test. It now uses SCHEDULE_1_ADJUSTMENTS, written in the test from
  the 2025 Schedule 1, and the classification test asserts the parameter
  equals it.
- Invariant 3 skipped every household with student loan interest. It now
  allows for the change D in that deduction (household resources =
  max(0, without - D); AGI lower by the exclusions plus D), and the grid
  adds six phase-out households so that case is exercised.
- test_worked_example duplicated a YAML case and is dropped.

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

* Check each exclusion's effect on the student loan deduction in the MI grid

Review r2 on #9795: in the phase-out households, savings bond interest and
adoption benefits must change the student loan interest deduction and
Puerto Rico income (added back under IRC 221(b)(2)(C)) must not; the grid
now asserts each instead of "at least one". Possession income is left
unchecked, since its effect depends on the federal modified AGI's
treatment of section 931. The formula comment adds possession and Puerto
Rico income to the input convention.

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

* Add the combined #9781 regression case, a joint Maryland surtax case, and move the distributions comment

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

* Use tax_unit_non_dep_add for lines 16 and 17; describe the dependent change in the changelog

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

* Sum Michigan line 30 over the head and spouse

Review r5: since #9801, the federal above-the-line total leaves dependents'
person-level items out, but line 30 summed educator_expense,
early_withdrawal_penalty and traditional_ira_contributions over every member
with add. It now uses tax_unit_non_dep_add, as above_the_line_deductions does.
Regression case: a dependent's IRA 2,000, penalty 100 and educator expenses
300 gave 47,600; the form gives 50,000.

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

* Restore capped educator expenses in Michigan household resources

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 9, 2026
* Count capital gains once in Arizona property tax credit income

az_property_tax_credit_income added capital_gains_excluded_from_taxable_income
on top of federal AGI. That variable is the part of federal taxable income
taxed at the capital gains rates; when taxable income is zero it is the whole
net capital gain plus qualified dividends. Federal AGI already holds those
amounts, so they counted twice, mostly for the low-income seniors the credit
is for.

ARS 43-1072(H)(6)(b) adds "the amount of capital gains excluded from adjusted
gross income". A.A.C. R15-2C-502(C)(3), ITR 12-1 item (7) and the 2021-2025
Form 140PTC instructions (Part 1 line D) count each member's net gains and
losses from sales or exchanges of property, which federal AGI holds. The model
has no gain excluded from federal AGI, so the entry is removed.

Adds Form 140PTC line-by-line YAML tests and seeded property tests
(differential against a line A-J reference, counted once, independence from
the preferential-rate amount, credit monotone in gains).

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

* Count dependents' income in Arizona property tax credit income

Review r1b: federal AGI (irs_gross_income) leaves out every tax-unit
dependent's income. The removed preferential-rate amount summed all members'
gains and qualified dividends, so it had been counting a dependent's gains;
without it a claimant whose child had $3,000 of gains got $502 instead of $412.
A.A.C. R15-2C-502(A)(2) and (B) count every household member's income whether
or not the member is a dependent, so az_property_tax_credit_dependent_income
adds dependents' income from the same federal gross income sources, without
Social Security (ARS 43-1072(I)).

Also corrects the zero-taxable-income description: the preferential-rate
amount is then the adjusted net capital gain. Adds dependent YAML cases and
dependents to the sampled property tests.

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

* Apply Arizona's $1,500 member capital loss limit and allow a negative line J

A.A.C. R15-2C-502(C)(3), ITR 12-1 item (7) and the Form 140PTC line D
instructions (2021-2025) limit each household member's net capital loss
to $1,500. az_property_tax_credit_agi used federal AGI's capital gains
and losses instead: non-dependents' net gains less a capital loss limited
to $3,000 per return. It now swaps those for each non-dependent member's
line D amount (new az_property_tax_credit_capital_gains, parameter
capital_loss_limit). Dependents' line D amounts move into
az_property_tax_credit_dependent_income with the same limit, in place of
their gains floored at zero.

The line J note in the instructions lets household income go negative
and uses zero for the Schedule 1 and 2 amounts. az_property_tax_credit_agi
no longer floors at zero; az_property_tax_credit floors income at the
schedule lookup, where a single-amount scale would otherwise return 0
below its first threshold.

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

* Cite the line J note where it appears: 2023-2025 instructions, page 5

The 2021 and 2022 instructions have no negative household income note;
the floor at the schedule lookup applies in every year because the
schedules start at zero.

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

* Combine members' income before any floor in Arizona property tax credit income

Review r2: federal AGI deducts every member's losses, dependents' included,
but az_property_tax_credit_agi floored at zero before dependents' income was
added, so a loss counted only against the claimant's or spouse's own income.
A claimant with no income whose dependent had $3,000 of wages and a $1,000
capital loss got household income of $3,000 instead of $2,000.

az_property_tax_credit_agi is no longer floored. Form 140PTC line J can be
negative, and az_property_tax_credit uses zero for the Schedule 1 and 2
lookup (the same change as in #9770, so that PR rebases cleanly).

Adds regressions for a loss on the dependent, on the claimant, a rental loss
and a negative line J; the property sample now includes dependents' losses,
raises a dependent's gains, and states its actual domain. Notes that the
federal source list is not Arizona's (unemployment by paying state, estate
income, strike benefits, nontaxable alimony).

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

* Swap only the capital amounts federal AGI holds for Arizona line D

Review r1 of #9770 found that az_property_tax_credit_agi added back
limited_capital_loss even when federal AGI never deducted it (a reform that
drops loss_ald from the above-the-line list, or loss_ald set to zero),
manufacturing income. The swap now takes out only the positive capital gains
irs_gross_income puts in AGI (per gross income source list) and the capital
loss deduction loss_ald actually contains, then adds each non-dependent's
line D. Gains a reform leaves out of AGI still count, as ARS 43-1072(H)(6)(b)
adds them back.

Line D now combines capital gain distributions reported without Schedule D
with the member's other gains and losses before the $1,500 limit: they are
long-term capital gains (26 U.S.C. 852(b)(3)(B)), and R15-2C-502(C)(3) nets
each member's capital gains and losses. The dependent loop skips them so they
count once.

Tests: YAML cases for the two reforms, a zero loss_ald input, distributions
for a claimant and a dependent, the three r3 finding-1 households (losses
beyond $1,500 with tax-exempt income), and r3's estate/rental case, now right
on main since #9633. Property sample adds distributions and signed rental
income (dependents too) to the Form 140PTC oracle, uses only non-dependents'
losses in the federal coverage check (#9647), and compares the
preferential-rate mutation with an unmodified run (r1 nit). Corrects the
spouse-netting comment (r1 nit).

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

* Add back only loss_ald's capital part in Arizona household income

Review r1 of the fold (GPT-6.1 Sol, 21cb189) found that
min(limited_capital_loss, loss_ald) cannot tell loss_ald's capital part from
its business part: a reform or supplied loss_ald that holds only a rental
loss was reversed as a capital deduction ($2,500 / $323 instead of the
form's $1,500 / $502).

loss_ald's section 461(l) business part moves, unchanged, into a new
limited_business_loss variable, and loss_ald adds limited_business_loss and
limited_capital_loss (identical federal results). Arizona now adds back
loss_ald less limited_business_loss, clipped to [0, limited_capital_loss].

Tests: a loss_ald case pins both parts; Arizona cases for a rental and
capital loss together and for a supplied rental-only loss_ald; a pytest
with a Reform whose loss_ald holds only rental losses. Both Arizona tests
fail on 21cb189's formula.

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

* Add the dependent IRA household now that #9801 is on main

Delta review r2 asked for the r1 household as a regression once #9801 (keep
dependents' above-the-line deductions off the filer's AGI) was in this
branch. Claimant aged 70 with a 4,000 long-term gain; dependent with 1,600
wages and a 200 traditional IRA contribution: federal AGI 4,000, line J
5,600, no credit (Schedule 2 limit 5,501).

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

* Leave the prior-year long-term carryover out of Arizona line D

Delta review r3 (Sol, 2ea9d6b): #9841 added long_term_capital_loss_carryover,
a memo amount that long_term_capital_gains already includes as a loss
(Schedule D line 15). ITR 12-1 item (7) bars a prior-year carryover from
reducing the year's gains for household income, so line D adds the
carryover back before the $1,500 member limit. Federal AGI keeps it.

Tests: three YAML cases (a carryover netting a gain, a carryover making the
whole net loss, a dependent's carryover); the property sample draws
carryovers with long_term_capital_gains net of them and the Form 140PTC
oracle adds them back. All fail on the previous formula (3 YAML, 4 property).

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

* Cover dependent Arizona capital-gain changes (#9762)

Preserve all 80 original sampled households and their independent line-D
oracle. Add dependent gain and loss perturbations for the 26 households
with dependents in the same simulations, preserving member loss floors
and filer/dependent accounting.

Use the educator deduction variable introduced on main in the test
that removes loss_ald from the federal deduction list. Expected outputs
and public carryover inputs remain unchanged.

* Clarify Arizona capital input convention and consolidate release notes

* Test bounded whole-dollar parity of federal loss extraction

* Test bounded whole-dollar parity of federal loss extraction

* Pin d1107 terminating-trust carryover treatment for Arizona credit

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Oct 10, 2026
…I-1040CR lines 14-27, 30 and 31) (#9796)

* Net capital gain distributions inside the capital loss limit

A filer with capital losses or other capital gains enters capital gain
distributions on Schedule D line 13 (2025 Instructions for Schedule D), so
they net against the losses before the 26 U.S.C. 1211(b) limit on line 21.
The model added distributions (non_sch_d_capital_gains) to gross income and
deducted min(3,000, losses) separately: a 5,000 long-term loss with 3,000 of
distributions gave 0 in AGI instead of -2,000.

- capital_losses_allowed_against_gains (new): losses allowed up to the
  gains in gross income, distributions included (1211(b), first part).
- limited_capital_loss: the net loss up to the limit (1211(b)(1)-(2),
  Schedule D line 21). loss_ald deducts both. This also nets spouses'
  gains and losses on a joint return.
- loss_limited_net_capital_gains (+ person version): Form 1040 line 7a,
  max(-limit, LT + ST + distributions). Net investment income no longer
  adds the distributions separately (Form 8960 line 5a).
- has_qdiv_or_ltcg: qualified dividends, or Schedule D lines 15 and 16
  both above zero (Form 1040 instructions, line 16).
- dependent_taxable_ss_magi: the same netting on the dependent's return.
- dc_self_employment_loss_addition: subtracts both capital parts of
  loss_ald.

Tests: YAML cases with form line comments; grid, Hypothesis property and
monotonicity tests.

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

* Count distributions inside Schedule D in the NII invariant reference

filer_loss_limited_net_capital_gains (from #9784) now nets the head and
spouse's capital gain distributions with their Schedule D gains and losses
before the 1211(b) limit, and net investment income no longer adds the
distributions separately. The invariant test's reference computation
follows: distributions move from the person-level Form 8960 amounts to
the Schedule D inputs.

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

* Test the netting when a reform drops a gross income source

capital_losses_allowed_against_gains counts only the capital gains that
gov.irs.gross_income.sources includes, and dependent_taxable_ss_magi nets
distributions only when both sources are listed. Cover both branches with
reforms that drop non_sch_d_capital_gains or capital_gains.

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

* Address review: Michigan adjustments, filer-only worksheet test, floors

From the independent review of #9788:
- mi_household_resources subtracted all above-the-line deductions,
  including the capital loss already netted in the capital gains line
  (MI-1040CR line 30 is U.S. Schedule 1 adjustments only). It now leaves
  out capital_losses_allowed_against_gains and limited_capital_loss. The
  two existing loss-limit cases double counted the loss: 44,000 -> 47,000
  and 47,000 -> 48,500.
- has_qdiv_or_ltcg figures Schedule D lines 15 and 16 over the head and
  spouse, so a dependent's loss cannot switch off the filer's worksheet.
- Distributions are floored at zero per person in every line 7a variable
  (box 2a is not negative), as irs_gross_income does.
- Capital losses are deductible only while capital_gains is a gross income
  source, matching dependent_taxable_ss_magi under such a reform.
- Test that the two loss-limit parameters agree; rename the #9784
  invariant test that no longer compares with the pre-change formula.
- loss_ald label: "Business and capital loss ALD".

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

* Follow 1211(b) in the #9647 invariant and a Maryland surtax test

CI caught two tests written against the old capital loss formula:
- test_dependent_losses_agi_invariants (#9647) compared limited_capital_loss
  with min(cap, sum of losses), which does not net one spouse's gains
  against the other's losses. Its reference now splits 1211(b) the same
  way: losses allowed up to the gains, plus the excess up to the cap.
  Renamed ..._match_all_member_formula.
- md_capital_gains_surtax "partial offset" set capital_losses (a formula
  variable, max(0, -capital_gains)) to 50,000 next to 150,000 of net gains,
  a state no inputs can produce, and its comment applied the $3,000 cap to
  losses within gains. It now inputs the short-term loss directly
  (30,000 gains less 50,000 losses = -20,000): Schedule D line 16 and Form
  502CG line 1 are 100,000, surtax 2,000 (same on main).

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

* Net Michigan business and rental losses on MI-1040CR lines 16 and 17

MCL 206.508(4) adds back "any net business loss after netting all business
income and loss" and "any net rental or royalty loss". The MI-1040CR nets
line 16 (Schedule C, Form 4797 Part II, Schedule E Parts II and III,
Schedule F) and line 17 (Schedule E Parts I and V) and floors each total at
zero. Line 30 is the U.S. Schedule 1 adjustments, so loss_ald, which holds
business, rental and capital losses, is no longer subtracted there.

Estate and trust income and Form 4797 ordinary gains now count on line 16.

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

* Keep dependents' business and rental items off Michigan lines 16 and 17

MCL 206.508(3): "'Household' means a claimant and spouse." Netting every
tax unit member's sources let a dependent's business or rental loss offset
the claimant's income (a 15-year-old's Schedule C loss of 20,000 took the
claimant's household resources from 70,000 to 50,000). Lines 16 and 17 now
sum only non-dependents, as loss_ald and irs_gross_income do.

Tests: three dependent YAML cases and a deterministic dependent property
test. The loss_ald reform check now runs once, on the grid, instead of on
every Hypothesis example; test_properties drops from 931 s in CI to about
8 s. The deterministic tests no longer need hypothesis. Small inputs are
drawn at $100 or more, the tolerance docstring is corrected, and comments
list Schedule E Part IV (REMIC) on line 17.

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

* Count only the claimant and spouse in Michigan household resources

MCL 206.508(3) defines the household as "a claimant and spouse", and the
MI-1040CR asks for the income "you and your spouse received". Every
household resources source except lines 16 and 17 was summed over all tax
unit members, so a dependent's wages, interest, pensions and capital gains
raised the claimant's household resources, and a dependent's Schedule 1
adjustments (such as the deduction for half of self-employment tax)
lowered them.

- Sources are summed over the head and spouse with tax_unit_non_dep_add.
- Line 21 (Social Security, SSI and railroad retirement, including amounts
  received for minor children or dependent adults), line 22 (child
  support) and line 27 (public assistance paid to the household) still
  count for every member, as the form says.
- Line 19 reads filer_loss_limited_net_capital_gains, the head and
  spouse's Schedule D.
- Line 30 sums the head and spouse's Schedule 1 adjustments, with the
  self-employment adjustments read per person.
- Line 31 premiums paid for the family are unchanged.

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

* Give the membership property tests an explicit FIP grant

With no income, the model computes a Michigan FIP grant (tanf) for the
test household, which counts on line 27 but was missing from the test's
reference. Each SPM unit now gets a tanf input, drawn at random in the
Hypothesis test and counted in full on line 27 of the reference. The
Hypothesis tests also run more examples (50 and 30).

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

* Keep dependents' above-the-line deductions off the filer's AGI

irs_gross_income leaves tax unit dependents' income off the filer's
return, but self_employment_tax_ald, self_employed_health_insurance_ald
and self_employed_pension_contribution_ald summed every member's
person-level amount, and above_the_line_deductions summed every member's
IRA contributions, early withdrawal penalty, educator expenses, adoption
assistance and education bond interest. A dependent's Schedule SE and
Schedule 1 deductions belong on the dependent's own return.

- The three self-employment aggregates sum their _person variables over
  non-dependents; alimony_expense_ald masks dependents.
- above_the_line_deductions sums gov.irs.ald.deductions with
  tax_unit_non_dep_add.
- Readers that sum the ALD list themselves do the same: taxable_ss_magi,
  taxable_uc_agi, student_loan_interest_ald_magi,
  adjusted_gross_income_person and ma_part_b_agi.
- mo_adjusted_gross_income takes personal ALDs over non-dependents, so its
  remaining-ALD allocation never goes negative.
- medicaid_adjusted_gross_income_person attributes a dependent's own
  person-level deductions to the dependent instead of the head.
- ma_gross_income_loss_adjustment leaves out dependents' losses, as the
  federal gross income it adjusts does.

The _person variables keep each person's own amount, which a dependent's
own return (dependent_taxable_ss_magi) uses.

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

* Test that the ALD total stays between 0 and the all-member sum

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

* Read the federal Schedule 1 aggregates on Michigan line 30; reformable member lists

Review r1:
- Line 30 reads the tax-unit adjustments as they are, so supplied inputs
  and reforms of self_employment_tax_ald and the other aggregates are
  respected. #9801 (merged in) makes those aggregates and
  alimony_expense_ald leave dependents out.
- The every-member sources (lines 21, 22 and 27) move to a parameter,
  gov.states.mi.tax.income.household_resources_all_members, and a source
  defined for a group larger than the tax unit (an SPM unit amount) is
  aggregated as a household amount, so a reform cannot hit an entity error.
- gi_cash_assistance counts only for the claimant and spouse: nothing shows a
  pilot payment is public assistance paid to the claimant's household.
- Tests: dependent alimony and guaranteed income YAML cases; property tests
  always have a dependent and a positive-resources household; a reform test.

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

* Add the combined #9781 regression case, a joint Maryland surtax case, and move the distributions comment

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

* Use tax_unit_non_dep_add for lines 16 and 17; describe the dependent change in the changelog

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

* Keep a supplied net_capital_gains amount on the filer's line 7a; add aggregate-input cases

Review r1 finding 1: filer_loss_limited_net_capital_gains summed the head's
and spouse's components, so a tax unit net_capital_gains input was ignored
(wages 10,000 plus a 5,000 aggregate gain gave 10,000, not 15,000). It now
takes net_capital_gains less the dependents' own gains and losses.

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

* Document supplied net_capital_gains on the filer's line 7a; add NII and SE health insurance cases

Review r2 follow-ups: a supplied net_capital_gains reaches net investment
income (YAML case), a supplied self-employed health insurance deduction comes
off Michigan line 30 (YAML case), and the variable documents how a supplied
total combines with dependents' person-level gains.

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

* Pass include_dependents on Michigan line 30; test a dependent's positive Schedule C and F income

With #9801 on main: line 30 sums gov.irs.ald.filer_amounts_recorded_on_dependents
over every member, as above_the_line_deductions does, and the losses test now
draws positive dependent Schedule C and F income, whose self-employment tax
deduction is on the dependent's own return.

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

* Use shared filer Schedule D lines without dependent rounding drift

* Preserve supplied capital gains without rounded residuals

* Recognize Michigan dependent pension SSI interaction (d1143)

* Compute dependent SSI in Michigan retirement regression

* Cite the 2025 MI-1040CR-7 book for Michigan household resources

michigan.gov has removed the 2025 home heating credit book
(TY2025/MI-1040CR-7-Book.pdf now returns 404), so cite the Wayback
Machine capture of 2026-02-18. It is byte-identical to the NBER TAXSIM
mirror (sha256 f540a3dd...). Its total household resources lines 17-33
say the same as MI-1040CR lines 14-31 about whose income counts:
"you and your spouse", Social Security "for minor children or other
dependent adults who live with you" (line 24), child support and foster
care payments (line 25), MDHHS payments "made to your household"
(line 30), and premiums "for yourself and your family" (line 33).
References only; no formula or value changes.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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