Skip to content

Use the filers' Schedule D for the tax on net capital gain - #9855

Merged
MaxGhenis merged 9 commits into
mainfrom
ncg-filer-gains-floor-distributions
Oct 9, 2026
Merged

MaxGhenis merged 9 commits into
mainfrom
ncg-filer-gains-floor-distributions

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preferential capital gains tax uses the filers' own capital income. A dependent's gains, losses, qualified dividends and Form 4952 election belong to the dependent's return. This PR excludes those amounts from the parent's federal rate calculation, floors each filer's negative capital gain distributions at zero, and aligns the affected Hawaii and Vermont calculations.

The current head is 982378520b. Its model code is unchanged from 63e4df4ab8, which the hub measured below: 982378520b corrects only the changelog fragment and one helper docstring. The comparison base is 7b956eb4014e3a189075c79f9b1f0a8f1d3b02ab.

Law and forms

  • 26 U.S.C. 1222(11) defines net capital gain using net long-term gain and net short-term loss. 2025 Schedule D reports short-term gain on line 7, distributions on line 13, long-term gain on line 15, and their combination on line 16.
  • 26 U.S.C. 1(h) adds qualified dividends for preferential rates and removes income elected for investment-interest purposes. The 2025 Schedule D instructions, page 15 use qualified dividends on worksheet line 2, Form 4952 amounts on lines 3 and 4, and the smaller of Schedule D lines 15 and 16 on line 7. The election consumes eligible gain before dividends.
  • The 2025 Schedule D instructions, page 2 place distributions reported in Form 1099-DIV box 2a on Schedule D line 13. The input floor matches the existing AGI treatment.
  • A child's interest, dividends and capital gain distributions normally belong to the child's return unless the parent makes the Form 8814 election. This model has no Form 8814 election or Form 8615 kiddie tax.

Implementation

filer_schedule_d_lines supplies lines 7, 15 and 16 to the routing flag, net_capital_gain and the Schedule D/Form 4952 worksheet. Hawaii's alternative-tax helper (hi_capital_gain_for_alternative_tax) also reads its lines 7 and 15. Filer membership means tax-unit members whose is_tax_unit_dependent flag is false. It nets their short-term gains and losses, and floors distributions separately for each filer before adding them to long-term gains.

Line 16 preserves a supplied tax-unit net_capital_gains: it subtracts dependents' person-level long- and short-term gains and adds filer distributions. Form 1040 line 7a, filer_loss_limited_net_capital_gains, independently sums the filers' person-level long_term_capital_gains and short_term_capital_gains; it does not read that supplied aggregate. This PR does not edit that variable, which overlaps #9796 and #9840. It does overlap the held #9977 (§163(d), held under d1054) in seven capital-gains files. This PR lands first, and #9977 merges main afterwards, keeping both PRs' changes in each file.

The 28% Rate Gain Worksheet reads filer short_term_capital_gains directly through tax_unit_non_dep_add; it does not call filer_schedule_d_lines. This preserves its minimal Core dependency contract, which excludes non_sch_d_capital_gains. Its model diff against the comparison base contains documentation and formatting changes only. Main already made both specialty worksheets filer-only in #9988; their added cases preserve that behavior.

Qualified dividends and Form 4952 elections are filer-only throughout the affected federal rate, section 911 and AMT paths. Hawaii's alternative-tax capital-gain helper now uses filer amounts. Vermont's flat exclusion subtracts filer qualified dividends from the now-filer-only adjusted gain. The existing regular-tax calculation, specialty worksheet contracts and separate section 199A QBID calculation are retained.

Properties and differential checks

The seven Python tests cover eight invariants using person-level capital inputs, explicit membership flags, joint filers, dependents and a deterministic grid of 300 households. These properties apply to component-derived amounts with nonnegative qualified dividends and bounded whole-dollar inputs; supplied aggregate overrides are excluded from the equivalence checks.

  1. With no filer election, G = max(0, min(L15, L16)) and net_capital_gain = G + Q, where L15 = Σ(LT + max(0, D)), L16 = L15 + Σ ST, and Q sums filer qualified dividends.
  2. With no filer election, the independent worksheet path agrees: dwks09 = G, worksheet line 6 equals Q, and dwks10 = net_capital_gain.
  3. The worksheet routing flag is true exactly when Q > 0 or both L15 and L16 are positive.
  4. The independent AGI-side calculation gives filer_loss_limited_net_capital_gains = max(-limit, L16), with a $3,000 limit for the generated single, joint and head-of-household cases. The formula also applies the statutory $1,500 married-filing-separately limit, which this generator does not exercise.
  5. Changing dependent capital inputs or elections leaves all 16 filer tax outputs unchanged, including AGI, taxable income, capital gains tax, AMT, regular tax and tax before credits.
  6. A negative distributions input has the same effect as zero, separately for each filer.
  7. Increasing a filer's long-term gain, short-term gain, nonnegative distributions or qualified dividends cannot reduce net capital gain, or increase it by more than the input increase.
  8. With a nonnegative filer election E, net_capital_gain = max(0, G + Q - E), dwks09 = max(0, G - E), and worksheet line 6 is max(0, Q - max(0, E - G)). The worksheet and statutory paths agree; regular tax before credits equals ordinary tax plus capital gains tax.

