Skip to content

Read Schedule E line 32 as a pre-split reference does in the US input-mass gate - #1532

Merged
MaxGhenis merged 7 commits into
mainfrom
us-input-mass-line-32-pre-split
Nov 13, 2026
Merged

MaxGhenis merged 7 commits into
mainfrom
us-input-mass-line-32-pre-split

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The US input-mass gate compares partnership_income alone with its reference, and a reference from before #1261 holds partnership and S corporation income together in that column. A build that keeps that income can still fail the gate once the split leaves too little of it in partnership_income. The --allow-input-mass-drift flag gets such a build through by turning the gate off for every column.

For example, this gate failed the release attempt at 9434c50 against populace_us_2024.h5, which holds $847.756B in partnership_income and no s_corp_income record. The export held $391.947B in partnership_income, 53.8% short of the reference, and $664.150B in s_corp_income, so the two columns together exceeded it by 24.6%. That file dates from July, before #1251 added passive income to the column, so the excess may include that addition. Calibration brought the line's positive amounts to $1,147.2B against SOI's $1,157.6B target, while this gate sums signed amounts; #1228 tracks that difference.

What changes

us_line_32_on_reference_terms counts both columns as the candidate's partnership_income when no reference record holds an s_corp_income amount, or the reference lacks the column. Any reference record that holds one marks the split, even when those amounts cancel to a zero total, and the gate then compares each column alone. So the rule ends once a reference carries the split, with no register entry to lift. A weighted total can't tell records that cancel from no records, so us_line_32_carriers reads whether records hold each column, from the frames whose totals the gate compares.

The rule counts both of the candidate's columns only when one of its records with nonzero weight holds partnership_income. Counting S corporation income for a candidate without one would pass a build that lost the whole column, since $664.150B alone falls 21.7% short of this reference, inside the ±50% band. Weighted records that hold partnership income count however their amounts net, so when they cancel, the gate compares the combined line. The helper raises when a nonzero total has no carrier, because the carriers must then come from other frames than the totals did.

The release's base and export gates and the L0 refit export now run through us_input_mass_parity_gate, which takes the carriers. Its details add partnership_income_counts whenever the rule counts both columns, so a receipt's drift under that name says what it measures. The dry-run and preflight checks read the base frame the same way, and the preflight's details name both columns too.

This changes which builds pass the gate and moves no target or weight. A build at 9434c50 keeps the old comparison.

Limits

Against a reference without the split, the gate reads only the total, so it can't catch a wrong division between the columns. For example, −$1,000B in partnership_income and $1,900B in s_corp_income pass. No calibration target binds the division either until PolicyEngine/chronicle#180 publishes SOI's Table 1.4 entity legs, and the attempt at 9434c50 carried only combined partnership and S corporation rows.

The dry run reads partnership_income as at risk, rather than certain to fail, in two cases where the gate refuses it at base weights. In one, every partnership record has an opposite S corporation record; in the other, only records at zero base weight hold partnership income. In a release, the dense solve caps each weight at five times its starting weight (the builder's default --max-weight-ratio), so it keeps those records at zero, and the L0 refit drops them. An uncapped solve from a positive warm start can give them weight. Tests pin both readings, and the gate still refuses the first at export.

Invariants

Hypothesis tests in test_us_input_mass_line_32.py check these across inputs:

  • Only partnership_income moves, only when a candidate record with nonzero weight holds partnership_income and no reference record holds s_corp_income, and the helper leaves its input unchanged.
  • The gate finds no drift when it compares a frame with itself, with or without a floor, across zero weights, missing amounts and records that cancel.
  • The carriers match a record-by-record reading of the frames, and a frame's carriers never contradict its totals.
  • Against a pre-split reference, moving signed income between the two columns never changes the gate's verdict while a weighted record holds partnership income.
  • The dry-run preview refuses partnership_income when the gate does, and only then.

Example tests cover each refusal, records that cancel on either side at two scales, and carriers that contradict the totals. They also pin both errors the preview raises when it disagrees with the gate, and the frames each caller reads the carriers from.

Status

WIP. An independent reviewer reads this next, and the PR leaves draft once they agree at the final head.

🤖 Generated with Claude Code

MaxGhenis and others added 7 commits November 6, 2026 05:08
…-mass gate

The gate compares partnership_income alone with its reference. #1261 split the
line between partnership_income and s_corp_income, but populace_us_2024.h5
predates the split and holds the whole line in partnership_income. The release
attempt at 9434c50 stopped on this comparison, with partnership_income 53.8%
short of the reference while the two columns together exceeded it by 24.6%.

Against a reference with no s_corp_income mass above the gate's floor, the
candidate's partnership_income now counts both columns. The release's base and
export gates, the dry-run preview and the L0 refit export share the rule. A
reference that carries the split gets each column compared alone.

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

The preflight's export-mass check ran the gate's band math on the pool's
partnership_income alone, so against a pre-split reference it flagged a pool the
gate would pass. It now calls the same rule as the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comparing the reference's s_corp_income with the gate's floor read a small split as no split, so a frame with small columns could fail against itself. Counting S corporation income for a candidate with no partnership_income mass could pass a build that lost the whole column. The rule now applies only when the reference's s_corp_income total equals zero or the reference lacks the column, and the candidate's partnership_income total differs from zero.

The base gate, the export gate and the L0 refit export now run through us_input_mass_parity_gate, whose details name both columns when the rule moves the total. The docstring, README and changelog now say that a reference from before #1251 holds only the nonpassive part of this income.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A weighted total can't tell records that cancel from no records, so the
line 32 rule now reads carriers. Any reference record that holds an
s_corp_income amount, at any weight, marks the split, and the gate then
compares each column alone. The candidate counts both columns only when a
record with nonzero weight holds partnership_income, so records without
weight can't let S corporation income stand in for lost partnership mass.
Carriers that contradict a nonzero total raise.

The release base and export gates, the L0 export, the preflight and the dry
run preview read carriers from the frames whose totals they compare, and the
preflight's details name both columns when it counts them together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The #327 export-gate tests pass stand-in frames that only the patched totals
read. The gate now also reads line 32 carriers from those frames, so each test
patches the carriers reader to check it gets the export and the reference the
totals use: the base when no reference frame is given, otherwise the
certified reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release's dense solve caps each weight at five times its starting
weight, which keeps records at zero base weight at zero, and the L0 refit
drops them. Only an uncapped solve from a positive warm start can give
those records weight. Comment only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 13, 2026 11:59
@MaxGhenis MaxGhenis closed this Nov 13, 2026
@MaxGhenis MaxGhenis reopened this Nov 13, 2026
@MaxGhenis
MaxGhenis merged commit 1e88319 into main Nov 13, 2026
22 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

CI passed at 31b7124 (run 43421622977: all 11 jobs pass or skip, on a merge ref with main at 7b93dae; main's one later commit touches none of this PR's files). The independent review approved 3dbc840 and asked for one documentation change. 31b7124 makes it in a test comment, and the description's limits paragraph says the same. No code changed after the approval.

@MaxGhenis
MaxGhenis deleted the us-input-mass-line-32-pre-split branch November 13, 2026 14:03
MaxGhenis added a commit that referenced this pull request Nov 13, 2026
Merge main at 1e88319 (#1532), 1,016
commits past the merge base 3293730. Main has no commit on solve.py, the
calibrate tests, the cap-step fixture or the exact-cap evidence, so the
branch's 18 files that only it changed keep their bytes from 47c0625.
docs/calibration-l2-basis.md, the experiment README and sweep.py,
test_us_acs_local_release_tool.py and tools/build_us_acs_local_release.py
merged on their own and carry the branch's edits unchanged.

Five files conflicted. All five hold digests that a tool recomputes. Each
was resolved by taking main's side and then running the tool:
- docs/evidence/spec-engine/us-f0-coverage.json: main's side, rewritten
  by tools/spec_engine_coverage.py.
- packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py:
  main's EXPECTED_HASHES (source_manifest dc387988 kept), the branch's
  microcosm#1096 comment restored after main's last comment line, then
  seed_map and seed_protocol re-pinned by
  tools/repin_us_spec_engine_contracts.py.
- packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py:
  main's golden and comment lines, the branch's microcosm#1096 line
  restored, then the golden re-pinned by the same repinner.
- packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py:
  main's spec_sha256 and comment lines, the branch's microcosm#1096 line
  restored, then spec_sha256 re-pinned by the same repinner.
- packages/microcosm-graph/tests/fixtures/parity/kernels/calibrate/pins.json:
  main's side, then re-pinned by tools/graph_parity_repin.py calibrate.

Pins that moved, and the tool that wrote each:
- EXPECTED_HASHES seed_map bcb012ed -> d216f75c and seed_protocol
  e1f88676 -> 2316aa41: tools/repin_us_spec_engine_contracts.py.
- Minimal-loader golden spec_sha256 d5c303a4 -> eeba65f7: the same tool.
- US multispine spec_sha256 3dabec5c -> c15471ae: the same tool.
- us-f0-coverage.json, two map_sha256, two protocol_sha256 and two
  implementation_sha256 to the seed values above, and two spec_sha256 to
  c15471ae: tools/spec_engine_coverage.py (42394/42394 configuration
  fields; 41/41 inventory checks).
- calibrate.adam@1 implementation_hash f6554bfe -> 19806a72 and node_key
  b6020102 -> c767438d on arm64/darwin/py3.14:
  tools/graph_parity_repin.py calibrate. direct.csv did not move.

The repinner and the coverage tool each ran twice. The first repinner
pass read stale pins and wrote covered_item_count 40 into
test_spec_engine_coverage_tool.py; the second pass, after the coverage
report was regenerated, restored 41, so that file equals main's. Both
tools then passed --check. ruff format on the three repinned .py files
changed the repinner's single quotes to double quotes and nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 13, 2026
Brings in main at 1e88319 (1,023 commits
since the merge base 3a9c808). Seven files conflicted:

- us_annual_static_aging.py: the module docstring. Kept both paragraphs:
  the branch's flag requirement, then main's dataset names (#1570).
- docs/us-annual-static-aging.md: the manifest `base` bullet. Took main's
  wording (base build ID `parent_release`) and appended the branch's
  `local_jurisdiction_flags` receipt clause.
- us_runtime/l0_refit_export.py: the import block. Main's #1532 widened the
  input_mass import (us_input_mass_parity_gate, us_line_32_carriers); the
  branch added the local_jurisdictions import beside it. Kept both; the
  function bodies merged cleanly, so the export re-derives the flags and
  then runs main's Schedule E line 32 input-mass gate.
- spec_engine/inventory_coverage.py, docs/evidence/spec-engine/
  us-f0-coverage.json, tests/engine_free/shared/test_spec_engine_loader.py
  and tests/engine_workflow/us/test_us_multispine_pool_tool.py: every hunk
  is a digest that a tool computes. Took main's side and kept the branch's
  comment sentences naming #1444 and #1453 above seed_map. Neither side's
  seed and spec digests are right for the merged tree; a later commit
  recomputes them with tools/repin_us_spec_engine_contracts.py and
  tools/spec_engine_coverage.py.

Known red until the following commits: the transport binding-identity
count (B1) and the digests above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 13, 2026
…and #1600

Main gained #1588, #1285, #1582, #1532 and #1600 since the last merge
(c93419c). One file conflicts, tools/build_us_fiscal_refresh_release.py,
in its import block: #1532 widened the input_mass import to four names,
right below this branch's immigration import. The merge keeps both.

No function is changed by both sides in that tool or in
test_us_fiscal_refresh_builder.py (syntax-tree comparison against the merge
base), and each side's changed functions carry over whole. Neither
tools/repin_us_spec_engine_contracts.py --check nor
tools/spec_engine_coverage.py --check moves a pin on the merged tree.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 13, 2026
Main gained #1582, #1532 and #1600 since this branch's base 7b93dae. Git
merges them without conflict: README.md, docs/agent-guide.md,
release_publication.py and test_uk_release_publication.py change on both
sides in separate hunks.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant