Skip to content

Net household members' Medicaid MAGI before the zero floor, and give each spouse their own deductions - #9860

Open
MaxGhenis wants to merge 30 commits into
mainfrom
medicaid-magi-joint-floor
Open

MaxGhenis wants to merge 30 commits into
mainfrom
medicaid-magi-joint-floor

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Medicaid MAGI household income for married couples on one return had two interacting bugs:

  1. medicaid_magi_person floored each person's MAGI at zero, and medicaid_household_income added the floored amounts. One spouse's loss therefore never offset the other spouse's income, although the couple's MAGI is that of their joint return.
  2. medicaid_adjusted_gross_income_person split every above-the-line deduction other than the self-employment ones 50/50 between head and spouse. That included an IRA deduction, student loan interest, and business and capital losses (loss_ald).

They have to be fixed together. With the per-person floor, giving a loss to the spouse who has it makes the floor bite harder. An October 2026 attempt to switch Medicaid AGI to own attribution alone raised medicaid_magi_person by $8.1B and cut Medicaid eligibility by about 137,000 people (hub runner, 2024), so it was backed out.

Example from the brief, a joint couple: spouse A earns $30,000 of wages and spouse B has a −$20,000 Schedule C loss, so joint AGI is $10,000.

A B Household income
main (50/50 split, per-person floor) 20,000 −10,000 → 0 20,000
own attribution, per-person floor 30,000 −20,000 → 0 30,000
this PR 30,000 −20,000 10,000