Known limitation: supplied aggregate inputs

An explicit net_capital_gains override can disagree with person-level gains. This preexisting aggregate/component split affects worksheet line 16 while the statutory net-capital-gain path uses lines 15 and 7. With supplied net_capital_gains: -5_000, zero person-level gains and $1,000 of distributions, line 16 is -$4,000, dwks09 = 0, dwks10 = 0, and the routing flag is false, but net_capital_gain = 1_000 and adjusted_net_capital_gain = 1_000. Section 911 also reads the component-derived gain. The existing YAML case records this discrepancy explicitly. It is outside the component-derived differential invariant and remains a separate modeling question. Prefer person-level capital inputs and derive aggregate amounts.

Tests

There are 17 new YAML cases against the comparison base: nine net-capital-gain cases, three 28% worksheet cases, one section 1250 case, two Form 4952 cases, one Hawaii case and one Vermont case. The 7 property tests check the invariants above. These are regression coverage; this body does not claim that every added case fails on base. In particular, the specialty worksheets already use filer-only inputs on base.

The earlier repair recorded seven filer property tests, two specialty Core property tests and 104 YAML cases across nine files passing at the earlier model head a90a4143c6. Those are historical results, not new results from this round. Fresh checks in this round:

  • The expanded Form 4952 YAML file passed all 15 cases through the official Core command, run alone. This includes dwks10, net_capital_gain and adjusted_net_capital_gain observations for the supplied-aggregate limitation. Pytest reported 34.82 seconds after model initialization and one plugin assertion-rewrite warning.
  • make format and lint passed (7,036 Python files unchanged), and the four documentation regressions passed.
  • Source-integrity checks confirmed unchanged executable helper code and retained inputs and existing expectations in all 15 Form 4952 cases.
  • The seven-test filer property module was interrupted during Hypothesis constant-cache collection: exit 2, no tests ran (587.18 seconds reported by pytest). This supplies no fresh property-test result.

No full suite, folder run or partner-contract test was run in this round. Existing property and differential coverage is retained, with no new test concurrency or CI jobs.

At repair head 63e4df4ab8aedb672e9acfaf87d79285c5b32ec3, all seven GitHub CI checks were skipped, including Python, baseline and partner tests; they supply no executed validation.

The documentation regressions check each review finding against source and test counts. All four failed against the original live body and passed against this complete replacement body. The source helper's obsolete 28% dependency claim is corrected alongside the body.

Hub microsimulation impact (model code at the current head)

A real microsimulation on the default dataset, main at the merge base 7b956eb401 against 63e4df4ab8, for 2025 and 2026. The current head 982378520b has the same model code. The runs went one at a time under the shared heavy-job lock. Sums are weighted.

Output 2025 change 2026 change 2025 records changed (weighted) 2026 records changed (weighted)
net_capital_gain -17.71bn -18.51bn 280 (545,690) 280 (549,587)
taxable_income +0 +0 0 (0) 0 (0)
state_income_tax -4.47M -4.65M 14 (30,287) 14 (30,503)
income_tax +1.68bn +1.56bn 247 (483,970) 245 (487,427)
household_net_income -1.68bn -1.56bn 247 (480,772) 245 (487,427)
household_benefits +0 +0 0 (0) 0 (0)

On main, irs_gross_income excludes dependents' income (irs_gross_income.py:16-19), but net_capital_gain summed every member's gains. So dependents' gains enlarged the preferential-rate portion of the filer's own taxable income. This PR uses the filers' Schedule D. Federal income tax rises $1.68bn (2025) and $1.56bn (2026) as that over-preferencing is removed. Household net income moves by minus the federal and state tax changes, to within $2,000, in both years.

State income tax falls $4.47M (2025) on 14 records. Two parts of this PR change state tax directly. Hawaii's alternative-tax gain becomes filer-only. Vermont's flat exclusion now subtracts only the filers' qualified dividends from the filer-only adjusted gain, so it can rise or fall. Other states' formulas also read federal amounts this PR changes. The hub hasn't split the net by state.

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

Impact

