Skip to content

Match the SOI congressional-district file by family, at any vintage - #1244

Merged
MaxGhenis merged 2 commits into
mainfrom
soi-cd-vintage-free-family
Oct 13, 2026
Merged

MaxGhenis merged 2 commits into
mainfrom
soi-cd-vintage-free-family

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Every check that asks "is this the IRS SOI congressional-district file?" matched the pinned package literally: ".congressional_district_2022." in record_set_id, or the family id irs_soi.congressional_district_2022. The next IRS district release will arrive as a new package, e.g. irs_soi.ty2024.congressional_district_2024.all_returns, and it would pass straight through the guards:

No target value and no registry version moves. Evidence is below.

Changes

Site Before After
fiscal_targets._is_soi_congressional_district_record_set (gates _soi_taxable_interest_control_key_from_fact and _is_soi_cd_premium_tax_credit_amount_conflict, its only callers) ".congressional_district_2022." in record_set_id _soi_record_set_family(record_set_id) == "congressional_district". The helper is copied verbatim from #1036/#1040, which are not merged.
release_target_parity.RED_LINE_COMPILED_FAMILIES "irs_soi.congressional_district_2022", looked up by exact manifest key "irs_soi.congressional_district". At least one district family must be declared and every declared vintage must compile. New public us_target_family_vintage_free_id.
tools/build_us_target_parity_manifest.py _COMPILED_FAMILY_NOTES keyed irs_soi.congressional_district_2022 keyed and looked up by vintage-free id

Left exact on purpose, and now tied to the pinned feed scope so a repin fails loudly at them:

  • SOI_CONGRESSIONAL_DISTRICT_RECORD_SET_ID. The household CD sampling distribution (tools/build_us_puf_support_base.py) must read exactly one district file. A 2024-only feed raises No SOI congressional-district return-count facts. A two-vintage feed reads only the pinned file and never mixes rows; a vintage-free match there would raise on duplicate geoids.
  • The soi-congressional-district-2022 source-coverage alias (source_coverage.py; CONGRESSIONAL_DISTRICT_SOURCE_ALIASES and REVIEWED_EXCLUDED_ALIASES in the release builder). These are package registries, not family checks.
  • The generated packaged JSON (chronicle_feed_scope.json, target_parity_manifest.json, target_parity_feed_families.json). It describes the pinned feed and regenerates byte-for-byte; TestRegeneration passes locally with the feed present.

Already vintage-free, unchanged:

  • us_critical_targets.is_congressional_district_target (.congressional_district_);
  • the irs_soi.congressional_district_ spec prefix in tools/build_us_acs_local_release.py and tools/us_acs_local_cd_surface.py.

Invariants (property-tested)

test_us_soi_congressional_district_vintage.py::test_district_guards_hold_at_every_vintage generates 400 record-set ids. Period tokens are none, ty/cy/fy, a bare year, monthYYYY_MM or YYYY_MM; district data vintages run 1990–2099; any trailing segments are allowed. It checks:

  1. A district file is a CD record set and its PTC amount conflicts. It never keys a taxable-interest control, while its Table 1.4 twin keys one and does not conflict.
  2. No other SOI family, and no other source, is a CD record set.
  3. Differential vs the replaced literal. Every id .congressional_district_2022. matched still matches, and the two agree on every non-district id.
  4. Differential vs the other district checks. The family match holds exactly when each of these holds:
    • the period-free id starts with the release tools' irs_soi.congressional_district_ prefix;
    • the source record id's target family maps to the red line's vintage-free id;
    • us_critical_targets classifies the target as a district one.

Example tests:

  • the 2022 and hypothetical 2024 record sets end to end (interest rebase, PTC amount);
  • red-line cases: pinned, repinned, both vintages, a missing family, either vintage downgraded;
  • a manifest regeneration round trip on a 2024-only feed: the note attaches and the red line passes;
  • the exact pins match the pinned feed scope;
  • the household distribution refuses a 2024-only feed and ignores a second vintage;
  • a pinned-feed fact-by-fact equivalence test, which skips in CI where the feed is absent.

Evidence (executed locally)

Full compile fingerprint, main 7253402fb vs this branch. Each run replicates the pinned_feed_national_state_surface fixture: compile at 2024 with the canonical CD crosswalk and age targets, apply Medicaid substitutions, select national_state, and build the exclusion receipt. Every per-spec line is byte-identical.

feed registry (after Medicaid subs) national_state surface receipt fact decisions (raw / translated)
51aa40f (pinned) 33,250 specs, f5bd921d6b21, identical 6,102 specs, e1f9906bf0e0, identical identical 40,178 / 40,986 facts, 26,880 / 27,328 CD, 0 disagree
c5e5bf8 33,148, 0f3f81d9dd28, identical 6,000, 07f5c476b41d, identical identical 0 disagree
cf9ece2, f98acf4 (fact-level only) 0 disagree

The only district record set on any of these feeds is irs_soi.ty2023.congressional_district_2022.all_returns. Peak RSS was 3.0 GB.

Mutation. Running the new tests in-process with main's guards patched back in:

guard patched back tests that fail
literal predicate 8, every 2024-vintage case (end-to-end interest rebase and PTC, property, table rows)
old red line the repin and downgrade cases
old notes key the regeneration and shipped-note tests

The pinned 2022 cases pass under all three mutants.

Tests. The new file plus test_release_target_parity.py gave 88 passed locally with the feed-dependent tests running.

Scripts and outputs: ~/PolicyEngine/_reviews/cd-vintage-free-20261012/ (pinned_feed_fingerprint.py, fp_*, feed_fact_equivalence.py, mutation_old_guards.py).

Interaction with open PRs

axiom: n/a: microsim target-compilation guard; no policy rule changes.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 12, 2026 14:20
Every check that asked "is this the IRS congressional-district file?"
matched the pinned package literally (`.congressional_district_2022.` or
the family id `irs_soi.congressional_district_2022`). The next IRS
district release would arrive as a new package, e.g.
`irs_soi.ty2024.congressional_district_2024.all_returns`, and pass
straight through the guards: a ty2024-stamped district US aggregate would
out-date the ty2023 Table 4.3 control and become the taxable-interest
rebase control (#489), and its PTC amount would compile.

- fiscal_targets: `_is_soi_congressional_district_record_set` keys on
  `_soi_record_set_family(...) == "congressional_district"` (the helper
  #1036/#1040 add, mirrored verbatim).
- release_target_parity: the red-line entry is the vintage-free
  `irs_soi.congressional_district`; every declared vintage must compile
  and at least one must be declared. New `us_target_family_vintage_free_id`.
- tools/build_us_target_parity_manifest.py: the one-surface note is keyed
  by vintage-free family id.

The exact pins stay exact on purpose and are now tied to the pinned feed
scope: SOI_CONGRESSIONAL_DISTRICT_RECORD_SET_ID (household CD sampling
reads one district file) and the soi-congressional-district-2022 coverage
alias.

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

Copy link
Copy Markdown
Contributor Author

Merged at head c39b63e3f (merge 8fd39a21b), pinned with --match-head-commit. Gates:

Executed evidence is in the PR body: byte-identical compile fingerprints on feeds 51aa40f and c5e5bf8, fact-level equivalence on cf9ece2 and f98acf4, and the mutation runs.

None of the 63 commits main gained after CI ran touch the changed or dependent files, and the branch merges into current main without conflicts.

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