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
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. Stacked on #1036. The base is
mainso that CI runs, sincetest.ymlruns only on PRs intomain. Until #1036 merges, the diff also shows #1036's commits0f343249fand6ebfcf7f4and the main merge2c811ab1c. This PR's own change is commit011a63b1a:git diff 2c811ab1c..us-cd-capital-gains-concept.Summary
On the default
--target-surface full, the congressional-district file (22incd.csv) had three families summing past the national target of the same model quantity. Two more of its measures read the wrong IRS column:full(pinned feed)net_capital_gains_returnslimited_state_local_taxes_amountnet_capital_gains_amountpremium_tax_credit_returnsThis PR:
US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONSregister keyed by (measure id, IRS column). It replaces the hard-coded CD PTC-amount check.full.This moves published
full-surface target values, so it waits on Max's ruling before merge.national_state(what Build P shipped) keeps every value and membership.Option (a) or (b)
I quantified both options on the pinned feed and the sha-matched IRS files. Scripts and JSON are in
~/PolicyEngine/_reviews/cd-cg-concept-20260927/lane-b/.(a) Rebase as shares. This is what the PR does.
full:return_countpair (1.6% / 2.4%).(b) Exclude. This would throw away the strongest geographic signal on the surface.
One accepted difference. The CD US row equals the sum of its 51 states, because the file has no other areas. So rebased CD states and CD districts each sum to the control itself. The HT2 US row includes other areas, so HT2 states sum to 99.2% of the control for returns and 98.0% for amounts.
Interplay
The
congressional_district_children_scale_to_state_parentprofile rule.22incd.csv: state = sum of districts), so all 872 CD capital-gains children still reconcile with factor 1.#1030 (source-vintage correction).
test_congressional_district_capital_gains_ignore_the_package_stamp) compiles and ages the same package stamped ty2023 and truthfully at 2022, and asserts identical values. Its facts carry the pinned 22incd.csv digest and raw key.source_vintage.py, "was rebased; review the rebase"). So Read restamped Chronicle facts at their data year before aging #1030 plus this PR refuses every compile.soi_share_total_source_record_id(new here) is a restamp of the same package with the same stamp. Movesource_period/uprating_from_periodto the data year, and never moveuprating_to_period.~/PolicyEngine/_reviews/cd-cg-concept-20260927/lane-a/source_vintage_share_narrowing.patch. With it, all 21 of Read restamped Chronicle facts at their data year before aging #1030'stest_us_source_vintage.pytests pass.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, keyed by family) and scaled to the control.soi_source_concept,soi_control_conceptand the newsoi_share_total_source_record_id.AmbiguousSoiCapitalGainsShareTotalError.US_FISCAL_TARGET_SOURCE_COLUMN_EXCLUSIONSdrops SOI facts whose (measure id,layout.source_column_id) is listed:limited_state_local_taxes_{returns,amount}read from N18425/A18425;premium_tax_credit_{returns,amount}read from N85530/A85530.The IRS column is the definition, so a corrected package that reads N18460/N85770 passes untouched. These are the only CD measures whose column differs from their HT2 twin's; all 56 were compared.
us_fiscal_target_exclusion_receiptgains asource_column_concept_exclusionrule.The release coverage report lists the register (
tools/build_us_fiscal_refresh_release.py)._is_soi_cd_premium_tax_credit_amount_conflictis removed. Its comment called A85530 "not the same gross annual PTC control"; A85530 is not PTC at all.Docs:
docs/us-soi-capital-gains-concepts.md: the CD section, the (a)/(b) analysis and the effect table.docs/us-chronicle-feed-repin.md: a follow-up note with the new pins.Effect on the pinned feed
Release compile: target period 2024, aging, packaged CD crosswalk, Medicaid substitution. Before is #1036 merged with main (
2c811ab1c).full)e02123644d42)059dc56d78db)national_state65e4dde11c83)47dce807b412)fullfull:national_state: membership and every value are unchanged. The only difference is one metadata key,soi_share_total_source_record_id, on the 102 HT2 capital-gains rows, each naming the HT2 US row. That key alone moves the registry version.Invariants
full(pinned feed, 35 compared families). Before this change, 3 of 38 violated it.national_statevalues and membership are unchanged (pinned diff).Tests
All runs below were local on the pinned feed, sequential, with peak RSS at most 3.5 GB. CI has no feed and skips the pinned-feed tests.
engine_free/us/test_us_fiscal_targets.py: all 205 tests passed, before the order-free denominator test was added (that test passes on its own). The 6 pinned-feed tests passed under-rA, not skipped:engine/us/test_us_fiscal_targets.py,engine_free/shared/test_release_target_parity.py,engine_free/us/test_us_chronicle_feed.py,test_us_release_gate_preflight.pyandtest_us_fiscal_refresh_builder.py, run withMICROCOSM_US_CHRONICLE_FACTSset: 467 passed.tools/ci_test_groups.py --verifypasses.ruff checkandruff format --checkare clean on the touched files.New tests:
31,376/059dc56d78db/47dce807b412.Not changed here (follow-ups filed)
test_pinned_feed_exclusion_receiptflags them for deletion.full, at 0.40x the national target. HT2 interest rows are rebased; CD rows are not. Same structure as capital gains, in the other direction; it needs its own analysis._is_soi_congressional_district_record_setmatches onlycongressional_district_2022. Another session is making it vintage-free. The new share-family code already uses the vintage-free_soi_record_set_family.axiom: n/a: microsim target compilation, no policy rule changes.
🤖 Generated with Claude Code