The hub table above is the population measurement for this head, which supersedes the earlier "pending" notes. The 15 Form 4952 YAML cases pass at 63e4df4ab8, and the delta to 982378520b is text only. CI runs the full suite when the PR leaves draft.

Scope, dependencies and partner impact

Partner contract files and expected outputs are untouched. The underlying PR can change partner-facing federal tax results for filers with dependent capital income or negative distribution inputs, and the affected Hawaii and Vermont taxes. Partner contract tests run in CI when the PR leaves draft.

net_capital_gains, loss_limited_net_capital_gains, dependent investment income for EITC, North Dakota's dividend subtraction and Vermont's 40% exclusion remain separate questions. This repair introduces no new policy interpretation.

Follows #9788.

axiom: 26 USC 1222(11) and 1(h) encoded-correct. The Axiom rulespec-us 1222 and 1(h) modules cover return-level gains and a gain election. Capital gain distributions under 852(b)(3)(B) remain rulespec-us#1490, queued with pe-parity, awaiting corpus ingestion and signed-encoder approval. No PR-specific HOLD was recorded in the original body; existing external holds and core rulings are unaffected.

MaxGhenis and others added 5 commits October 6, 2026 07:34
Net capital gain (26 U.S.C. 1222(11), 1(h)(11)), the Schedule D Tax
Worksheet and the 28% rate gain summed long- and short-term gains,
capital gain distributions, qualified dividends, collectibles gain and
Form 4952 elections over every tax unit member. Adjusted gross income
leaves out tax unit dependents, whose items are on their own returns
(2025 Form 8814, line 4), so a dependent's gain or dividends let the
filer's ordinary income be taxed at capital gain rates. The rate side
also added a negative capital gain distributions input, which AGI
floors at zero (Form 1099-DIV box 2a).

