Skip to content

Rebase congressional-district taxable interest onto Table 4.3 as shares of the district file's US row - #1229

Draft
MaxGhenis wants to merge 3 commits into
mainfrom
us-cd-taxable-interest-rebase
Draft

MaxGhenis wants to merge 3 commits into
mainfrom
us-cd-taxable-interest-rebase

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1038 (follow-up from the 2026-09-27 congressional-district concept sweep, lane D). Independent of #1036, #1040 and #1224; it builds on main.

Summary

The congressional-district file (22incd.csv) is TY2022 data that the feed stamps ty2023 (Chronicle#117). Its taxable-interest rows (A00300/N00300) shipped on the default full surface as TY2022 levels.

Historic Table 2's TY2022 interest rows have been rebased onto the latest Pub 1304 control since #518 (#489 adjudication): taxable interest grew x2.35 from TY2022 to TY2023, while interest dollar targets age on the CBO AGI default (x1.12). #518 barred the district file from being a control but left its own rows as levels.

On the pinned feed (51aa40f), after aging:

district-file US row its 51 states (sum) its 436 districts (sum) national target (Table 4.3 ty2023)
amount, main $134.59B, compiled as a second national target $134.59B (0.395x) $134.59B (0.395x) $340.43B
returns, main 48,547,160 48,547,160 (0.896x) 48,547,160 (0.896x) 54,167,410
amount, this PR retired (it is the share denominator) $340.43B $340.43B $340.43B
returns, this PR retired 54,167,410 54,167,410 54,167,410

The district US row and Table 4.3 materialize the same unfiltered taxable_interest_income sum. On main the surface therefore asked for one quantity at two values 2.53x apart: the contradiction #489 removed for Historic Table 2. #1030's stamp correction moves these levels only about +3%.

What changes (fiscal_targets.py)

Share families. The interest rebase now treats every stale photo as a share family (_SOI_TAXABLE_INTEREST_SHARE_FAMILIES): Historic Table 2, and the district file of any data year (22incd.csv's record sets read congressional_district_2022, the data year).

Denominators (_soi_taxable_interest_share_national_totals).

  • Keyed by family, so a district row never divides by the Historic Table 2 US row.
  • Two different totals under one key refuse the compile (AmbiguousSoiTaxableInterestShareTotalError). Equal totals name the smaller record id, whatever the feed order.

Controls are unchanged. The Table 4.3 control, reached through the declared all_returns -> returns_excluding_dependents universe bridge, applies to the district rows exactly as it does to Historic Table 2's. A share family still never anchors the control; the bar now covers any district file, where main matched only .congressional_district_2022..

Hierarchy. One factor scales a family's states and its districts alike. So the congressional_district_children_scale_to_state_parent rule that runs next reconciles all 872 district interest rows with factor 1.

Stamp-invariance. A share divides the district rows by the district US row of the same restamped package, so the period stamp cancels. The value lands at the control's period (2023) and ages from there on the same link as the Table 4.3 row. This holds while the stamp is no later than the control's period. A family stamped after every control keeps its levels and its US row, as on main; the next district file under the same +1 stamp error would do this, and #1030's restamp prevents it. Tracked in #1236.

One behaviour change in a corner (both families)

A full-range row whose own family has no national total is now dropped when a control is eligible. On main it stayed as a stale TY2022 level beside the control.

  • With no control anywhere it still stays (the Rebase stale HT2 taxable-interest rows onto the Pub 1304 national actual (#489 adjudication) #518 no-anchor rule), and an AGI slice without a total still drops.
  • This matches capital gains on main, which drops a row whose control exists but whose source total is missing.
  • The last block of test_stale_soi_taxable_interest_period_selection_laws pinned the old behaviour and is rewritten.
  • It does not occur on the pinned feed, where every family has its US row.

Effect on the pinned feed

Release compile on 51aa40f: target period 2024, aging, packaged CD crosswalk, Medicaid substitution. A diff of every compiled spec against main (51a263726):

main this PR
Compiled targets (full) 33,250 (f5bd921d6b21) 33,248 (5bdfa798ad97)
national_state 6,102 (e1f9906bf0e0) 6,102 (1b318eafb174)
  • Removed: the district file's two US interest rows.
  • Values: the 974 district-file state and district interest rows, by one factor per measure. Amounts move x2.52943223191 ($313.120B / $123.791B raw); returns move x1.115768872989 (54,167,410 / 48,547,160).
  • Metadata only: 1,052 Historic Table 2 interest rows gain soi_share_total_source_record_id. 1,034 of them are on national_state, which is that surface's whole change: no national_state value or membership moves.
  • Hierarchy: all 872 district interest rows reconcile with factor 1.

The tilt. Historic Table 2's US row includes Puerto Rico and other areas, so its rebased states sum to 0.984 of the control for amounts and 0.992 for returns. The district file has no other-area rows, so its states sum to exactly the control. In aggregate each district-file state target therefore sits about 1.7% (amounts) and 0.8% (returns) above the matching HT2 state share; per state the amount ratio runs from 0.80 (Wyoming) to 1.075 (Rhode Island, Delaware, DC), a spread typical of the CD-vs-HT2 pairs full already carries.

ACS-local (tools/build_us_acs_local_release.py on the same feed, main vs this PR):

  • state_cd: all 26,425 spec values are identical (max relative difference 4.3e-16). Its counts, the factor band's out-of-band blocks, its drops and its internal-consistency check are all unchanged.
    • state_cd already used district interest rows only as within-state shares of Historic Table 2, so a national factor cancels.
    • Only the receipt's interest rebase-factor summaries move: amounts from 2.35–2.70 to 0.93–1.07 (median 0.977), returns from 1.095–1.116 to 0.981–1.001.
    • docs/us-acs-local-soi-target-surface.md and a comment in tools/us_acs_local_cd_surface.py are updated.
  • state / totals / full: irs_soi counts unchanged at 4,227 / 607 / 31,321. On full, the district interest values move as above.

Invariants

  • Shares conserve the control.
    • Every share row is raw x control / its own family's US row.
    • A family's states, and each state's districts, sum to control x (Σ states / family US), so never past the control. When the states partition the US row (the district file), they sum to exactly the control.
    • No district-file interest row ships at the country level.
    • Every rebased row's control is a compiled national target.
    • Test: a Hypothesis property over random district packages and their period stamp (2022 or 2023), other-area residuals, HT2 rows, controls, measures, and an equal-valued twin US row sorting before or after us.
  • Order-free. The compiled registry (names, values, metadata) is identical in every feed order, and a twin total names the smaller record id. Tests: the property; a parametrized twin-denominator test.
  • Own denominator. Every share row divides by, and names, its own family's US row; conflicting totals refuse. With the district file stamped truthfully at 2022, its US row shares period, universe and status with Historic Table 2's, so only the family separates them. Tests: the property; the stamp differential.
  • Stamp-invariance. Test: a differential compiles and ages the package stamped ty2023 (as on the feed) and truthfully at 2022. The values are identical and age from the control's 2023 period on the AGI link, exactly as the Table 4.3 row does.
  • Coverage band (pinned, two-sided). On the full surface every stale taxable-interest family sums to within [0.85, 1] of the national target it was scaled to: the district file's states and districts, and Historic Table 2's states.
    • The comparison key reads a bridged universe (soi_return_universe_bridge) as the control's universe and drops the materializer's no-op all ledger filters (_is_noop_ledger_filter_value), so all-returns rows compare with the excluding-dependents Table 4.3 row.
    • No compared family may be missing.
    • On main it fails: the district US row is still a country-level target, and the district families sit at 0.395 (amounts) and 0.896 (returns), as computed on the main compile dump.

Tests

Run locally on the engine-free venv; the pinned-feed tests read ~/PolicyEngine/_buildh-runtime/inputs/consumer_facts_us_51aa40f.jsonl. CI has no feed and skips them.

  • engine_free/us/test_us_fiscal_targets.py: 182 passed, plus the 3 pinned-feed tests (the receipt, the fences re-pinned at 33,248 / 1b318eafb174, and the new district interest check).

  • Neighbouring suites at 2b7164e15, 280 passed with none skipped:

    • test_us_acs_local_sparse_cd.py, including the pinned-feed state_cd contract test;
    • test_us_congressional_district_vintage.py;
    • test_us_soi_state_agi_bands.py;
    • shared/test_release_target_parity.py;
    • test_us_release_gate_preflight.py;
    • test_us_chronicle_feed.py;
    • test_us_acs_local_release_tool.py.
  • test_us_fiscal_refresh_builder.py: 327 passed, 6 skipped (they need the US engine extra).

  • Mutation run. Each mutant of fiscal_targets.py ran against the interest tests; two also ran against the pinned check. All 8 were killed (failing tests in brackets):

    • the district file not a share family (11, plus the pinned check);
    • share rows not naming their denominator (5);
    • totals stored under the wrong key, so every lookup misses (19);
    • stale levels kept beside a control (3);
    • conflicting totals not refused (1);
    • the district US row surviving (4, plus the pinned check);
    • the district file allowed as a control (7);
    • a family-agnostic key and lookup (1). Only the corrected-stamp case separates the two families' US rows, so 4602d939d adds Historic Table 2 rows to the stamp differential to pin it. Since 8bf49c35e the property also draws that case.

    The mutants and log are in the evidence folder.

  • ruff check and ruff format --check clean; tools/ci_test_plan.py verify passes.

  • 8bf49c35e was pushed during a host hold. It holds the property rewrite plus docstring and doc edits; CI's engine-free jobs cover it, and the interest and pinned suites re-run locally once the hold lifts.

New tests:

  • the district rows are shares of the control, while HT2 rows keep their own denominator;
  • the stamp-invariance differential;
  • no control keeps levels;
  • no family total drops the rows beside a control (district file and HT2);
  • conflicting totals refuse;
  • an order-free denominator;
  • a share-family classification table;
  • the Hypothesis property;
  • the pinned coverage-band check.

Interplay

Why this lands without a ruling

Review

In-session executed review. Three Opus 5.5 reviewers took distinct lenses: rebase logic, downstream and interplay, and method, tests and claims. An adversarial verifier re-checked each P1/P2 finding. Reports are inhouse-review-*.md and inhouse-verify-*.md in the evidence folder. There was no P1.

Independent GPT-6.1 Sol review (Subfleet 20261012-103246-review-1229, at 2b7164e15): pending.

Evidence (compile dumps, diff script, state_cd receipts, mutant log): ~/PolicyEngine/_reviews/cd-taxable-interest-20261012/.

axiom: n/a: microsim target compilation, no policy rule changes.

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 12, 2026 10:28
…es (#1038)

The congressional-district file (22incd.csv, TY2022 data stamped ty2023) was
barred from being a taxable-interest control but still shipped its rows as
TY2022 levels, and its US row compiled as a second national target. On the
pinned 51aa40f feed's full surface its US row, states and districts each
summed to $134.6B against Table 4.3's $340.4B (0.395x) and 48.5M against
54.2M returns (0.896x).

The interest rebase now treats Historic Table 2 and the district file as
share families: each row is its share of its own family's national all-AGI
row times the Pub 1304 control (one factor per family, quantity and period),
each family's US row retires, and each share row names its denominator in
soi_share_total_source_record_id. Conflicting family totals refuse; equal
ones name the smaller id. A share row with no family total is dropped beside
an eligible control, as capital gains already does.

Pinned feed: 974 district-file values move by x2.52943 (amounts) and
x1.11577 (returns); the two district-file US rows retire (33,250 -> 33,248);
1,052 HT2 interest rows gain the denominator key, so national_state moves
e1f9906bf0e0 -> 1b318eafb174 with no value change. state_cd values, counts
and band verdicts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stamp differential now compiles Historic Table 2's TY2022 interest rows
beside the district package. Stamped truthfully at 2022, the two families'
US rows share a period, universe and status, so only the family in the
denominator key keeps each on its own US row; a family-agnostic key fails
this test (mutation run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding, doc numbers

- The Hypothesis property now draws the district stamp (2022 or 2023) and an
  equal-valued twin US row on either side of "us", so its own-denominator
  and order-free clauses can fail (a family-blind key or a feed-order
  denominator breaks it), and checks that every rebased row's control is a
  compiled target.
- Docstrings: "_2022" in congressional_district_2022 is the data year, not a
  boundary vintage; state the stamp <= control-period precondition and the
  pre-existing per-row-control vs per-pair-retirement corner (main has it
  for Historic Table 2 too; no current feed carries Table 1.4 interest).
- Historic Table 2's states sit at 0.984 of the control for amounts and
  0.992 for returns; the state_cd doc gives interest's new factor range
  (0.93-1.07, 0.981-1.001) and why it sits below 1.
- _soi_bridged_quantity says it is the interest comparison key, not the
  materializer's full key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Heads-up from #1244, which makes the SOI congressional-district guards vintage-free. #1244 changes _is_soi_congressional_district_record_set to a family match (_soi_record_set_family(...) == "congressional_district"), and adds test_district_taxable_interest_never_controls_the_rebase[pinned-cd-2022|hypothetical-cd-2024] in tests/engine_free/us/test_us_soi_congressional_district_vintage.py.

That test asserts main's semantics:

  • the district US row compiles;
  • an uncontrolled Historic Table 2 band keeps its source value.

This PR retires the US row and drops uncontrolled shares, so those two assertions need updating when the second of the two lands. The controlled case (the band rebases onto Table 4.3, never onto a later-stamped district row) should still hold.

Once this PR and #1040 both land, _is_soi_congressional_district_record_set has no callers left. Consider having _soi_taxable_interest_share_family use _soi_record_set_family rather than the .congressional_district_ substring, so the namespace and segment semantics stay shared.

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

#1244 has merged (8fd39a21b). The heads-up above now applies on this PR's next rebase onto main.

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

No deployments
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