Repository navigation
Offset SSTB and non-SSTB Schedule C results in federal AGI - #9995
Conversation
irs_gross_income counts each Schedule C category's profit on its own, but loss_ald took the loss only from the net total_self_employment_income, so a loss in one category next to a profit in the other never reached AGI. loss_ald now takes each category's profit and loss on its own. Fixes #9989. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The all-member reference in test_dependent_losses_agi_invariants netted self_employment_income and sstb_self_employment_income per person before splitting income from loss, so it disagreed with loss_ald once loss_ald takes each category on its own (#9989). Use each input on its own, as irs_gross_income does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed the two red checks:
|
Main moved the section 461(l) business-loss logic from loss_ald into limited_business_loss. Take main's loss_ald and apply the per-category Schedule C change to limited_business_loss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…locations Wisconsin's homestead disqualified-loss add-back, Kentucky's spouse loss allocation and Maryland's two-income loss allocation took the Schedule C loss from the net total_self_employment_income, matching the old loss_ald. They now take each category on its own, as loss_ald does. The 2023 Schedule H instructions (line 11j, page 16) say not to net a business with a gain against one with a loss, and the 2025 Form 740 instructions (page 13, line 9) say each spouse claims their own income and deductions. The loss_ald extraction parity reference now treats each category as its own source as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hua7450
left a comment
There was a problem hiding this comment.
Approving. Read all 11 files at d922bb7 plus irs_gross_income with gov/irs/gross_income/sources.yaml, loss_ald, limited_business_loss on main, adjusted_gross_income, wi_homestead_disqualified_losses, wi_homestead_income, the full ky_federal_agi and md_two_income_subtraction formulas, dc_self_employment_loss_addition and taxable_self_employment_income, against the 2024 Schedule C (lines 31 and 32a), Schedule 1 line 3, Form 1040 lines 8 to 11, IRC 461(l), the 2023 Wisconsin Schedule H instructions (page 16), the 2025 Kentucky Form 740 instructions and the Maryland two-income subtraction instructions.
Federal: irs_gross_income floors self_employment_income and sstb_self_employment_income separately, so taking the loss only from the net total dropped a loss that sat next to a profit in the other category. The new per-category profit and loss in limited_business_loss mirrors that, both Schedule C results go on Schedule 1 line 3 and net in AGI, and the 461(l) identity holds (I - min(L, I + T) = max(I - L, -T)), so the cap is unchanged; the dependent mask and the other seven loss sources are untouched, as are the capital pieces. The 5,000 SSTB profit / 5,000 non-SSTB loss household now gives AGI 0.
Wisconsin: with the federal change, the earlier total_self_employment_income entry would have given household income 0 for that household; listing the two categories separately gives 5,000, which is what the line 11j text requires ("consider each business individually. Do not net a business with a gain against a business with a loss"; Example 1 adds back the full 30,000 beside a 20,000 profit). Kentucky: the spouse who owns both Schedules C now carries the loss, [0, 40,000] on the new case instead of the old [2,500, 37,500] split, consistent with "Each spouse must claim his or her own income and deductions"; a couple with one category each gives [-5,000, 5,000]. Maryland: the split only enters the no-gross-income branch, where both categories are zero or negative, so it is a no-op as the description says. All 18 YAML cases across the six test files recompute by hand, and each new case fails on the old lines. Other consumers (MA, MI, ND, AZ, MT) need no change; DC stays on the net and only diverges when the 461(l) cap binds, which issue 9867 already covers. CI is fully green and the axiom: line is present.
Merge interaction with PR 9890: loss_ald_person.BUSINESS_INCOME_SOURCES and its test list still use total_self_employment_income, so whichever lands second must apply the same split or adjusted_gross_income_person stays [2,500, 37,500] for the Kentucky household.
Nits, not blocking:
- The Kentucky comment and description cite "page 13, line 9", but the quoted sentence sits under the Filing Status 2 / line 5 instructions; line 9 is Kentucky AGI.
- Three comments still say "as loss_ald deducts them" where
limited_business_lossnow holds the per-category floor. - The
_pre_extraction_referencedocstring in the core test predates the split. - Optional: assert
limited_business_loss: 5_000in the federal cases to pin the deducted amount, not only AGI.
Pre-existing, for follow-ups: the 50/50 loss_ald split in adjusted_gross_income_person (9890 fixes it) and the DC cap-binding divergence.
Fixes #9989
What and why
irs_gross_incomecounts each Schedule C category's profit on its own (self_employment_incomeandsstb_self_employment_incomeare separate entries ingov.irs.gross_income.sources, each floored at zero), but the business-loss deduction took the loss only from the nettotal_self_employment_income. A loss in one category next to a profit in the other was dropped: a non-SSTB loss of 5,000 and an SSTB profit of 5,000 gave AGI 5,000.limited_business_loss(moved out ofloss_aldby #9762) now takes each category's profit and loss on its own, the same wayirs_gross_incomecounts them. Per the 2024 Schedule C (lines 31 and 32a), both results go on Schedule 1 line 3, which flows to Form 1040 lines 8, 9 and 11, so AGI is 0. #9989 has the verbatim form quotes.State code that matched the old net loss now takes each category on its own too:
disqualified_loss_sources): the 2023 Schedule H instructions, line 11j (page 16), say "consider each business individually. Do not net a business with a gain against a business with a loss" (Example 1: two Schedules C). The add-back now lists the two categories separately. Without this, household income inwi_homestead_income.yamlcase 5 fell from 5,000 to 0, the CI failure on the previous push.ky_federal_agi): the 2025 Form 740 instructions, page 13, line 9: "Each spouse must claim his or her own income and deductions. The total of line 5, Columns A and B, must equal the combined federal adjusted gross income." The spouse who owns both Schedules C now gets the loss; before, it was split 50/50 when that spouse's net was 0.md_two_income_subtraction):BUSINESS_LOSS_SOURCESlists the two categories separately. That split only runs when the couple has no gross income, where both categories are zero or negative, so results do not change.Notes:
I, lossLand thresholdT, the allowed net isI − min(L, I + T) = max(I − L, −T)whether or not the categories are netted first.dc_self_employment_loss_additionalso uses the net of the two categories. The D-40 Schedule I line 6 text ("Pass through losses from DC unincorporated businesses that exceed the $12,000 threshold") does not say how to treat two businesses, and D.C. Schedule I line 6: the $12,000 threshold is a business gross-income test, not a loss threshold #9867 already questions that rule. Michigan (MCL 206.508(4) nets all business income and loss) and North Dakota's marriage penalty credit use their own definitions and do not change.test_dependent_losses_agi_invariants.pyandtest_loss_ald_extraction_parity.pybuild an independent reference of the old formula; both references now treat each category as its own source.Test plan
self_employment_income.yaml. Expected values come from the 2024 Schedule C, Schedule 1 and Form 1040 arithmetic in Federal AGI drops a Schedule C loss when the same person has Schedule C profit in the other SSTB category #9989 (AGI 0, 0 and 50,000). All three fail without thelimited_business_losschange and pass with it.wi_homestead_disqualified_losses.yamlcase 9 (expected 5,000 from the line 11j instructions) andwi_homestead_income.yamlcase 5 fail without the Wisconsin change and pass with it.ky_federal_agi.yamlcase (expected[0, 40_000]from the Form 740 line 9 instructions) fails without the Kentucky change ([2_500, 37_500]) and passes with it.00ce2281d0): states WI 361, KY 594, MD 606, DC 397 passed, and the targeted federal, Wisconsin, Kentucky and Python loss tests pass. On the previous merge with main (2308800c88): IRS shard 1,892 passed; 55 other YAML files that referenceloss_ald,limited_business_lossorsstb_self_employment_income461 passed; 34 Python test files that reference these variables 378 passed.ruff formatandruff check(ruff 0.15.5, as inuv.lock)changelog.d/axiom: TheAxiomFoundation/rulespec-us#1542 queued (§62(a)(1) composition, deferred in
us/statutes/26/62.yaml; the signed encoder run needs approval)🤖 Generated with Claude Code