Repository navigation
Exclude dependents from Schedule D specialty capital gain worksheets - #9988
Merged
Merged
Conversation
Contributor
Author
|
US + core hub sweep audit (2026-10-07): squash-merged #9988 as Reviewed head: |
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.
What and why
Exclude dependents from every person-level aggregation in
capital_gains_28_percent_rate_gain.py, including reported Schedule D line 18 inputs and the shared gains-minus-losses helper. This ports only that formula change and its comment froma0d4dce2e4fcc149da257978e643f1a32061d5f8in #9977; the §163(d) cap and its dataset dependency remain with #9977.The 2025 Schedule D instructions, 28% Rate Gain Worksheet, page 11, lines 1–7, use amounts on the filer's forms. Dependents' gains and losses belong on their own returns. The Unrecaptured Section 1250 Gain Worksheet, page 13, lines 14–18, uses the same netting, so the shared helper correction also fixes that sibling. Its own gain inputs are already TaxUnit variables and need no separate source edit.
Reviewed main after #9841's netting helpers and #9852's regular-tax cap. Both shared-helper callers and the downstream Schedule D, §911 and AMT worksheet consumers were checked. Consumers read TaxUnit results; no additional person aggregation needs changing in this worksheet path.
Test plan
make format.changelog.d/.All commands used one file per foreground process, without parallel workers, on main
e3a38da446392dd5c44753f7b109e042328d279fand fixed heada274001030e07b3155a7b9ffd65b223d5bc79984.capital_gains_28_percent_rate_gain.yamlschedule_d_unrecaptured_section_1250_gain.yamlcore/test_capital_gains_rate_worksheet_properties.pyHypothesis reduced the main bug to a dependent's $1 reported small-business-stock gain incorrectly raising the filer's worksheet from $0 to $1. Existing
test_capital_gain_rate_group_netting.pyalso passed (3 tests covering worksheet transcription, netting invariants and §911/AMT consumers); existingcapital_gains_tax.yamlpassed all 11 cases. The post-fix total is 48 passing tests across the five files. No partner-test edits.Invariants: dependents' person-level specialty gains and losses never change the filer's 28% or unrecaptured §1250 worksheet. For each person input, the head-and-spouse aggregate equals the sum over non-dependents; their short-term gains and losses net before the loss floor.
The isolated 2025 example has $140,000 wages and $10,000 filer capital gain, with a dependent's $10,000 reported collectibles gain. Main gives regular tax $25,067 rather than the correct $24,167. The YAML holds the filer's
net_capital_gainat $10,000 to isolate this worksheet correction. Recomputing the original r2 household, which also enters the dependent's $10,000 total gain, gives $24,167 on current main because main's separate genericnet_capital_gainaggregation includes that dependent gain. After this narrow fix it gives $23,267: the 28% worksheet now correctly excludes the dependent, but generic net capital gain remains overstated. That separate aggregation defect remains outside this port and still needs follow-up with #9977's wider changes.Python tests create fresh small Core systems with production classes per example; package import constructs the global US model once. Existing core CI group context: successful run 37613339193 took 502.62 s and peaked at 6,261,696 KiB (~5.97 GiB). Local macOS property-file measurements including import/setup: main 243.367 s / 1,413 MiB peak RSS (both expected failures); fixed 207.690 s / 797.55 MiB peak RSS (both passed, 60 Hypothesis examples). Pytest test times were 120.30 s and 76.88 s respectively; the main run includes failure shrinking. These are local measurements, not a prediction of Linux CI cost. No CI jobs or concurrency were added.
Impact
No change on the default dataset in 2025 or 2026: 0 records change. Base:
mainat the merge basee3a38da446. Branch:a274001030, which has the same PR diff as the current head6372059a31(the US + core hub mergedmainon 2026-10-07 with no conflicts). Both ran one at a time under the shared heavy-job lock onpopulace_us_2024.h5@populace-us-2024-spm-20260909(79,729 tax units).capital_gains_28_percent_rate_gainschedule_d_unrecaptured_section_1250_gaincapital_gains_taxregular_tax_before_creditsincome_taxstate_income_taxhousehold_net_income(household)Both worksheets are populated in the dataset, and still no record's worksheet amount, tax or net income moves. So in this sample, excluding dependents' amounts never changes either worksheet. The fix changes results for households that enter such amounts for a dependent, as in the $140,000 example above. Compare files:
~/reviews/us-hub/fixes/9988-impact/compare.{2025,2026}.json.axiom: n/a (pe-parity follow-up if rulespec-us lacks the worksheet)
🤖 Generated with Claude Code