Repository navigation
Conversation
… shares On the full surface the congressional-district file's US row was still a second national all-AGI target beside the Table 1.x control for 11 SOI quantities (control / district US row 1.001 to 1.169 on the pinned feed). Its state and district rows of these measures now ship as shares of the file's own US row times #1247's control, naming the denominator in soi_share_total_source_record_id, and the US row retires. The register records each column's IRS id, and a district fact that would be rebased under another column refuses the compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e_cd The state_cd level bridges lift charitable, interest-paid and QBI district levels by a sibling's Historic Table 2 / district-file ratio. Their siblings (itemized deductions, return count, AGI) are now national shares, so the ratio is read from the sibling's file level (cd_file_level), re-aged like the bridged row. Without this, the bridged amounts fell 9.07% (charitable and interest paid), 5.63% (QBI) and the counts 2.65% on the pinned feed; with it every state_cd value matches the #1247 base within 4.2e-15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rface Synthetic tests for the district pass (shares and declarations for all 11 carried columns, own denominators beside HT2, keep-level and drop cases, stamp invariance, the column guard before the crosswalk, denominator ties), a Hypothesis share-conservation property, a differential test against the HT2 pass, and a state_cd property that national-share district rows move no state_cd value or verdict. On the pinned feed: the district rows take their control level, every controlled quantity has one national value on full, and the compiled count re-pins at 33,224. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… checks docs/us-soi-national-controls.md gains a congressional-district section: the guide check per column, the district US row's same-year coverage (0.940 to 0.997 of Table 1.4), the rule, and the pinned-feed effect. The ACS-local surface doc explains why level bridges read a rebased sibling at the file's own level and refreshes the bridge figures. The state_cd property now also checks the band's relative gaps and recorded sibling ratios, and an example pins a national-share sibling's bridges and recorded ratios. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#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>
The docs and changelog now say the state_cd receipt and per-row records are unchanged, explain the bridge's aging-series assumption, and note that AGI slices take the measure's factor. A national AGI slice of the district file is now tested: it is a share, never a second denominator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ging series from the rule (#1250 Sol review) From the GPT-6.1 Sol review (review-sol.md, REQUEST CHANGES, three P2): - A row could divide by another district file's US row at the same stamp. District US totals are now keyed by record set, so each package uses its own; a package without one drops its rows beside a control. - The column guard refused facts that never bind (a stale AGI slice, a superseded vintage). It now runs inside the pass on the rows it rebases: each row's source facts (traced through the crosswalk's contributions and the at-large state-total proxies) and its denominator, read by column as the feed carries them, before the crosswalk merges layouts. - state_cd refused a valid bridge when a share landed at the build year (receipt source_equals_build). The aging series now comes from target aging's own rule (_not_ageable_reason, _cbo_income_source_for_spec). The pinned compile and every state_cd value and receipt are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
source_columns is now a required argument of the district pass: translated facts alone cannot name their sources' columns. New tests: a reviewed crosswalk merge compiles and rebases, and a US row read from another column refuses although every state and district row is reviewed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…delta review) From the GPT-6.1 Sol delta review (review-sol-r2.md: the three earlier P2s resolved, two new P2): - A duplicate record id could hide an unreviewed contributor, because the column inventory kept the last column per id. - Compiling the translator's output refused, because the inventory held only the incoming ids while the guard looked up ancestral ones. The crosswalk now records each contributor's source_column_id in lineage.congressional_district_vintage_contributions, and the guard reads every contributor's column from there (any other fact is its own source; facts sharing an id all count). The pre-translation inventory and its argument are gone. Tests: a duplicate merged by the crosswalk refuses in either order; translated facts compile to the crosswalk compile's registry; a recorded-ratio example with a share aged unlike the file. The pinned compile, state_cd values and receipt are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
October 13, 2026 03:10
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.
Follow-up to #1243 / #1247. Stacked on #1247 (base
us-soi-national-control-concepts, head490b67181), which is stacked on #1036. This PR's commits sit directly on #1247's head.It moves published
full-surface target values, so it waits on Max's ruling (d1450) and on #1247 and #1036.Summary
#1247 made each Table 1.x control the only national level of 14 SOI quantities on
national_state. On the defaultfullsurface, the congressional-district file's US row was still a second national all-AGI target beside the control for 11 of them. That row isirs_soi.ty2023.congressional_district_2022.all_returns.us.<measure>: TY2022 data from22incd.csv, stamped ty2023, for a processing-window subset of filers. On the pinned feed (51aa40f), control / district US row ran from 1.001 (taxable pension returns) to 1.169 (taxable Social Security amount).This PR applies the district doctrine of #1229 (taxable interest) and #1040 (capital gains) to those 11 columns, using #1247's register:
After it, every quantity a control of the register measures has one national value on
full, and the district file's states and districts each sum to the control.The columns
22incddocguide.docx(TY2022) defines each column at the same Form 1040 line, under the same IRS name, as the HT2 guides #1247 checked. The district US row is a narrower count of the same concept. The file covers only returns processed in calendar 2023. It drops returns with a missing or mismatched ZIP code, and APO/FPO, foreign and territory addresses (guide sections C-D). It also suppresses small and single-return-dominated cells (section E).22incd.csv,22in14ar.xlsand22in55cmcsv.csv, with Table 1.4 columns located by header text (scripts/cd_identities.py).This is the #1229 case (same column, stale vintage and coverage), not the #1040/#1231 case (a proxy for a different concept).
What changes
fiscal_targets.py:_SoiHt2NationalControlRule.source_column. Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247's register now records each column's IRS name, which the HT2 guides and22incddocguide.docxboth use (N1, A00100, ..., A04800). A test pins the 14 names against the guide._rebase_stale_soi_district_distributionsruns after Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247's HT2 pass, with the same register, the same control chooser andAmbiguousSoiNationalControlError.value x control / district US row. The US row is the same record set's national row of the same measure, filing status, universe and period.uprating_*receipts,soi_source_concept/soi_control_concept, andsoi_share_total_source_record_idnaming the denominator.congressional_district_children_scale_to_state_parentkeeps factor 1.source_column; otherwiseUnreviewedSoiNationalControlColumnErrorrefuses the compile. A missing column refuses too.translate_congressional_district_facts_to_current_vintagenow records each contributor'ssource_column_idin the lineage._soi_district_source_columnsreads every source of a district fact from there; any other fact is its own source, and facts sharing a record id all count.tools/us_acs_local_cd_surface.py:state_cdlevel bridges lift the district-only concepts (charitable, interest paid, QBI) onto the HT2 basis by a sibling's HT2 / district-file ratio. Their siblings (itemized_deductions_amount,return_count,adjusted_gross_income) are three of the 11 columns. Read as compiled, a rebased sibling cancels the gap the bridge exists to carry. On the pinned feed, the bridged charitable and interest-paid amounts would have fallen 9.07%, QBI amounts 5.63% and bridged counts 2.65%.cd_file_levelreads a national-share district row at the file's own level: it divides outuprating_factorand, for a bridge, re-ages like the bridged row. That re-aging stands in for the sibling's own aging only when both age on one series, as every registered bridge does, so a pair on different series refuses. The series comes from target aging's own rule (_not_ageable_reason,_cbo_income_source_for_spec), not the receipt, which is a no-op for a share landed at the build year.state_cd_cd_file_value,state_cd_cd_file_state_sum,state_cd_rebase_factor, whichtarget_roles.jsonpublishes) and band factor use it.Docs:
docs/us-soi-national-controls.mdhas a new section, "Congressional-district rows (Rebase congressional-district rows of the Table 1.x-controlled SOI columns as national shares #1250)".docs/us-acs-local-soi-target-surface.md: rebase-factor and bridge notes; the bridge figures are refreshed to this stack's values.docs/us-fact-to-target.md,docs/us-chronicle-feed-repin.md, and a changelog fragment.Effect on the pinned feed
Release compile:
target_period=2024,age_targets=True, packaged CD crosswalk, Medicaid substitution. Before = #1247's head490b67181.0bbbad9b22d1ce77f86efb24national_state0e899cd7f893fullfullstate_cd. All 26,425 values match Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247's head within 4.2e-15. Its counts, drops, band verdicts and receipt (rebase and bridge factors, recorded ratios) match within 5e-15, and so does each district row's record of the file value.stateandtotalshave no district-file rows of these columns.Invariants
fullfor all 14 controlled quantities, with every state and district family at most the control.)state_cdis invariant to national shares. Binding district rows as shares, with any binary-exact factor and aging, moves nostate_cdvalue, drop, verdict, relative gap, bridge factor or recorded sibling ratio. The bridged row and its sibling share one aging series, as every registered bridge does; a pair on different series refuses. Where the share ages like the file (the pinned feed), the block rebase factors and every district row's recorded file value are unchanged too. (Hypothesis, with and without the band; examples for the recorded ratio and the series refusal.)Tests
New
test_us_soi_district_national_controls.py(36 tests):test_us_acs_local_cd_properties.py:state_cdinvariance property, which expects the series refusal exactly where a bridge pairs two series;cd_file_level;state_cd.Pinned feed (
test_us_fiscal_targets.py):test_pinned_feed_district_rows_take_their_national_control_level: 51 + 436 rows per column, factor, denominator, landing period, aging, sums, reconciliation;test_pinned_feed_full_surface_has_one_national_value_per_controlled_quantity;Mutation check: 30 source mutations at
5768ffd49(mutation/mutations.log, earlier rounds inmutations-r*.log). 27 fail at least one synthetic test:state_cd:Three are equivalent mutants, so no test can see them:
Local runs (4 workers, engine-free venv,
MICROCOSM_US_CHRONICLE_FACTSset to the pinned feed):microcosm-buildengine-free tree atc13a31b67(this head): 13,086 passed, 69 skipped, 1 failed (engine-free-all-r3.log). The failure istest_telemetry_emitter.py::test_subprocess_exchanges_ambient_token_and_delivers_events: its local telemetry service was unavailable (LocalTelemetryEmitter.availablewas False), the same failure Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247's broad run reported. It fails the same way at every head; a solo rerun hung past 10 minutes and was stopped. The diff touches no telemetry code.5768ffd49: fiscal targets, HT2 and district controls, AGI bands, ACS-local sparse CD and properties, ACS-local release tool, CD vintage, crosswalk and geography, release parity, Chronicle feed, release-gate preflight, fiscal refresh builder. Result: 926 passed, 7 skipped (6 need the US engine extra, 1 a built CD plan registry). It includes the feed-gatedtest_pinned_feed_state_cd_surface_matches_its_contract.ab6171978: byte-identical toafter/.state_cdvalues and receipt are identical across the review heads (statecd/head_r2-r4).CI runs only for PRs into
main; it runs when Choose the capital-gains rebase control by concept and period, not feed order #1036 and Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247 merge and this PR retargets.ruff checkandruff format --checkare clean on the touched files.Evidence:
~/PolicyEngine/_reviews/cd-soi-national-controls-20261012/. It holdscd_identities.json, the guide text, theafter/compile (before is #1247'safter-r2/),diff.json, thestate_cdreceipts and values (statecd/), the #1030 overlay,scripts/andmutation/.Interactions
mainafter they merge.03ceca6admerged into this PR. Source files merge clean; the test file conflicts.uprating_from_periodmoves 2023 -> 2022 anduprating_to_periodstays 2023, so aging is unchanged and no value moves.state_cdholds. All 26,425 values, band rows (with their recorded ratios) and bridge factors are identical with the district pass on or off (1e-14). That is the casecd_file_level's re-aging exists for: unrebased district rows age from 2022 under Read restamped Chronicle facts at their data year before aging #1030, shares from 2023. A block of a rebased amount column records its file values aged from 2023, one link from an unrebased row, so its recorded rebase factor moves (itemized deductions, median 1.062 -> 1.095); its shares and bound values do not...._restores_the_fencesre-pins tonational_state603ebb05a967on the overlay.test_pinned_feed_corrects_the_translated_congressional_district_specsbecomes {9,156 / 14,824 / 1,092 / 1,705 district,soi-state-20221, W-2 1}._SoiDistrictShareTotal,UnreviewedSoiNationalControlColumnError), so no symbol collides. Text overlap:__all__;STATE_CD_LEVEL_BRIDGEScomment block;state_cdfactor-band comment.cd_file_levelalso reads Rebase congressional-district taxable interest onto Table 4.3 as shares of the district file's US row #1229/Rebase congressional-district capital gains onto Table 1.4 and drop mislabeled CD SALT and PTC columns on the full surface #1040 shares at file level in the band's ratios; their verdicts are unchanged (the relative gap is scale-free). Bind congressional-district interest paid as mortgage interest shares #1231's national-share rows bind as compiled through its own branch, which runs before any sibling lookup.Not changed here
fullfor 22 quantities whose other national row is the TY2022 HT2 US row: dividends, Schedule C, partnership, rental and tax-exempt income, EITC, ACTC, income tax, medical deductions. Rebase congressional-district capital gains onto Table 1.4 and drop mislabeled CD SALT and PTC columns on the full surface #1040 (capital gains) and Drop congressional-district SALT and PTC facts read from the wrong IRS column #1224 (SALT, PTC returns) handle five more. A follow-up chip is filed.full(above).state_cdalready drops HT2's at-large copies.Review
Round 1, in-session Opus 5.5 (
review-opus.md, with executed checks: a fresh compile byte-identical toafter/, 63 targeted and pinned tests, four extra mutations, two counterexample scripts). Verdict APPROVE WITH NITS, no P1. Responses, indddcfddd4and0072c2159:state_cdper-row records held share values. Fixed.cd_file_level.state_cd_cd_file_value,state_cd_cd_file_state_sumandstate_cd_rebase_factor(published intarget_roles.json) record the file's own values again, and the receipt's rebase factors match Rebase stale Historic Table 2 rows onto their concept-matched national controls #1247's base.state_cdrebase-factor range left out itemized deductions. Moot after F3: the receipt is unchanged, and the docs say so.cd_file_levelrefuses a pair on different series (test added).Round 2, independent GPT-6.1 Sol (
review-sol.md, at0072c2159): REQUEST CHANGES, three P2s, each with an executed counterexample. Fixed in01aec387aandabe8df5da:state_cdbridges. Its receipt is the no-opsource_equals_build. The aging series now comes from target aging's own rule; Sol's case is an end-to-end test.Round 3, Sol delta (
review-sol-r2.md, atabe8df5da): the three earlier findings RESOLVED, two new P2s. Fixed in5768ffd49:The crosswalk now records each contributor's column in the merged fact's lineage, and the guard reads every contributor from there.
Round 4, Sol delta (
review-sol-r3.md, at5768ffd49): APPROVE, both findings RESOLVED, no new defect.ce77f86efb24,national_state0e899cd7f893,state_cd82f42fbf2ec8, all unchanged.c13a31b67after it is docs only.axiom: n/a: calibration-target compilation (no tax-benefit rule changes)
🤖 Generated with Claude Code