For a deduction the earner owns (A's $6,000 IRA, B with no income), main gives $27,000 and this PR gives $24,000.

Law and guidance

  • 42 CFR 435.603(d)(1): "household income is the sum of the MAGI-based income, as defined in paragraph (e) of this section, of every individual included in the individual's household." It is a plain sum, with no floor for each member. (eCFR)
  • 435.603(e): MAGI-based income is "income calculated using the same financial methodologies used to determine modified adjusted gross income as defined in section 36B(d)(2)(B) of the Code."
  • 26 USC 36B(d)(2)(A): household income is the taxpayer's MAGI plus the aggregate MAGIs of dependents required to file. (LII)
  • Instructions for Form 8962 (2025), line 3: "Add the amounts on lines 2a and 2b. Combine them even if one or both of them are negative. If the total is less than zero, enter -0- on line 3." Line 2a is the couple's joint MAGI and line 2b the dependents' combined MAGI. (IRS, p. 8)
  • 435.603(f)(4): each spouse of a married couple living together is in the other's household "regardless of whether they expect to file a joint tax return."
  • CMS: the MAGI-Based Household Income Eligibility Training Manual (Dec. 2020) adds the spouses' incomes for joint filers ("Sam scenario", p. 83). I found no CMS guidance that addresses negative income offsetting another member's income. State MAGI manuals treat losses as offsetting other income:
    • Montana CMA 503-1: "Any loss reported on Schedule E, Line 32 can be used to offset any other income and decrease MAGI income."

    • New York GIS 14 MA/07: when "there is other taxable income in the household, the negative income is used to reduce the individual's other taxable income source(s)," and when "the only income source for the household is the self-employment that nets a loss, then the income would be set to zero."

      New York also bars a loss from offsetting nontaxable Social Security. That departs from the 36B worksheet (Form 8962 Worksheet 1-1 adds nontaxable benefits to an AGI that may be negative), which this model follows.

Where the floor goes. The floor goes on the household's total, the same as Form 8962 line 3: household income = max(0, J + D), where J is the couple's MAGI and D is the MAGI of dependents required to file. Applied to each path:

  • Joint filers: the couple's combined MAGI is netted with counted dependents' MAGI, then floored.
  • Non-filers (435.603(f)(3)): with co-resident parent IDs, the merged candidate sums the signed MAGI of the same linked members counted by medicaid_household_size, then floors the total. Medicaid MAGI household composition from co-resident parent ids (fixes #9404) #9406's membership excludes relatives outside that household, so linked parents', children's and siblings' negative amounts can offset its other counted income. Without parent IDs, the existing conservative fallback remains: an adult's own and their spouse's MAGI enter signed; family-wide relatives enter only when positive, each child's amount separately and married parents' amounts netted together. This includes a non-filer child's own amount among the family-wide children. Unmarried parents' losses and children's or siblings' negative amounts do not offset income in that fallback.
  • Cohabiting spouses filing separately: each spouse's household includes the other (f)(4), so their two returns' MAGIs are summed, then floored. A dependent of either spouse is in that spouse's household (f)(2), so the dependent's household gets the other spouse's MAGI too. Household size already counted that spouse; before this PR, household income left them out.
  • Dependents required to file: their own MAGI, possibly negative, enters the claimant's household before the floor, as on Form 8962 line 2b.

The brief's property, max(0, J) + D, agrees with this whenever J ≥ 0 and no counted dependent's MAGI is negative. The two differ only when a negative joint MAGI meets a dependent's positive income, or a dependent's MAGI is negative. Form 8962 line 3 settles that case by combining before the floor.

The fix

  • medicaid_adjusted_gross_income_person = medicaid_irs_gross_income − above_the_line_deductions_person.
    • Each spouse's own IRA deduction, student loan interest, alimony and business and capital losses now lower only their own amount, and the head's and spouse's amounts add up to the return's AGI.
    • A tax unit dependent's amount is their own income less their own person-level deductions. That includes alimony paid, which main already attributed to its payer. A dependent's own business and capital losses aren't modeled, as before: a dependent's gross income counts only positive amounts, and above_the_line_deductions_person gives dependents no loss deduction.
    • Taxable basic income (UBI Center reform) is divided equally between head and spouse with filer_share.
  • medicaid_magi_person: no floor. Person-level MAGI additions (tax-exempt interest) are the person's own. Additions recorded only for the tax unit (foreign earned income exclusion, nontaxable Social Security) are divided equally between head and spouse with filer_share, as before for joint returns.
  • medicaid_household_income: members' amounts are summed signed across the tax household, the claimant household, cohabiting separate spouses and the linked non-filer household. The merge retains Medicaid MAGI household composition from co-resident parent ids (fixes #9404) #9406's claimant and spouse membership helpers. Only the household total is floored at zero. The fallback for non-filers without parent IDs retains the positive family-wide relative amounts described above.
  • HSA integration from main: health_savings_account_ald_person remains attributed to its owner by the existing allocator. When only a tax-unit HSA deduction is supplied, the existing equal filer fallback remains. The refresh changes no HSA formula: it removes stale equal-only metadata and documentation and corrects the independent spouse-deduction property reference for its tax-unit-only HSA fixture.
  • medicaid_person_is_required_to_file: unearned income was gross income less earned_income. Gross income counts each source's positive amount, so a self-employment loss made other income look unearned: a dependent with a $5,000 loss and $100 of interest had $5,100 of "unearned income" and was required to file. With members no longer floored, that would have counted the dependent's negative income. Unearned income is now gross income less the positive wage and self-employment sources it contains (Pub. 501 (2025), Table 2). This also stops 401(k) deferrals, which box 1 wages leave out, from hiding unearned income.
  • above_the_line_deductions_person: amounts in gov.irs.ald.filer_amounts_recorded_on_dependents (education savings bond interest, employer adoption assistance) are the filer's even when recorded on a dependent. They no longer reduce the dependent's own amount, which Medicaid now reads. Main's Medicaid formula already left them off dependents.

Dependency

This PR remains stacked on #9890 (each spouse's own above-the-line deductions in per-person AGI), which is open at eaabd725476ecb797eab2df217efaaf2552f79ac. That PR adds above_the_line_deductions_person, loss_ald_person, limited_capital_loss_person, limited_business_loss, alimony_expense_ald_person and filer_share. This branch retains its stacked history. Merge #9890 first. The filer_amounts_recorded_on_dependents fix to above_the_line_deductions_person described above is part of #9890.

Membership merge

#9406 (Medicaid MAGI households from co-resident parent IDs) merged in f33a4b3b1666b07f99da83ea771a0819a416c571. This branch merges main with a history-preserving merge and keeps its claimant, co-resident parent and spouse membership together with this PR's signed income sums and one household zero floor. Members' MAGI has no per-person floor.

Previously approved candidate head and release merge: 052420824c4b62bc4ff14c59607b354982de9515, with parents ad2d76c1b0de997a748be051d8c801ef618d5eb9 and current main e44d7c367327108858e06a22160b0ab5d7189c41. Earlier main merge 79ae598674c711d3d9961e698d4984a45e0ef04c retains main 7b956eb4014e3a189075c79f9b1f0a8f1d3b02ab; dependency merge 6b81b743c8b8238ecc8523c1cb936f0540af0a17 is preserved in that history.

Main merge (resolved conflict with #9857)

Merged main at 0a8c3c2c43e12bef720aba38dbb33b2acdada1fb into approved head 052420824c4b62bc4ff14c59607b354982de9515 with merge commit 6c5f5cddd8ad7cb43c21cd84ff281d382e9ecee7. The D.C. resolution preserves #9857's filer-only losses and proportional split, with #9860's business-first limited_business_loss cap and signed Medicaid household income netting. An additional Ohio test conflict retains both independent regression cases and their original expectations.

Targeted verification: 75 passed across 10 files, each run separately and sequentially in the foreground; make format passed. Runs used the supplied Python 3.13.9 environment (Core 3.32.15, pytest 9.1.1, Hypothesis 6.168.5), with a verified untracked raw-source cache after the first file. The committed tree is the exact tested tree. No partner expectations were edited. The existing hub impact section below was measured before this main merge; no new microsimulation was run. The PR remains draft for the hub's delta review.

Invariants

The existing generator draws joint filers with dependent children aged 5–17, non-filing couples, cohabiting spouses filing separately, and single filers without children, each household its own family. The merge adds a focused six-person linked non-filer property described below; YAML cases cover additional paths:

  1. Joint filers: every member's household income = max(0, J + D). J is the couple's MAGI, figured independently from the tax unit's adjusted_gross_income plus the MAGI additions. D is the sum of the MAGI of children required to file. When J ≥ 0 and no counted child's MAGI is negative, this equals max(0, J) + D.
  2. Accounting: the head's and spouse's medicaid_magi_person add up to J (differential against the tax-unit AGI path). A dependent's Medicaid AGI is their own gross income less their own deductions.
  3. Couples outside a joint return: for non-filing couples and cohabiting spouses filing separately, household income = max(0, the two spouses' MAGI added). For single filers without dependents, max(0, their MAGI).
  4. Floor: household income is never negative, equals max(0, the unfloored sum), and is zero whenever the unfloored sum is not positive.
  5. Metamorphic:
    • Removing the spouse's own IRA deduction, early withdrawal penalty and alimony leaves the head's deductions unchanged. Student loan interest is excluded because its phase-out reads joint MAGI.
    • Swapping the spouses' incomes and deductions leaves every member's household income unchanged.
    • Lowering a spouse's self-employment income never raises household income.

These invariants are checked in policyengine_us/tests/core/test_medicaid_household_income_invariants.py, using 20 drawn batches of 10–40 households plus a seeded population of 200. The merge adds a property drawing signed MAGI for six co-resident people: two unmarried parents, their two children, a grandmother and an unrelated adult. An independent membership matrix checks both household size and max(0, signed member sum), including exclusion of relatives outside each person's household. Children's required-to-file flags are inputs, so this property isolates membership and netting. The fixture supplies person and parent IDs as dictionaries for the tested year (2025).

Tests

The list combines original PR coverage with the two HSA integration cases. Earlier run results below are historical; fresh commands and results for this candidate are recorded at the end of this section. YAML expectations are hand-computed:

  • medicaid_household_income.yaml (new, 13 cases):

    • three CMS training-manual scenarios (Sam, Marty, Sadie/Stephanie), unchanged by this PR;
    • a joint loss;
    • one spouse's IRA deduction;
    • a negative joint MAGI with a dependent required to file (Form 8962 line 3);
    • a dependent with negative MAGI;
    • cohabiting spouses filing separately;
    • non-filer spouses;
    • a negative total floored to zero;
    • a grandparent outside a child's non-filer household (from review r1);
    • an adult dependent of a filer whose cohabiting spouse files separately (from review r1);
    • married non-filer parents whose loss offsets their wages in their child's household (from review r2).

    The claimant path with a cohabiting separate spouse is already covered by Case 11 of medicaid_uses_non_filer_rules.yaml.

  • medicaid_magi_person.yaml (new, 2 cases).

  • medicaid_adjusted_gross_income_person.yaml (10 cases in the candidate):

    • original PR additions: spouse-only deductions, a spouse's negative AGI, and savings bond interest recorded on a dependent;
    • new HSA integration case: a $4,000 supplied spouse deduction gives own Medicaid AGIs of $60,000 and $36,000;
    • new HSA fallback case: a $4,000 tax-unit deduction with no person amounts gives $58,000 and $38,000.

    Both HSA cases reconcile to $96,000 joint AGI. The HSA refresh preserves the preceding eight cases' outputs.

  • medicaid_person_is_required_to_file.yaml (+2 cases): a self-employment loss; a 401(k) deferral.

Historical differential check before this merge refresh. The original PR ran the new and changed files against three checkouts:

Checkout Failing cases
main, bab1a47 14
#9890 alone 14
original PR branch 0

The grandparent case passes on main and on #9890 alone, as it should: it guards against a leak that signed sums would otherwise open. The original four invariant test cases failed on #9890 alone. For example, the brief's loss case gives $20,000 there.

Historical regression check before this merge refresh. Every YAML file under gov/hhs/medicaid/income/ passed on the original PR branch, as did is_older_child_for_medicaid, is_parent_for_medicaid, the CA CCHIP integration test, and the above-the-line deduction files. Those runs used single files and left full suites to CI.

Earlier merge verification (before the main merge with #9857): All 10 targeted files passed (120 cases), each run sequentially in the foreground. Runs used committed head ad2d76c1b0de997a748be051d8c801ef618d5eb9; its tested policyengine_us subtree is be1b6e89292e4880a3916f93836b7dc917e035ee. Final release merge 052420824c4b62bc4ff14c59607b354982de9515 preserves that exact subtree. The untracked source cache verified tracked source bytes and directory order; Hypothesis was the locked 6.168.3 version. Commands ran from .hubrepo with:

Each file ran on its own, sequentially in the foreground, against the repository's locked test dependencies.

Command File Passed Options
pytest policyengine_us/tests/core/test_medicaid_household_income_invariants.py 5 --durations=0
pytest policyengine_us/tests/core/test_spouse_above_the_line_deductions_invariants.py 7 --maxfail=1
pytest policyengine_us/tests/core/test_parent_links_properties.py 11 None
YAML policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/parent_ids_composition.yaml 47 None
YAML policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml 13 None
YAML policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_adjusted_gross_income_person.yaml 10 None
YAML policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_magi_person.yaml 2 None
YAML policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.yaml 8 None
YAML policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_self_employment_loss_addition.yaml 10 None
YAML policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_separate_capital_loss_adjustment.yaml 7 None

No partner contract expectations were edited. Full suites and microsimulation were not run for this merge refresh. Independent read-only source review: APPROVE for exact final local head 052420824c4b62bc4ff14c59607b354982de9515, with no unresolved P1/P2 findings. Approval covers the local source head only. The PR remains draft; current green CI and review of the current published head are required before readiness.

Methodology ruling (Max, d1120, 2026-10-09): approved as built. A non-filer Medicaid household sums its members' signed MAGI and floors only the household total at zero (42 CFR 435.603(d)(1); Form 8962 line 3). Unlinked relatives' income counts only when positive.

Hub microsimulation impact (current head)

A real microsimulation on the default dataset, main at the merge base 0a8c3c2c43 against this PR's head 6c5f5cddd8, for 2026. The runs went one at a time under the shared heavy-job lock. Sums are weighted.

Output 2026 change 2026 records changed (weighted)
medicaid +2,560 5,273 (18,057,956)
is_medicaid_eligible +194,970 73 (194,970)
is_chip_eligible -19,449 11 (19,449)
aca_ptc -342.79M 10 (23,336)
household_health_benefits +0 0 (0)
household_net_income_including_health_benefits -7.73M 3,652 (11,062,094)
state_income_tax -909,087 340 (297,226)
income_tax +27.46M 857 (2,200,173)
household_net_income -20.74M 1,106 (2,310,990)
household_benefits +5.81M 8 (5,668)

This run is at the merged head. It matches the pre-merge run at 052420824c to within $560 and one record in every row, so the #9857 merge doesn't change the PR's population effect. Medicaid spending barely moves because each state's total is a calibrated amount: more enrollees lower the amount per enrollee, not the total (see Impact below).

Comparison files are in fixes/9860-impact/ on the hub host.

Impact

Historical microsimulation, kept for the mechanism. The current-head estimate is the hub table above. The table below was measured on the default dataset with the hub runner (lockrun.sh, run.py, compare.py), comparing #9890's then-head 36058bac8d with this PR's then-head d4b561e7a1. It does not measure the current candidate against current main or current #9890. In those earlier runs, #9890 changed no Medicaid, CHIP or ACA variable in either year against its then-main baseline. One run per checkout per year. Dollar changes are weighted totals; "records" counts changed microdata records. The 2024 figures were identical, to the dollar, to the earlier pair of runs (986d04658a and 1681b9b487). No new microsimulation was run for this merge refresh.

Variable 2024 change 2024 records 2026 change 2026 records
Medicaid eligible (people) +83,335 75 (all up) +224,472 81 (all up)
Medicaid enrolled (people) +66,228 66 (all up) +180,844 70 (all up)
CHIP eligible and enrolled (people) −31,590 17 −40,096 14
CHIP spending −$108M 17 −$127M 14
Medicaid spending −$2,318 (none, in effect) 5,390 +$4,539 (none, in effect) 7,077
ACA PTC −$17.8M 12 −$343M 12
ACA PTC eligible (people) −1,551 22 −59,622 22
medicaid_magi_person (sum) −$38.2B 31,557 −$34.1B 31,586
medicaid_household_income (sum over people) −$27.7B 18,490 (5,297 up, 13,193 down) −$34.4B 18,613 (5,970 up, 12,643 down)
medicaid_person_is_required_to_file (people) −56,588 48 −58,988 44
Federal income_tax, state income taxes, AGI none 0 none 0
household_net_income +$4.75M 5 +$10.79M 9

Medicaid spending stays the same because each state's total is a calibrated amount (calibration.gov.hhs.medicaid.totals.spending). medicaid_cost_if_enrolled spreads it over that state's enrollees, weighted by cost index (medicaid_slcsp_state_denominator). More enrollees lower the amount per enrollee, not the total. medicaid_magi_person falls because members' negative MAGI is no longer floored. Two changes in this PR can also raise household income: dependents now count the claimant's separate spouse, and the filing-requirement fix can newly count a dependent's positive income. The increases were not decomposed between them.

In the historical comparison, the brief's attempt to switch Medicaid AGI to each spouse's own deductions while keeping the per-person floor cut eligibility by about 137,000. The historical combined fix instead raised eligibility. These figures do not establish the current merge's impact.

axiom: TheAxiomFoundation/rulespec-us#1507 queued (42 CFR 435.603(d)(1): us/policies/medicaid/magi_household_income_pipeline.yaml already sums members' MAGI with no per-member floor; the queued companion tests pin a spouse's negative MAGI offsetting the household)

🤖 Generated with Claude Code

MaxGhenis and others added 6 commits October 6, 2026 06:27
adjusted_gross_income_person split every above-the-line deduction other than
the three self-employment ones 50/50 between head and spouse on a joint
return. Each person now takes their own deductions through
above_the_line_deductions_person; only tax-unit-level inputs (HSA, tuition
and fees, domestic production, possession income) are divided equally.
Adds alimony_expense_ald_person, loss_ald_person and
limited_capital_loss_person, moves Medicaid's per-person AGI and Montana's
Social Security worksheet onto the same attribution, and applies Montana's
capital loss rule for spouses filing separately (MCA 15-30-2110(6)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loss_ald_person now divides the Section 461(l)-limited business loss by each
spouse's business losses and the rest of loss_ald by their capital losses, so
it stays right when loss_ald gains capital components (#9788). Adds the
filer_share helper used by the per-person deduction variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Attributing each spouse's deductions in Medicaid AGI without also netting the
couple's MAGI before medicaid_magi_person's zero floor moved Medicaid
eligibility in both directions; the two belong in one Medicaid change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…view r1 fixes; strengthen property test

The property test's new independent 461(l) check still has a test-side
indexing bug: the model gives the right limited_business_loss (256,000 for a
2026 single filer with a 1.5M loss).

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

above_the_line_deductions_person gave a tax unit dependent every person-level
deduction recorded on them, including employer adoption assistance and
education savings bond interest, which gov.irs.ald.filer_amounts_recorded_on_dependents
marks as the filer's. Those now count only for the head and spouse, whose
parts already take them up through above_the_line_deductions. The dependent's
part matters once Medicaid AGI reads it for a dependent's own return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits October 6, 2026 09:17
…d spouse

Education savings bond interest and employer adoption assistance recorded on
a dependent are the filer's (gov.irs.ald.filer_amounts_recorded_on_dependents),
but which spouse's is not recorded. They reached the head's and spouse's parts
through the reconciliation to above_the_line_deductions, in proportion to
each spouse's other deductions, so the spouse's IRA deduction changed the
head's share. They are now divided equally, as the other amounts recorded
only for the return are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Units that set a tax-unit deduction directly run in their own simulation.
  An input given for one tax unit is an input for every unit in a
  simulation, so one unit's loss_ald set to 0 zeroed every other unit's.
- The Section 461(l) reference keeps each business source's gain and loss
  separate (aggregate income against aggregate deductions), as the model
  does, rather than netting a person's sources first.
- The capital loss reference nets losses against capital gains and
  distributions before the 1211(b) limit, as main does since #9788.
- The alimony identity skips units that set alimony_expense_ald directly:
  alimony_expense_ald_person stays each payer's own alimony there.
- The reference gives a dependent's filer amounts to the head and spouse
  equally.

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

above_the_line_deductions_person now reads gov.irs.ald.filer_amounts_recorded_on_dependents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits October 6, 2026 10:35
…ouse AGI

With each spouse's own deductions, a spouse with a business loss or an IRA
deduction above their income has negative AGI, and these two withholding
estimates multiplied it by the rate. Every other state's withholding formula
already floors its base at zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
va_agi_person divides tax-unit additions by each spouse's share of federal
AGI. A spouse with negative AGI got a negative share and the other spouse
more than all of it. A spouse with negative AGI now gets none, as
#9878 does for Delaware's itemized deductions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Directly set loss_ald still reconciles through loss_ald_person, so its identity is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the medicaid-magi-joint-floor branch from 016520c to e3660c8 Compare October 6, 2026 14:36
…ules are modeled

Montana spouses who filed separately on one form through 2023 allocate
capital losses by one of two elections (ARM 42.15.206(3)) and recompute the
Section 461(l) limit with the single filer's threshold. Neither is modeled.
Giving each spouse their own federal losses instead of half moved Montana
away from both. With one spouse's $1,000 gain against the other's $3,000
loss, the loss spouse's AGI was $7,000, though separate tracking caps the
loss at $1,500 ($8,500). A $600,000 business loss on one spouse used the
joint limit, lowering tax by $45.65 against main.

mt_loss_ald_reallocation adds back to each spouse's federal AGI the
difference between their own loss_ald_person and an equal share of the
return's loss_ald, so Montana divides losses as before. The IRA and other
deductions still go to the spouse who has them (former MCA 15-30-2110(8);
ARM 42.15.206(1)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the medicaid-magi-joint-floor branch from e3660c8 to 14a53e3 Compare October 6, 2026 16:27
…t return's AGI

mt_standard_deduction_joint and mt_medical_expense_deduction_joint added each
spouse's mt_agi_indiv, which is floored at zero. With each spouse's own
deductions, a spousal IRA above that spouse's income was lost to the floor:
head wages $30,000 and a $6,000 spousal IRA gave a joint deduction of $6,000
(20% of $30,000) instead of $4,920 (the floor, 20% of the joint $24,000
being less). Both now read mt_agi_joint, the joint column's Montana AGI
through 2023. Their tests take mt_agi_joint as the input. Adds the spousal
IRA case, a single filer's loss and a case with student loan interest and an
IRA in each spouse's own column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the medicaid-magi-joint-floor branch from 1681b9b to b8be91c Compare October 6, 2026 20:48
Review r5: the medical floor had no year gate, so reading mt_agi_joint also
changed 2024 and later, when mt_agi_indiv is zero for everyone and main's
floor was zero. From 2024 Montana starts from federal itemized deductions,
whose floor is a share of federal AGI, a separate fix. The joint AGI now
applies while married filing separately on the same return is allowed
(through 2023); 2024 on is unchanged from main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the medicaid-magi-joint-floor branch from b8be91c to 4afd853 Compare October 6, 2026 21:31
Comment only (review r6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 5 commits October 7, 2026 06:36
…se allocation from 2024

Per Max's d1014 ruling:
- DC: spouses filing separately on the same return each deduct their own
  capital losses up to their own capital gains plus the $1,500 married filing
  separately limit (D-40 instructions, line c), via
  dc_separate_capital_loss_adjustment. It applies only to the separate column;
  dc_taxable_income_joint keeps the federal joint deduction.
- Montana: mt_loss_ald_reallocation and mt_applicable_ald_deductions apply only
  while spouses may file separately on the same form (through 2023).

Adds YAML cases and DC/Montana invariants to the spouse property test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bute each spouse's own deductions

medicaid_magi_person floored each person's MAGI at zero, and
medicaid_household_income added the floored amounts, so a spouse's business
loss never offset the other spouse's wages on their joint return. Household
income is the sum of every member's MAGI-based income (42 CFR 435.603(d)(1)),
and the 36B methodology the regulation adopts (435.603(e)) combines the
taxpayer's and dependents' modified AGIs "even if one or both of them are
negative" before entering a negative total as zero (Form 8962, line 3).
medicaid_magi_person is now unfloored and medicaid_household_income floors
only the household's total.

medicaid_adjusted_gross_income_person now subtracts
above_the_line_deductions_person, so each spouse's own IRA deduction,
student loan interest, alimony and business and capital losses lower only
their own amount, and a dependent's own deductions, alimony paid included,
lower the dependent's own AGI. Tax-unit-only MAGI additions are divided
equally between the head and spouse with filer_share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned in the Medicaid filing test

medicaid_person_is_required_to_file took unearned income as gross income less
earned_income. Gross income counts each source's positive amount, so a
self-employment loss made other income look unearned: a dependent with a
5,000 loss and 100 of interest had 5,100 of unearned income and was required
to file. With household members' MAGI no longer floored, that would count the
dependent's negative income. Unearned income is now gross income less the
positive wage and self-employment sources it includes (Pub. 501, Table 2),
which also stops 401(k) deferrals, left out of box 1 wages, from hiding
unearned income.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hypothesis draws batches of joint filers with dependent children, non-filing
couples, cohabiting spouses filing separately and single filers, with losses,
own deductions and children who may be required to file. For every
household: joint filers' household income is max(0, J + D), with J the
couple's MAGI figured from the tax unit's AGI; the spouses' MAGIs add up to
J; spouses outside a joint return are netted before the floor; income is
never negative and is zero exactly when the unfloored sum is not positive;
and three metamorphic relations hold (the spouse's own deductions never
change the head's, swapping spouses changes nothing, and lowering the
spouse's self-employment income never raises household income).

20 examples plus a seeded population of 200 households: 44 s wall and
1.17 GB peak locally (macOS, loaded host).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive dependents the claimant's separate spouse

Two findings from review r1:

- A non-filer household's parents and siblings are read from the whole family,
  which can include people outside the household, such as a grandparent who
  is also a parent there. With signed amounts, a grandmother's $5,000 loss
  cut her granddaughter's household income from $12,000 to $7,000, though
  42 CFR 435.603(f)(3)(iii) leaves her out. Those relatives' amounts are now
  added only when positive: each child's, and each couple's parents' netted
  together, so married parents' losses still offset each other. The
  individual's and spouse's amounts stay signed.
  #9406's co-resident parent IDs fix the
  membership itself.
- A dependent's tax household is the claimant's (435.603(f)(2)), which
  includes the claimant's cohabiting spouse who files separately (f)(4).
  Household size already counted that spouse; household income now does
  too.

Also corrects two comments to the 2025 standard deduction, $15,750.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2 notes:
- A non-filer child's own amount and their siblings' enter with the
  family's children, only when positive, and unmarried co-resident parents
  are each counted only when positive. The documentation now says so,
  rather than "always added signed".
- Medicaid AGI documentation says a dependent's own business and capital
  losses are not modeled.
- New case: married non-filer parents, $12,000 of wages and a $5,000
  business loss, give their child's household $7,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the medicaid-magi-joint-floor branch from 9824d72 to d4b561e Compare October 7, 2026 10:37
…oss_ald

Review r7: dc_separate_capital_loss_adjustment removed the computed capital
loss deduction even when loss_ald was set directly, so it took out an amount
federal AGI did not contain. It now removes the capital part of each spouse's
loss_ald_person (loss_ald less the business loss, by own capital losses). Adds
YAML cases with loss_ald set to $0 and $1,000, and the property test checks
every unit against that capital part, keeping the nonnegative couple sum for
computed units only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 6 commits October 7, 2026 10:57
…s_ald

Review r8: with loss_ald set directly and both business and capital losses,
dc_self_employment_loss_addition isolated the business loss by subtracting
the computed capital deduction, while loss_ald_person (and so federal AGI and
the DC capital adjustment) takes the business part first. Use
min(limited_business_loss, loss_ald), as loss_ald_person does; the amount is
unchanged when loss_ald is computed. Adds computed and direct mixed-loss YAML
cases.

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

Copy link
Copy Markdown
Contributor Author

Context for the hub from the original session, which is handing this PR over and will not push to it.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant