Repository navigation
Check the Table 2.5 EITC child splits against the real IRS rows in CI - #1274
Conversation
Commit the 274 pinned-feed rows (TY2023 Publication 1304 Table 2.5 and TY2024 filing-season EITC by AGI) as a fixture and test them in CI: source band sums, split-to-all-returns totals, reconciliation with IRS-published TY2023 and TY2024 EITC, and Hypothesis properties on the real layout that the compiled AGI bins and total rows add to any filing-season EITC. The compiled tests fail on the pre-#1227 code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the unverified cause of the Publication 1304 vs December-count gap and state only the two documented bases. Correct the per-split rounding gap to $1,000. Compare the compiled 2024 rows with IRS's TY2024 figures only, not TY2023. Say what the source sum check can and cannot catch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Interplay with microcosm#1235, which rakes the Table 2.5 child-split bins to their total rows and the active AGI groups.
For arbitrary filing-season inputs, the rake can also be infeasible: active EITC only in AGI groups where a split has no bins. The compile then refuses with "no scaling of the source bins meets both margins". So the property needs to accept that error, or draw only feasible inputs. Your other tests (the source checks, the total rows, uniform growth) hold under the rake as they are. 🤖 Generated with Claude Code |
Main re-pinned the US Chronicle feed to 41b2fb2 since this branch's CI ran on 2026-10-14; the next commit refreshes the fixture to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since this branch's CI ran, main re-pinned the US Chronicle feed three times: cf9ece2 (#454), a9026cc (#1343) and 41b2fb2 (#1074). After the merge, test_fixture_rows_are_verbatim_pinned_feed_rows failed wherever the pinned feed is present (CI has no feed, so it skips there). Of the fixture's 274 rows, the 32 filing-season AGI-bin rows changed. All 32 carry a new record_set_spec_hash, and the two under_1 rows carry the label "No adjusted gross income" (it was "No adjusted gross income and deficit"), the one-label-per-value change #1343 pinned. No value, bound or record id changed, and the Table 2.5 rows are byte-identical. cf9ece2's rows for these record sets match the old fixture byte for byte. - The fixture now holds the 41b2fb2 rows, built the same way as before: the feed's lines for the nine record sets, sorted by lineage.source_record_id. The same procedure on 51aa40f reproduces the old fixture byte for byte. - The verbatim test's docstring says how to refresh the fixture, and its assertion names the file to refresh. - docs/us-chronicle-feed-repin.md runs this test file with the parity tests after a re-pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrite the module docstring and five test and helper docstrings in active voice: "the halving that microcosm#1227 fixed", "returns IRS processed by December 2024", "exceeds the TY2023 December figures by 6.3% and 3.5%", "the compile puts a bin in", "the extraction neither drops a bin". Text only; no code, value or tolerance changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 2.5 tests test_fixture_rows_are_verbatim_pinned_feed_rows now checks the local feed's sha256 against the facts_sha256 that chronicle_feed.json pins, as pinned_feed_national_state_surface does through load_ledger_consumer_artifact, so a stale or altered local feed fails with both digests in the message instead of a row diff. The uniform-growth test's docstring said each split's bins add to its total row within the source's rounding gap (5 returns or $5,000 before scaling); its assertion allows twice that times the factor. The compile scales the total rows by the ratio of all bins to all total rows, so each split's gap adds its share of the gap summed over splits to its own. The docstring now says so. 0bd01eb also rewrote the _ROUNDING comment, which its message left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0d0e49f's docstring and message said each split's gap adds its share of the gap summed over splits to its own. The share enters with the opposite sign: the compile scales each total row by the filing-season bins' sum over the four total rows' sum (here the factor times all Table 2.5 bins over all total rows), so a split's compiled gap equals the factor times its source gap less its total row's share of the summed gap. The docstring now states that, and that every gap on this fixture stays within one rounding allowance; the assertion's bound (twice the allowance times the factor) is unchanged. Text only; docstring-stripped ASTs equal 0d0e49f's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8c140f6's sentence "the factor times its source gap, less its total row's share of the gap summed over the four splits" also reads as applying the factor to the first term only, and "every gap stays within one allowance" holds for the gap per unit of factor, not for the compiled gap at growth above 1. The docstring now gives the compiled gap as factor * (g - t / T * G), defines each symbol, and says g - t / T * G stays within one allowance on this fixture, so each compiled gap stays within one allowance times the factor. Text only; docstring-stripped ASTs equal 8c140f6's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I'm handing this PR to the Microcosm hub (session
|
|
I merged this at d305e2e. All 11 checks passed on that head, and an independent Opus 5.5 review approved it. |
Why
The app v3 Validation tab (PolicyEngine/policyengine-app-v2, report 4323) showed the US EITC at about 2× its SOI Table 2.5 child-split targets. The model's EITC matched the totals IRS published; the targets came to about half of them.
The tab reads
irs_soi.ty2023.table_2_5.eitc_by_agi_children.<split>.total.{eitc_returns,eitc_total}@2024from releasepopulace-us-2024-spm-20260915'scalibration_diagnostics.json. Those 8 rows summed to 11.92M returns and $34.52B. IRS published "more than 23 million" and "about $64 billion" for TY2023.Root cause: the compile, not the extraction
Chronicle extracts the table correctly. Its
soi-table-2-5-eitc-agi-children-2023package reads IRS23in25ic.xls(sha256c6a58f63…, byte-identical to the live IRS file on 2026-10-14), and we checked it against the workbook:The bug sat in microcosm's compile.
_uprate_cross_period_eitc_decompositionsscales the TY2023 rows to the TY2024 filing-season EITC by AGI. For the all-AGI total rows, it uses the group (-inf, inf)._eitc_source_decomposition_total_for_boundssummed every row inside that group: each split's 28 bins and its total row. So the denominator doubled the source:The bug left the AGI-band rows alone. For example, 10k–15k divided 3,819,056 by 4,197,059, the correct sum over splits, for 0.9099. The code path dates from #157 (2026-06-20).
#1227 fixes it and merged on 2026-10-14 as
de90c6c7e. It counts each split's outermost rows only. An independent Opus 5.5 agent reviewed its head40bfb23eaafter the merge and approved. That reviewer re-derived the effect with a whole-registry differential on the pinned feed: 8 targets change, each ×2, and no others.What this PR adds
These tests let CI catch the halving if it comes back. The existing pinned-feed tests skip in CI because CI has no feed.
tests/fixtures/us_soi_eitc_table_2_5_feed_rows.jsonlholds the 274 rows of the pinned feedconsumer_facts_us_41b2fb2.jsonl(sha2561d45a89c…) for:25inweek47.xlsx): 16 bins and the totals.The fixture keeps them verbatim, in record-id order, and the tests load them through
load_ledger_consumer_artifact, as the release does. On any machine that has the feed,test_fixture_rows_are_verbatim_pinned_feed_rowschecks the feed's sha256 against the pin and then checks the fixture byte for byte against the feed's rows. The fixture first copiedconsumer_facts_us_51aa40f.jsonl; main's later re-pins changed the metadata of 32 rows and no value.Example tests check the source rows:
Reconciliation tests compare the rows with the IRS EITC statistics pages, which we read on 2026-10-14:
Compiled tests compile the real rows at target period 2024:
Hypothesis property tests run 100 examples each on the real Table 2.5 layout and cover both grouping paths: bins inside one filing-season bin, and the $50k-and-over bin, which spans seven.
Under non-uniform growth it holds summed over splits, but not per split. Since Count each EITC child split once in the Table 2.5 uprating source total #1227, the compile keeps each total row on the all-AGI child mix and each bin on its group's. Rake the EITC child-split bins to their total rows and AGI groups #1235 takes up the methodology question of reconciling the two.
On the pre-fix code (main at
21416b03e), 4 of the 15 tests fail: both compiled reconciliations (11,918,574.5 returns and $34,520,825,260 against 23,837,149 and $69,041,650,000) and both properties. Hypothesis minimizes the defect to a filing season with 1 return, in 10k–15k: the total rows compile to 0.5. The 11 source and fixture tests pass on both trees, because the extraction had no bug.Did the calibration weights use these targets?
Yes. Release
populace-us-2024-spm-20260915inherits its calibration from Build P (populace-us-2024-buildp-sparse-rmloss100-cae8640-20260728T011454Z). Itscalibration_diagnostics.jsonlists 5,659 targets, the same count astarget_surface.n_targets. That surface includes all 232 Table 2.5 child-split rows, the 8 halved total rows among them. The calibration weighted its losses withsqrt_value_concept_budget_weighted…_cap_100pctand capped each target's relative error at 1.0.The halved rows pulled against the other EITC targets and lost:
Seven of the 8 started inside the cap and finished at or near it. The fit followed the other EITC targets: the filing-season totals and AGI bins, the 224 Table 2.5 bins, and Historic Table 2 state EITC by children. The fit pushed the childless returns row past the cap (
past_cap_census.pushed_out_rowslists it). The final weighted estimates land within −5.4% to +1.6% of the corrected values. These figures come from the release's diagnostics; they don't predict a re-calibration.#1227's reviewer re-derived on the pinned feed what #1227 changes in the next calibrated build:
e1f9906bf0e0→3fad14f85468; fullf5bd921d6b21→c3aaea9c1e8c.target_loss_weights.pysets each weight to √|value| over the basis mean. Count each EITC child split once in the Table 2.5 uprating source total #1227's differential found every other national_state weight moving by at most 0.12% after renormalization.Given where the final estimates already sit, these rows should go from near-cap error to within a few percent, and their pull against the other EITC targets ends. Only a calibration build can measure how much the weights move.
This PR changes nothing in the build. It adds tests, a fixture and a paragraph in the re-pin doc.
The Validation tab keeps showing the halved targets until we calibrate a release from main at or after
de90c6c7e, publish it, and select it in the calibration-diagnostics dashboard manifest. The tab reads that release's diagnostics, and a person publishes each release by hand (README, "Releasing & alerts"). On 2026-11-10 the dashboard still selectedpopulace-us-2024-spm-20260915, and its 8 total rows still showed 89% to 103% error.The zero AGI-band cells
Neither comes from band parsing; the row guards hold. Two different causes produce them:
23in25ic.xlsthe three-or-more 25k–30k cell holds 635,160 returns and $3.81B, and the 30k–35k cell holds 0.Invariants (load-bearing logic)
Main merge and fixture refresh (2026-11-10)
This branch's CI ran on 2026-10-14. Since then main re-pinned the US Chronicle feed three times: cf9ece2 (#454), a9026cc (#1343) and 41b2fb2 (#1074).
4ae2bf353merges main atbd09f1783with no hand resolution: its tree equalsgit merge-tree --write-tree bd09f1783 fd5b42c48.After the merge,
test_fixture_rows_are_verbatim_pinned_feed_rowsfailed on any machine that has the pinned feed; CI has no feed, so it skips there. The other 14 tests passed. Of the fixture's 274 rows, the 32 filing-season AGI-bin rows changed:record_set_spec_hash;under_1rows carry the label "No adjusted gross income" (it was "No adjusted gross income and deficit"). Chronicle commit2431ba87made that change, and the a9026cc re-pin brought it in.No value, bound or record id changed, and the Table 2.5 rows kept every byte. cf9ece2's rows for these record sets match the old fixture byte for byte.
e4932a485refreshes the fixture and documents how to refresh it again:lineage.source_record_id. That procedure reproduces the old fixture from 51aa40f byte for byte.docs/us-chronicle-feed-repin.mdruns after a re-pin, with a paragraph on why.0bd01ebccrewrites the test module's docstrings and the_ROUNDINGcomment in active voice and changes no code.0d0e49f66makes the verbatim test check the local feed's sha256 against the pin inchronicle_feed.jsonfirst.0d0e49f66,8c140f6beandd305e2e48correct the uniform-growth test's docstring, which had stated half the bound its assertion allows, and give the gap it bounds:factor * (g - t / T * G), wheregis the split's source gap,tits source total row,Tthe four total rows' sum andGthe four source gaps' sum.Tests run
At
0d0e49f66(2026-11-11, pinned feed 41b2fb2;8c140f6beandd305e2e48change only a docstring):uv run pytest packages/microcosm-build/tests/engine_free/us/test_us_eitc_table_2_5_irs_reconciliation.pypasses, 15 of 15 including the local pinned-feed check.ruff checkandruff format --checkpass.At
e4932a485(2026-11-10, after the merge):test_us_eitc_decomposition_uprating.pyandtest_us_chronicle_feed.pypass, 54 of 54, with the local feed.engine_free/us/test_us_fiscal_targets.pywithout the feed, so that file's pinned-feed tests skip there; the local pinned-feed run of that selection didn't finish.At
b9b08396f(2026-10-14, pinned feed 51aa40f):test_us_fiscal_targets.pyandtest_us_eitc_decomposition_uprating.py,-k 'eitc or decomposition or pinned_feed',-n 4) passes 21 of 21 with the local feed, none skipped. That includes the national_state fence at3fad14f85468.21416b03e(pre-Count each EITC child split once in the Table 2.5 uprating source total #1227), 4 fail and 11 pass.Review
An independent Opus 5.5 agent reviewed
4cbdfd1eband approved. It:23in25ic.xls, with 0 mismatches;age_targets=True, Medicaid substitutions);21416b03e;fiscal_targets.py: total rows or bins ×0.75, ×1.02 and ×1.5; innermost rows; no-merge; drop-zero groups; one-split source; and the pre-fix sum. The one survivor, narrowest→widest group choice, behaves identically on this data, because filing-season bins never overlap;b9b08396ffixes its non-blocking findings, and the reviewer approved it on a second pass:fd5b42c48fixes its one nit atb9b08396fwith a docstring-only change: footnote 1 implies that Table 2.5 includes prior-year returns but doesn't state it.Another independent Opus 5.5 agent reviewed
b9b08396f..d305e2e48over four rounds, building on a first agent's checks of the merge and the fixture, and approved the whole PR atd305e2e48. It:4ae2bf353has no hand resolution and that the fixture matches the pinned feed's rows byte for byte;de90c6c7e, and that theunder_1relabel leaves the compiled values as they were;We answered its findings in
0d0e49f66(the digest check and the uniform-growth bound) and in8c140f6beandd305e2e48(the gap formula, whose last term had the wrong sign in0d0e49f66and whose factor could read as applying to the first term only in8c140f6be).d305e2e48's commit message says the one-allowance claim fails for compiled gaps above growth 1; they first exceed one allowance above growth 5/3, on returns only, and the docstring states the bound correctly. The reports sit in~/reviews/microcosm-eitc-t25-2026-11-10/runs/delta-review-0bd01ebcc/.axiom: n/a: calibration-target compile tests (no policy encoding)
🤖 Generated with Claude Code