Skip to content

Bind Table 2.5's misplaced TY2023 three-or-more EITC cell as one row - #1577

Draft
MaxGhenis wants to merge 5 commits into
mainfrom
eitc-t25-misplaced-cell
Draft

MaxGhenis wants to merge 5 commits into
mainfrom
eitc-t25-misplaced-cell

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Draft. A target-only change: it changes which Table 2.5 rows bind and the values of the EITC rows near them, and nothing in the engine, the microdata or the loss. It lands under d2680 if Max rules yes there, on a re-solve receipt; until then it stays a draft. It splits the Table 2.5 repair out of #1235 and follows the workbook check in #989.

What IRS published

IRS SOI Publication 1304 Table 2.5, TY2023 (23in25ic.xls, sha256 c6a58f637e42e832…, the file Chronicle ingests) prints the three-or-more-children column's $30,000 to $35,000 cell as 0 returns and $0. The same column holds 407,149 returns at $20,000 to $25,000 and 312,506 at $35,000 to $40,000. In every other AGI row the four child columns add to the all-returns columns (J, K) within 1 return and $1,000. Near the zero they don't:

AGI row Child columns less all-returns: returns Amount
$20,000 under $25,000 +1,187 +$297,000
$25,000 under $30,000 +310,212 +$1,723,778,000
$30,000 under $35,000 −311,398 −$1,724,074,000

The three gaps sum to within 1 return and $1,000 of zero, so IRS appears to have printed the $30,000 to $35,000 cell in the row above. TY2022's workbook reconciles within 1 return and $1,000 in every row.

Row totals can't say which child column holds the $20,000 to $25,000 row's extra 1,187 returns, 0.3% of that row's 407,149 three-or-more returns, so this PR leaves that row as published. The merged $25,000 to $35,000 row's four child columns then fall 1,186 returns and $296,000 short of the all-returns columns.

What the compile did

It bound the zero as a calibration target. It also uprated the 635,160-return $25,000 to $30,000 row by the filing season's $25,000 to $30,000 bin alone. Each filing-season group's factor divides the group's TY2024 EITC by the TY2023 Table 2.5 EITC inside it, so with three-or-more EITC moved down a row both factors went wrong for every child split's rows in them:

Group Returns factor Amount factor
$25,000 to $30,000 (before) 0.8322 0.8813
$30,000 to $40,000 (before) 1.0304 1.2979
$25,000 to $40,000 (after) 0.9540 1.0892

The fix (us_runtime/fiscal_targets.py)

  1. US_SOI_MISPLACED_ROW_MERGES declares the merge, with the published values reviewed here and the evidence. _merge_misplaced_soi_rows runs just before EITC uprating. For each measure it replaces the two rows with one …three_or_more_qualifying_children.25k_to_35k.<measure> target at their sum, in the first member's place. The new target's AGI bounds, restated Ledger AGI filter, income range, row label and hierarchy dimensions read $25,000 to $35,000. derived_source_record_ids names the two members, and the target carries none of their per-fact Ledger identities (fact keys, source record id, fact label), as the CHIP-derived targets don't.

  2. The merge's guard: it applies when the feed carries every member at its published value. A feed that carries every member with one at another value stops the compile, as an IRS correction would, and so does a feed that carries some members with one at its published value. A feed that carries some members, none at its published value, is another feed (a test registry, say) and passes unchanged.

  3. _coarsen_eitc_agi_groups merges filing-season AGI groups until each Table 2.5 row that uprating scales has one group's factor. Two kinds of row need a merge:

    • a row that straddles a group, meaning the two overlap and neither holds the other. The merged row crosses the filing season's $30,000 edge, so the $25,000 to $30,000 and $30,000 to $40,000 groups become one, and every child split's rows in $25,000 to $40,000 take its factor;
    • a leaf (a row that holds no other row of its child split) that no one group holds, even one that holds two or more groups exactly. Without the merge, those groups' source totals would miss the leaf's EITC.

    A row with rows of its own split inside it, such as a split's all-AGI total, may hold several groups, because the rows inside it carry its EITC into each one. That holds while those rows tile it, as Table 2.5's bins tile each split's total; the docstring states the precondition. A row that runs past the groups' range keeps the all-returns fallback that test_cross_period_soi_eitc_uprating_requires_complete_agi_interval pins on main. The coarsening raises when the groups to merge leave a gap inside a row, or when a merge would duplicate another active total. Only rows that uprating scales (requires_total_eitc_uprating) enter it.

  4. us_fiscal_target_exclusion_receipt gains a soi_misplaced_row_merge rule (action merged). It lists each declared merge with its members, their published values and reason. It replays the merge's decision over the facts latest-vintage selection activates: when those facts hold every member of an entry, it lists them under source_record_ids; when they hold only some, which a finished compile leaves as they are, it lists them under passed_through_source_record_ids.

