Repository navigation
Conversation
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>
… 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
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.
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, sha256c6a58f637e42e832…, 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: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:
The fix (
us_runtime/fiscal_targets.py)US_SOI_MISPLACED_ROW_MERGESdeclares the merge, with the published values reviewed here and the evidence._merge_misplaced_soi_rowsruns 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_idsnames 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.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.
_coarsen_eitc_agi_groupsmerges 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 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_intervalpins 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.us_fiscal_target_exclusion_receiptgains asoi_misplaced_row_mergerule (actionmerged). 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 undersource_record_ids; when they hold only some, which a finished compile leaves as they are, it lists them underpassed_through_source_record_ids.Effect on the pinned feed
3aa2a0830e7d→6775e22cc90d(test_us_fiscal_targets.pyre-pinned).3aa2a0830e7d, so it moves no other target.$50,000 and overrow is a leaf that holds seven filing-season groups, so the leaf rule merges them into one$50,000 and overgroup. 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.Invariants, all tested
Merge (
test_us_soi_misplaced_row_merges.py, Hypothesis over 2 to 4 tiling members among unrelated rows):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):
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 carriesrequires_total_eitc_upratingas"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):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.pyandtest_us_target_loss_weights.pyin 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.pyandtest_us_eitc_decomposition_uprating.py: 50 passed.test_us_fiscal_refresh_builder.py's Ledger filter and exclusion receipt tests, withMICROCOSM_US_CHRONICLE_FACTSset to the pinned feed: 11 passed._leaf_boundsreturns 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;"false"and no-key cases oftest_coarsening_reads_only_rows_that_uprating_scalesfail;"false"(review r3's survivor on bfa0b49): the no-key case fails;test_exclusion_receipt_lists_merge_rows_the_compile_mergesfails;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:
Left out
🤖 Generated with Claude Code