Repository navigation
Conversation
…ed order Historic Table 2 and congressional-district N01000 count Form 1040 line 7 returns (gain, loss-limited loss or distributions only); Table 1.4 col 37, the population capital_gains_gross measures, counts Schedule D gain returns only. The rebase control is now the latest Table 1.4 fact not after the build period, CD and HT2 rows never qualify, a tie between matched records refuses the compile, and a line-7 row without a usable control is dropped instead of shipping as a level. Rebased rows declare the bridge in soi_source_concept / soi_control_concept. On the pinned feed the 51 national_state HT2 state return counts go from 29,599,604 (2.39x the national 12,392,020 target) back to Build P's 12,289,836; amounts keep their values. national_state registry d315c75804ef -> 65e4dde11c83 (microcosm#1035). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review) The chooser now treats one record id carrying two values or period labels at the winning period as ambiguous too, so no feed order can pick the value. Tests cover that, an equivalent period label, and a tie at a superseded period. The model-concept comment scopes "no loss returns" to the Build P release data, and the doc's AGI-mix median is the median absolute change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abeled CD columns (#1038) On the full target surface the congressional-district file's capital-gains rows compiled as Form 1040 line-7 levels onto capital_gains_gross (Schedule D gain): its states and districts each summed to 29,845,710 returns, 2.41x the Table 1.4 target, and $1,522.2B, 1.198x. They now enter as shares of the file's own US row scaled to the Table 1.4 control, as Historic Table 2 rows do since #1036; the US row retires and every share row names its denominator in soi_share_total_source_record_id. The same package reads N18425/A18425 (state and local income taxes) as the limited SALT deduction and N85530/A85530 (additional Medicare tax) as the premium tax credit. US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONS drops facts by (measure id, IRS column), replaces the hard-coded CD PTC-amount check, and is listed in the exclusion receipt and the release coverage report. On the pinned feed: 31,376 compiled targets (was 32,842), no CD-file family past its national target on full (was 3), national_state values and membership unchanged (version moves only for the new provenance key). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
changed the base branch from
us-cg-returns-control-concept
to
main
September 27, 2026 21:03
…s and totals (#1040 review) The congressional-district package reads interest_paid_deduction_* from N19300/A19300, Schedule A line 8a mortgage interest, while interest_deduction is the line 10 total; add both to US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONS. A congressional-district fact of a listed measure with no layout.source_column_id now refuses (MissingSoiSourceColumnError) instead of compiling unchecked, and a capital-gains share row that has a control but no national total of its own family refuses (MissingSoiCapitalGainsShareTotalError) instead of dropping silently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-concept # Conflicts: # packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py
…-concept # Conflicts: # packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py
main re-pinned the US Chronicle feed to 51aa40f (#940), whose capital-gains cells are identical to c5e5bf8's. Compiled there, this change still moves the same 60 Historic Table 2 return counts by 0.415202720927 and adds the concept keys to the 60 amount specs; national_state goes from e1f9906bf0e0 to 882f4764a248 at 6,102 targets (full f5bd921d6b21 to f09571684885). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
…n exclusions with #1224 Review (review-1040.md) follow-ups: - Interest paid stays out of US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONS: N19300 (line 8a mortgage interest) is a component of the line 10 deduction, not another concept, and it feeds state_cd's itemized bridge; its share-or-drop decision is a separate chip. The register comment, docs and claims now say 50 of the package's 56 measures have a Historic Table 2 twin. - A share row with no national row of its own family is dropped, as the established rule and test_stale_soi_capital_gains_without_source_total_is_dropped require; the pinned invariant is now two-sided (every compared district family keeps its state and district rows and sits in (0.85, 1] of its national target), so a vanished or partial family fails. - The CD-vs-HT2 tilt (0.8% returns, 2.1% amounts) is stated plainly; the amount agreement is reported on the demeaned comparison with the worst states named. - The Hypothesis property draws Historic Table 2 rows alongside and checks each family divides by, and names, its own US row; comments on CD boundary vintages sharing a family and on a corrected PTC package. The SALT/PTC column exclusions are now #1224 (a bug fix that lands on its own); this branch carries them byte-identical until it merges. Pins on the 51aa40f feed: 31,784 compiled (full 6e1ac91262bc), national_state 6,102 at 84504a7afd57. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-concept # Conflicts: # packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py
… under the share rebase The ACS-local contract test pins totals at 120 SOI specs and full at 29,860 (identical to #1224). With the district file's capital-gains rows as shares of the Table 1.4 control, state_cd's capital-gains amount rebase factors move from 0.77-1.00 to 0.93-1.20 (median 0.98); its counts and factor-band verdicts are unchanged (measured on the pinned 51aa40f feed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Oct 12, 2026
…d total apply_source_vintage_corrections refused every restamped fact that carried uprating_factor. A congressional-district capital-gains row rebased as a share of the same package's US row times the Table 1.4 control (microcosm#1040) is such a fact, so #1030 plus #1040 refused every pinned compile. A rebased restamp is now admitted only when the total its rebase names in soi_share_total_source_record_id is a restamp of the same package, stamp and data year, and its uprating_from_period is the stamp or the data year. The stamp then cancels in the share and the level is the control's: source_period and uprating_from_period move to the data year, and uprating_to_period, where aging starts, stays at the control's period. Moving it would age the control's data-year-to-control-period change twice (x0.761 for CD capital gains). A missing, truthful or mixed-vintage total still refuses. The module docstring no longer says the CD row wins the capital-gains control tie: a restamped control keeps the selection its stamp won, which holds whichever rule picks the control. Tests: an admitted same-package share (and its idempotence), seven refusals (no total, truthful total, another package, stamp or data year, another reading period, no reading period), and the Hypothesis property now draws uprating_factor, uprating_from_period and share totals across packages and vintages, with the exact refusal oracle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
MaxGhenis
added a commit
that referenced
this pull request
Oct 12, 2026
On a local merge of #1040, the 487 congressional-district capital-gains amount shares are admitted and aged from the control's 2023 period, and aging records that start in source_period. The counter test's "every corrected CD spec reads 2022" now allows exactly that case (a rebased spec whose source_period is its uprating_to_period), so a later merge re-pins only counts. Measured on #1040 + this branch: all 974 shares keep #1040's values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1040 re-review nits From the #1224 review (P2/P3), carried here byte-identical: the congressional-district crosswalk sums source districts under the first contributor's layout, so US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONS and the missing-column refusal now run on each source fact before translation, in the compile and the receipt (which therefore lists 4 x 480 source ids); tests cover mixed-column merges in both orders, every missing-column order, and a corrected A85770 PTC amount. From the #1040 re-review (APPROVE WITH NITS): the doc says the return counts agree among the tightest pairs (ninth of 45 by median gap) and that the CD-over-HT2 tilt holds in aggregate (Montana's amount is 0.73x); the congressional-district parity-manifest note names the capital-gains shares, the retired US row and the column exclusions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Heads-up from #1244, which makes the SOI congressional-district guards vintage-free. Two things to adjust when this rebases after it, or that #1244 would need if this lands first:
The |
Contributor
Author
|
#1244 has merged ( |
MaxGhenis
added a commit
that referenced
this pull request
Oct 13, 2026
#1250 review) From the in-session Opus review (review-opus.md): - F3: state_cd district blocks read their rows through cd_file_level, so state_cd_cd_file_value, state_cd_cd_file_state_sum and the rebase factor record the district file's own values again and the receipt's rebase factors match #1247's base. Bound values are unchanged. - F2: re-aging a share sibling like the bridged row refuses when the two age on different series, and the sibling's band median is re-aged with it, so its recorded ratio matches the unrebased case. - F4: AGI slices of the district file take the measure's one factor, as #1229 and #1040 rebase district slices, and the column guard checks them; tests pin the guard's eligibility rule and the slice rebase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #1038 (capital gains). Stacked on #1036 and #1224.
mainso CI runs, so until Choose the capital-gains rebase control by concept and period, not feed order #1036 and Drop congressional-district SALT and PTC facts read from the wrong IRS column #1224 merge the diff also shows their changes. This PR's own change is the capital-gains share rebase.Waiting on Max's ruling (d539), together with #1036 (d468). It changes published
full-surface target values, and choosing shares over exclusion is a methodology call.Summary
On the default
--target-surface full, the congressional-district file (22incd.csv) compiles its N01000/A01000 rows ontocapital_gains_gross. Those columns are "net capital gain (less loss)" at Form 1040 line 7: gain, capped loss and distributions-only returns. The model measures something else: the positive part of Schedule D, whose IRS counterpart is Table 1.4 col 37/38 (#1035).On the pinned feed (
51aa40f), the district file's states and its districts each summed to:This PR makes those rows shares of the district file's own US row, scaled to the Table 1.4 control, exactly as #1036 does for Historic Table 2:
soi_source_concept,soi_control_conceptand its denominator,soi_share_total_source_record_id;Option (a) shares, or (b) exclusion
Quantified on the sha-matched IRS files and the compile dumps. Scripts and JSON:
~/PolicyEngine/_reviews/cd-cg-concept-20260927/lane-b/. Critic re-derivations:critic.md.The share assumption is #1036's. A district's share of line-7 returns stands in for its share of Schedule D gain returns. AGI composition is the measurable source of error. Reweighting each of the 428 numbered districts' N01000 by AGI class, with Table 1.4's per-class gain share, moves its share by:
AGI composition is one measurable source of error, not a bound on the total: non-AGI variation in the gain/loss/distributions mix cannot be measured from IRS geography and could add to or offset it.
Exclusion would discard more.
Agreement with the HT2 state rows already on
full. Both files' state rows stay onfull; 45 measures pair two state targets. After dividing out each pair's common coverage-and-aging offset:The amount gap comes from item suppression in the district file's A01000; Montana's state total is 32.5% below HT2's. Other pairs have worse single states, for example qualified dividends in Hawaii at −58%.
Split of the control. The district file has no other-area rows, so its US row equals the sum of its states, and its rebased states and districts each sum to the control. HT2's US row includes other areas, so its rebased states sum to 99.2% (returns) and 98.0% (amounts).
Interplay
The
congressional_district_children_scale_to_state_parentprofile rule.The ACS-local
state_cdsurface.test_pinned_feed_state_cd_surface_matches_its_contractpasses).#1030 (source-vintage correction).
test_congressional_district_capital_gains_ignore_the_package_stampcompiles and ages the package stamped ty2023 and truthfully at 2022 and asserts identical values. Its facts carry the pinned 22incd.csv digest and raw key.03ceca6ad), and carries the reviewed narrowing (lane-a/source_vintage_share_narrowing.patch):soi_share_total_source_record_idis a correction of the same package and stamp;source_periodanduprating_from_periodto the data year;uprating_to_period. Starting the aging at 2022 would apply the Table 1.4 2022→2023 fall twice (×0.761).What changes (
fiscal_targets.py)_rebase_stale_soi_capital_gains_distributionsrebases every row of a share family: a registered family whose concept is not the model's, todayhistoric_table_2andcongressional_district(_soi_capital_gains_share_family)._soi_capital_gains_share_national_totals, which is keyed by family and refuses conflicting duplicates. A row with no control, or no national row of its own family, is dropped, never shipped as a level. That is the established rule (test_stale_soi_capital_gains_without_source_total_is_dropped).soi_share_total_source_record_id.Effect on the pinned feed
Release compile on
51aa40f: target period 2024, aging, packaged CD crosswalk, Medicaid substitution.full)f09571684885)6e1ac91262bc)national_state882f4764a248)84504a7afd57)fullnational_state) gainsoi_share_total_source_record_id. That is the wholenational_statechange: nonational_statevalue or membership moves.stateandstate_cdkeep their counts and band verdicts.state_cd's capital-gains amount rebase factors move from 0.77–1.00 to 0.93–1.20 (median 0.98).Invariants
full. Pinned, two-sided: every compared family keeps its state and district rows and sums to within (0.85, 1] of its national target. Before this change, the capital-gains returns family was at 2.41x and the amount family at 1.198x.Tests
These runs were local, on the pinned
51aa40ffeed, run sequentially with peak RSS 3.6 GB. CI has no feed and skips the pinned-feed tests.engine_free/us/test_us_fiscal_targets.pyat21a638dec: 210 passed, none skipped. That includes all six pinned-feed tests:6e1ac91262bc/84504a7afd57);21a638dec: the ACS-local release tool, thestate_cdsparse surface (its contract included), source coverage, release target parity, the Chronicle feed and the fiscal refresh builder: 495 passed, none skipped.90ad595a6(the ACS-local count pins and thestate_cddoc paragraph) was verified with the same contract test on Drop congressional-district SALT and PTC facts read from the wrong IRS column #1224.tools/ci_test_plan.py verifypasses;ruff checkis clean.New tests:
Review
The 2026-09-27 independent review (
review-1040.md) asked for changes. Each finding is addressed below. A GPT-6.1 Sol re-review at90ad595a6(review-1040b.md) returned APPROVE WITH NITS. It found no P0–P2 in this PR's own change and confirmed that each prior answer holds, including that the stamp test is a real #1030 tripwire. Its four P3 nits are addressed atd3a625350:d3a625350also carries #1224's review fix byte-identical (the column check runs before the district crosswalk merges source districts).soi_share_total_source_record_idis a correction of the same package and stamp, movessource_period/uprating_from_periodto the data year, and never movesuprating_to_period. With it, all 21 of Read restamped Chronicle facts at their data year before aging #1030's tests pass.test_congressional_district_capital_gains_ignore_the_package_stampfails until the narrowing is in.state_cd's itemized bridge.totals607 → 120,full31,321 → 29,860,state/state_cdunchanged. The column exclusion is now its own PR, linked above.test_stale_soi_capital_gains_without_source_total_is_droppedon main codifies it, and the interest twin does the same. The pinned invariant is now two-sided: every compared CD family must keep its state and district rows and sit in (0.85, 1] of its national target. So a family that vanishes, or loses a whole geography level, fails on the pinned feed; a family losing a few states can still pass that generic check, and for capital gains the dedicated pinned test (51 states and 436 districts per measure, exact control sums) catches it.MissingSoiSourceColumnError).national_statethat is a metadata-only change on the 102 HT2 rows.axiom: n/a: microsim target compilation, no policy rule changes.
🤖 Generated with Claude Code