Effect on the pinned feed

  • Compiled registry: 33,250 → 33,248 targets. National_state surface: 6,102 → 6,100, and its version 3aa2a0830e7d → 6775e22cc90d (test_us_fiscal_targets.py re-pinned).
  • With the merge switched off, the coarsening leaves the surface at 3aa2a0830e7d, so it moves no other target.
  • Each child split's TY2023 $50,000 and over row is a leaf that holds seven filing-season groups, so the leaf rule merges them into one $50,000 and over group. Uprating already gave each of those rows the seven groups' joint factor, and no other row sits in them, so no compiled target and no surface version moves.
  • On the pinned feed only TY2023 rows take this uprating: 115 rows for each of returns and amount, in four child splits whose bins tile each split's all-AGI total, over 30 distinct AGI ranges. Their filing-season groups tile all AGI, so no row runs past the groups' range. After coarsening each measure has nine groups. Review r2 found each group's uprated bins equal its control within a relative 3.4e-16, with no row on the all-returns fallback.
  • The merged rows compile to 605,935 returns and $4,152,165,490.
  • The feed carries Table 2.5's child splits for TY2022 and TY2023 only.

Invariants, all tested

Merge (test_us_soi_misplaced_row_merges.py, Hypothesis over 2 to 4 tiling members among unrelated rows):

  • it conserves the registry's total value;
  • it replaces exactly its members with one row at their sum, in the first member's place, and leaves every other target as it was;
  • a second pass changes nothing;
  • guard tests cover moved values, one member at its published value without the other, a member at two periods, members that leave a gap, conflicting metadata, a standard error, a measure mismatch and a name collision. A registry with none of the members, or with some members none at its published value (the synthetic registry in test_cross_period_soi_eitc_decomposition_prefers_agi_specific_factor), comes back unchanged.

Coarsening (Hypothesis over groups that tile AGI, arbitrary rows and leaves, infinite ends included):

  • the result tiles AGI on input edges only;
  • each control equals the sum of the input controls inside it;
  • no row straddles a result group, and one result group holds each leaf;
  • it is idempotent;
  • the groups come back unchanged when no row needs a merge;
  • differential: it agrees with an independent edge-removal reading of the same rule, in which a leaf removes every group edge strictly inside it.

Uprating, end to end (test_uprating_conserves_each_group_s_controls_for_any_split_tiling, Hypothesis over filing-season bins that tile AGI and one to four child splits whose bins tile AGI, with an optional subtotal row, plus a fixed example of review r1's geometry): through the real _uprate_cross_period_eitc_decompositions, every row survives, one group holds each row, each final group's uprated bins add to its controls within 1e-9, and the uprated split totals add to all of them. With the leaf rule switched off, the fixed example fails the property without any generated input.

Only rows that uprating scales shape the groups (test_coarsening_reads_only_rows_that_uprating_scales): a straddling row merges groups only when it carries requires_total_eitc_uprating as "true". A row without the key, which is how the compile leaves a row it doesn't uprate, merges none, and neither does a row with "false".

Real data (test_us_eitc_table_2_5_irs_reconciliation.py, the #1274 fixture of verbatim pinned-feed rows):

  • the declaration matches the fixture's values, the zero and both neighbours;
  • the merged row equals its members' sum times the filing season's $25,000 to $40,000 EITC over every split's Table 2.5 EITC in that range, with the metadata and hierarchy above;
  • the release materializer's Ledger filter guards accept the merged rows and refuse one whose restated AGI bound disagrees with its compiled bound;
  • the Check the Table 2.5 EITC child splits against the real IRS rows in CI #1274 properties still hold over the bound rows and coarsened groups: for any filing season, total rows and bins each sum to it and keep each group's child split, and under uniform growth each split's bins still sum to its total row. The test derives the groups independently: it checks that every non-total bin is a leaf, removes each season edge inside a bin, and places each row in exactly one group.

Receipt (test_us_fiscal_targets.py): the merge rule lists exactly the four TY2023 member ids as merged on the pinned feed, none on the synthetic feed, both members of a feed that carries both, and a lone member at another value as passed through, not merged. When a feed also carries a newer vintage of both rows, the rule lists neither TY2023 row, because latest-vintage selection never activates them.

Verification

Local runs block the engine, as CI's engine-free job does. All ran on 63ddb73's content:

  • test_us_fiscal_targets.py and test_us_target_loss_weights.py in full, with the pinned feed present: 217 passed, the re-pinned surface, EITC split and receipt tests among them.
  • test_us_soi_misplaced_row_merges.py, test_us_eitc_table_2_5_irs_reconciliation.py and test_us_eitc_decomposition_uprating.py: 50 passed.
  • test_us_fiscal_refresh_builder.py's Ledger filter and exclusion receipt tests, with MICROCOSM_US_CHRONICLE_FACTS set to the pinned feed: 11 passed.
  • Mutants, each patched in memory and run with a fresh Hypothesis database and shrinking off. Every one fails a test, and the unmutated run passes:
    • the leaf rule off, two ways (_leaf_bounds returns no leaves; the coarsening reads straddling rows only). On bfa0b49 each failed in 5 of 5 runs. Review r3 also ran the conservation property on its fixed example alone: it failed under four leaf mutants and passed without one;
    • every EITC decomposition row marked for uprating: the "false" and no-key cases of test_coarsening_reads_only_rows_that_uprating_scales fail;
    • a row counts unless its flag reads "false" (review r3's survivor on bfa0b49): the no-key case fails;
    • the receipt lists every carried member as merged, as 643eb69 did: the one-member case of test_exclusion_receipt_lists_merge_rows_the_compile_merges fails;
    • the receipt reads every fact in the feed instead of the selected vintage (review r3's other survivor): the newer-vintage case fails.
  • Ruff check and format pass on the changed files.

Reviews: r1 and r2 at 643eb69 and earlier heads, r3 on 643eb69bd..bfa0b4971 (approve with nits; 63ddb73 answers them and corrects this description's known limits).

Known limits

Review r2 ran three inputs through the real uprating that go wrong or lose detail without an error. The pinned feed has none of them:

  • a row past the groups' range that overlaps a group keeps the all-returns factor while that group's source total misses its EITC. Main does the same. The docstring says so; filing-season bins tile all AGI;
  • a split that lacks a bin under its all-AGI total leaves that bin's EITC out of every filing-season group, so the groups it falls in take wrong factors. Main does the same. The docstring states the tiling precondition;
  • a split that carries only its total makes that total a leaf, so every group merges into one. That conserves, but loses AGI detail. This case is new with the leaf rule. Review r3 ran it on main (89660a3), where the other splits' bins took each group's whole control and summed to twice their own total row.

Left out

  • Rake the EITC child-split bins to their total rows and AGI groups #1235's rake has to use the same coarsened groups; a comment there says so.
  • TY2021's workbook shows the same pattern in the one-child column: $45,000 to $50,000 prints 0, and the $25,000 to $30,000 row exceeds the all-returns columns by 107,558 returns and $26,117,000. The pinned feed carries no TY2021 Table 2.5 child-split rows, so this PR declares no merge for them.
  • Chronicle keeps the published cells as IRS prints them; the merge lives in Microcosm's compile.

🤖 Generated with Claude Code

IRS SOI Publication 1304 Table 2.5 (TY2023) prints the three-or-more-children
column's $30,000 to $35,000 cell as 0 returns and $0, and its $25,000 to
$30,000 cell exceeds the all-returns columns by 310,212 returns and
$1,723,778,000; the two rows reconcile only in sum.

US_SOI_MISPLACED_ROW_MERGES declares the merge with the reviewed published
values. _merge_misplaced_soi_rows binds the two rows of each measure as one
$25,000 to $35,000 target before EITC uprating, and stops the compile if the
feed carries other values or only some of the rows. _coarsen_eitc_agi_groups
joins the filing-season AGI groups a source row straddles, so every child
split's rows in $25,000 to $40,000 take one uprating factor.

Pinned feed: 33,250 -> 33,248 compiled targets, national_state surface
6,102 -> 6,100, registry version 3aa2a0830e7d -> 6775e22cc90d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits November 11, 2026 10:50
… receipt (review r1)

Review r1 found that a split's leaf row holding two or more filing-season
groups exactly sat in no single group, so those groups' source totals
missed its EITC. The coarsening now merges the groups for any leaf no one
group holds, as it does for a straddling row. Rows past the groups' range
keep the all-returns fallback that main pins, and only rows that uprating
scales enter the coarsening.

The exclusion receipt gains a soi_misplaced_row_merge rule that lists each
declared merge and the member ids the feed carried. Docstrings state the
merge guard exactly and say why the $20,000 to $25,000 row stays as
published.

Tests: an end-to-end Hypothesis property runs the real uprating over any
filing-season bins and one to four tiling child splits and checks that
each final group's uprated bins add to its controls (switching the leaf
rule off fails it); the coarsening oracle and invariants cover leaves; the
Table 2.5 reconciliation test derives groups with leaves; the receipt
tests pin the new rule. On the pinned feed the leaf rule merges each
split's $50,000-and-over groups into one and leaves every compiled target
and the registry version (6775e22cc90d) as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Exclusion receipt: list a partial feed's member rows under
  passed_through_source_record_ids instead of as merged. The receipt now
  replays the compile's rule, which merges an entry only when the feed
  carries every member.
- _coarsen_eitc_agi_groups: state the precondition that a split's bins tile
  its total, and what goes wrong without an error when they don't.
- Tests: a fixed example of the leaf-holding geometry for the end-to-end
  conservation property, a test that only rows uprating scales shape the
  groups, and receipt tests for one carried member and for every member.
- Changelog: the receipt's pass-through list and both surface versions.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The uprating-filter test now covers the form the compile writes for a
  row it doesn't uprate (no requires_total_eitc_uprating key) beside the
  literal "false", so a filter that skips only "false" fails it.
- The receipt test adds a feed that carries a newer vintage of both rows:
  latest-vintage selection never activates the TY2023 rows, so the rule
  lists neither. A receipt that read every fact in the feed fails it.
- The pinned-surface test's docstring says "surface version".

Co-Authored-By: Claude Fable 5.2 <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