Repository navigation
Give each spouse their own above-the-line deductions in per-person AGI - #9890
Merged
Merged
Conversation
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>
…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>
…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>
…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>
…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>
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>
Comment only (review r6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
…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>
…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>
6 tasks done
This was referenced Oct 7, 2026
MaxGhenis
added a commit
that referenced
this pull request
Oct 8, 2026
Re-review 3 of #10004: alimony, educator expense and HSA deductions are tax-unit variables with person-level counterparts that record whose they are, but the zero-income fallback split them equally. One spouse paying $2,000 of deductible alimony then reached the $1,200 cap instead of the worksheet's $1,000. Each such deduction is now split by the spouses' counterpart amounts, and equally only when neither has one, as adjusted_gross_income_person does in #9890. New YAML cases cover alimony (both labellings), educator expenses and an HSA deduction with a recorded owner; main already got these right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Oct 9, 2026
…uses their own losses, report the whole Virginia EITC (#10004) * Count only deductible mortgage interest in Montana; report the whole Virginia EITC Montana's itemized deductions (2018-2023 under MCA 15-30-2131(1)(a), which takes the IRC section 161 items as amended per MCA 15-30-2101) allow the home mortgage interest "allowed by federal law" (Form 2 instructions, line 9), so interest on acquisition debt above the IRC 163(h)(3) caps is not deductible. The four Montana itemized deduction variables used `mortgage_interest`, which adds `non_deductible_mortgage_interest`; they now use `deductible_mortgage_interest`. `va_eitc` returned only the head's VAGI share of the credit for SEPARATE units, so a two-adult SEPARATE unit's reported credit depended on which spouse was labelled head, and a dependent's Virginia subtractions scaled a lone filer's credit. Spouses filing separately together claim the whole credit (Form 760 instructions: EIC shares by earned income, the low-income credit on one return), and the tax already applies the whole credit, so `va_eitc` now reports it for every filing status. `va_eitc_person` and `va_agi_share` fed only that branch and are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Name the separate-filer Virginia EITC case for what it checks On main a dependent's Virginia subtractions raise the filer's VAGI share above 1, so the case guards against any dependence, not only a reduction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check Montana's mortgage interest against the federal cap for every balance A grid of couples (balance, origination year, interest, the spouse's share) restates the 26 U.S.C. 163(h)(3) caps independently of the parameter files and checks the four Montana itemized deduction variables against them, on the joint path every year and on the separate-on-the-same-form path through 2023. Fails on main for the 12 of 60 joint units where a cap binds (largest difference $28,000); passes here. Locally (macOS arm64, not CI): about 1 s of test time, 15.7 s wall including import, 1.14 GB peak RSS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give each Maryland spouse their own losses when the couple has no gross income Worksheet 13D line 1 takes "the portion of federal adjusted gross income ... attributable to each spouse". Gross income never goes below zero here, so with no gross income the couple's AGI is their losses and above-the-line deductions. md_two_income_subtraction gave all of it to the head. When one spouse had the whole loss that was the legal answer, because the subtraction takes the smaller spouse. But when both spouses had losses it was not: two spouses with -$20,000 each and $35,000 each of Maryland additions get $1,200 by the worksheet and $0 on main. Each spouse's portion now follows their own losses (the person-level sources of loss_ald) and person-level deductions, with deductions recorded only for the tax unit split equally. Also from the review of #10004: Montana's separate-on-the-same-form cases state the joint federal filing status and the cap assumption, a federal separate return's $375,000 cap gets its own case, va_eitc's documentation describes the applied credit, and the removed Virginia variables are listed in a changelog fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Split Maryland zero-income couples' allowed losses by kind, and the rest equally The re-review of #10004 found two gaps in the previous commit. It weighted by raw losses, so a spouse with a -$100,000 capital loss (only $3,000 allowed) took most of the couple's -$23,000 AGI: $833 instead of the worksheet's $0. And it scaled deductions recorded only for the tax unit by the spouses' own items instead of splitting them equally. With no gross income, md_two_income_subtraction now builds each spouse's portion of federal AGI from: - the allowed business and capital parts of loss_ald (the capital part is limited_capital_loss plus capital_losses_allowed_against_gains), each split by the spouses' own losses of that kind; - their own person-level above-the-line deductions; - half of whatever is recorded only for the tax unit. New YAML cases cover the capped capital loss under both labellings and a tax-unit HSA deduction. 600 random zero-income couples give the same result under either labelling. The Montana property test now checks the model's separate-filing switch against the 2023 boundary instead of skipping when it is off, and says what the grid catches that the YAML cases do not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give Maryland spouses the deductions their person-level amounts record Re-review 3 of #10004: alimony, educator expense and HSA deductions are tax-unit variables with person-level counterparts that record whose they are, but the zero-income fallback split them equally. One spouse paying $2,000 of deductible alimony then reached the $1,200 cap instead of the worksheet's $1,000. Each such deduction is now split by the spouses' counterpart amounts, and equally only when neither has one, as adjusted_gross_income_person does in #9890. New YAML cases cover alimony (both labellings), educator expenses and an HSA deduction with a recorded owner; main already got these right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Sum Maryland business losses in a loop, not built-in sum() over entity calls test_no_builtin_sum_over_entity_calls failed CI at 8800580. The loop adds the same arrays, so results are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
US + core hub merge audit, us#9890 at
|
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR attributes each spouse's federal above-the-line deductions to the person who owns them.
adjusted_gross_income_personcurrently splits most deductions equally on a joint return, so one spouse's IRA deduction or business loss can lower the other spouse's state AGI. The new person-level allocator preserves the federal tax-unit totals while changing the person amounts read by state taxes, benefits and withholding estimates.above_the_line_deductions_personcombines each person's deduction amounts. IRA deductions, early withdrawal penalties, student loan interest, adoption assistance and U.S. savings bonds for education follow the person who has them.loss_ald_persondivides the allowed business loss by each spouse's own business, farm, rental, estate and partnership losses. A tax-unit-only Form 4797 loss counts equally. The capital portion follows each spouse's own capital losses, including losses allowed against gains and the net capital-loss limit. Main'slimited_business_losssupplies the federal Section 461(l) calculation;limited_capital_loss_personandalimony_expense_ald_personprovide the other person amounts.filer_sharecomputes a head's or spouse's share, with an equal fallback and zero for dependents. A dependent'sabove_the_line_deductions_personkeeps their own person-level deductions for their own return, excluding filer amounts recorded on dependents. Theiradjusted_gross_income_person,loss_ald_personandlimited_capital_loss_personremain zero.adjusted_gross_income_personbecomesirs_gross_income − above_the_line_deductions_person. The head's and spouse's amounts still sum to federaladjusted_gross_income.mt_loss_ald_reallocation; Montana's historical loss elections and separate Section 461(l) threshold remain follow-ups. From 2024,mt_agi_indiv,mt_applicable_ald_deductionsandmt_loss_ald_reallocationapply only while separate filing on the same return is eligible, so they produce no spouse allocation after that filing arrangement ended.dc_separate_capital_loss_adjustmentreplaces the capital portion actually carried in each spouse's federal AGI with their own capital losses, limited to their own gains and distributions plus $1,500. The separate taxable-income and deduction-allocation paths use it. The joint taxable-income path preserves the joint federal deduction.dc_self_employment_loss_additionusesmin(limited_business_loss, loss_ald)for the business component and retains main's exclusion of dependent losses. The business component agrees with main whenloss_aldis computed; directly supplied totals use business losses first.The Montana joint standard and medical deduction fixes already landed in #9903. This PR uses main's formulas and tests for those deductions, including the federal medical expense deduction from 2024.
The merge also retains main's per-educator cap through
educator_expense_ald_person(#9833) and person HSA inputhealth_savings_account_ald_person(#9865). The spouse allocator uses those person amounts and reconciles them to the return total; HSA is equally divided only when no filer account-holder amount is available.Consumers and modeling choices
Max approved the state-specific loss treatment in decision d1014.
de_pre_exclusions_agiva_agi_personand Spouse Tax AdjustmentProportional allocation where state law leaves the joint-limit ratio unspecified is a modeling choice, using each spouse's own losses as the ownership measure. It gives all of a sole spouse's loss to that spouse. Tax-unit-only inputs retain an equal fallback; for HSA, 26 USC 223(b)(5) provides equal allocation unless spouses agree otherwise.
Invariants and coverage
The spouse property tests cover KY, MT, DE, VA, DC, OH and WV in 2020, 2023 and 2026:
loss_aldcan require a negative adjustment.YAML cases cover sole and joint loss owners, deductions supplied directly, DC capital-loss limits and mixed business/capital losses, Montana's pre-2024 and post-2023 paths, state AGI consumers, and withholding floors. The r8 direct DC example (
loss_ald: 22000, business loss $20,000, capital loss $5,000) expects a business add-back of $8,000, capital adjustment of $500 and separate taxable incomes of $17,300/$40,000.The new HSA reconciliation case supplies person amounts of $1,000/$3,000 and a return deduction of $6,000, expecting person deductions of $1,500/$4,500. Two 2020 IRA compensation regressions preserve ownership while showing the shared-limit interaction: $1,000/$3,000 of wages and $3,000 of contributions each yield deductions of $1,000/$3,000; removing the higher earner's contributions frees compensation for the lower earner, yielding deductions of $3,000/$0 and person AGIs of −$2,000/$3,000.
The determinism test retains eight unit cases and six independent hash-seed interpreters, with one complete US household simulation as the oracle. Each seed child uses actual core holders and projectors plus five production formulas (
above_the_line_deductions,above_the_line_deductions_person,loss_ald_person,adjusted_gross_income_personandstudent_loan_interest_ald_magi), using live parameter lists and explicit dependency values captured from that oracle. Values, dtypes and exact bytes must agree. The children focus on summation; default country construction and other deduction eligibility are evaluated once by the parent.Tests
Completed sequential Python runs at
a1a10fc21ff1969e2bae9a929368907f84a5122a:test_spouse_above_the_line_deductions_invariants.py(new)test_dependent_above_the_line_deductions_invariants.pyThe later determinism-only change and conflict-free main merge do not change these test files or the spouse allocator.
make formatpasses.Required YAML validation remains blocked on local runtime conditions: 132 cases in 19 explicit baseline files, plus 8 cases in
partners/my_friend_ben/2024.yamlandpartners/analytics_coverage/signatures/il.yaml. The first permitted 12-file baseline batch was interrupted in startup without reaching a case; the other baseline batch and partner files were not run. Shared-machine load averages exceeded 325. Python files and partner files run individually, with only one test process active. Partner expectations remain unchanged; pending runs cannot establish whether any partner output moves.Both the original merged-head determinism test and its revised isolated seed fixture passed eight unit cases before a child exceeded the 180-second timeout on the busy shared machine. An isolated diagnostic of the revised fixture later completed with the expected float32 values and bytes. These attempts are preserved as failed attempts, not passing tests. A further retry was interrupted after roughly half an hour in startup without test output. Complete determinism validation remains blocked on local runtime conditions.
Dependencies and follow-ups
axiom: TheAxiomFoundation/rulespec-us#1517 queued
Hub microsimulation impact (current head)
A real microsimulation on the default dataset, main at the merge base
4fbf8476b5against this PR's headf65aab3e3d, for 2026. The runs went one at a time under the shared heavy-job lock. Sums are weighted.adjusted_gross_income_personstate_income_taxky_income_taxde_income_taxdc_income_taxva_income_taxoh_income_taxwv_income_taxmi_income_taxpa_income_taxmt_income_taxincome_taxhousehold_net_incomehousehold_benefitsWhere the federal change comes from. Federal AGI does not change.
salt_deductiontakesreported_salt, which takesstate_and_local_sales_or_income_tax, the larger of sales tax andstate_withheld_income_tax. All 42 state*_withheld_income_taxestimates on main readadjusted_gross_income_person, so moving a deduction to the spouse who owns it changes the estimated state withholding that is itemized as SALT, and with it federal taxable income. A hub breakdown on the fixed 10% household sample (a check only; the figures above are the full-file run) places the wholeincome_taxchange in the itemized SALT deduction. AGI, the standard deduction, the QBI deduction, AMT, NIIT, the additional Medicare tax, the EITC, CDCC, saver's credit, PTC, AOC, the elderly credit and taxable Social Security do not change on that sample; the CTC moves only between its refundable and non-refundable parts in 5 records. Variables this PR adds (loss_ald_person,above_the_line_deductions_person) have no value on the base side, so the table leaves them out.Comparison files are in
fixes/9890-impact/on the hub host.