Skip to content

Nest the US target rows on the shared cross-grain operator, and re-pin the US feed (#1760: Stage A, steps 1 to 3 and decision 2) - #1791

Draft
juaristi22 wants to merge 46 commits into
mainfrom
claude/us-target-nesting-1760-4cb538
Draft

juaristi22 wants to merge 46 commits into
mainfrom
claude/us-target-nesting-1760-4cb538

Conversation

@juaristi22

@juaristi22 juaristi22 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1760. Closes #1759. Draft. Step 3 is here: the US feed re-pin to Chronicle 13294b93 and the target changes ruled for it, with decision 2 (the national level of the state SOI rows). Target values change.

Where this stands

Step What State
Stage A The four US share mechanisms run on the cross-grain operator that the UK uses, with the bytes they had Here
Rulings docs/us-target-nesting-rule-design.md: the rule, nine decisions (accepted 27 Nov 2026), and one general model to declare them Here (a page)
Step 1 The general model in the shared operator. The UK declares none of the new options Here
Step 2 The US on the model: one declaration in the UK's key names, the operator's metadata keys, one receipt format. Same target values; the keys and the receipts change Here
Step 3 The feed re-pin after PolicyEngine/chronicle#451, and the ruled target changes. The allocators and the level bridges go Here
Decision 2 The state rows of the 14 quantities of #1243 take the level of the newer national row, on a derived control of the kind scaled Here (1 Dec 2026). Its two build choices were ruled to stand on 1 Dec 2026
Joint surface The passes on one surface, in one operator call Not here: a follow-up PR (ruled 1 Dec 2026)
Second review An adversarial review of the head 30b22eea2 (1 Dec 2026): seven findings Six repaired here. For the seventh, 102 targets are held out of the production national mode until the follow-up (ruled 1 Dec 2026; see "The second review")
Review of 2 Dec 2026 A light review of the target changes: two requests and a view on the mortgage interest decision The account of the compile change is in the re-pin page (d6ce5d6c1). The build comparison needs a build, so it is María's call (see "The review of 2 Dec 2026")
Review of 3 Dec 2026 Two structural findings in the compile passes and three small fixes (anth-volk) All five done in 562e220f9. The compiled registry on the pinned feed is byte-identical before and after (see "The review of 3 Dec 2026")
Program review of 3 Dec 2026 Two critical findings on the district-file denominators of capital gains, one crosswalk read, and two text fixes All five done in 6d744f917. The compiled registry on the pinned feed is byte-identical before and after (see "The program review of 3 Dec 2026")
Second program review of 3 Dec 2026 One critical finding (two district files of one quantity both bound) and one to address (one file's districts stopped another file's state-total proxy) Both done in 0ceaf6652: the compile refuses two district files of one capital-gains quantity. The compiled registry on the pinned feed is byte-identical (see "The program review of 3 Dec 2026"). The third round replaces that refusal with a general rule (next row)
Third program review of 3 Dec 2026 One critical finding: a file with no district rows still bound a district through the state-total fill, beside another file (24 and 20 at D.C.) Done in ccdb91550 as a general rule: the compile refuses targets of one calibration cell that give different values, for any country and level (microcosm.build.ledger_cells). It replaces the district-file refusal of the second round. The compiled registry on the pinned feed is byte-identical (see "The program review of 3 Dec 2026")
Fourth program review of 3 Dec 2026 Two critical findings (C4: a gap in one file copied another file's own D.C. seat; C3: two spellings of all income were two cells) and two to address (A3: agreeing duplicates; A4: universes with no hash) All four done in 339ed484f. The rule now gives each cell one target: two values refuse, and one value is one target. On the pinned feed, two national copies of Table 1.2 that equal Table 1.1 stop binding: 28,099 targets (28,101 before), national_state 6,197 (6,199)

The rulings are in this comment on #1760. The page for the code is docs/us-target-nesting.md. The re-pin is in docs/us-chronicle-feed-repin.md.

What step 3 changes

The feed

  • US feed: Chronicle 13294b93 (Add later editions of the US feed's sources (chronicle#449) chronicle#451, merged 28 Nov 2026, with the vintage review of chronicle#449). Built offline from a clean checkout: 62,268 rows on chronicle.consumer_fact.v5, facts_sha256 2e880fd3…. The scope keeps today's record sets and tax years: 705 pairs (706 before).
  • County facts: moved to the same commit. The build at 13294b93 has the bytes of the 3e9d3a0 build (67b0998a…), so only the commit and the scope digest move.
  • chronicle#451 removes the district file's own state and US rows, keeps the at-large areas as district rows, and reads the district file's SALT and premium tax credit from the right IRS columns. The district file now carries its true tax year, 2022.

The compile

Surface Before (41b2fb2) After (13294b93)
Release compile (full) 31,748 28,116
national_state 6,102 6,316
  • national_state gains 204 Historic Table 2 state rows (charitable contributions and the QBI deduction, returns and amounts, 51 states; the 102 charitable rows are held out since the second review, see below), 2 national QBI rows of Historic Table 2 and 8 Table 1.4 partnership and S corporation rows. Historic Table 2 names the QBI deduction qbi_amount/qbi_claims, and the two SOI measure maps now take those ids.
  • The 810 TY2022 state taxable-interest band rows stay. The TY2023 state AGI-band package now carries taxable interest too, and the scope holds no TY2023 national Historic Table 2 row, so those slices would have displaced the TY2022 rows and then been dropped by the stale-interest rebase. A slice that the rebase would drop no longer takes part in the newest-vintage selection.
  • The state SSI targets take SSA's own workbook: the old pinned file's 51 state payment totals summed to more than its own US row. SNAP, BEA and Z.1 values move with chronicle#449's source revisions.
  • The District of Columbia's district is seat 98 (1198) at Chronicle, as at the Census Bureau. The district translation and the household district distribution read seat 98 as seat 00, Microcosm's at-large convention.
  • Row 4 retires (hierarchy_reconciliations: []): the district file has no state row to scale its district rows to.
  • Row 1: the district file has no US row, so the capital-gains share denominator of its rows is the sum of its district rows. On the state_cd surface the district capital-gains rows then nest in the Historic Table 2 state row, like every district row.
  • The restamp register is empty: no fact of the feed is restamped.

Held out of the compile: deferred_district_measures

A new register in us/fiscal_target_registers.json holds the district rows of 14 measures out of the compile (6,104 rows), each with its reason:

  • 12 would be new district targets: CTC, real estate taxes, taxable income, wages (new in the district file), and SALT and the premium tax credit (read from the right column now). New district families are for US local build: district targets that exist but are not in the fit #1731.
  • 2 are the renamed mortgage interest: mortgage_interest_paid_*, IRS column A19300/N19300, home mortgage interest paid to financial institutions. That is one part of the home mortgage interest deduction, not the whole interest deduction. Under its new id it binds no variable, at any level: Table 2.1 (national), Historic Table 2 (51 states) and the district file all carry it. Which variable it binds is a decision of its own (deductible_mortgage_interest is the closest). Table 2.1 keeps its national interest_paid_deduction target.

The nesting

  • Every district row nests in its Historic Table 2 state row, on state_cd and now on full too (rule: state_cd_district_shares on both modes in us/spec/target_sets.yaml). So full and state_cd give the same rows. Charitable contributions and the QBI deduction take Historic Table 2 parents, so the level bridges go.
  • The QBI deduction is paired by measure id: Historic Table 2's qbi_amount/qbi_claims with the district file's qualified_business_income_deduction_*, declared as paired_values on the district bridge selector.
  • The allocators go. Every pass divides a control by the operator's own rule (row × control / sum of the rows). Before they went, I checked that no reader needs an exact sum: every closure check has a tolerance. On the same inputs, removing them moves values in the last bits only: county populations keep their bits, and county SOI and household rows stay within 1e-12 relative of the old code. CrossGrainRule is main's again.
  • The factor band (1.25 around the median factor across states, unbind) takes off five blocks, 44 district rows: Hawaii qualified and ordinary dividends, Washington charitable contributions, Utah tax-exempt interest, New York rental income. The largest kept gap is 1.22x; the smallest dropped gap is 1.32x.
  • Both files are tax year 2022 now, so the factors are the level gap between the two publications: median 1.017 for returns, 1.019 for AGI (about 1.05 for amounts before). Taxable interest keeps its Table 4.3 rebase (median 2.40).
state_cd Before After
Historic Table 2 state rows 4,227 4,431
District-file state rows (level bridges) 302 0
District rows 21,743 (51 measures) 20,879 (49 measures)
(state, concept) blocks 2,189 2,102
Admin specs (with SNAP and Medicaid) 26,425 25,463
With the 487 ladder population rows 26,912 25,950

The state default goes from 4,380 to 4,584 compiled targets (5,071 with the ladder rows); totals stays at 255.

Not built yet

  • One pass on one joint surface. It goes in a follow-up PR (ruled 1 Dec 2026). The operator can do it: it rescales a middle level to its control first, and that row then controls the levels below it. The obstacle is in the US tools: the national pass runs in the compile before aging, the district pass when the local tool selects its surface, and the county passes after the engine pass. The clean form moves the district pass into the compile, which changes the registry on which the national release runs its parity and coverage gates.
  • the mortgage interest decision (above).

Decisions 4 and 7 go in their own PRs, as ruled.

Decision 2: the national level of the state rows

The defect (#1243). 14 SOI quantities bound two national rows of two tax years: the Historic Table 2 US row (tax year 2022), which is the total of the state rows' own file, and a newer Publication 1304 row (tax year 2023). No weight vector meets both. For two of them the state rows summed to more than the smaller national row.

The rule (ruled 27 Nov 2026). The newer row is the national control. Each state row takes one factor, the newer national value over the Historic Table 2 US total, so it keeps its share of the total of its own file. The Historic Table 2 US row stops binding.

How. A derived control of the kind scaled in the shared code (cross_grain_controls.scaled_control: a value times the lower rows' share of their own source's total). The operator divides it among the state rows. The US declares one pass with an entry for each pair, and the compile runs it (_nest_soi_state_rows_in_newer_national_controls), after rows 1 and 2 and before the state AGI bands.

Quantity (Historic Table 2 measure) Control Factor Historic Table 2 US over the control's table, tax year 2022 States over the control, after
adjusted_gross_income Table 1.1 1.0341 0.9965 0.9928
return_count Table 1.1 1.0060 0.9896 0.9941
wages_salaries_amount Table 1.4 1.0510 0.9969 0.9921
wages_salaries_returns Table 1.4 1.0069 0.9947 0.9947
taxable_ira_distributions_amount Table 1.4 1.0080 0.9929 0.9967
taxable_ira_distributions_returns Table 1.4 1.0161 1.0091 0.9973
taxable_pension_income_amount Table 1.4 1.0373 0.9857 0.9950
taxable_pension_income_returns Table 1.4 0.9863 0.9977 0.9956
taxable_social_security_amount Table 1.4 1.1561 0.9943 0.9977
taxable_social_security_returns Table 1.4 1.0507 0.9922 0.9968
unemployment_compensation_amount Table 1.4 1.0334 0.9898 0.9966
unemployment_compensation_returns Table 1.4 1.0107 0.9829 0.9979
itemized_deductions_amount Table 1.2 1.0620 0.9738 0.9967
taxable_income_amount Table 1.2 1.0227 0.9970 0.9919

The factor is on the published values (tax year 2023 over tax year 2022). At the build year an amount moves by 0.978 to 1.122 (the old rows were aged one year more), and a count moves by its factor.

The concept check of each pair (the ruling asked for it before the build):

  • on the pinned feed the two national rows of each pair carry one publisher concept (source_concept) and one return universe, with no other filter;
  • in tax year 2022 the two tables agree within 2.7% for every pair (the fourth column). Twelve come from the feed. The two Table 1.2 pairs come from the IRS file 22in12ms.xls as Chronicle pins it at 13294b93, because the feed's scope does not hold that table for 2022;
  • the compile holds each pair to its declared concept from now on: it refuses a pair whose rows carry another one, or none.

On the pinned feed:

Before After
Release compile 28,116 28,101
national_state 6,316 6,301
State rows that take a factor 0 714 (14 quantities, 51 states)
National rows that stop binding 15: 14 Historic Table 2 US rows, and the state_2022 copy of the US return count
Local state, totals, full, state_cd 4,584 / 255 / 25,463 / 25,463 the same counts; the values of the 14 quantities move

The 408 state AGI band rows follow their state total. The district rows and the county rows are shares of their state row, so they follow too.

Two choices of the build, ruled to stand on 1 Dec 2026:

  1. The pass runs in the compile, before the state AGI bands and before aging. So every build has it, a band follows its state total, and a state row ages from its control's period with its control.
  2. A district-file row of a paired measure takes the same factor in the compile (11 measures, 4,796 rows). On the local surfaces this changes nothing: a district row is a share of its state row there. It keeps the district file a part of the national row on the national tool's full mode, where district rows are raw: without it, the district rows of taxable IRA distributions sum to 1.0056 of the one national row that is left. It also keeps the factors and the bound of the district bridge as measured at the re-pin.

What a reader must know: a state row of the 14 quantities now carries the operator's keys, and its cross_grain_parent is the national control. A reader that wants the rows under a state parent must also read the level. The readers in the tree do (the hold-out rules, the loss weights, the closure check).

The UK: no UK output changes. One UK node is keyed more widely. The implementation hash of the gate battery covers every module that its bindings reach by an import statement, and that closure already holds the US compile. The US compile now imports the operator, its row-level pass, the US declaration reader and the US adapter, so the closure grows by these four modules (243 to 247; test_transport_evidence_kernels.py lists them). The gate battery computes again on the next UK run, as it does after any edit of the US compile.

The second review (1 Dec 2026)

A second adversarial review read the head 30b22eea2 (decision 2, step 3, the repaired tests, the merges). It confirmed the arithmetic of the pass on the pinned feed, the aging, the readers of the parent key, the gates on the compiled registry, the UK path and the four repaired tests. It found seven items. I checked each one with my own run before I changed code.

# Finding State
1 The re-pin adds targets that cannot be met together on the production national mode (national_state). See below The 102 rows are held out in f50fedd25 (ruled 1 Dec 2026). The repair is in the follow-up
2 A state that one pair lacks made the compile refuse: all pairs ran in one operator call, where the country covered the states of every pair Repaired in 2c2df0547: each pair is a pass of its own
3 A district-file row of a paired measure took the factor with no check of its tax year or quantity Repaired: the compile refuses a follower of another tax year or quantity. A follower is matched by its measure id, and the declaration says so
4 The call of the pass in the compile, and the county pairing by the row's own tax year, had tests on the pinned feed only Repaired: a test of the whole compile on small inputs, with a band and aging (it fails when the pass is removed or runs after the bands), and a county test
5 The pass skipped in silence where a conflict would stay, and it left no record Repaired: it refuses when the newer row binds beside state rows and the US total of their file is missing or of another tax year. It records its own receipt where a stage keeps the nesting receipts. A national build has the row metadata only (each state row names the total that stopped binding)
6 Guards weaker than the page said Repaired: a row with no publisher concept is refused, a factor of zero or below is refused, and a derivation that cannot run names its quantity
7 Three places in the pages gave numbers of the old pin Repaired

No pinned value moved with these repairs.

Finding 1, measured on national_state at the build year 2024:

Quantity What binds States over the national row New here? Now
Charitable deduction 102 Historic Table 2 state rows (tax year 2022) and the Table 2.1 national row (tax year 2023) 1.069 (amount), 1.028 (returns) Yes: the re-pin adds the state rows The 102 state rows are held out of national_state
SALT, real estate taxes The Historic Table 2 US row (2022), the Table 2.1 row (2023) and the state rows 1.043 (SALT amount), 1.006 (real estate taxes) No: on main today Every row binds, as on main. A declared known gap

This is the defect of #1243 on quantities outside its list of 14. For the charitable deduction the rule of decision 2 cannot run yet: Chronicle's Historic Table 2 US package has no charitable column, so the state rows have no US total of their own file.

Ruled on 1 Dec 2026: the repair goes in the follow-up of #1760 that makes the levels consistent, and the rows are held out until then. Built in f50fedd25:

  • a known gap of us/cross_grain_declarations.json can hold its rows out of the national solve (held_out_of_national_solve), and spec/target_sets.yaml excludes them from national_state by the predicate held_out_known_gap;
  • on the pinned feed national_state goes from 6,301 to 6,199 targets (2d99e5fddc8a). The compiled registry (28,101), the full mode and every local surface are unchanged: the state rows stay the parents of the district rows there, and no national row binds on a local surface;
  • the selection receipt of the national tool counts the held-out rows apart (held_out_known_gap_targets, only when there are any). dropped_congressional_district_targets counts district rows only, as before;
  • a comment on US targets: one declared nesting rule across national, state, district and county levels #1760 records what the follow-up needs to retire the hold-out.

A correction. The text of this description from 16:33Z to this update also listed partnership and S corporation income as a third case (8 Table 1.4 component rows beside the Historic Table 2 combined row, which is 7.4% above their net). That was wrong, and those rows are not held out. A US SOI row binds the positive part of its variable on each return, so the combined row binds the positive part of each return's sum. The four parts hold that quantity between their net ($1,078bn) and the sum of the two income rows ($1,358bn), and the combined target ($1,158bn) is inside that range. docs/us-target-nesting.md says so.

For a later ruling (not a defect): the feed also holds the tax year 2023 state AGI-class package, so the published 2023 state totals exist. The state totals of decision 2 (2022 shares at the 2023 national level) are 0.956 to 1.054 of them for adjusted gross income, and 14 states are more than 2% off.

The review of 2 Dec 2026

A light review of the target changes, at f50fedd25.

1. The compile change, by source. Done in d6ce5d6c1: docs/us-chronicle-feed-repin.md ("The compile change, by source"). It compares two compiled registries at the build year 2024: the code before the re-pin on the old feed, and this branch on the new feed.

Source Level Before After Change Reason
District file district 22,672 21,800 -872 The two interest paid deduction measures left (52 measures to 50, the same 436 districts): the column is mortgage interest paid, which binds no variable until that is decided
District file state 2,601 0 -2,601 chronicle#451 removes the district file's own state rows (51 measures, 51 states)
District file country 49 0 -49 chronicle#451 removes the district file's own US rows
Historic Table 2 state rows that stood in for a district district 324 0 -324 36 measures for 9 areas that had no district row in the old file. The file now holds them as district rows
Historic Table 2 state 2,397 2,601 +204 The charitable and QBI deductions, new in the state package
Historic Table 2 country 65 67 +2 The US rows of the QBI deduction
Table 1.4 country 18 26 +8 Partnership and S corporation net income and net loss
Every other source and level (36 groups) 3,622 3,622 0 The same count in each group; 13 rows have a new id and the same value
Total 31,748 28,116 -3,632

The 6,104 deferred district rows are not a removal of 6,104 rows. 5,232 of them are of twelve measures that the old feed did not hold, so they were never compiled. The other 872 are the first line of the table. Decision 2 then takes 15 national rows off (28,116 to 28,101).

2. The effect on the build. Not done: it needs a national build, and no build ran for this PR. The page gives what the comparison needs. On the production national mode, 4,830 of the 6,102 targets of the old surface keep their value (4,817 with the same id, 13 with a new id), 1,257 move with a known cause for each group, 112 are new and 15 are gone.

The view on the mortgage interest decision. The rows stay held out, as the review advises. The review calls A19300/N19300 interest before the limits, and that premise is not right (the program review of 3 Dec 2026). The district file's guide maps both columns to Schedule A line 8a, and the Schedule A instructions put on line 8a only the deductible part of the interest and points reported on Form 1098 when a limit applies. So the column is after the limits. In policyengine-us 2.145.3, mortgage_interest is the amount before the federal acquisition-debt caps, which is a different concept. deductible_mortgage_interest (after the caps; it also holds the interest and points not reported on Form 1098, lines 8b and 8c) stays the closest. The decision is still open.

The review of 3 Dec 2026

A review of the head d6ce5d6c1, with changes requested for two findings. Neither moved a value on the pinned feed; each was a case the code expected and handled only in part, with no test. Both are fixed in the structure, in 562e220f9, after the merge of main (bb203130d).

Finding The fix
A share denominator summed two district files. Where a district file has no US row, the capital-gains pass divides its rows by the sum of its district rows. The sum was keyed by the family label congressional_district, so two files of one tax year (two boundary vintages, say) added into one sum A share denominator is now typed: one published national row (_SoiShareTotal) or the sum of one district file's rows (_SoiSumOfDistrictRows), keyed by the file (its record set id without the period). _SoiShareDenominators.total_for gives a row one denominator or none. A sum holds each district one time and, when the compile translates the district facts onto the current plan, each district of that plan, or the compile refuses (IncompleteSoiDistrictFileError)
District-file rows of a pair kept their old level in one branch. With the newer national row and the Historic Table 2 US total but no state rows, the national-to-state pass retired the US total and scaled no district-file row The pass now plans each pair into one shape (_NationalSoiShape: absent, no control, control only, older control, scale) and then applies the plans. A plan that scales names the state rows and the district-file rows together, so with no state rows the district-file rows take the factor control / US total. District-file rows under the newer row with no US total of their file are refused, as state rows are
The receipt of the national selection counted every non-district drop as held out It counts with the predicate itself, and a dropped row that neither exclusion names is refused
The county population comment, and the county rung page, still described the allocator that step 3 removed Corrected
COUNTY_PREFIX had two definitions The county surface takes it from target_nesting

Tests on small inputs, which run in CI: two district files of one tax year; a Hypothesis property over one to three files; a district counted twice or missing from the plan (since the third round of the program review, these district-file cases are fixed examples of one property test); the shape of every layout of a pair; a pair with district-file rows and no state rows; and a Hypothesis property over the layouts of a pair (control absent, older or newer; US total absent, of the rows' year or older; zero to three state rows and zero to three district-file rows). Put back in memory, each of the two old behaviours fails these tests.

No value moved: the compiled registry of the pinned feed, aged and unaged, with the district crosswalk as the national tool compiles it, has the same bytes before and after (every spec's name, value bits and metadata in order).

The rest of the suggested design goes to the follow-up of #1760, with the joint surface, as the review proposes: the adjustments of a target as typed data (step 3), one invariant checker after each pass, including "no two binding targets measure one quantity at one geography" (step 5), and generated feeds with a registry-comparison tool that runs on every re-pin (step 6).

The program review of 3 Dec 2026

A review of the head 562e220f9: two critical findings, one to address and two suggestions. No value moved on the pinned feed: it has one district file, with no US row and with full rosters on both plans. All five are fixed in 6d744f917.

Finding The fix
C1. A district file with no US row took another file's US row. The published totals were keyed by the family. So with two district files of one tax year, file A's US row was file B's denominator, and B's sum, with its checks, was never built A share denominator has a scope: for Historic Table 2 the family (HT2 puts each state and the US in a record set of its own), and for a district row its own file (the record set id without the period). The published rows and the sums are both keyed by the scope. So a district row divides by its own file's US row, or by its own file's sum, never by another file's total. The one duplicate that is expected, one total under two record ids of one scope, keeps the smaller id, as before
C2. The roster check ran after the crosswalk had merged the source rows. A source row given twice, or a missing one whose current districts also take other source districts, could not be seen The translation records, in each translated row's lineage, the source rows that the crosswalk added into it, with the state-total proxies (congressional_district_vintage_sources). The check of a sum reads them first: each source district of the crosswalk one time. Then it checks each district of the current plan one time, as before
A1. The compile read the crosswalk twice, so a one-shot iterable of rows failed the second read The compile reads it into a frame one time (prepare_congressional_district_vintage_crosswalk) and gives the frame to the translation and to the plans (congressional_district_plans)
S1. The county population declaration and the ACS households paragraph of the county rung page still described rounding with a residual Both describe the operator's division: proportional, with no rounding, and closed within the tolerance
S2. The premise of the mortgage interest view Corrected in "The review of 2 Dec 2026" and in "Rulings and what is open"

Tests on small inputs, which run in CI: the review's cases with its numbers (file B's counts of 1 and 3 give 10 and 30 beside file A's US row; a source row twice under a one-to-one crosswalk refuses, and the rows are 16 and 24 without it; a missing source district under an even split refuses; a one-shot iterator compiles as the list does), the Hypothesis property over one to three district files, which now draws a US row or none for each file, and the source districts that a translated row names. Each of the five tests of C1, C2 and A1 fails on the code of 562e220f9.

The review's evidence gaps. The national before/after comparison needs a build. Whether to run one before the merge is María's call (see "The review of 2 Dec 2026"). The merge, and the UK release window that gates it, are María's call too.

The second round (the review of 6d744f917, 14:50Z): the five findings above are resolved, and there are two new ones. Both are fixed in 0ceaf6652.

Finding The fix
C3. Two district files of one quantity both bound the same districts. With file-local denominators, both files compiled, and on full each district took two targets of one quantity (8 and 2 at HI-01, 12 and 6 at HI-02 in the review's case) The compile refuses two district files that give district rows of one capital-gains quantity, before the crosswalk (OverlappingSoiDistrictFilesError). This holds for two boundary vintages of one tax year and for two tax years, because latest-vintage selection keeps one period of each file, not one file. One file at two tax years is one file. The file-local denominators stay in the pass
A2. One file's district rows stopped another file's state-total proxy, and that file then failed the check of its source districts with the wrong reason The overlap refusal runs before the translation, so the compile names the two files. The proxy rule is unchanged

Tests on small inputs: the review's two cases, two files of two tax years, and one file at two tax years. The multi-file tests of the pass now run the pass alone and check that the compile refuses. Both new tests fail on the code of 6d744f917.

The third round (the review of d6fed9bcb, 18:08Z): C3 stays open through one path, and it is fixed in ccdb91550 by a general rule, which replaces the refusal of the second round.

Finding The fix
C3. The refusal of the second round read only raw district rows. A legacy district file with a D.C. state total and its own US total, and no district rows, still bound the D.C. district through the state-total fill, beside a second file: 24 and 20 at D.C. on full. A Historic Table 2 D.C. state total can take the same path: on the pinned feed, its capital-gains state rows have the shape of the district rows One value for each calibration cell. A shared rule, for any country and any geography level (microcosm.build.ledger_cells): a cell is one quantity (the Ledger concept, unit, entity, aggregation, period type, filters and universe of the fact) at one geography for one target period, whatever its source. When the targets of one cell give different values, the compile refuses. The US compile runs it on the registry that it returns, after the crosswalk, the fills and every pass, so it sees what the calibration reads. The refusal of the second round (OverlappingSoiDistrictFilesError) is gone
A2, made general. The fill of one source depended on the rows of another The crosswalk fills the seat of a one-seat state for each source of district rows that gives no row there. So a second file's D.C. row meets the first file's fill in one cell, and the rule refuses when the second file has its own US row; when it divides by its own sum, its roster check refuses first, for its own gap. With one source of district rows, as on the pinned feeds, the fill is unchanged

Targets of one cell that give one value stay. On the pinned feed, Table 1.1 and Table 1.2 both give the TY2023 national return count and adjusted gross income, with equal values. How many times a cell enters the loss is a rule of the loss (microcosm#1729), as statement 9 of the nesting rule says.

Tests. Two property tests replace the per-finding tests of the three rounds. tests/engine_free/shared/test_ledger_cells.py tests the shared rule on random cells, sources and values, with no country. test_district_capital_gains_give_each_cell_one_value tests the district capital-gains surface against a small model of the rule. It replaces nine tests of the earlier rounds and the vintage test of round 1, and each case of the three reviews is a fixed example. On the code of d6fed9bcb the two cases of the third round compile, so the test fails there.

Older tests. The rule runs at the end of every US compile, so some older fixtures met it. Four tests gave one cell two values in a feed layout from before PolicyEngine/chronicle#451: a district file's own state or US row beside the Historic Table 2 row of the same cell. Two of them are the microcosm#489 pins: with no Table 1.4 control, they bound two national taxable-interest values. They now expect the refusal, or compile one source at a time. The other fixtures left out what the feed uses to tell two quantities apart: the return universe of the itemizers', excluding-dependents and EITC tables, the SSA payment-program dimension, and the CBO series concept. They now carry it, as the feed does.

A limit of the rule. It trusts the cell identity of the Ledger. Chronicle gives the TY2024 filing-season EITC total and the Table 2.5 TY2023 EITC total two universes, so the rule sees two cells, although for the credit's amount they are one quantity. The October release bound both (about $69.0bn and $72.0bn). That pair is a separate item, outside this PR.

The fourth round (the review of ccdb91550, 23:46Z): two critical findings and two to address, all fixed in 339ed484f.

Finding The fix
C4. A gap in one file copied another file's own seat. The fill of one-seat states gathered the gaps of all sources by state. So file B's gap filled the D.C. seat from file A's own state total, and the crosswalk added it to A's own D.C. row: A's D.C. district target was 40, beside its D.C. state target of 20 A state total never fills the seat of a state where its own record set gives a district row. A source with a gap still takes the fill from the state total of a source with no row there. State targets do not change
C3. Two spellings of all income were two cells. A file that stated income_range=all and a file that left it out gave 8 and 4 at HI-01 The cell key leaves out a filter whose value restricts nothing (all, or empty), as the US compile reads it
A3. Two files of one value compiled, and the local district nesting then refused the repeated member One target for each cell: targets of one value are one target, the one of the smallest fact id, and ledger_cell_also_given_by names the other facts. The third round kept both
A4. A bare feed with universe domains and no universe hash lost the universe A fact with no universe key is keyed by its domain

What this moves on the pinned feed. Table 1.2 gives the TY2023 national return count and adjusted gross income with the values of Table 1.1. Those two cells now keep the Table 1.1 targets, so the compile has 28,099 targets (28,101 before) and national_state has 6,197 (6,199). The rule finds no cell of two values on the pinned feed, and the local surfaces do not move. The pins of test_us_target_sets.py and test_us_fiscal_target_registers.py are measured again.

Tests. The two property tests now draw the new edge cases: filters of all or none and universes by key or by domain in the shared test, and a seat row with a state total in one file, and files that leave income_range out, in the district test. The three cases of this round are fixed examples, and each one fails on ccdb91550.

What Stage A and steps 1 and 2 do

The US local tools made child target rows from parent rows in four places, each with its own arithmetic, its own checks, its own metadata keys and its own receipt. They now run on the cross-grain operator that the UK uses (microcosm.build.cross_grain), and the US declares its choices in the UK's key names.

The model has six things, and each is general (no construct is for one country only; the shared operator runs the first five, and the coverage check reads the sixth): a measurement, a bridge (by id, or by a selector that makes one bridge for each pair of targets), a derived control, a bound on the factor of a bridge, the members of a leg, and pairs that are not reconciled.

Up to step 2 no target value changed: on the feed pinned then, each of the 26,272 rows of the state_cd SOI surface had the bits of the value it had, and the other three surfaces had their bytes.

The parts

Part Where
The operator: a bound measured from the median factor, one-sided, that can unbind a leg; the declared members of a leg; bridge selectors (which can pair values); the metadata keys of a reconciled row microcosm/build/cross_grain.py
The row-level pass (reconcile_rows: the operator on target rows, with an answer for each row). No country in it microcosm/build/cross_grain_controls.py
The US declaration, in the UK's key names us/cross_grain_declarations.json
Its reader, and a coverage check that is a receipt and a test only us_runtime/cross_grain_declarations.py
The US adapter: the rows of each pass, the checks that are US rules, the specs made from the operator's answer us_runtime/target_nesting.py
The four tool functions, thin wrappers with the same names and signatures tools/us_acs_local_cd_surface.py, tools/us_acs_local_county_surface.py
The operator's receipt, in target_nesting.json tools/build_us_acs_local_release.py

What step 2 changes (by design)

On valid data the rows and their values were the same. These things differ.

  1. Metadata keys. District and county rows carry the operator's keys, as UK rows do.

    New key Old keys
    cross_grain_parent state_cd_parent_target_name, state_county_parent_target_name
    cross_grain_value_before state_cd_cd_file_value, state_county_source_value
    cross_grain_factor state_cd_rebase_factor, state_cd_level_bridge_factor
    cross_grain_control state_cd_parent_basis, state_cd_level_bridge_sibling
    cross_grain_members state_county_cell_members

    Six old keys have no new one, because another place holds the value (the parent row, the operator's receipt, the declaration).

  2. Receipts. The district receipt names the bridge and its bound under bridge, with the legs it unbound; factor_by_measure replaces rebase_factor_by_measure, and since step 3 paired_measure_ids replaces the level-bridge fields. internal_consistency is gone. County blocks lose share_sum.

  3. Pins of state_cd (the registry, the roles and the receipts) moved, and were measured again.

  4. Refusal texts. A refusal that the operator makes has the operator's text: a leg that does not hold its members, a sum of zero under a control, opposite signs, a county with no state.

  5. One check is gone: that the district file's own state row is the sum of its district rows. Since step 3 the district file has no state row.

  6. One refusal is new: a concept that takes its state parent from Historic Table 2 in some states and from the district file in others. It does not occur on the pinned feed.

  7. With the bound turned off (only tests do that), a concept whose Historic Table 2 level is zero in every state keeps district rows of zero. The old code dropped them.

  8. A band of 2.0 or more is refused. The old code accepted any band. No command-line flag sets it, so only a test or a direct caller can meet this.

The readers of the keys moved with them: the loss weights, the hold-outs and their pro-rata baselines, the county reports, and one field of the reviewed limitations. The dated runs under experiments/ read registries of their own date and are not changed.

Since Stage A, three inputs that the oldest code computed are refused by the operator (rows that sum to less than 1e-9 of their control, a county SOI block under a negative state row, a control of -0.0). None occurs on the pinned feed.

A run that is resumed across this change is stopped: a later stage refuses targets with the old keys, and a district receipt with the old fields, and says to run --stage materialize again.

Commits

# Commit Proof
A0 288b2e3ca Pins on the code as it is (the pin test of #1755, cherry-picked) It passes on main as it is
A1 e3e483dbd The allocator hook (removed again in step 3) 400 seeded surfaces through the operator and through a reference copy of the file
A2 bc8aa6ae1 cross_grain_controls Each allocator equals the arithmetic it replaces, bit for bit, on 200 seeded blocks
A3 d1f62f9dd The US declaration, its reader and the adapter base Each register equals the literal it replaces
A4 6da6e3b12 District SOI shares on the operator (row 5) 160 seeded surfaces against a verbatim copy of the old function
A5 55fa55c36 County population, county SOI shares, county households on the operator (rows 8, 6, 7) 120 seeded inputs for each
A6 c3dc13b4c The inventory, the docs page, the coverage test The pinned feed's compiled registry has no coverage gap
merge 3aac702e3 Merge of main (5589fae09), with the US F0 pins written again Both pin tools ran twice; --check passes
design 350cd9de2, 17ee67085, 035881105 The rule, the rulings, one general model (docs only) No code
step 1 947978c46 The bound, the members and the bridge selector, general in the operator The differential test holds the default path to the operator before any edit, bit for bit
fix 938c7faa6 Annotations that the spine-blindness check needs The whole file passes
step 2 d91ae5b37, 2264fb377, 011651554 The operator refuses a declared leg with no row; the US on the model; the pages See "Tests run here"
rulings 625c93702 The ten rulings of 27 Nov on the steps, in the design page Docs only
county 6e76eaee6, fa297a018 The county rows on the pinned county facts; the county SOI bridge declares the bound of the district bridge No leg is unbound on the pinned county facts
review f1c17c5e1, bb6776f87, ff0b9fa15, 672e82936 The eleven findings of the adversarial review See "Adversarial review"
merge a8b9d2c52 Merge of main (be6a1983d), with the US F0 pins written again Both pin tools ran; --check passes
fix ca5e864bc The property test of the district shares draws no block that the operator refuses All twelve CI checks passed on it
merge b138c5f20 Merge of main (dc77fa312, with the geography-first move of #931), with the US F0 pins written again Both pin tools ran; --check passes
merge b4c276c23 Merge of main (6b87a0c28, with #1755) The tests ran on the merged tree
step 3 87fabcde0 Re-pin the US feed to Chronicle 13294b93, and compile the feed there The pinned compile counts and digests, measured again
step 3 12677fb68 Nest the district rows in Historic Table 2; the allocators and the level bridges go See "Tests run here"
step 3 75cb18cba The pages and the changelog Docs only
merge a9d1dd414 Merge of main (88fadfa8f, the post-export scoring work) No conflict
CI c00e34ccf Four tests that the feed re-pin and the key change left behind See "CI"
review of #1755 df726b5d6 Seven items from the review of #1755 See "The seven items from the review of #1755"
decision 2 38f3e6cfa Give state rows the level of the newer national control See "Decision 2" and "Tests run here"
decision 2 30b22eea2 The pages and the changelog Docs only
second review 2c2df0547 Six items from the second review See "The second review" and "Tests run here"
merge 5cf1f85e3 Merge of main (fdd4a98fa) No conflict. It brings the renewal of the UK register expiries (#1834)
second review f50fedd25 Hold the state charitable rows out of the production national mode See "The second review". national_state 6,301 to 6,199; the US F0 pins move with the target-set file
review of 2 Dec d6ce5d6c1 Account for the compile change of the feed re-pin, by source Pages only
merge bb203130d Merge of main (96888466d) Eight pin files conflicted; main's side, then the pin tools
review of 3 Dec 562e220f9 Five items from Anthony's review See "The review of 3 Dec 2026"
program review 6d744f917 Five items from the program review of 3 Dec See "The program review of 3 Dec 2026"
program review 0ceaf6652 Refuse two district files of one capital-gains quantity (the second round) See "The program review of 3 Dec 2026"
program review ccdb91550 One value for each calibration cell, for any country and level (the third round) See "The program review of 3 Dec 2026"
program review 339ed484f One target for each calibration cell; a fill never copies its own seat (the fourth round) See "The program review of 3 Dec 2026"
merge d6fed9bcb Merge of main (23479e822) Three pin files conflicted; this branch's reason comments with main's values, then the pin tools

87fabcde0 also renamed the SOI measure maps from interest_paid_deduction_* to mortgage_interest_paid_*. That was wrong: it took Table 2.1's national interest paid deduction off its variable, and bound column A19300 to the variable of the whole deduction. 12677fb68 reverts the rename and holds the mortgage rows out (see above). Only the head runs in CI, and 87fabcde0 alone does not pass the state_cd tests.

The county rows on the real inputs

The pinned county facts file (922 MB, sha256 67b0998a…) is a test input on the build machine. Two tests in test_us_target_nesting_county.py read the pinned feed, the PUMA ladder and that file, when MICROCOSM_US_CHRONICLE_FACTS, MICROCOSM_US_PUMA_LADDER_ARTIFACT and MICROCOSM_US_CHRONICLE_COUNTY_FACTS name them. They skip in CI.

Pass Rows At step 3
County population, 2020 counties 3,143 Same codes, order and value bits
County population, 2023 county-equivalents 3,144 Same
County SOI (return count, adjusted gross income) 6,286 Same rows; values within 1e-12 relative of the old code (the allocator went); bytes pinned again
County households 51 state rows, 3,144 county rows Same rows; values within 1e-12 relative; bytes pinned again

The county SOI bridge declares the bound of the district bridge (1.25 around the median factor across states, unbind). No leg is outside it on the pinned county facts, so it unbinds nothing.

Adversarial review, 27 Nov 2026

A reviewer with no part in the work tried to prove the PR wrong, at head fa297a018. It changed no file. UK outputs and US values held; the eleven findings were fixed in f1c17c5e1 to 672e82936 (a lost refusal came back twice, a run resumed across the change of keys is stopped, the coverage check is tighter, two more bit-for-bit tests). Step 3 removed one of the two lost refusals again, with the level bridges it guarded: a district block that lacked a district while its level bridge was distrusted.

Pins

  • Feed pins: us/chronicle_feed.json, us/chronicle_feed_scope.json, us/chronicle_county_facts.json, us/chronicle_county_facts_scope.json, and the two parity resources (32 compiled families, 64 reviewed exclusions).
  • Compile pins in test_us_fiscal_targets.py, test_us_fiscal_target_registers.py and test_us_target_sets.py: measured again on the new feed.
  • state_cd bytes in test_us_acs_local_surface_bytes.py, the district contract in test_us_acs_local_sparse_cd.py, and the district and county pins in the two nesting test files: measured again.
  • Decision 2: the compile pins, the registry versions, the surface bytes and the county SOI rows are measured again. The district counts, drops and unbound blocks did not move. The US F0 pin tools ran and moved no pin.
  • US F0 pins: both pin tools ran (legacy, twice, coverage twice) and both --check pass. The seed protocol attests the bytes of congressional_district_geography, so the golden vector of the spec loader test moved.

The seven items from the review of #1755

#1755 merged on 30 Nov 2026 with seven review items open. They are in df726b5d6, at María's request (1 Dec 2026).

# Item What changed
1 (text) The pages said that a reworded rationale of the declared target sets re-keys no UK solve node The UK national line keys its targets, problem and gates on the bytes of every UK resource, so it computes again. docs/uk-target-sets.md, the #1759 changelog entry and test_uk_solve_scope.py now say so. The root cause is not changed here
2 docs/us-target-sets.md said that a reworded rationale moves no pin It moves documentation_sha256 in the US coverage evidence. The page names the tool to run
3 equals: [] (or {}) changed a selection and no hash The schema of the typed resource and the shared reader refuse a list or an object as a compared value
4 exclude and left_out_levels were hashed in order Both take the set order. The US spec_sha256 and documentation_sha256 move one time; the UK content hash does not
5 UK text described the BRMA row filter and the frs_brma stage that #931 retired Corrected in docs/uk-target-sets.md and in two prose fields of uk/spec/target_sets.yaml
6 The level check of the compile does not read the rows that the local tool builds us/local_target_construction.json is held to the level rule and to the declared built rows when it loads (require_declared_built_levels)
7 Four #1728 changelog entries gave old US field counts The counts are gone

The UK

  • The UK graph hashes cross_grain.py and microcosm.calibrate.target_sets. So the UK target nodes, and every node after them, compute again on the next UK run. The outputs are the same: the bit-for-bit test compares the operator with main's file on seeded surfaces, and it pins the list of definitions that this branch changed or added.
  • uk/spec/target_sets.yaml changes in two prose fields (item 5 above: one description and one rationale). Its content hash and the UK solve fingerprint are the same: test_uk_solve_scope.py and test_uk_graph.py pass with no change of a pinned value. The byte fingerprint moves, so the UK national line computes its targets, problem, solve and gates again one time.
  • No file in uk_runtime/ changes. One UK test file changes in its docstrings only (test_uk_solve_scope.py, item 1).
  • The UK graph does not hash cross_grain_controls.

Merges

Tests run here

On 4 Dec 2026, on the tree of 339ed484f (the fourth round of the program review, on ccdb91550).

What Result
The US files of the compile, the national-to-state pass, the target sets, the declaration and coverage, the district and county passes, the surface bytes, the district vintage, the national tool and its post-export probe, the county surface, the spine blindness, the EITC, FSA and source-vintage files, and the shared files of the rule, the Ledger compile, the release parity, the operator, the gate bindings, the country spec and the spec engine, with the three pinned inputs and CI's fixed seed 2,882 tests: 2,876 passed and 6 skipped (they need the US engine), after the pin of one more pinned-feed test, the fences test of test_us_fiscal_targets.py, was measured again
ruff check ., tools/ci_test_plan.py verify, both pin tools with --check pass. No pin of the pin tools moved
The compiled registry of the pinned feed (aged and unaged, with the district crosswalk, after the Medicaid substitution) 28,099 targets each (aged: version e630858e12b1; unaged: f14bdff8309b). The third round left the bytes as they were; the fourth round takes off the two Table 1.2 copies
The review cases of the district test, on the code before each round (d6fed9bcb, ccdb91550) the cases of each round fail on the code before it; all thirteen pass on 339ed484f

No build ran here. The UK files and the engine tests did not run here: these changes touch no UK code and no pin of the pin tools. The machine was at memory pressure level 2, so the tests ran on one worker.

CI

CI was red on 75cb18cba, and on the two heads before it. I had not read it since ca5e864bc.

Job Test Cause Now
engine-us (since the merge of main at dc77fa312) test_every_chunk_and_batch_size_gives_the_one_chunk_target_matrix The test came from main and names the state parent with the old key, state_cd_parent_target_name The fixture uses the operator's key. Passes in the US engine venv
engine-free test_the_committed_feed_pin_banks_the_anchor It follows committed re-pin reports to prove that the pinned feed holds the three BEA facts of the ESI premium anchor. This re-pin drops and changes rows, so it needs a report of its own experiments/us-feed-13294b93/anchor_rows.json: the three facts have the same period, value and source file before and after
engine-free (found locally: CI stops at the first failure) test_the_release_s_recorded_post_export_outputs_are_unchanged The JCT tax expenditures have fiscal-year ids since the re-pin (fy2024), and the test's stand-in reform takes its effect from its id The pin is measured again
not in CI (feed-gated) test__load_ledger_target_specs__compiles_the_pinned_feed It looked for the district file's wv_total row, which the feed no longer has It holds West Virginia's district rows to the two districts of the current plan

One failure was not from this branch: test_no_committed_local_adjudication_is_about_to_lapse (UK). Four DESNZ adjudications expire on 15 Dec 2026, and the test fails from 14 days before, which is 1 Dec. It fails on every branch until the adjudications are renewed on main. The engine-free job stops at the first failure, so it can hide a later one.

CI on df726b5d6 (read 1 Dec 2026, 13:52Z): engine-us, engine-uk, integration-uk, installed-emitter, lint and wheels pass, so the chunk test is repaired in CI too. The two engine-free jobs fail on that one UK test and stop there (23,820 tests passed before it).

CI on 30b22eea2 (read 1 Dec 2026, 16:18Z): engine-us, engine-uk and the other jobs pass. The two engine-free jobs fail on the UK notice test only. #1834 renewed those registers on main (merged 1 Dec 2026, 15:38Z), and 5cf1f85e3 merges that main, so the engine-free job can now run to its end.

CI on f50fedd25: all 12 checks pass (read 2 Dec 2026, 08:27Z). It is the first run on this branch since ca5e864bc in which the engine-free job ran to its end, on both Python versions. The engine-us and engine-uk jobs pass too.

CI on d6ce5d6c1: all 12 checks pass (read 3 Dec 2026). The PR then conflicted with main, which bb203130d resolves.

CI on 562e220f9 (read 3 Dec 2026, 13:26Z): engine-uk, integration-uk, installed-emitter, lint, select-countries and wheels pass. engine-free and engine-us were still running when 6d744f917 was pushed.

CI on 6d744f917 (read 3 Dec 2026, 15:04Z): engine-uk, integration-uk, installed-emitter, lint, select-countries and wheels pass. engine-free and engine-us were still running when 0ceaf6652 was pushed.

CI on 0ceaf6652 was not read: the merge d6fed9bcb replaced it. CI on d6fed9bcb: all 12 checks pass (read 3 Dec 2026, 22:50Z). CI on ccdb91550: all 12 checks pass (read 4 Dec 2026, 12:03Z). CI on 339ed484f was not read when this text was written.

Not verified

  • No build ran. Matrix rows on real households are not covered.
  • In CI: nothing on the pinned inputs. CI has no feed, no ladder and no county facts file. The pinned bytes, the pinned district and county comparisons and the pinned coverage skip there. A commit that breaks one keeps CI green: run those test files with the three variables set before a merge.
  • A whole state_county surface. The county rows are compared and pinned on the real inputs (above). The support moves and the matrix rows of the county mode need a household frame, and no test here has one.
  • The engine-us and engine-uk jobs did not run here, except 41 engine tests. CI runs them. After decision 2 every file of the engine-free job ran here, in two parts; after the second review's repairs only the touched files ran here (see "Tests run here").
  • The --exact-k arm waited on a feed with the chronicle#277 fix. 13294b93 contains it; the arm has not run on it.
  • A UK build. The proof for the UK is the bit-for-bit test and the UK tests.

Rulings and what is open

Ten calls on the steps were ruled on 27 Nov 2026, with the nine decisions (section 4 of the design page). Step 3 was started on 30 Nov 2026 and decision 2 on 1 Dec 2026, on the rulings of those days. On 1 Dec 2026 the joint surface was ruled into a follow-up PR.

Open:

  • For the follow-up of US targets: one declared nesting rule across national, state, district and county levels #1760: the joint surface, and the retirement of the hold-out with the two known gaps (the charitable deduction needs a Historic Table 2 US row from Chronicle and a feed re-pin; the SALT and real estate taxes pairs need their concept check).
  • For the follow-up of US targets: one declared nesting rule across national, state, district and county levels #1760 (from the review of 3 Dec): the adjustments of a target as typed data, one invariant checker after each pass, and generated feeds with a registry comparison on every re-pin.
  • Mortgage interest: which variable mortgage_interest_paid_* (column A19300, Schedule A line 8a: the deductible part of the interest and points reported on Form 1098) binds, at the three levels. deductible_mortgage_interest is the closest. mortgage_interest is the amount before the caps, so it is not the same concept (the program review of 3 Dec 2026 corrected the premise of the review of 2 Dec).

🤖 Generated with Claude Code

juaristi22 and others added 16 commits November 26, 2026 16:31
…ladder

microcosm#1728 moves the code that builds the local target surface out of
the tools. Each move must leave every target, role and receipt as it was.
TargetRegistry.version sorts metadata keys, so it does not see a change of
key order. Materialize writes target_registry.json and target_roles.json with
the keys in insertion order, and their sha256 is in the run identity.

test_us_acs_local_surface_bytes.py follows the target part of do_materialize
for each non-county --soi-mode: the admin surface, the ladder populations,
the role records, the district pro-rata populations, the ladder population
rows, and the district and county hold-outs. It pins the sha256 of
target_registry.json, of target_roles.json, of the target receipts, and of
the population rows' matrix on a household table that supports every ladder
cell (a release run refuses a cell with no household).

Measured at 3316038 and run twice: state 4,867 targets, totals 742, full
30,464, state_cd 26,912. The tests run only when MICROCOSM_US_CHRONICLE_FACTS
and MICROCOSM_US_PUMA_LADDER_ARTIFACT name the pinned inputs. state_county is
not pinned: it needs the pinned county facts, which are not on this machine,
and a household frame for its support moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
microcosm#1760 moves the US share mechanisms to the shared cross-grain
operator with the same bytes. The operator divides a control among its lower
rows as row x control / numpy sum. The US rows sum with math.fsum and, for the
county rows, use a residual rule. On the pinned US feed the numpy sum changes
the last bit of 5,533 of 21,743 district values.

CrossGrainRule gains one field, allocator, default None. With None the
operator runs the standing rule: no float operation is added or removed. With
an allocator, the operator calls it for each control and takes
(values, factor, raw_sum) from it; the refusals and the closure check apply
unchanged, and the leg receipt names the allocator. The file gains no import.

The UK declares no allocator. The UK graph hashes this file, so the UK target
nodes and the nodes after them compute again on the next UK run, with the
same outputs.

Proof:
- test_support/microcosm_build/cross_grain_reference.py is the file at
  e29843d, pinned by sha256. test_cross_grain_allocator.py runs 400 seeded
  surfaces (with and without factor bounds) through both modules and compares
  the value bytes, the receipts and the refusal texts. It also checks that
  only CrossGrainRule and the reconcile function differ from the reference,
  and that the imports are the same.
- The operator tests and the UK tests that use the operator pass unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
microcosm.build.cross_grain_controls holds what a country's sources can need
around the operator (microcosm#1760). It is plain arithmetic on values and
keys, with no country in it:

- allocators for CrossGrainRule.allocator: proportional_fsum (the standing
  rule with an exactly rounded sum), and share_residual_to_largest and
  scale_residual_to_largest, which reproduce rows first made outside the
  operator and are marked for replacement in Stage B;
- derived controls: sum_of_lower_rows and scaled_by_sibling_ratio;
- the factor band: control_ratio, level_ratio, median_by_group, band_verdict;
- completeness: leg_completeness, with declared combined cells;
- self-consistency: sum_gap.

The operator does not import the module, so the UK graph does not hash it.
No caller uses it yet.

Proof: test_cross_grain_controls.py holds each allocator, bit for bit, to
the arithmetic it replaces on 200 seeded blocks, runs each one through the
operator, and checks the helpers and that the module names no country.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
us/cross_grain_declarations.json is the US file of the shared cross-grain
operator (microcosm#1760). It names the geography levels and the levels that
hold controls with the key names of uk/cross_grain_declarations.json, and it
declares the four mechanisms that make lower-level rows from a higher-level
control in the local tools (rows 5 to 8 of the issue): the allocator, the
rule for the control, the bounds, the source of the member lists, the old
metadata keys, and the reviewed registers with their reasons.

The registers were Python literals in the tools: the defective, unparented
and excluded district measures, the six level bridges, the factor band, the
two tolerances, the reviewed crosswalk digest, the required county measures
and the combined cell with its basis. The tools now read them from the
declaration under their old names. No function uses the operator yet.

us_runtime/cross_grain_declarations.py reads the file.
us_runtime/target_nesting.py is the adapter: it builds one surface from
blocks (a control and its lower rows), runs the operator with the declared
allocator, and returns each block's rows. A stage can record the operator's
own receipts and write them to target_nesting.json.

The new resource row moves the US F0 pins, as each new legacy resource does:
42,407 configuration fields (32,621 authored), the country_manifest claim at
116 pointers, and the US bundle's semantic spec_sha256 (9141b9bf). No target
changes. Both pin tools ran twice and their --check modes pass.

Proof: test_us_cross_grain_declarations.py holds each register to the
literal it replaces (value, type and order), read from
test_support/microcosm_build/us_target_nesting_reference.py, which is the
tool code at e29843d. It also checks the declaration's shape and the
adapter's block interface.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
state_cd_soi_surface (row 5 of microcosm#1760) rebased each state's district
rows onto the Historic Table 2 state row with its own arithmetic. The shared
operator now divides each state control among its district rows, with the
proportional_fsum allocator the US declaration names. The adapter
(us_runtime.target_nesting.district_soi_surface) keeps the US side: the
choice of the control, the level bridge by a sibling ratio, the factor band,
the plan completeness check, the self-consistency check, the refusals with
their texts, and the old metadata keys and receipt.

The tool functions state_cd_soi_surface and state_parent_reconciliation keep
their names and signatures and call the adapter. About 450 lines leave
tools/us_acs_local_cd_surface.py.

No target changes. On the pinned feed and ladder the state_cd surface has the
bytes it had: 26,912 targets, and the same sha256 of target_registry.json,
target_roles.json and the receipts (test_us_acs_local_surface_bytes.py).

Proof:
- test_us_target_nesting_district.py holds the tool function to the verbatim
  copy of the code it replaces on 160 seeded surfaces: the same specs in the
  same order, value bits, metadata key order, receipt bytes and refusal
  texts. The draws include signed rows, all-zero blocks, blocks out of the
  band (with NaN in the receipt), bridged concepts, a state with one district
  and four kinds of refusal.
- The district property tests, the sparse tests and the feed contract tests
  pass unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Three county mechanisms of the ACS local release made rows from a state
control with their own arithmetic (rows 8, 6 and 7 of microcosm#1760). The
shared operator now divides each state control among its counties, with the
allocator the US declaration names:

- with_county_populations: the ladder's county overlaps, scaled to the state
  total (scale_residual_to_largest);
- state_county_soi_surface: county SOI facts as shares of the broad state
  row, with the declared combined cell (share_residual_to_largest);
- acs_household_surface: the state target is the sum of the county estimates
  (sum_of_lower_rows), and the counties divide it
  (share_residual_to_largest).

The adapter (us_runtime.target_nesting) keeps the US side of each one: the
fact checks, the completeness checks, the refusals with their texts and
their order, and the old metadata keys and receipts. The tool functions keep
their names and signatures. county_code_of, the county hierarchy,
cell_members and the broad-parent test moved with them and stay in the tool
under their old names. About 460 lines leave
tools/us_acs_local_county_surface.py.

The materialize stage records the operator's own receipt of each nesting
pass and writes it to a new file, target_nesting.json. No stage reads it and
it is not in the run identity. The old receipts keep their bytes.

No target changes.

Proof:
- test_us_target_nesting_county.py holds each tool function to the verbatim
  copy of the code it replaces on 120 seeded inputs: the same specs in the
  same order, value bits, metadata key order, receipt bytes, refusal texts
  and refusal order. The draws include equal largest rows, zero rows, the
  combined cell, optional measures and ten kinds of refusal.
- The three county test files, the tests that run the materialize stage and
  the pinned non-county surfaces pass unchanged.

Not covered: the county rows on the pinned county facts file. The file is
not a local test input, so these blocks are synthetic.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
us/cross_grain_declarations.json gains an inventory: each US family that two
geography levels measure, with the route that ties the levels today or the
reason none does (microcosm#1760). It records what the code does. It decides
no nesting rule: the decisions of the issue are open, and Stage B applies
them.

- Rows 1 to 4 of the issue (capital gains, taxable interest, state AGI bands,
  the district file's own state row) are compile rules. Each entry says why
  its arithmetic stays where it is in Stage A and names the metadata the rule
  writes.
- Rows 5 to 8 name their mechanism on the shared operator.
- The families that do not nest have a reason and an issue: the SOI families
  with two national rows, the state age rows, the program families whose
  state rows are not checked against their national row, the families with
  no national row, and the district ACS rows that are not in the fit.

us_cross_grain_coverage_violations checks a set of compiled specs against the
inventory. It is a receipt and a test of the declaration. No build calls it
and it refuses nothing.

docs/us-target-nesting.md describes the operator, the allocators, the four
mechanisms, the receipts, the inventory and what Stage A leaves open.

Proof: test_us_cross_grain_coverage.py checks each entry, that rows 1 to 8
each have one entry and each mechanism has one, and each kind of gap on
synthetic specs. With the pinned feed it compiles the registry: no
violation, and the families below the national level are exactly the ones
the compiled entries name. The inventory does not move the US pins (both
--check modes pass).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tracts

main moved 93 commits (to 5589fae). None touches cross_grain.py, the three
local tool files or fiscal_targets.py. Two generated pin files conflicted:
the F0 coverage evidence and the pool tool's spec_sha256 pin. Both took main's
side and were written again by the pin tools on the merged tree
(tools/repin_us_spec_engine_contracts.py, tools/spec_engine_coverage.py: two
passes each, then --check). Coverage reads 42,407/42,407 fields and 41/41
inventory checks; the US bundle's semantic spec_sha256 is now 7ef87297.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
docs/us-target-nesting-rule-design.md is the design step of Stage B of
microcosm#1760. It is a proposal: no code reads it and no target changes.

It records the two rulings so far, the second from 27 Nov 2026 (the Historic
Table 2 state row is the state parent of a district row on every surface,
and a parent that it does not contain is not removed). It then proposes one
rule in nine statements, shows what each family does today with the sum of
its lower rows over its higher row on the pinned feed, and lists nine
decisions, each with a recommendation: the level holder, national to state
for the SOI families, the program families, the state population vintage,
the county households, bounds and members, the ACS district rows, the parent
in the loss, and one allocator, key set and receipt.

docs/us-target-nesting.md points to it and notes the 27 Nov ruling.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… constructs

docs/us-target-nesting-rule-design.md: the nine decisions of the nesting rule
were accepted on 27 Nov 2026 (the recommended option of each). The page now
says so, and gains a section on how the rulings are declared.

The principle of that section: the US declares its nesting with the
constructs that the UK declares in uk/cross_grain_declarations.json, under
the same key names (exact signatures, bridges, bridges with a derived
control, partitions, relations, local routes, licensed empty legs, the
cross_grain_* metadata keys and the pass receipt). The section maps each
ruling to one of them, gives sketches, and lists the four additions that the
shared tooling needs, each optional and beside the operator: bridge
families, two kinds of derived control, a bound around a common factor, and
a US contract derived from declared metadata fields. It also says what the
US-only keys of Stage A (mechanisms, inventory) become at the re-pin.

Docs only. No code applies the rulings yet; the target changes wait for the
feed re-pin.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Ruled on 27 Nov 2026: clean country-agnostic code comes first, the simpler
and the more general the better, with no construct for one country only, and
a UK re-key is accepted for it.

So section 5 of docs/us-target-nesting-rule-design.md no longer adds US parts
beside the operator. It states one model for every country in the shared
operator, in six things: the measurement, the bridge (by id or by a
selector), the derived control (sum or scaled), the bound (limits around a
reference, and refuse or unbind), the members of a leg, and the pairs that
are not reconciled. It lists what goes: the allocator hook and the three
allocators at the re-pin, the US-only keys and checks, the sibling-ratio
bridge, the US metadata keys and receipts, and the four separate passes. It
maps each ruling to the model and gives three steps.

Docs only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…erator

Three things that each country did in its own code are now parts of the
shared cross-grain operator (microcosm#1760, design section 5), each off by
default:

- The bound of a bridge. CrossGrainBridge gains min_factor_shift (a
  one-sided bound), shift_around ("one", or "median" for the median factor
  across the legs of the bridge, which takes out a gap that every leg
  shares) and out_of_bound ("refuse", or "unbind": the leg's lower rows stay
  as given and the receipt names them, so the caller takes them off its
  surface). The US band of 1.25 around the median is a shift from -0.20 to
  +0.25 around "median" with "unbind".
- The members of a leg. apply_cross_grain_reconciliation takes
  expected_members (lower target -> leg -> geographies) and refuses a leg
  that holds other rows than those. A leg with no row stays with the
  empty-leg licences.
- The bridge selector. CrossGrainBridgeSelector and expand_bridge_selectors
  make one bridge for each pair of targets from one declared entry, and name
  the lower targets that no higher target pairs with.

The UK declares none of these. Its outputs are the same: the bit-for-bit
test still holds the default path to the operator at e29843d on 400 seeded
surfaces (values, receipts, refusal texts), and a receipt gains the
unbound_legs key only when a bridge of its rule unbinds. The UK graph hashes
this file, so the UK target nodes and the nodes after them compute again.

Proof: test_cross_grain_model.py (20 tests); the pinned list of changed
definitions in test_cross_grain_allocator.py; the operator tests and the 17
UK test files that use the operator pass unchanged (787 passed, 7 skipped).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s as frames

CI's engine-free job failed on the Stage A head in
test_runtime_population_operators_are_source_spine_blind. The check treats a
function parameter with no annotation as a possible frame, and refuses a
subscript on it whose key it cannot resolve. us_runtime/target_nesting.py had
nine: two lambdas over a block key, and the county populations and county
values of the two county functions, which came from the tool with no
annotations.

The two county functions now annotate their parameters, and the block key is
read by a named function. No behavior changes. The whole test file passes.

I had run one test of that file locally, not the file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…row in the operator

Two general changes to the shared cross-grain operator, for step 2 of
microcosm#1760 (the US on the model). The UK declares neither.

- expected_members reads every declared leg, with or without rows. A leg
  whose members were all absent was left to the empty-leg licences. So a
  target with no row at all formed no group, and the pass left its totals
  as they were without a word. Such a leg is now refused like a leg that
  lacks one member. A leg that declares no member holds no row, and the
  licences still decide it.
- The metadata of a reconciled row is in the operator: the UK's key names
  (cross_grain_value_before, cross_grain_factor, cross_grain_control), two
  new general keys (cross_grain_parent, the name of the control row, and
  cross_grain_members, the geographies a row stands for), and
  cross_grain_metadata, which writes them in a fixed order. A country takes
  the names from one place. No UK code changes.

The default path is the operator before any edit, bit for bit
(test_cross_grain_allocator.py, 400 seeded surfaces; its pinned list of
added definitions gains cross_grain_metadata). The UK graph hashes this
file, so UK target nodes compute again on the next UK run, with the same
outputs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…'s keys and receipts

Step 2 of microcosm#1760 (docs/us-target-nesting-rule-design.md, section
5.5), on María's go of 27 Nov 2026. No target value changes: on the pinned
feed and ladder each of the 26,272 rows of the state_cd SOI surface has the
bits of the value it had, and the full, state and totals surfaces have the
bytes they had.

What is general now, and where:

- cross_grain_controls holds one row-level pass, reconcile_rows: it runs
  the operator on target rows and says, for each row, its value, what
  reconciled it, the factor, and the control row. The helpers that only the
  US used (factor band, completeness, self-consistency, sibling ratio) are
  gone: the operator's bound, members and selectors do that work.
- us/cross_grain_declarations.json is in the UK's key names:
  bridge_selectors (Historic Table 2 state rows over district-file rows,
  with the bound +0.25 / -0.20 around the median and unbind; state SOI rows
  over county-file rows), derived_controls (county households),
  same_measurement (the ladder population), relations (six subset pairs,
  Medicaid with max_excess), local_routes, members, registers. What goes at
  the feed re-pin is under until_the_feed_repin: the allocators, the level
  bridges of the six district-only concepts, the compile rules of rows 1
  to 4 and two known gaps. The keys mechanisms and inventory are gone.
- us_runtime/target_nesting.py runs each of the four passes through one
  function, run_pass.

What changes by design:

- Metadata keys: cross_grain_parent, cross_grain_value_before,
  cross_grain_factor, cross_grain_control and cross_grain_members replace
  the state_cd_* and state_county_* keys. Six old keys have no new one:
  the parent row, the operator's receipt or the declaration holds the value.
- Receipts: the district receipt has bridge (with the unbound legs),
  level_bridge_out_of_band and factor_by_measure. factor_band,
  rebase_factor_by_measure and internal_consistency are gone. County blocks
  lose share_sum. target_nesting.json entries are pass, allocator and the
  operator's receipt.
- So three pins of state_cd move (registry, roles, receipts). The target
  count and the population matrix are the same.
- A refusal that the operator makes has the operator's text.
- The check that the district file's own state row is the sum of its
  district rows is gone. Row 4 of the compile scales the district rows to
  that state row before this pass (22,236 district rows carry its marker on
  the pinned feed; the 436 that do not are never bound).
- A concept that takes its state parent from Historic Table 2 in some
  states and from the district file in others is refused. It does not occur
  on the pinned feed.
- With the bound turned off (tests only), a concept whose Historic Table 2
  level is zero in every state keeps district rows of zero.

The readers of the keys move with them: the loss weights, the hold-outs and
their pro-rata baselines, the county reports, and one field of the reviewed
limitations. The dated runs under experiments/ are not changed.

Proof: test_us_target_nesting_district.py and test_us_target_nesting_county.py
hold the tool functions to verbatim copies of the code they replace (160 and
120 seeded inputs, and the pinned feed): the same rows in the same order, the
same value bits, the same parent, factor, value before and members under the
new keys, the same counts, drops and summaries. Both US pin tools ran and
wrote no file; --check passes.

PR #1755 declares the old parent keys in us/local_target_construction.json
and pins the state_cd registry bytes. The PR that merges second takes the
other's change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
docs/us-target-nesting.md is the page of the code as it is after step 2 of
microcosm#1760: the six things of the model, the four passes, what the
operator checks and what the adapter checks, what stays until the feed
re-pin, the metadata keys with the keys they replace, and each difference
from the code before. The SOI surface page and the county page name the new
keys and receipt fields. The design page records that steps 1 and 2 are on
the branch and which two parts of the model are not built yet (the scaled
derived control, and one pass on one joint surface).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@juaristi22 juaristi22 changed the title Run the US share mechanisms on the shared cross-grain operator (Stage A of #1760, no target change) Nest the US target rows on the shared cross-grain operator (#1760: Stage A and steps 1 and 2, no target change) Nov 27, 2026
juaristi22 and others added 3 commits November 27, 2026 15:39
Ruled on 27 Nov 2026, after steps 1 and 2 of microcosm#1760 were written:
no allocator after the re-pin; one parent source for a concept; the
district file's self-consistency check stays out; the county rows are
compared and pinned on the pinned county facts file now; the merge waits for
a gap between UK releases; PR #1755 merges first; the rulings go on the
issue after the text is approved; Medicaid stays a subset with a declared
excess; the full surface and district capital gains nest in the Historic
Table 2 state row at step 3; decisions 4 and 7 go in their own PRs.

Docs only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pin them

Call 4 of the rulings of 27 Nov 2026 on microcosm#1760: the county rows are
compared and pinned on the real inputs now, not at the feed re-pin.

test_us_target_nesting_county.py gains two tests that read the pinned feed,
the pinned PUMA ladder and the pinned county facts file
(us/chronicle_county_facts.json, 922 MB, sha256 67b0998a...). They run when
MICROCOSM_US_CHRONICLE_FACTS, MICROCOSM_US_PUMA_LADDER_ARTIFACT and the new
MICROCOSM_US_CHRONICLE_COUNTY_FACTS name those files, and skip without them.

- The three county passes give the rows of the code before the move to the
  shared operator, in the same order, with the same value bits, parent,
  value before and members: 3,143 county populations on 2020 counties and
  3,144 on the 2023 county-equivalents, 6,286 county SOI rows (two measures
  for 3,143 cells; one cell stands for Kalawao and Maui), and 51 state and
  3,144 county household rows.
- The bytes of those rows and of their receipts are pinned.

Measured on the same inputs, for decision 6: the factor of each of the 51
county SOI legs is within 0.998 to 1.052 of the median for adjusted gross
income (median 1.1207) and within 0.9997 to 1.0005 for the return count
(median 1.0000). No leg is outside the band of 0.8 to 1.25 that the district
bridge declares. The pages record it. Whether the county bridge declares
the band is still to rule.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Ruled on 27 Nov 2026 (microcosm#1760, decision 6), after the county factors
were measured on the pinned county facts: the county bridge declares the
band of the district bridge. No county value changes.

- us/cross_grain_declarations.json: the selector state_soi_vs_county_file
  takes max_factor_shift 0.25, min_factor_shift -0.2, shift_around median
  and out_of_bound unbind.
- us_runtime/target_nesting.py: the county pass handles a leg that the
  operator unbinds. Its county rows of that measure leave the surface, the
  receipt names the leg under bridge.unbound, and its counties do not count
  as missing. One helper gives both passes their selector, and one gives
  each surface receipt the same bridge entry (the bridge, its bound, the
  legs it unbound), the households receipt too.
- tools/us_acs_local_county_surface.py: state_county_soi_surface takes
  factor_band, as state_cd_soi_surface does. The default is the declared
  band, and an infinite band turns the bound off (tests with random
  factors use that).

On the pinned county facts the factor of each of the 51 legs is within
0.998 to 1.052 of the median for adjusted gross income and 0.9997 to 1.0005
for the return count, so no leg is unbound: the 6,286 county SOI rows keep
their pinned bytes. The two receipt pins of the county rows move, because
the receipt names its bridge in the new shape. The state_cd pins do not
move.

Tests: a state that is off the median loses its county rows of that measure
and the receipt names it; a state off in both measures is not refused; the
old-against-new comparison on random blocks runs with the bound off,
because the old code had none.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
juaristi22 and others added 9 commits November 27, 2026 19:19
…with the old copy

From the adversarial review of PR #1791 (microcosm#1760), findings 2, 8
and 9.

- The members check of the operator counted each member once, so a row
  that appeared two times passed. The old US district code refused that.
  The rule is now one public function, assert_leg_members: a leg holds each
  declared member one time; a member that is absent, a row of another area,
  and a member that two rows hold are refused. A caller that takes a leg
  off its surface before a pass checks it with the same function. The UK
  passes no expected_members, so no UK call reaches this.
- reconcile_rows named a wrong factor, or no status, in two shapes that the
  operator accepts: a row under two controls (a bridge and a control of its
  own measurement), and a leg id that holds "+". It refuses both. No US
  pass reaches either.
- The bit-for-bit test had one shape of surface. Two tests add the others:
  seeded surfaces with a bridge that is valued for each geography (200
  seeds: 241 results and 159 refusals, all equal to the copy of the file
  at e29843d), and a replay of the operator's own tests
  (test_cross_grain.py) in which each call also runs that copy: 59
  reconciliation calls, 6 partition calls and 4 detection calls, with
  bounded bridges, rows that bind nothing, reviewed unbound targets,
  licensed empty legs and unchecked bounds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…its coverage check

From the adversarial review of PR #1791 (microcosm#1760), findings 1, 6,
10 and 11.

The district pass:
- A block whose level bridge is distrusted leaves the surface before the
  pass, so the operator never saw it, and a block that lacked a district
  was dropped in silence. The old code refused it. The adapter now checks
  such a block with the operator's rule (assert_leg_members). With the
  operator change before this commit, a district row that appears two
  times is refused again too.
- A district-file target that the selector pairs with no Historic Table 2
  target, and that no state row of its own measurement controls, is
  refused. The pass threw that list away.
- The trust band of a level bridge reads both limits of the declared bound.
  It read the upper one and took its inverse.

The declaration:
- An unknown top-level key, a bridge by id and a partition are refused when
  the file loads: no US pass would read them.
- The part of a subset relation must be at a lower level than its whole.
- The higher level of a compile rule or a known gap must be a declared
  level. The derivation of a derived control is read by the adapter, which
  hard-coded the sum.
- single_member_legs goes: nothing read it.

The coverage check:
- A role that the top level and a lower level both hold must be named: by a
  relation of its own, or by a compile rule or a known gap that lists it. A
  family was covered as a whole, so a new role in a covered family passed
  unseen. On the pinned feed ten roles are at two levels. Six had a
  relation. The two premium tax credit roles of Historic Table 2 get a
  subset relation (their 51 state rows sum to 0.9996 and 0.9997 of the US
  row). The general SOI role and the Census age rows are listed by the two
  known gaps that are about them.
- A subset whose whole is more than one row, or is not positive, is a
  violation. It was skipped in silence.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…r code wrote

From the adversarial review of PR #1791 (microcosm#1760), finding 4, on
María's go of 27 Nov 2026 ("Fix all").

A run that is resumed across the change of the metadata keys reads files of
older code. The run identity holds no code hash, so nothing stopped it:
calibrate failed with a text about concept groups, finalize wrote an empty
value in one reviewed limitation, and a county report could lose the SOI
evidence of the county that a combined cell covers.

- The checkpoint loader refuses a target_registry.json or a
  target_roles.json that holds a key with the prefix state_cd_ or
  state_county_.
- The finalize stage refuses a district receipt in materialize_rss.json
  that holds rebase_factor_by_measure, factor_band or internal_consistency.

Each refusal says that the file was materialized by older code and to run
--stage materialize again. No key of this code has one of the two prefixes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
From the adversarial review of PR #1791 (microcosm#1760), findings 3, 5, 7,
10 and 11.

- Two sentences from Stage A said that every metadata key and receipt, and
  the bytes of the surface, were as before. Step 2 made them untrue.
- docs/us-target-nesting.md: what the removed self-consistency check leaves
  open for the six concepts that only the district file has; the two
  refusals that were lost and are back; a band of 2.0 or more is refused;
  the guard for a run resumed across the change; which proofs run in CI and
  which only where the pinned inputs are; what the coverage check proves
  and what it does not; that the pairs that are not reconciled are read by
  the coverage check only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tten again

main moved 114 commits past the last merge (5589fae), and the PR
conflicted, so no CI check ran on it. Two generated files conflicted, the
same two as at the first merge: docs/evidence/spec-engine/us-f0-coverage.json
and test_us_multispine_pool_tool.py. main's side was taken for both, and the
US pin tools then wrote them for the merged tree (legacy, twice, coverage
twice); both --check pass.

main touches none of the nesting files: not the operator, not
cross_grain_controls, not the US declaration, its reader or the adapter,
not the two local surface tools. Its change to
tools/build_us_acs_local_release.py (household batch helpers) merged with
no conflict. The merged tree holds no reader of the retired metadata keys.

The environment needs the lock file of main: microcosm-emitter-interface
0.18.0 (uv sync, from the local cache).

Not run on the merged tree here: the tests. A build of another session
filled the machine's memory, and the test run was stopped. ruff, the CI
test plan check and both pin checks pass. CI runs the suites; the tests on
the pinned inputs still need a run on this machine.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the refusal

CI runs the property tests with a fixed seed. On that seed, this test drew
a district block of 2.0 under a Historic Table 2 state row of 2,000,000,001,
with the bound turned off. The operator refuses a lower total that is below
1e-9 of its control, by design. So the two engine-free jobs failed on this
test on each run. A local run draws a random seed, and passed.

The test now draws values from 1 to 1e8, so no block is below the limit.
The case that CI drew is now a fixed case of the refusal test.

Only the test file changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tten again

main is 319 commits ahead, with the geography-first move of microcosm#931
(PR #1538). Six files conflicted, each a generated pin or a count of the
spec-engine ledger. Each takes main's side, plus the three declaration
fields that this branch adds (one resource row of the US manifest): 32,641
authored fields and 50,845 configuration fields. Both pin tools ran, and
both --check pass.

main changed the shared operator for #931: a share_of_parent partition may
miss a member that a signed deferral leaves off the frame. So the reference
copy of the bit-for-bit test is now main's file at dc77fa3 (it was the
file at e29843d). The sets of definitions that this branch changed or
added are the same, and the operator tests pass against the new copy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR #1755 is on main now. It moves the US target selection, hold-outs, ladder
rows and compile registers into declared files. Ten files conflicted:

- six generated pins and counts of the spec-engine ledger. Each takes main's
  side, plus the three fields of the one manifest row that this branch adds:
  32,814 authored fields, 51,018 configuration fields, country manifest
  125 pointers. Both pin tools ran, and both --check pass.
- the hold-out and baseline code of the two local tools: main's side (the
  shared target_holdouts code). Its declaration
  us/local_target_construction.json and the frozen reference copy of the old
  tool code now name the parent key cross_grain_parent at both levels, as the
  tool code before #1755 read it on this branch. The hold-out equivalence
  test sets that key on its records.
- the module list of the spine blindness test: both lines.
- the surface-bytes test: one docstring for both changes, and this branch's
  three state_cd pins. The merged code gives those bytes again, so #1755's
  moves change no byte here. test_us_target_sets.py pins the state_cd
  registry version that main makes with the state_cd_* keys; it takes this
  branch's version (the count and every value are as before).

An import that the merge left unused goes. The shared cross-grain operator
is the same file on main, so the bit-for-bit reference stays.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PolicyEngine/chronicle#451 merged as 13294b93 (28 Nov 2026). The US feed and
the county facts move there together (microcosm#1760, step 3).

The feed (tools/build_us_chronicle_feed.py, built offline from a clean
checkout; 62,268 rows on the chronicle.consumer_fact.v5 contract, sha256
2e880fd3...). The scope keeps today's record sets and tax years: nine
record sets now carry their true tax year (chronicle#117) and take it, the
JCT tax expenditures for 2024 are the fiscal-year record set, and the TY2023
copy of the W-2 tips table goes because its TY2020 pair is in the scope
(705 pairs). The county facts built at 13294b93 have the bytes of the
3e9d3a0 build, so only their commit and scope digest move. The parity
resources follow the feed: 32 compiled families, 64 reviewed exclusions.

What the compile needs on this feed:
- District of Columbia: Chronicle numbers its seat 98 (1198), as the Census
  Bureau does; the district translation reads a seat 98 at seat 00.
- Taxable interest by AGI band: the TY2023 state package carries it now,
  and no TY2023 national Historic Table 2 row is in the scope, so the stale
  interest rebase would drop those rows after they displaced the TY2022
  rows. Such a slice no longer takes part in the newest-vintage selection
  (eligibility is part of selection), so the TY2022 rows stay and the six
  reviewed Iowa/North Dakota/Vermont exclusions need no change.
- Measure ids: qbi_amount/qbi_claims (Historic Table 2's ids of the QBI
  deduction) map to the QBI variable; interest_paid_deduction_* is
  mortgage_interest_paid_* now (column A19300/N19300), with the same
  variable.
- A new register, deferred_district_measures: twelve district measures that
  would be new targets (CTC, real estate taxes, taxable income, wages, and
  SALT and PTC, which read the right IRS column now). They are bound in
  microcosm#1731, not here.
- The restamp register is empty: no fact of the feed is restamped.
- District capital gains: the district file has no US row now, so its share
  denominator is the sum of its district rows of the same key.
- The 44 JCT references take the fy2024 ids; the target names change, the
  values do not.

The national_state surface keeps its 810 state taxable-interest band rows
and gains the Historic Table 2 state rows of charitable contributions,
mortgage interest and the QBI deduction (306), the Historic Table 2 US QBI
rows and eight Table 1.4 partnership and S corporation rows. The state SSI
targets take SSA's own workbook values (the pinned file's states summed to
more than its own US row). The state_cd surface still refuses at this
commit: its pairing and parents change in the next commit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
juaristi22 and others added 5 commits December 1, 2026 09:24
38 commits of main since 6b87a0c: the pooled post-export scoring work
(#1775 and the commits before it). No conflict. main touches no nesting
file, no pin of the spec engine and no feed pin.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
CI on 75cb18c was red, and a local run of the whole engine-free job found
the rest (CI stops at the first failure).

- test_the_committed_feed_pin_banks_the_anchor follows committed re-pin
  reports from the feed that added the three BEA facts of the ESI employer
  premium anchor (NIPA Table 7.8, series B4923C) to the pinned feed. The
  re-pin to Chronicle 13294b93 drops and changes rows, so it needs its own
  check: experiments/us-feed-13294b93/anchor_rows.json lists the three rows
  of the feed before and after it (list_anchor_rows.py), and
  _follow_row_changing_repin_report holds both sides to the banked rows:
  same period, value and source file. The three facts are unchanged.
- test_every_chunk_and_batch_size_gives_the_one_chunk_target_matrix (from
  main, engine-us) built its district rows with state_cd_parent_target_name.
  The tool reads the operator's key, cross_grain_parent, so the per-chunk
  parent check saw no block. The fixture names the parent with PARENT_KEY.
  It failed since the merge of main at dc77fa3.
- test_the_release_s_recorded_post_export_outputs_are_unchanged (from main)
  pins a hash of the reform validation output. The JCT tax expenditures
  have their fiscal-year ids since the re-pin (fy2024, cy2024 before), and
  the stand-in reform's effect is a function of its id, so the pin moves.
- test__load_ledger_target_specs__compiles_the_pinned_feed (feed-gated)
  looked for the district file's wv_total row, which the feed no longer
  has. It now holds West Virginia's district rows to the two districts of
  the current plan, and the state row to Historic Table 2's.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The adversarial review of #1755 (30 Nov 2026) left one important finding
and six smaller ones. None was changed before its merge.

1 (text). The UK national line keys its targets, problem and gates on the
   bytes of every UK resource, so a reworded rationale of the declared
   target sets makes it compute again. docs/uk-target-sets.md, the #1759
   changelog entry and test_uk_solve_scope.py said that it re-keys no solve
   node. They now name the full line, and the national kernels as out of
   the test's scope. The root cause is not changed here.
2. docs/us-target-sets.md: a reworded rationale moves documentation_sha256
   in the US coverage evidence; the page said that it moves no pin.
3. A metadata test compares with one scalar. The schema of the typed
   resource and the shared reader refuse a list or an object as the value
   of equals or not_equals: one with no member is absent from the canonical
   content, so the test changed a selection and no hash.
4. exclude and left_out_levels take the set order: their order means
   nothing to a selection. The US spec_sha256 and documentation_sha256 move
   one time (pins written again); the UK content hash does not move. The
   same entry two times in left_out_levels is refused by the spec engine
   before the reader. The page names the five fields that are normative
   though no selection reads them.
5. The UK page and the prose of uk/spec/target_sets.yaml described the BRMA
   row filter and the frs_brma stage that #931 retired. Only description
   and rationale text changes in the UK file: its content hash and the UK
   solve fingerprint are the same (test_uk_solve_scope.py, test_uk_graph.py
   pass with no change of a pinned value); the byte fingerprint moves, so
   the UK national line computes again one time.
6. The level check of the compile reads compiled targets only. The US
   ladder population levels (us/local_target_construction.json) are now held
   to the level rule and to the built rows of the declared target sets when
   the file loads (require_declared_built_levels). It reads the two packaged
   declarations only.
7. Four #1728 changelog entries lose their US field counts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ion 2)

Fourteen SOI quantities bound a Historic Table 2 US row (tax year 2022)
beside a newer Publication 1304 row (tax year 2023): no weight vector meets
both (microcosm#1243). Decision 2 of microcosm#1760 (ruled 27 Nov 2026):
the newer row is the national control, each state row keeps its share of
the US total of its own file, and the Historic Table 2 US row stops
binding.

- The shared arithmetic: cross_grain_controls.scaled_control, a derived
  control that is a value times the lower rows' share of their own source's
  total. The operator divides it, so each lower row takes one factor and
  the lower rows are not scaled to sum to the value.
- The declaration: one derived control of the kind scaled in
  us/cross_grain_declarations.json, with an entry for each of the 14 pairs
  (the measure of the state rows, the table and the measure of the control,
  the publisher concept and the evidence of the concept match). The known
  gap of microcosm#1243 goes.
- The pass: fiscal_targets._nest_soi_state_rows_in_newer_national_controls,
  in the compile after rows 1 and 2 and before the state AGI bands, on
  target_nesting.national_share_surface. A state is a control level too, so
  each state is a leg of its own and the country covers them all. A state
  row lands at the control's period (uprating_to_period) and ages from
  there with its control. The compile refuses a pair with two controls or
  two own totals, with state rows of two periods, with a row that another
  rule rebased, or whose rows do not bind one quantity under the declared
  publisher concept (ledger_source_concept).
- What follows a state row: the state AGI bands (the band rule reads the
  period that a rebased total is at), the district rows and the county rows
  (the county pass pairs by the tax year of the state row's own data). A
  district-file row of a paired measure takes the same factor in the
  compile, so its relation to its state row, and the factors and the bound
  of the district bridge, stay as they were.
- A reconciled state row carries the operator's keys; its
  cross_grain_parent is the national control.
- The US compile now imports the operator, its row-level pass, the US
  declaration reader and the US adapter. The implementation hash of the
  gate battery covers every module that its bindings reach by an import
  statement, and that closure holds the US compile, so it grows by these
  four modules (243 to 247). test_transport_evidence_kernels.py lists them.
  The gate battery computes again on the next UK run, as it does after any
  edit of the US compile; its outputs do not change.

The concept check of the 14 pairs, on pinned data: the two rows of each pair
carry one publisher concept and one return universe, and in tax year 2022
the Historic Table 2 US row is 0.974 to 1.009 of the other table's row
(twelve from the feed; the two Table 1.2 pairs from the IRS file as
Chronicle pins it at 13294b93).

On the pinned feed: 714 state rows take a factor of 0.986 to 1.156 on the
published values (an amount moves by 0.978 to 1.122 at the build year); 15
national rows stop binding (14 Historic Table 2 US rows and the state_2022
copy of the US return count); the compile goes from 28,116 to 28,101
targets and national_state from 6,316 to 6,301; the local surfaces keep
their counts and move in value. The pins are measured again. The US F0 pin
tools ran and moved no pin.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- docs/us-target-nesting.md: a section on the national-to-state pass (the
  rule, where it runs, what follows a state row, the keys, the guard, and
  the table of the 14 pairs with their factors and concept checks); what
  the joint surface needs before it can be built; what the gate battery's
  implementation hash covers since decision 2.
- docs/us-target-nesting-rule-design.md: the status of 1 Dec 2026, with the
  two choices of the build that are open to a ruling.
- docs/us-target-sets.md: the counts and registry versions after the pass.
- docs/us-chronicle-feed-repin.md, docs/us-acs-local-soi-target-surface.md:
  one paragraph each.
- changelog.d: an entry for the pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@juaristi22 juaristi22 changed the title Nest the US target rows on the shared cross-grain operator, and re-pin the US feed (#1760: Stage A and steps 1 to 3) Nest the US target rows on the shared cross-grain operator, and re-pin the US feed (#1760: Stage A, steps 1 to 3 and decision 2) Dec 1, 2026
juaristi22 and others added 3 commits December 1, 2026 16:23
A second adversarial review read the branch at 30b22ee. These are its
items on the national-to-state pass of decision 2. No pinned value moves.

- A state that one pair lacks no longer stops the compile. The pass ran all
  pairs in one operator call, where the country covered the states of every
  pair, so a pair with a state less was refused as an empty leg. Each pair
  is now a pass of its own (target_nesting.national_share_surface).
- A district-file row of a paired measure takes the factor only when it is
  of the state rows' tax year and binds their quantity; the compile refuses
  it otherwise. A follower is matched by its measure id, as the district
  bridge matches it, and the declaration says so.
- The pass no longer skips in silence where a conflict would stay. With the
  newer row beside state rows, it refuses when the US total of the state
  rows' own file is missing or of another tax year. With the newer row, the
  US total and no state row, the US total stops binding.
- The pass records what it did where a stage keeps the nesting receipts
  (target_nesting.record_pass_receipt): the factor of each pair, the district
  rows that followed, the rows that stopped binding and the pairs it left,
  with the reason.
- The guards are as strict as the page says: each row of a pair must carry
  the declared publisher concept (a row with none is refused), the control
  and the US total must be of one sign and not zero, and a derivation that
  cannot run names its quantity.
- Two behaviours had tests on the pinned feed only, which CI does not have.
  They now have tests on small inputs: the pass in the whole compile, with a
  state band and aging (it fails when the pass is removed or runs after the
  bands), and a county block under a state row that took a newer national
  level.

The pages: the target-sets page gave the state-row counts of the old pin
(4,431, 5,860 and 4,635 state rows and 441 country rows now); the county
bridge medians are 1.1246 and 1.0059 since decision 2; the list of
pinned-input test files has nine files; the joint surface is a follow-up
PR (ruled 1 Dec 2026).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main has the renewal of the UK register expiries (microcosm#1834). Without
it the engine-free job stops at the UK adjudication notice test on every
branch from 1 Dec 2026.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…1760)

The feed re-pin to Chronicle 13294b93 brought in the 102 Historic Table 2
state rows of the charitable deduction (tax year 2022). The only national
row of that quantity is Publication 1304 Table 2.1, for tax year 2023, and
both bind one model column. At the build year 2024 the 51 states sum to
1.069 of the national row for the amount and to 1.028 for the returns, so
no weight vector meets them together. The national-to-state pass cannot
give the state rows the national level: the feed holds no Historic Table 2
US row for this quantity, and the pass needs it for the shares. A second
review of the branch found this (1 Dec 2026).

Ruled on 1 Dec 2026: the repair goes in the follow-up of microcosm#1760
that makes the levels consistent, and the rows are held out until then.

- us/cross_grain_declarations.json: a known gap can hold its rows out of
  the national solve (held_out_of_national_solve: a level, a record set
  family, measures). One gap does, for the charitable rows. A second gap
  records the SALT and real estate taxes deductions, which bind two
  national rows of two tax years as on main; every row of it binds.
- us_runtime.fiscal_targets.us_target_is_held_out_known_gap is the test,
  and spec/target_sets.yaml excludes by it in national_state, beside the
  district classifier (predicate held_out_known_gap).
- The national tool passes the predicate. Its selection receipt counts the
  held-out rows apart (held_out_known_gap_targets, only when there are
  any); dropped_congressional_district_targets counts district rows only,
  as before.

On the pinned feed national_state goes from 6,301 to 6,199 targets. The
compiled registry, the full mode and every local surface are unchanged:
the state rows stay the parents of the district rows there, and no
national row binds on a local surface. The US F0 pins move with the
target-set file (one authored field more).

The 8 Table 1.4 rows of partnership and S corporation net income and net
loss, which the re-pin also brought in, are not held out. They sum to less
than the Historic Table 2 combined row, and that is no conflict: a row
binds the positive part of its variable on each return, so the four parts
do not fix the combined quantity, and the combined target is inside the
range that they allow. The page says so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Light pass, focused on the target changes, since an adversarial review and your rulings already cover the operator. Two requests and one view on the open decision.

1. Reconcile the compile change. full goes from 31,748 to 28,116 targets (−3,632). The description lists:

  • +204 Historic Table 2 state rows, +2 national QBI rows and +8 Table 1.4 rows;
  • 6,104 district rows deferred;
  • 102 charitable rows held out of national mode.

Those don't add up to −3,632 on their own: 31,748 + 214 − 6,104 is 25,858, so about 2,250 rows are explained elsewhere. That's presumably the district file's changes (the state and US rows removed, the at-large areas, the 2022 tax year) and Row 4 retiring. A short table of the net change by source and reason, in docs/us-chronicle-feed-repin.md, would let a reviewer confirm that nothing dropped out by accident. "Target values change" PRs are where that matters most.

2. Check the effect on the build before merging. Since target values change, it's worth comparing the next national build's fit on the unchanged targets with the current build's. A big shift there would point to a nesting or rebase side effect rather than the new feed.

On the open decision: what mortgage_interest_paid_* binds. IRS A19300/N19300 is mortgage interest paid to financial institutions, before any limits. deductible_mortgage_interest is the amount after the TCJA acquisition-debt limit and the itemising choice, so it would sit below the target by construction. If policyengine-us has a pre-limit paid-interest input, binding to that matches the IRS concept better. If not, keeping these rows deferred, as you have, is safer than binding to the deductible amount.

The rest looks consistent with the rulings on #1760:

  • every district row now nests in its Historic Table 2 state row on both modes;
  • DC's seat 98 is mapped to 00;
  • the SSA workbook replaces the state SSI file whose state rows summed to more than its US row;
  • the 12 new district families are deferred to #1731.

Review drafted with AI assistance and checked against the code at f50fedd250702a9f98fd44afa55c46abf29c726f.

A review of the pull request asked how the release compile goes from 31,748
to 28,116 targets, because the listed changes do not add up to the
difference by themselves.

docs/us-chronicle-feed-repin.md now has the account, measured on two
compiled registries at the build year 2024 (the code before the re-pin on
the old feed, and this branch on the new feed):

- the release compile by source and level: the district file's own state
  rows (-2,601) and US rows (-49), the two interest paid deduction measures
  of the district file (-872), the Historic Table 2 state rows that stood in
  for a district in nine areas (-324), and the new rows (+204, +2, +8);
- why the 6,104 deferred district rows are not a removal of 6,104 rows:
  5,232 of them are of twelve measures that the old feed did not hold;
- the production national mode by id: 4,830 of its 6,102 old targets keep
  their value, 1,257 move (with the cause of each group), 112 are new and
  15 are gone.

The design page records the ruling of 1 Dec 2026 that the two build choices
of decision 2 stand.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@anth-volk anth-volk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three minor fixes from a read of d6ce5d6c1, each with a suggested change. Two larger findings follow in a separate review.

Drafted with AI assistance (Claude) and checked against d6ce5d6c1.

Comment thread tools/us_acs_local_county_surface.py Resolved
Comment thread tools/us_acs_local_county_surface.py Resolved

@anth-volk anth-volk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the two findings in the inline comments. Neither moves a value on the pinned feed, but each is a case the code expects (a docstring in one, an explicit branch in the other) and handles only in part, and neither shape has a test. Both come from how the compile passes are put together, so I'd rather fix them in the structure than patch each branch. Below is one possible implementation; another design that removes the same failure modes is fine.

Why these happened

The compile runs a series of passes over the target list in memory: taxable interest, capital gains, the new national-to-state pass, the AGI bands, the profile. Each pass builds its own grouping key from a family label parsed out of the record set id, and records what it did in metadata strings (uprating_factor, uprating_to_period, cross_grain_parent, soi_share_total_source_record_id) that later passes and readers interpret. This PR adds a pass and gives two of those strings new readers: the AGI-band controls now read uprating_to_period, and a state row's cross_grain_parent now names a national row.

  • The first finding is a grouping error. The label congressional_district merges district files of different boundary vintages. That was safe while the denominator was one published row per file, with a check that the files agree; a sum over the label is not.
  • The second is a branching error. The national-to-state pass has several outcomes for each pair (skipped, recorded as left as it is, refused, retired without scaling, scaled), and the scaling of district-file rows is attached to only one of them.

A possible implementation

1. Key facts on their source file. Parse each fact once, when the feed loads, into typed keys, and group on them in every pass:

@dataclass(frozen=True)
class SourceFile:
    publisher: str                 # "irs_soi"
    table: str                     # "congressional_district", "historic_table_2", "table_1_4", ...
    tax_year: int
    boundary_vintage: str | None   # "117th_congress" for a district file
    universe: str                  # "all_returns", ...


@dataclass(frozen=True)
class Quantity:
    variable: str
    measure_mode: str
    filters: tuple[tuple[str, str], ...]   # filing status, AGI class, itemizer, ...

Where two files are meant to be read as one, a declaration says so; no parser merges them.

2. Give a denominator a type. It is either a published row or a sum built under checked conditions:

@dataclass(frozen=True)
class PublishedTotal:
    fact_id: str
    value: float


@dataclass(frozen=True)
class SumOfRows:
    source: SourceFile             # exactly one file
    members: tuple[str, ...]       # fact ids, checked complete against the file's district plan
    value: float


def total_for(source: SourceFile, quantity: Quantity) -> PublishedTotal | SumOfRows:
    """Exactly one total for a file and a quantity, or an error."""

SumOfRows cannot span two files and total_for cannot return two totals, which removes the first finding. soi_share_total_source_record_id can still name the sum's record set and member count, as it does now.

3. Record a target's adjustments as typed data. Keep them on the target, and write today's metadata keys from them only when the registry is saved, so the output bytes need not change:

@dataclass(frozen=True)
class Rescale:
    rule: str                      # "national_soi_pairs", "capital_gains_shares", ...
    factor: float
    control: str                   # the control row's id
    denominator: PublishedTotal | SumOfRows
    to_period: str


@dataclass(frozen=True)
class Target:
    key: tuple[SourceFile, Quantity, str]   # file, quantity, geography
    source_value: float
    adjustments: tuple[Rescale, ...]

    @property
    def value(self) -> float: ...           # source value x every factor

    @property
    def period(self) -> str: ...            # the last adjustment's to_period, else the source year

The AGI-band controls would read target.period instead of uprating_to_period, and "a row takes one control" becomes one check over adjustments instead of a check in each pass.

4. Plan, then apply. Each rule returns a list of operations, and one function applies every list:

Op = ScaleRows | StopBinding | Refuse


def national_soi_pairs(groups: QuantityGroups, pairs: Sequence[NationalSoiPair]) -> list[Op]:
    ops: list[Op] = []
    for pair in pairs:
        group = groups.of(pair)  # the control, the own-file total, state rows, district-file rows
        match group.shape:
            case Shape.NO_CONTROL:
                continue
            case Shape.NO_OWN_TOTAL:
                ops.append(Refuse(pair, "the state rows have no US total of their own file"))
            case Shape.CONTROL_AND_TOTAL:
                factor = group.control.value / group.own_total.value
                ops.append(StopBinding(group.own_total))
                ops.append(ScaleRows(group.rows_below_control, factor, rule="national_soi_pairs"))
    return ops

rows_below_control holds the state rows and the district-file rows of the quantity together, so no branch can scale one and skip the other, which removes the second finding. A match over a small enumeration lets a type checker report a shape that has no case.

5. Check invariants after each pass, with one shared checker:

  • a target's value equals its source value times its factors;
  • each declared parent and its children add up within the declared tolerance;
  • no two binding targets measure one Quantity at one geography.

The last check finds the #1243 kind of conflict without a review, including the SALT, real estate taxes and charitable cases this PR declares as known gaps. Those would become exceptions in the declarations, each with its issue and an expiry date.

6. Test the shapes the code says it handles. Generate small feeds (Hypothesis) with two district files in one tax year, a US total with no state rows, a missing district, and district-file rows present or absent, and use the invariants above as the expected results. A tool that compares two compiled registries value by value and groups the differences by source file (the table in docs/us-chronicle-feed-repin.md) could then run on every re-pin.

Scope

Steps 1, 2 and 4 are enough for the two findings and could land in this PR, with the compiled registry on the pinned feed byte-identical before and after (compare the two registries). Steps 3, 5 and 6 could go in the follow-up of #1760 with the joint surface: with the national control, the state rows and the district rows in one declared hierarchy and one operator call, district-file rows are children of their state rows and need no separate follower step.

Drafted with AI assistance (Claude) and checked against d6ce5d6c1.

juaristi22 and others added 2 commits December 3, 2026 11:07
main was 108 commits ahead. Eight files conflicted, all of them pins that
the US F0 pin tools write: the coverage evidence, the field counts, the
seed map and seed protocol, the loader's golden vector, the multispine
pool tool's spec digest and the coverage tool's digest. Each took main's
side, kept the reason comments of both sides, and the pin tools then wrote
the values of the merged tree (both pin checks pass). No other file
conflicted; main does not touch the nesting code or the compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two findings on the structure of the compile passes, and three small
fixes. None moves a value on the pinned feed: the compiled registry is
byte-identical before and after (compared aged and unaged, with the
district crosswalk, as the national tool compiles).

- A share denominator of the capital-gains pass is one published national
  row (_SoiShareTotal) or the sum of one district file's rows
  (_SoiSumOfDistrictRows), and _SoiShareDenominators.total_for returns
  one or none. The sum is keyed by the file (its record set id without
  the period), not by the family label, so two district files of one tax
  year, such as two boundary vintages, no longer add into one sum. A sum
  holds each district one time, and, when the compile translates the
  district facts onto the current plan, each district of that plan
  (congressional_district_vintage.current_congressional_district_plan);
  otherwise the compile refuses (IncompleteSoiDistrictFileError).
- The national-to-state pass plans each pair into one shape
  (_NationalSoiShape: absent, no control, control only, older control,
  scale), then applies the plans. A plan that scales names the state rows
  and the district-file rows together and applies them in one step, so the
  district-file rows of a pair with no state rows take the pair's factor
  (control over own total) instead of keeping their own year's level
  beside a retired US total. District-file rows under the newer row with
  no US total of their own file are refused, as state rows are.
- The national tool's selection receipt counts held-out rows by the
  predicate itself and refuses a dropped row that neither exclusion names.
- The county surface takes COUNTY_PREFIX from target_nesting, and the
  comment on the county population pass (and the county rung page) no
  longer describes the allocator that step 3 removed.

Tests on small inputs for each shape: two district files of one tax year,
a Hypothesis property over one to three files, a district counted twice
or missing from the plan, every layout of a pair and its shape, a pair
with district rows and no state rows, and a Hypothesis property over the
layouts of a pair (control absent, older or newer; own total absent, of
the rows' year or older; zero to three state and district rows). Both
behaviours that the review found fail these tests when they are put back.

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

Copy link
Copy Markdown
Collaborator Author

Program review

Base repository: PolicyEngine/microcosm
PR number: 1791
Reviewed head SHA: 562e220
Merge base SHA: 9688846
Mode: full
Scope: Changed behavior and affected dependencies, prior review, CI and release readiness
Review status: PARTIAL

Source Documents

Critical

C1 — Match published capital-gains totals by district file (OPEN)

CRITICAL. With two same-tax-year district files, a published US total for file A prevents the code from constructing file B’s own denominator. A file B target then uses A’s published row and names it in its lineage. In a TY2022 compile with a 40-return Table 1.4 control, B’s district counts of 1 and 3 should produce targets of 10 and 30. Giving A a published US row of 10 produces 4 and 12 for B. This is the mixed published/summed case of the per-file support this PR adds. It also skips B’s complete-roster check. Key both published and computed district-file denominators by file, while retaining the distinct Historic Table 2 handling and making expected duplicates explicit. Head denominator selection. Declared share rule.

I called the national release’s selector with the resulting registry. Its CLI-default full mode retained both incorrect rows for target materialization. The production national_state surface drops the district rows. A later local state rebase can cancel a uniform file factor if one file supplies a block, but the national full path has no such rebase. The pinned feed has only one file with no published US row. Release CLI default. Target frame entry point.

C2 — Validate district source members before translating geography (OPEN)

CRITICAL. The new membership check sees one row per destination district after the crosswalk has already merged input rows. A duplicated source cell is added to the legitimate cell, and a missing source district can be hidden when another source district has edges to every destination. With old-district counts of 2 and 3, a one-to-one crosswalk and a 40-return control, the expected output is 16 and 24. Repeating the first source cell with a distinct fact ID should raise, as the new guard promises. Instead the release’s full selector retains 22.857 and 17.143. Separately, a crosswalk that splits either of two source districts evenly across both destinations accepts a feed missing the second district and emits 20 and 20. Check each file and quantity’s source roster for complete, unique membership after legitimized proxies are constructed, then retain the destination roster check after translation. Crosswalk aggregation. New membership check.

The missing or duplicate source rows change district proportions. Rescaling a block to its state parent leaves those proportions in place. The reproduction constructs malformed inputs to test the explicit guard and establishes no effect on the pinned feed.

Should Address

A1 — Read a one-shot district crosswalk once (OPEN)

SHOULD ADDRESS. The compiler passes the same crosswalk object to translation and then to current-plan discovery. The translator expressly accepts an iterable of row mappings. For a one-shot iterator, the second read now reports all of the supplied columns as missing. I executed the preceding head’s compiler with the same iterator and verified it returns the 16 and 24 district targets. A list still compiles at this head. Prepare or materialize the crosswalk once and reuse the result. The national release’s normal file loader passes a DataFrame. Changed compile call. Translator input API.

Suggestions

S1 — Remove stale residual-allocation claims (OPEN)

SUGGESTION. The new county population declaration says the rounding residual goes to the largest county. The county rung guide also still promises exact closure through largest-residual rounding for ACS households. The shared operator now divides both controls proportionally and closure checks use tolerance, as the PR's nesting page explains. The older behavior in the new declaration can mislead downstream users reading the rule. Update the declaration and the ACS households paragraph together. This follows the already-resolved inline comment about the county population code comment. County population declaration · County rung guide · Operator rule · Prior thread

S2 — Correct the mortgage-interest follow-up premise (OPEN)

SUGGESTION. The 2 December review calls IRS A19300/N19300 pre-limit mortgage interest, and the PR's last open mortgage-interest bullet carries that interpretation forward. The TY2022 district guide maps both columns to Schedule A line 8a. The IRS instructions limit that line to deductible interest and points reported on Form 1098. A raw pre-limit mortgage_interest input would cover a different concept. Clarify the PR discussion before selecting a follow-up binding. The current defer remains appropriate, and the tracked binding register already distinguishes this component from the total Schedule A deduction. 2 December review · TY2022 SOI district guide · Schedule A instructions, physical page 8 · Deferred measures

Evidence Gaps

  • The review requested a national before/after calibration comparison on the 4,830 unchanged targets. No comparison or explicit deferral is recorded. The production runner expects a main commit. The PR owner can decide whether to run a matched-support diagnostic before merge or assess the first main build.
  • The US targets: one declared nesting rule across national, state, district and county levels #1760 ruling bars merge from the start of a UK release build through sign-off. The current UK release window remains unverified.
  • At 12:38 UTC the exact-head engine-free, US and UK jobs were in progress on both Python versions. The branch requires the aggregate ci check, which had yet to report.
  • Independent local tests skipped cases requiring the pinned input files or the US engine. The PR reports pinned-input tests at this SHA. Real-household target matrix behavior remains unverified in this review.

Notes

  • The PR is open, in draft, and GitHub reports BLOCKED and CHANGES_REQUESTED. All five inline threads are resolved. The older changes-requested review still appears at d6ce5d6. The district-only scaling repair passed its regression.
  • Both critical findings are reproduced with alternate district inputs. The pinned Chronicle feed has one district file, and its production national_state mode filters district rows.
  • The compile count reconciliation addresses the first 2 December review request. The final counts are 28,101 compiled and 6,199 in production national_state.

Validation Summary

Focused exact-head pytest passed 1,132 and skipped 34 in 178.34 seconds. Compiler and selector diagnostics reproduced three findings and confirmed the iterator was accepted by the preceding head. Source review independently corroborated all 42 values across the 14 Decision 2 pairs and checksum-verified 16 originals. At 12:38 UTC, exact-head lint, wheels, country selection, installed-emitter and integration-uk passed. The UK after-merge job was skipped as expected on this PR. GitHub Actions.

Timing

elapsed seconds: 554.51s; parallel review seconds: 410.00s; code role seconds: 401.00s; policy role seconds: 397.00s; consolidation cleanup seconds: 60.51s

Review Severity

REQUEST_CHANGES. Open findings: 2 critical, 1 should address, 2 suggestions.

The review of 562e220 (3 Dec 2026): two critical findings, one to
address and two suggestions. No value moves on the pinned feed: the
compiled registry has the same bytes, aged and unaged, with the district
crosswalk.

- C1: a capital-gains share denominator has a scope. A Historic Table 2
  row's scope is the family; a district row's scope is its own file. The
  published US rows and the sums of district rows are both keyed by the
  scope, so a district file with no US row divides by its own sum, never
  by the US row of another file of the same tax year.
- C2: the check of a sum reads the source rows that each translated row
  records in its lineage (congressional_district_vintage_sources): each
  source district of the crosswalk one time, then each district of the
  current plan one time. A source row given twice, or a missing one that
  other source districts hid after the crosswalk, refuses the compile.
- A1: the compile reads the crosswalk into a frame one time
  (prepare_congressional_district_vintage_crosswalk) and gives it to the
  translation and to the plans (congressional_district_plans), so a
  one-shot iterable of rows works.
- S1: the county population declaration and the ACS households paragraph
  of the county rung page describe the operator's proportional division.
- S2 (the mortgage interest premise) is a correction to the PR text only.

Tests: the review's cases with its numbers, the district-file property
with a US row or none for each file, and the source districts of a
translated row. Each new test of C1, C2 and A1 fails on 562e220.

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

Copy link
Copy Markdown
Collaborator Author

All five findings of the program review of 562e220f9 are addressed in 6d744f917. The compiled registry of the pinned feed has the same bytes before and after (aged and unaged, with the district crosswalk), and national_state stays at 6,199 targets.

C1. Published totals by district file. A share denominator now has a scope. A Historic Table 2 row's scope is its family, because HT2 puts each state and the US in a record set of its own. A district row's scope is its own file (the record set id without the period). The published US rows and the sums of district rows are both keyed by the scope. So file B divides by its own sum (10 and 30 in your case), never by file A's US row, and B's sum gets its roster checks. The one duplicate that is expected, one total under two record ids of one scope, keeps the smaller id, as before. Two district files' US rows are no longer compared: each file divides by its own. Tests: your two-file case, and the Hypothesis property over one to three files, which now draws a US row or none for each file.

C2. The source roster before the crosswalk. The translation records, in each translated row's lineage, the source rows that the crosswalk added into it, with the state-total proxies (congressional_district_vintage_sources). The check of a sum now reads them first: each source district of the crosswalk one time. Then it checks each district of the current plan one time, as before. Your two cases are tests: a source row repeated under another fact id with a one-to-one crosswalk (16 and 24 without the repeat), and a missing source district under an even split. Both now refuse the compile. The check covers the sums, the scope of the guard; a file with its own US row divides by that row, as before.

A1. A one-shot crosswalk. The compile reads the crosswalk into a frame one time (prepare_congressional_district_vintage_crosswalk) and gives the frame to the translation and to the plans. Test: a one-shot iterator compiles as the list does.

S1. The county population declaration and the ACS households paragraph of the county rung page now describe the operator's division: proportional, with no rounding, and closed within the tolerance.

S2. Agreed. The Schedule A instructions put on line 8a only the deductible part of the interest and points reported on Form 1098 when a limit applies, so A19300/N19300 is after the limits. In policyengine-us, mortgage_interest is the amount before the acquisition-debt caps, which is a different concept. deductible_mortgage_interest (after the caps, and it also holds lines 8b and 8c) stays the closest. The PR description's view and its open item are corrected. The rows stay deferred.

Each of the five new tests of C1, C2 and A1 fails on the code of 562e220f9.

Evidence gaps. The national before/after comparison needs a build. Whether to run one before the merge is the PR owner's call, and the PR description records it. The merge, and the UK release window that gates it, are the owner's call too.

🤖 Addressed by Claude Code

@juaristi22

Copy link
Copy Markdown
Collaborator Author

Thanks, Vahid.

1. The compile change. Done in d6ce5d6c1: docs/us-chronicle-feed-repin.md has the change by source and level. The 6,104 deferred district rows are not a removal of 6,104 rows: 5,232 of them are of twelve measures that the old feed did not hold, so they were never compiled, and the other 872 are the district file's interest paid rows. Decision 2 then takes 15 national rows off (28,116 to 28,101).

2. The effect on the build. Not done: it needs a national build, and none ran for this PR. The page gives what the comparison needs: on the production national mode, 4,830 of the 6,102 targets of the old surface keep their value. Whether to run it before the merge is María's call.

The mortgage interest decision. The rows stay deferred, as you advise. One correction to the premise, from the program review of 3 Dec: the district file's guide maps A19300/N19300 to Schedule A line 8a, and the Schedule A instructions put on line 8a only the deductible part of the interest and points reported on Form 1098 when a limit applies. So the column is after the limits. mortgage_interest in policyengine-us is the amount before the acquisition-debt caps, which is a different concept, and deductible_mortgage_interest stays the closest. The decision is still open.

@juaristi22

Copy link
Copy Markdown
Collaborator Author

Program review

Base repository: PolicyEngine/microcosm
PR number: 1791
Reviewed head SHA: 6d744f9
Merge base SHA: 9688846
Mode: incremental from 562e220
Scope: Changed district normalization and roster logic, prior findings, and remaining merge validation
Review status: PARTIAL

Source Documents

Critical

C1 — Match published capital-gains totals by district file (RESOLVED)

Published rows and computed sums now use the same file scope for district facts. The original crosswalk-enabled reproduction now gives 10 and 30 for file B and names its own two-district sum. File A still uses its published total and gives 8 and 12. Lookup and per-file sum.

C2 — Validate district source members before translating geography (RESOLVED)

The compiler checks the roster of source cells through translation lineage, in addition to the destination roster. It refuses a repeated original district and a missing original district whose target districts are filled by another source through a split crosswalk. The same diagnostic passed complete old-plan data with D.C. seat 1198 and complete current-plan data with Microcosm's D.C. seat 1100. Roster checks.

C3 — Resolve overlapping district files before binding the same calibration targets (OPEN)

CRITICAL. Preserve file-local denominators, then choose one reviewed vintage for each overlapping district concept or reject the overlap in the compile. This commit now accepts two complete same-year district files whose published US totals differ. Its geographic target selection retains both translated rows for each district. In an ordinary TY2022 compile with two Hawaii districts, a 40-return control, and published totals of 10 and 20, the national release's default full surface selects 8 and 2 for HI-01 and 12 and 6 for HI-02. The targets in each pair use the same geography, capital-gains return indicator, tax-unit filters and income range. They measure the same weighted totals, so the solver would trade off incompatible values. The ACS state_cd surface rejects the same data for repeated district members. national_state filters district rows.

The exact preceding compiler rejected the conflicting national totals. The case that now passes is explicitly supported by the new file-scoped code and property test. The pinned feed has a single district file, so the example establishes a newly admitted re-pin failure. New scope for published totals. Default national target mode. National target materializer. ACS target selector.

Should Address

A1 — Read a one-shot district crosswalk once (RESOLVED)

The compiler materializes the rows before it passes the reusable frame to the translator and the plan reader. The original iterator and list both compile to the same target names and values, 16 and 24. Crosswalk preparation.

A2 — Keep single-seat proxy detection inside each district file (OPEN)

SHOULD ADDRESS. The crosswalk suppresses a state-total proxy once any file has a source district in the state. An old-style file B with Hawaii district rows of 1 and 3 and a D.C. state total of 4 compiles by itself using the three legitimate input cells, yielding 5, 15 and 20. Another file A's explicit D.C. district then suppresses B's proxy and B fails the new file-local source roster despite providing its state total. The prior head accepted the combined feed by using A's published denominator for B, which hid the proxy failure and produced the wrong numbers. If overlapping files stay supported through compilation, detect the absence of an explicit at-large district within the candidate file and quantity before filling a legacy state-total proxy. Resolving the overlap by selecting one source file before translation would also avoid cross-file suppression. Cross-file proxy detection.

Suggestions

S1 — Remove stale residual-allocation claims (RESOLVED)

RESOLVED. The county population declaration and the county household guide now describe proportional division and closure within tolerance. The examples retain their original populations, weights and units. County declaration. County household guide.

S2 — Correct the mortgage-interest follow-up premise (RESOLVED)

RESOLVED. The updated PR discussion explains that IRS A19300/N19300 refers to Schedule A line 8a, which reflects applicable deductibility limits and Form 1098 reporting. It distinguishes this measure from the raw mortgage_interest input and retains the expressly deferred binding decision. The original IRS district guide and the Schedule A instructions support the correction and apply to TY2022. Author's updated discussion. District guide. Schedule A instructions, page 8.

Evidence Gaps

  • The national fit comparison on 4,830 unchanged targets was requested and remains open. The latest author response records neither results nor a decision to defer it.
  • The UK release window remains unverified. The US targets: one declared nesting rule across national, state, district and county levels #1760 ruling bars merge between the first UK release build and its sign-off.
  • Exact-head GitHub Actions were still running at 14:12 UTC. The required aggregate ci check had yet to report.
  • The independent local run skipped 26 cases requiring pinned input files. The author reports passing pinned-input tests and byte-identical pinned registries at this head. The real-household calibration remains unverified.

Notes

  • All five findings from the posted review of 562e220 are resolved. The new findings use alternate multi-file district inputs. The pinned feed contains one district file, and production national_state excludes district rows.
  • GitHub reports an open draft, BLOCKED and CHANGES_REQUESTED. All five inline threads are resolved. The remaining changes-requested review is on an older head.
  • The fetched main at 134477a advanced by six commits via Belgium PR Record Belgium's method card rulings and pin NGI as the language-region source #1856. A local merge-tree check completed without conflicts.

Validation Summary

The exact-head focused test run passed 423, skipped 26 and reported zero failures. The implementation review independently repeated the prior and current compiler cases and exercised the national and ACS local selectors. The source review reconciled 436 source and 436 destination districts and both capital-gains totals, using 17 checked originals including 16 reused. CI lint, wheels, installed-emitter, select-countries and integration-uk passed at 14:12 UTC. Exact-head CI.

Timing

elapsed seconds: 448.54s; parallel review seconds: 323.00s; code role seconds: 323.00s; policy role seconds: 188.00s; consolidation cleanup seconds: 51.54s

Review Severity

REQUEST_CHANGES. Open findings: 1 critical, 1 should address, 0 suggestions.

juaristi22 and others added 2 commits December 3, 2026 15:34
The second program review of 6d744f9 (3 Dec 2026): one critical
finding and one to address. No value moves on the pinned feed, which
has one district file: the compiled registry has the same bytes, aged
and unaged, with the district crosswalk.

- C3: two district files that give district rows of one capital-gains
  quantity, such as two boundary vintages of one tax year or two tax
  years, would each bind the districts that they share. Latest-vintage
  selection keeps one period of each file, not one file. The compile
  now refuses them (OverlappingSoiDistrictFilesError) before the
  crosswalk. Each file's denominator stays its own, and one file at two
  tax years is one file.
- A2: before the crosswalk, the district rows of one file could stop
  the state-total proxy of another, and that file then failed the check
  of its source districts with the wrong reason. The overlap refusal
  runs first, so the compile names the two files instead.

Tests: the review's two cases (two files with US rows of 10 and 20; a
file whose D.C. seat is a proxy beside a second file with an explicit
D.C. seat), two files of two tax years, and one file at two tax years.
The multi-file tests of the pass now run the pass on its own and check
that the compile refuses. Both new tests fail on 6d744f9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three files conflicted, all of them pins that the US F0 pin tools
write: us-f0-coverage.json, inventory_coverage.py and the multispine
pool tool test. Each kept this branch's reason comments and took main's
values; then the pin tools wrote the values of the merged tree, and
both --check runs pass. main brings Belgium's method card rulings
(#1856) and the pin of the Fed's SCF 2025 summary reissue (#1865).

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

Copy link
Copy Markdown
Collaborator Author

The two open findings of the second program review, of 6d744f917, are addressed in 0ceaf6652. The compiled registry of the pinned feed has the same bytes before and after (aged and unaged, with the district crosswalk): the feed has one district file.

C3. Overlapping district files. The compile now rejects the overlap, as the review proposes. Two district files that give district rows of one capital-gains quantity are refused before the crosswalk (OverlappingSoiDistrictFilesError). This holds for two boundary vintages of one tax year and for two tax years: latest-vintage selection keeps one period of each file, not one file, so both files would bind the districts that they share. One file at two tax years is one file, and the compile keeps its latest year. The file-local denominators stay: when the pass runs on its own, it still divides each file's rows by that file's own total. The multi-file tests now run the pass alone and check that the compile refuses. Tests: your case (US rows of 10 and 20), two files of two tax years, and one file at two tax years.

A2. Cross-file proxy suppression. The same refusal resolves it, by the review's second option. The overlap check runs before the translation, so in a compile that goes on, no second district file of the quantity can stop a file's state-total proxy. Your case (file B with Hawaii rows and a D.C. state total, beside file A with an explicit D.C. district) now refuses as two files of one quantity, not as a missing D.C. district. B alone compiles to 5, 15 and 20. The proxy rule itself is unchanged: it fills a seat only in a state with no SOI district row. A second district file that gives only other measures can still stop a proxy, and then the check of the source districts refuses the compile, so it does not pass silently.

Both new tests fail on the code of 6d744f917: there the overlap compiled, and the proxy case refused as a missing district.

Evidence gaps. The national fit comparison waits for the PR owner's decision: a comparison build before the merge, or a check of the first main build. The merge, and the UK release window that gates it, are the owner's call too.

🤖 Addressed by Claude Code

@juaristi22

Copy link
Copy Markdown
Collaborator Author

Program review

Base repository: PolicyEngine/microcosm
PR number: 1791
Reviewed head SHA: d6fed9b
Merge base SHA: 23479e8
Mode: incremental from 6d744f9
Scope: Changed district overlap and proxy behavior, merged dependencies, prior findings, and remaining merge validation
Review status: PARTIAL

Source Documents

Critical

C1 — Match published capital-gains totals by district file (RESOLVED)

Published rows and computed sums now use the same file scope for district facts. The original crosswalk-enabled reproduction now gives 10 and 30 for file B and names its own two-district sum. File A still uses its published total and gives 8 and 12. Lookup and per-file sum.

C2 — Validate district source members before translating geography (RESOLVED)

The compiler checks the roster of source cells through translation lineage, in addition to the destination roster. It refuses a repeated original district and a missing original district whose target districts are filled by another source through a split crosswalk. The same diagnostic passed complete old-plan data with D.C. seat 1198 and complete current-plan data with Microcosm's D.C. seat 1100. Roster checks.

C3 — Resolve overlapping district files before binding the same calibration targets (STILL OPEN)

CRITICAL. The guard rejects the original two-file repro before translation, but it only sees raw district rows. A legacy district file A with a D.C. state total of 6 and its own published US total of 10 can appear alongside file B with Hawaii district counts of 1 and 3 and a D.C. state total of 4. A has district-file record-set metadata and a published denominator, so it can bind outside a complete raw roster. The preflight only sees B's district records. Translation gathers eligible proxy shapes across the feed, then creates a D.C. district record for each file from its state total. The ordinary compiler and actual national full selector retain targets of 24 and 20 for the same D.C. district, filing status, AGI range and capital-gains return indicator. The selector's materializer-semantics comparison confirms those targets measure the same population. National full would calibrate to conflicting values for district 1100. Keep the raw check and also check the translated, eligible district bindings before the registry is consumed. This is the original incompatibility through the proxy path. The pinned feed contains one district file. Guard calls before translation only. Proxy generation. National selector.

Should Address

A1 — Read a one-shot district crosswalk once (RESOLVED)

The compiler materializes the rows before it passes the reusable frame to the translator and the plan reader. The original iterator and list both compile to the same target names and values, 16 and 24. Crosswalk preparation.

A2 — Keep single-seat proxy detection inside each district file (RESOLVED)

The exact original same-quantity input now raises OverlappingSoiDistrictFilesError before attempting translation. With only the legacy file, the D.C. state total still supplies its single seat and the return targets are 5, 15 and 20. This closes the original same-quantity case by excluding the conflicting input. When another file supplies only a different measure, its explicit D.C. district can still suppress the legacy capital-gains returns proxy. Both the prior and current compilers refused the computed-denominator case because they saw an incomplete roster. The published-denominator path skips that roster by inspection. This run did not independently finish the published-denominator case. The PR describes the disjoint-measure proxy limitation. Early guard.

Suggestions

S1 — Remove stale residual-allocation claims (RESOLVED)

RESOLVED. The county population declaration and the county household guide now describe proportional division and closure within tolerance. The examples retain their original populations, weights and units. County declaration. County household guide.

S2 — Correct the mortgage-interest follow-up premise (RESOLVED)

RESOLVED. The updated PR discussion explains that IRS A19300/N19300 refers to Schedule A line 8a, which reflects applicable deductibility limits and Form 1098 reporting. It distinguishes this measure from the raw mortgage_interest input and retains the expressly deferred binding decision. The original IRS district guide and the Schedule A instructions support the correction and apply to TY2022. Author's updated discussion. District guide. Schedule A instructions, page 8.

Evidence Gaps

  • The national calibration comparison on 4,830 unchanged targets remains open. The latest author reply records two options without results or an explicit deferral.
  • The current UK release window remains unverified. The US targets: one declared nesting rule across national, state, district and county levels #1760 ruling bars merge between first build and sign-off.
  • The exact-head required aggregate ci check was still pending at 17:51 UTC.
  • The independent run skipped 23 pinned-feed tests. The author's pinned-input and registry evidence is documented in the PR. Real-household calibration remains unverified.

Notes

  • This head closes the original raw-district overlap and proxy-suppression reproductions before crosswalk application. C3 remains open because translation can create the overlapping district targets from state totals.
  • The source check reconfirmed the single pinned district file with the complete IRS and Census rosters. The proxy-induced overlap uses alternate legacy feed inputs.
  • All five review threads are resolved. GitHub still reports the PR as an open draft, BLOCKED and CHANGES_REQUESTED. A local merge-tree check against fetched main e124f96 completed without conflict.

Validation Summary

Exact-head focused tests passed 319, skipped 23 and reported zero failures. Ordinary compilation and the actual national full selector reproduced the remaining C3 path. Reused and checksum-verified 17 primary source originals and independently reconfirmed 436 source and 436 current districts and both IRS national totals. At 17:51 UTC the UK engine matrix, UK integration, lint, wheels, installed-emitter and country selection passed. The US and engine-free matrices were in progress. Exact-head CI.

Timing

elapsed seconds: 1157.05s; parallel review seconds: 1047.00s; code role seconds: 1047.00s; policy role seconds: 88.00s; consolidation cleanup seconds: 54.05s

Review Severity

REQUEST_CHANGES. Open findings: 1 critical, 0 should address, 0 suggestions.

The third program review of d6fed9b (3 Dec 2026) found that the
refusal of overlapping district files read only raw district rows. A
legacy district file with only a D.C. state total and its own US row
still bound the D.C. district through the crosswalk's state-total fill,
beside a second file: 24 and 20 on the full surface. A Historic Table 2
D.C. state total can take the same path.

The fix is one general rule in place of the district-file checks. A new
shared module, microcosm.build.ledger_cells, refuses a compiled registry
in which the targets of one calibration cell give different values. A
cell is one quantity (the Ledger concept, unit, entity, aggregation,
period type, filters and universe) at one geography for one target
period, whatever its source. The rule reads only the metadata that the
shared Ledger compile writes, so a country declares nothing. The US
compile runs it on the registry that it returns, after every pass.
Targets of one cell with one value stay: Table 1.1 and Table 1.2 give
the TY2023 national return count and AGI with equal values, and how
often a cell enters the loss is a rule of the loss (microcosm#1729).

- The round-2 refusal (OverlappingSoiDistrictFilesError) is deleted.
- The crosswalk fills the seat of a one-seat state for each source of
  district rows that gives no row there, so the rows of one source no
  longer hide the gap of another. With one source, as on the pinned
  feeds, the fill is unchanged.
- Tests: a shared property test of the rule with no country, and one
  property test of the district capital-gains surface that replaces
  nine tests of the earlier rounds and a vintage test. Each review case
  is a fixed example.
- Old fixtures that gave one cell two values (a district file's own
  state or US row beside the Historic Table 2 row of the same cell, as
  before chronicle#451) now expect the refusal or compile one source at
  a time. Fixtures that left out what the feed uses to tell two
  quantities apart (a return universe, the SSA program dimension, the
  CBO series concept) now carry it.

The compiled registry of the pinned feed has the same bytes, aged and
unaged, with the district crosswalk.

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

Copy link
Copy Markdown
Collaborator Author

Program review

Base repository: PolicyEngine/microcosm
PR number: 1791
Reviewed head SHA: ccdb915
Merge base SHA: 23479e8
Mode: incremental from d6fed9b
Scope: Shared Ledger cell invariant, US district proxy scope, prior findings and merge evidence
Review status: PARTIAL

Source Documents

Critical

C1 — Match published capital-gains totals by district file (RESOLVED)

Published rows and computed sums now use the same file scope for district facts. The original crosswalk-enabled reproduction now gives 10 and 30 for file B and names its own two-district sum. File A still uses its published total and gives 8 and 12. Lookup and per-file sum.

C2 — Validate district source members before translating geography (RESOLVED)

The compiler checks the roster of source cells through translation lineage, in addition to the destination roster. It refuses a repeated original district and a missing original district whose target districts are filled by another source through a split crosswalk. The same diagnostic passed complete old-plan data with D.C. seat 1198 and complete current-plan data with Microcosm's D.C. seat 1100. Roster checks.

C3 — Resolve overlapping district files before binding the same calibration targets (STILL OPEN)

CRITICAL. The new final registry guard refuses both original feeds when they use identical filter metadata, including the state-only file whose conflicting D.C. target is created during translation. A supported equivalent all-income input still bypasses the guard. Give the second file the same two Hawaii district observations and published denominator as in the original counterexample, and omit only its dimensions.income_range field. The compiler deliberately defaults that field to all. Its published denominator lookup and selected target filters treat the two encodings equivalently. But the cell key includes every raw ledger_filter_* pair, so the only identity difference is the first file's ledger_filter_income_range=all. The actual national full selector retains incompatible targets of 8 and 2 at HI-01 and 12 and 6 at HI-02. Each pair has the same geography and materializer semantics. Normalize equivalent unrestricted filters in the collision key, or validate the normalized US model bindings in addition to the source-cell check. US all-income default. Ledger filter stamping. Cell key. Materializer semantics.

C4 — Keep single-seat proxy gaps attached to their source (OPEN)

CRITICAL. The translator records district presence per source and then merges the missing shapes by state across all sources. When one file has a D.C. district and another lacks it, the second file's gap can turn the first file's D.C. state total into an additional copy of its own district row. The derived fact retains the first file's record set, so the crosswalk sums the two contributions before the new ledger-cell check sees them. A published denominator also skips the computed-denominator roster check.

I ran the exact-head translator, ordinary compiler and national builder's normal full selector with two disjoint TY2022 files. File A gives the D.C. district count of 5 and its own US total of 10. File B gives Hawaii district counts of 1 and 3 and its own published US total. With the Table 1.4 control at 40, A's D.C. district correctly targets 20. Adding A's D.C. state total of 5 supplies the same published quantity in the single-seat jurisdiction. A already covers the district, so that state total should not create an additional contribution. Instead the translated lineage contains the explicit seat and its state-total proxy, each contributing 5. The compiler accepts the feed and the national full selector retains a single D.C. target of 40. This case uses alternate input scope. The pinned feed has one complete district source and does not exercise it. Preserve source and period in the proxy eligibility check so a gap in one source cannot authorize a proxy in a source that already supplied the district. Gap construction and proxy eligibility. Crosswalk contribution key.

Should Address

A1 — Read a one-shot district crosswalk once (RESOLVED)

The compiler materializes the rows before it passes the reusable frame to the translator and the plan reader. The original iterator and list both compile to the same target names and values, 16 and 24. Crosswalk preparation.

A2 — Keep single-seat proxy detection inside each district file (RESOLVED)

The original direct D.C. row no longer suppresses the other file's state-total proxy. With unequal values, the compile refuses their D.C. cell after translation. With the other file publishing only D.C. amounts, the legacy return source retains its Hawaii and D.C. targets of 5, 15 and 20 in the actual national selector. This disposition applies to the original blocked-proxy case. Proxy scope.

A3 — Handle agreeing district duplicates before validating local nesting (OPEN)

SHOULD ADDRESS. The compiler now accepts two district files that give the same dollar or return target. The selected local district surface still requires each geography to appear once in a nesting block. With two agreeing Hawaii district files and a Historic Table 2 Hawaii parent, the tested registry compiled successfully, but the actual ACS state_cd selector raised a repeated-member error for both districts. This reopens a path that the preceding raw-file guard refused at the compile. Apply a district-surface source-selection rule for agreeing duplicate inputs, or refuse the overlap with a targeted message before local nesting. This concerns the district reconciliation path. The national compiler's documented agreement policy can still retain agreeing source rows where they do not enter that path. Registry agreement policy. Local block assembly.

A4 — shared-1 — Preserve distinct Ledger universes when the hash is absent (OPEN)

SHOULD ADDRESS. When a supported bare Ledger feed supplies its universe domain without an opaque universe hash, the new cell key loses a distinction the US materializer acts on. The normal JSONL loader read a synthetic TY2024 all-returns count of 80 and an EITC-returns count of 30. The exact preceding compiler returned both; their SOI materializer masks differed in the positive-EITC filter. The head now refuses the build as a single cell with conflicting values. Giving the rows separate universe hashes leads the head to accept both. The key fills the missing hash with an empty string and omits the recorded domain. Include the domain in the fallback for rows without the hash, or key model-population semantics directly. Vendored Chronicle v4 and v5 schemas require the universe hash, so the demonstrated regression concerns the older/bare diagnostic input contract, and no pinned-feed impact was established. Cell key. Ledger metadata. Materializer filter. Legacy/bare loader contract.

Suggestions

S1 — Remove stale residual-allocation claims (RESOLVED)

RESOLVED. The county population declaration and the county household guide now describe proportional division and closure within tolerance. The examples retain their original populations, weights and units. County declaration. County household guide.

S2 — Correct the mortgage-interest follow-up premise (RESOLVED)

RESOLVED. The updated PR discussion explains that IRS A19300/N19300 refers to Schedule A line 8a, which reflects applicable deductibility limits and Form 1098 reporting. It distinguishes this measure from the raw mortgage_interest input and retains the expressly deferred binding decision. The original IRS district guide and the Schedule A instructions support the correction and apply to TY2022. Author's updated discussion. District guide. Schedule A instructions, page 8.

Evidence Gaps

  • Exact-head CI remained in progress at 23:43 UTC, including the required aggregate ci result.
  • The national calibration comparison on 4,830 unchanged targets or an explicit deferral remains open.
  • The UK release timing condition remains unverified. The US targets: one declared nesting rule across national, state, district and county levels #1760 ruling bars merge between a first UK build and sign-off.
  • The independent US run skipped 23 pinned-feed cases. The commit reports unchanged pinned registry bytes. Real-household calibration remains unverified.

Notes

  • The new guard rejects both original conflicting-district cases with matching Ledger metadata. C3 remains open with equivalent all-income filters. The new proxy double-count was executed separately.
  • The new shared helper is only called by the US fiscal compiler at this head. The pinned district source reconciling against the original IRS counts still covers 436 source and 436 destination districts.
  • The PR remains an open draft with the older changes-requested review. All five inline threads are resolved. Merge-tree against main e124f96 succeeded.

Validation Summary

Focused exact-head US tests passed 310 with 23 pinned-feed skips. The exact-head shared property test passed. The broader shared suite was stopped before completion, so it supplies no full-run result. Executed ordinary compile and actual national and ACS selectors, including the original cases and alternatives. Executed exact prior/current legacy bare-file loader and compiler for the separate universe-key case. Seventeen source originals were verified and the pinned IRS roster and totals reproduced. At 23:43 UTC lint, select-countries, wheels, installed-emitter and UK integration passed. CI run.

Timing

elapsed seconds: 427.28s; parallel review seconds: 304.00s; code role seconds: 181.00s; policy role seconds: 137.00s; shared code role seconds: 289.00s; consolidation cleanup seconds: 54.28s

Review Severity

REQUEST_CHANGES. Open findings: 2 critical, 2 should address, 0 suggestions.

#1760)

The fourth program review of ccdb915 (3 Dec 2026): two critical
findings and two to address.

- C4: a gap in one district file let the crosswalk fill the D.C. seat
  from another file's own state total, although that file gave the
  seat's row. The two rows of one record set added into one, so the
  seat counted twice: a D.C. district target of 40 beside a D.C. state
  target of 20. A state total now never fills the seat of a state where
  its own record set gives a district row. State targets do not change
  and still bind at their own level.
- C3: the cell key read the raw filters, so a file that stated
  income_range=all and a file that left the dimension out were two cells
  (8 and 4 at HI-01). A filter whose value restricts nothing (all, or
  empty) is no longer part of a cell.
- A3: two files of one value at a district compiled, and the local
  district nesting then refused the repeated member. The shared rule now
  gives each cell one target: two values refuse, and one value is one
  target, the one of the smallest fact id. Its metadata
  ledger_cell_also_given_by names the other facts.
- A4: a fact with no universe key is keyed by its universe domain, so a
  bare feed keeps two universes apart.

On the pinned feed the rule finds no cell of two values. Table 1.2 gives
the TY2023 national return count and adjusted gross income with the
values of Table 1.1, so those two cells keep the Table 1.1 targets: the
compile has 28,099 targets (28,101 before), and national_state has 6,197
(6,199). The pins of test_us_target_sets.py,
test_us_fiscal_target_registers.py and the fences test of
test_us_fiscal_targets.py are measured again. The local surfaces do not
move.

Tests: the shared property test now draws filters of all or none and
universes by key or by domain, and it checks which target stays. The
district property test now draws a seat row and a state total in one
file, and files that leave income_range out. The three cases of this
review are fixed examples, and each one fails on ccdb915.

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

Copy link
Copy Markdown
Collaborator Author

The fourth program review, of ccdb91550, is addressed in 339ed484f: both critical findings and both to address.

The rule. Since ccdb91550 the compile ends with a shared rule for any country and any geography level (microcosm.build.ledger_cells), in place of the district-file checks of the earlier rounds. A cell is one quantity (the Ledger concept, unit, entity, aggregation, period type, universe and each filter that restricts it) at one geography for one target period, whatever its source. The rule runs on the registry that the compile returns, after the crosswalk, the fills and every pass, so it sees what the calibration reads. Since 339ed484f it gives each cell one target: two values refuse the compile, and targets of one value are one target.

C4. Proxy gaps attached to their source. Your case reproduced: file B's gap let the crosswalk fill the D.C. seat from file A's own state total, and the crosswalk added that copy to A's own D.C. row. So A's D.C. district target was 40, beside its D.C. state target of 20. A state total now never fills the seat of a state where its own record set gives a district row. In your case A's D.C. target is 20 again, and B's Hawaii targets are 10 and 30. A source with a gap still takes the fill from the state total of a source that has no row there, as the A2 fix needs. State targets do not change, and they bind at their own level.

C3. Equivalent unrestricted filters. Reproduced: with income_range left out of one file, the two files gave 8 and 4 at HI-01, and 12 and 6 at HI-02. The cell key no longer reads a filter whose value restricts nothing (all, or empty), so the two files are one cell, as the US compile already reads them, and the case refuses.

A3. Agreeing duplicates. Targets of one cell that give one value are now one target. The target of the smallest fact id stays, so feed order does not choose, and its metadata ledger_cell_also_given_by names the other facts. So the local district nesting gets each member one time. On the pinned feed this keeps one target for each of two national cells that Table 1.1 and Table 1.2 both give with one value, the TY2023 return count and adjusted gross income: the compile has 28,099 targets (28,101 before), and national_state has 6,197 (6,199). The local surfaces do not move.

A4. Universes without a hash. A fact with no universe key is keyed by its universe domain. A bare-feed case like yours (national EITC return counts of 80 in all returns and 30 in returns with the credit, with domains and no hashes) refused as one cell on ccdb91550 and compiles as two cells now.

Tests. The two property tests of ccdb91550 now draw the new edge cases:

  • the shared test (no country) draws filters of all or none, and universes by key or by domain, and it checks which target stays;
  • the district test draws a seat row and a state total in one file, and files that leave income_range out. Your three cases of this round (C4, C3 and A3) are fixed examples, and each one fails on ccdb91550.

Checks. 2,882 US and shared tests pass, and six are skipped (they need the US engine), with the three pinned inputs and CI's fixed seed. Both pin tools, tools/ci_test_plan.py verify and ruff pass. The compiled registry of the pinned feed moves only by the two Table 1.2 copies (aged: 28,099 targets, version e630858e12b1), and the pins of test_us_target_sets.py, test_us_fiscal_target_registers.py and the fences test of test_us_fiscal_targets.py are measured again. CI on ccdb91550 passed all 12 checks.

🤖 Addressed by Claude Code

@juaristi22

Copy link
Copy Markdown
Collaborator Author

Program review

Base repository: PolicyEngine/microcosm
PR number: 1791
Reviewed head SHA: 339ed48
Merge base SHA: 23479e8
Mode: incremental from ccdb915
Scope: Ledger cell equivalence, duplicate collapse, state-total proxies, US consumers, prior findings and merge evidence
Review status: PARTIAL

Source Documents

Critical

C1 — Match published capital-gains totals by district file (RESOLVED)

Published rows and computed sums now use the same file scope for district facts. The original crosswalk-enabled reproduction now gives 10 and 30 for file B and names its own two-district sum. File A still uses its published total and gives 8 and 12. Lookup and per-file sum.

C2 — Validate district source members before translating geography (RESOLVED)

The compiler checks the roster of source cells through translation lineage, in addition to the destination roster. It refuses a repeated original district and a missing original district whose target districts are filled by another source through a split crosswalk. The same diagnostic passed complete old-plan data with D.C. seat 1198 and complete current-plan data with Microcosm's D.C. seat 1100. Roster checks.

C3 — Resolve overlapping district files before binding the same calibration targets (RESOLVED)

The ordinary compiler now refuses the original Hawaii overlaps when one district file explicitly gives income_range=all and the other omits it. It also still refuses the earlier identical-encoding case and the D.C. state-total variant after the crosswalk. Both files now share a normalized cell for the all-income aliases. The same-file latest-vintage selection regression below arises at an earlier stage. Filter normalization.

C4 — Keep single-seat proxy gaps attached to their source (RESOLVED)

RESOLVED. The exact-head check independently reran the original two-file TY2022 setup through the translator, ordinary US compiler and national full selector. With and without the redundant D.C. state total, translated D.C. lineage contains only the explicit source district, its raw count is 5, and the selected target is 20. The previous head added a proxy contribution of 5 and incorrectly selected 40. The new eligibility predicate rejects a state proxy when that fact's raw record set already supplies a district in the state. Proxy guard.

C5 — Keep an eligible state source when collapsing agreeing targets (OPEN)

CRITICAL. The compiler collapses agreeing rows before the national solve chooses its target surface. If a district-file state row wins lexically over the equivalent Historic Table 2 row, national_state then excludes it as district-file-sourced. The equal-valued HT2 row is gone. In a cross-source D.C. return count example, both compiled source targets gave 2, the exact preceding compiler's normal national_state selector retained the HT2 target at 2, and the new normal selector kept zero D.C. state targets for that quantity. Bypassing only the new collapse on the current compiler restored it. Consider surface eligibility before choosing a representative, so the district-origin exclusion and other solve filters preserve the intended calibration targets. The directly demonstrated path uses alternate input scope. Collapse before selection. Representative selection. Production surface selection.

C6 — Normalize equivalent filters before choosing the latest vintage (OPEN)

CRITICAL. The changed district property test fails on the CI-style fixed Hypothesis seed. In two minimized cases, one district file reports its D.C. capital-gains amount as explicit all-income in TY2022 and as implicit all-income in TY2023. Its earlier vintage has one observed unit and a computed denominator of 1. Its newer vintage has the same observed units and a published denominator of 2 or 1. The latest-vintage selector keys raw fact dimensions and keeps both encodings. With denominator 2, the later normalized collision check raises, although the one latest eligible target should be 400 under the Table 1.4 control of 800. With denominator 1, agreement collapses to the older computed-denominator fact, despite the newer published source. Canonicalize those dimensions in the same-file selection key before comparing source periods. Source-period selection. Raw target identity.

Should Address

A1 — Read a one-shot district crosswalk once (RESOLVED)

The compiler materializes the rows before it passes the reusable frame to the translator and the plan reader. The original iterator and list both compile to the same target names and values, 16 and 24. Crosswalk preparation.

A2 — Keep single-seat proxy detection inside each district file (RESOLVED)

The original direct D.C. row no longer suppresses the other file's state-total proxy. With unequal values, the compile refuses their D.C. cell after translation. With the other file publishing only D.C. amounts, the legacy return source retains its Hawaii and D.C. targets of 5, 15 and 20 in the actual national selector. This disposition applies to the original blocked-proxy case. Proxy scope.

A3 — Handle agreeing district duplicates before validating local nesting (STILL OPEN)

SHOULD ADDRESS. The original agreeing Hawaii targets now collapse and reach the ACS state_cd selector as two distinct districts. Selecting an allowed training block still fails in the actual ACS release loss-weight wrapper. Each child's new ledger_cell_also_given_by contains a different source fact ID. The concept-budget key treats this provenance as a modeling field and splits one training concept into two groups, which the validation rejects. Removing just that field in the diagnostic makes the same wrapper succeed, with weights 0.899 and 1.101. Preserve the source receipt and exclude the field from calibration concept identity. Concept key and metadata exclusions. Local release wrapper.

A4 — Preserve distinct Ledger universes when the hash is absent (RESOLVED)

Replayed the exact prior bare JSONL fixture through the normal loader and the current US compiler. Both national TY2024 count targets survived with their original values, 80 for all tax returns and 30 for EITC returns. The actual materializer signatures differ in the positive-EITC filter. The new universe-domain fallback gives them distinct cell keys. Universe fallback

A5 — shared-1 — Resolve mixed hash and domain encodings to the same universe (OPEN)

SHOULD ADDRESS. When two supported bare-feed records declare the same domain and one carries the universe hash, the cell key compares an opaque hash string with a domain string. The normal loader and compiler consequently retain both TY2024 country return-count targets, even though the materializer signatures coincide. Equal values of 80 and 80 bind twice. Conflicting values of 80 and 30 survive as incompatible targets. The latest test property chooses one universe representation for a whole generated dataset, so it does not reach this mixed case. Normalize compatible universe representations from their semantics before cell grouping, preserving actual domain and constraint differences. The loader's documented bare/diagnostic path permits mixed older row contracts. The supported Chronicle v4/v5 publisher schemas require hashes, so no impact on the pinned feed is established. Cell key · Bare loader contract

Suggestions

S1 — Remove stale residual-allocation claims (RESOLVED)

RESOLVED. The county population declaration and the county household guide now describe proportional division and closure within tolerance. The examples retain their original populations, weights and units. County declaration. County household guide.

S2 — Correct the mortgage-interest follow-up premise (RESOLVED)

RESOLVED. The updated PR discussion explains that IRS A19300/N19300 refers to Schedule A line 8a, which reflects applicable deductibility limits and Form 1098 reporting. It distinguishes this measure from the raw mortgage_interest input and retains the expressly deferred binding decision. The original IRS district guide and the Schedule A instructions support the correction and apply to TY2022. Author's updated discussion. District guide. Schedule A instructions, page 8.

Evidence Gaps

  • Exact-head required aggregate CI remained pending at 12:18 UTC on 4 December.
  • The requested national fit comparison on unchanged targets or an explicit deferral remains open.
  • The current UK release window remains unverified. The US targets: one declared nesting rule across national, state, district and county levels #1760 ruling bars merge between the first UK build and sign-off.
  • The independent run skipped 23 pinned-feed cases. The author's exact-head pinned-input test evidence and revised counts are recorded on the PR. Real-household calibration remains unverified.

Notes

  • The exact earlier C3/C4 and A4 examples are resolved. A3's original surface-selection crash is gone. The loss-weight wrapper still rejects the selected block when the new provenance field differs by district.
  • The author reports that two agreeing national targets are collapsed on the pin. The exact matching IRS values for AGI and return count were independently verified. The 28,099 full and 6,197 national_state counts are author-reported.
  • The PR remains an open draft with the older changes-requested review. All five inline threads are resolved. Merge-tree against current main e124f96 succeeded.

Validation Summary

Local exact-head US suite with Hypothesis seed 0 reported 309 passed, 1 failed, 23 pinned-feed skips. The failed district capital-gains property exposes the latest-vintage issue described in C6. The focused shared property test passed. Executed ordinary exact prior/current compile, actual national and ACS selectors, and the ACS loss-weight wrapper. Seventeen source originals were verified. The source review reconciled the pinned district roster and two agreeing national source rows. CI run.

Timing

elapsed seconds: 321.14s; parallel review seconds: 203.00s; code role seconds: 203.00s; policy role seconds: 104.00s; shared code role seconds: 163.00s; consolidation cleanup seconds: 56.14s

Review Severity

REQUEST_CHANGES. Open findings: 2 critical, 2 should address, 0 suggestions.

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.

Consolidate the shared target code so it serves the UK and the US

3 participants