A new helper, filer_schedule_d_lines, gives the head and spouse's
Schedule D lines 7, 15 and 16 with distributions floored per person. It
now feeds filer_loss_limited_net_capital_gains (Form 1040 line 7a),
has_qdiv_or_ltcg, net_capital_gain and the worksheet's Form 4952 lines,
so the AGI side and the rate side read the same lines. Qualified
dividends, the Form 4952 election and the 28% rate gain inputs are
summed over the head and spouse with tax_unit_non_dep_add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the remaining pytest group's added time small: the file now takes
about 50 s of CPU locally (6 tests, 1.4 GB peak footprint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Line 16 of the filers' Schedule D now starts from the tax unit
net_capital_gains and takes out dependents' person-level gains and
losses, as #9796 does for Form 1040 line 7a. The Schedule D Tax
Worksheet read net_capital_gains on main, so a tax unit amount supplied
there keeps reaching worksheet line 7.

filer_loss_limited_net_capital_gains goes back to main's formula, so
this PR no longer edits the file #9796 and #9840 change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r1 found that Vermont's flat capital gains exclusion took every
member's qualified dividends out of the now filer-only
adjusted_net_capital_gain. A dependent's 3,000 of dividends cut a 4,000
exclusion to 1,000 (Vermont tax 936.33 to 1,036.82). The dividends are
now the head and spouse's, as in the federal amount.

Hawaii's Tax on Capital Gains Worksheet took the smaller of the filers'
net capital gain (line 7) and every member's long-term gains (line 4),
so a dependent's loss shrank the head's line 8. Line 4 is now the head
and spouse's too.

The property tests also give dependents section 1202 gain, a long-term
loss carryover and Schedule D line 18 small business stock gain, and
no longer claim the grid runs without Hypothesis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2 asked for a case covering 2b7bf4f: distributions of 1,000
and a tax unit net_capital_gains input of -5,000 make line 16 a loss of
4,000, so has_qdiv_or_ltcg is false and worksheet line 9 is 0. Main
turned the flag on there. The helper's line 16 comment now says it is
figured from net_capital_gains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retain the supplied federal Schedule D line 16 aggregate contract and
filer-only Form 4952 election. Combine both specialty worksheet regression
sets and preserve main's regular-tax cap and property coverage.

Move Hawaii's filer filter into the new capital-gain helper while retaining
its component-derived gain and exclusion of qualified dividends.

make format passed. Model tests are blocked: the required heavy-run wrapper
exits 75 because the sandbox denies ps. This local merge is a patch artifact;
the assigned worktree Git metadata is read-only and no push was performed.
Keep gain-first Form 4952 elections, supplied tax-unit roles, and downstream regular tax from main. Restore the specialty worksheets' direct filer short-term-gain dependency and cover election and dependent-role composition.

Formatting: make format (Ruff 0.15.5) passed. Targeted foreground verification is recorded outside the code PR.
@MaxGhenis
MaxGhenis marked this pull request as draft October 8, 2026 23:18
MaxGhenis and others added 2 commits October 8, 2026 20:13
The 28% Rate Gain Worksheet was already filer-only on main (#9988), so the
fragment no longer claims this PR changes it, and it now names Vermont's
dividend subtraction. The helper docstring sentence was missing an "and".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 9, 2026 05:48
@MaxGhenis
MaxGhenis merged commit e6b0fe3 into main Oct 9, 2026
33 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

US + core hub merge audit, us#9855 at 982378520b210525938d64141a983434c183a532 (squash): the tax on net capital gain uses the filers' own Schedule D.

  • Reviews: the r2 delta review (Subfleet) found the code right; its only P2 was in the PR body. The hub fixed the body, changelog and one docstring in 982378520b, a text-only delta. The r3 delta review (independent Opus) APPROVES this exact head.
  • Gates checked live at merge:
    • gh pr checks exits 0;
    • the latest Pull request run at the head concluded success;
    • MERGEABLE;
    • not a draft;
    • no CHANGES_REQUESTED review;
    • the semantic-overlap guard;
    • head pinned.
  • Impact: a hub microsim, merge base 7b956eb401 against the model code at this head (table in the body).
    • Federal income tax rises $1.68bn (2025) and $1.56bn (2026), because dependents' gains no longer enlarge the filer's preferential-rate income.
    • State income tax falls $4.47M (2025).
  • Order: the held Limit investment interest deductions under §163(d) and Form 4952 #9977 (d1054) overlaps seven of these files. This PR lands first.
  • --admin: used only because a required approving review is the sole block.

@MaxGhenis
MaxGhenis deleted the ncg-filer-gains-floor-distributions branch October 9, 2026 07:07
MaxGhenis added a commit that referenced this pull request Oct 12, 2026
… Missouri lines

From the independent review of the first commit:

- Alabama AGI sums every member's interest, so it now also subtracts
  dependents_us_govt_interest (new, next to us_govt_interest, for state
  income definitions that count dependents' income). Without it the
  filer-only us_govt_interest left a dependent's U.S. government interest
  taxed (parent wages 100,000, child 5,000 of Treasury interest: AL AGI
  105,000 instead of 100,000).
- Virginia's National Guard subtraction leaves a dependent's pay out of both
  the cap and the per-person shares, so the filer keeps the full amount.
- Michigan's senior interest, dividends and capital gains deduction counts
  only the head's and spouse's income (MCL 206.30(1)(p): "included in
  adjusted gross income").
- Missouri's capital gains subtraction takes a dependent's gains out of
  net_capital_gains, and its per-person split allocates among the head and
  spouse only.

The Utah retirement credit case with SINGLE status now names its roles
(one head, two dependents), and the property test drops the Vermont
restriction now that #9855 is on main.

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

From the independent review of the first commit:

- Alabama AGI sums every member's interest, so it now also subtracts
  dependents_us_govt_interest (new, next to us_govt_interest, for state
  income definitions that count dependents' income). Without it the
  filer-only us_govt_interest left a dependent's U.S. government interest
  taxed (parent wages 100,000, child 5,000 of Treasury interest: AL AGI
  105,000 instead of 100,000).
- Virginia's National Guard subtraction leaves a dependent's pay out of both
  the cap and the per-person shares, so the filer keeps the full amount.
- Michigan's senior interest, dividends and capital gains deduction counts
  only the head's and spouse's income (MCL 206.30(1)(p): "included in
  adjusted gross income").
- Missouri's capital gains subtraction takes a dependent's gains out of
  net_capital_gains, and its per-person split allocates among the head and
  spouse only.

The Utah retirement credit case with SINGLE status now names its roles
(one head, two dependents), and the property test drops the Vermont
restriction now that #9855 is on main.

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

From the independent review of the first commit:

- Alabama AGI sums every member's interest, so it now also subtracts
  dependents_us_govt_interest (new, next to us_govt_interest, for state
  income definitions that count dependents' income). Without it the
  filer-only us_govt_interest left a dependent's U.S. government interest
  taxed (parent wages 100,000, child 5,000 of Treasury interest: AL AGI
  105,000 instead of 100,000).
- Virginia's National Guard subtraction leaves a dependent's pay out of both
  the cap and the per-person shares, so the filer keeps the full amount.
- Michigan's senior interest, dividends and capital gains deduction counts
  only the head's and spouse's income (MCL 206.30(1)(p): "included in
  adjusted gross income").
- Missouri's capital gains subtraction takes a dependent's gains out of
  net_capital_gains, and its per-person split allocates among the head and
  spouse only.

The Utah retirement credit case with SINGLE status now names its roles
(one head, two dependents), and the property test drops the Vermont
restriction now that #9855 is on main.

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