Repository navigation
Read the SIPP 2023 person file once for the US release's five donor tables - #1686
Merged
Merged
Conversation
The US release tool hashed and parsed the 3.73 GB SIPP 2023 file once per donor table. It now reads it once: the file is tokenized with low_memory=True, keeping only the columns the five donors use, and that narrow table is parsed over whole chunks, so column types match a direct parse. Each stage builds its donor from the December rows, which are freed after the last SIPP stage. The vehicle and voluntary-filing donors, whose own reads used low_memory=True, refuse columns those parser blocks could have converted differently. The read refuses files with bare carriage returns or a first row longer than the header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
The new sipp_december_person_rows.py module was missing from the reviewed list of US runtime modules, so the classification test failed. It reads the SIPP person file for the five donor builders and treats no population, so it joins the non-registry modules. The multi-spine pool tool now reaches it through sipp_financial_assets.py, so its pinned runtime import graph grows from 86 to 87 modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The transport validation checks registered in TRANSPORT_GATE_REGISTRY import the us_runtime package, which now reaches sipp_december_person_rows through the five SIPP donor modules. The test that counts the modules those checks import found 247 instead of 246, so the module joins BINDING_MODULES_ADDED_AFTER_BASE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only conflicts were the seed-protocol and spec digests, which main moved for the in-place QRF leaf array and this branch moved for the SIPP modules. They were regenerated from the merged source with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's per-target QRF fit and draw (#1667) moved the same seed-protocol and spec digests as this branch. They were regenerated from the merged source with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
juaristi22
reviewed
Nov 24, 2026
juaristi22
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at 50d70c9c7. The shared read reproduces each old loader's parse, so the saving (peak memory from 6.3 GB to 1.2 GB, read time from 98 s to 21 s) comes with no output change. Two things before merge, and two notes.
What I checked
- On
main, all five loaders read 100,000-row chunks (none of_main's calls overrode the default), the financial-asset donor readSSUIDwithdtype="string", Head Start and SSI parsed withlow_memory=False, and vehicles and voluntary filing withlow_memory=True. Each new builder askssource_tablefor exactly that:ssuid_as_text,include_chunks_without_december_rowsfor Head Start, andread_in_parser_blocksfor the twolow_memory=Truedonors. - The refusal for those two donors is sound: a whole-chunk
int64orboolcolumn parses the same in every block, and afloat64column does when its integer cells have at most 15 digits and no negative zero; every other column is refused. - The SSI path loader that the ACS local build keeps goes through the same read with only its own columns. It infers the same types, because each column's type comes from its own cells.
- The sixth SIPP read in
_main,load_sipp_2023_tip_donor, reads a different file (SHA-2561f0bcb8e…), so the person file is now read once.
Before merge
- Let the engine-free jobs finish.
- This, #1697 and #1683 all edit
tools/build_us_fiscal_refresh_release.py, and this, #1683 and #1684 all move the US seed-protocol pins, so whichever merges later resolves the text and re-runs the repin tools.
Notes
- The 100,000-row chunk is now part of the equivalence: the tests prove it at matching chunk sizes, and
_mainrelies on the default matching the old loaders'. A named constant, or a test that the default stays 100,000, would stop a later memory tweak from changing inferred types. - I couldn't rerun the real-file comparison, because the SIPP file isn't on this machine; it rests on your run and the invented-file tests.
Checked
- 1,452 of 1,460 tests on the touched surface pass locally (macOS arm64, Python 3.14), including the 120 in
test_us_sipp_december_person_rows.py, the five donors' tests, the SSI and ACS loader tests and the re-pinned digest tests; the 8 skips need the US engine or the pinned Chronicle feed.
The equivalence with the old per-donor loaders holds only at matching chunk sizes, because column types are inferred per chunk, and the release tool and the ACS local-area build rely on the default. Fails until the constant exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SIPP_PERSON_FILE_CHUNK_ROWS (100,000) is now the default chunk size of read_sipp_december_person_rows and load_sipp_2023_ssi_disability_donor. Column types are inferred per chunk, and the old per-donor loaders all read 100,000-row chunks, so the donor tables equal theirs only at this size. Addresses the chunk-size note in the review of #1686. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's QRF prediction worker count (#1684) moved the same seed-protocol and spec digests as this branch. They were regenerated from the merged source with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's table operations through adopt (#1683) and build-tool thread settings (#1696) moved the same seed-protocol and spec digests as this branch. They were regenerated from the merged source with tools/repin_us_spec_engine_contracts.py, tools/generate_us_bundle_from_constants.py and tools/spec_engine_coverage.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's #1697 loads each donor table inside its stage's call, so no local keeps it. This branch builds the five SIPP donors inline from the shared December rows, so the merged _main keeps both: the SCF donor loaded inline, the shared read once, and each SIPP donor built in its stage's call. #1697's test_main_passes_each_donor_table_straight_into_its_stage now covers the five build_sipp_2023_*_donor calls in place of the removed loaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@juaristi22 thanks for the review. All four points are addressed at Before merge
Notes
🤖 Generated with Claude Code |
juaristi22
added a commit
that referenced
this pull request
Nov 25, 2026
…he SPI forest release and the shared SIPP read (#931) Main took seven pull requests since cac12ab: #1724 (each kernel reads read-only views of its inputs instead of a deep copy), #1690 (the SPI stage-2 forests freed before each later fit), #1686 (the SIPP person file read once for its five donor tables), #1697 (release tools free large objects after their last use), #1726 (a shared worker pool), #1660 (the County Files ACS donor patch) and #1707 (New Zealand's geography layer labels). No feed or engine pin moves, so no file is re-pinned. Four files conflicted, all pins that both sides moved: the US spec-engine seed map and seed protocol, the UK loader and US spec pins, and the US F0 coverage report. Each is computed on the merged tree, and the coverage report is regenerated (--check passes; 41/41 inventory checks). Two of main's new tests needed this branch's code reviewed. - #1724's scan for writes into shared buffers finds np.add.at in two weight folds of the identity tool: _pre_split_household_weights, which this branch changed, and _pre_high_value_household_weights, which it added. Both write into the copy of the household weights that _pre_residential_household_weights makes and _pre_clone_fold and the folds pass along, so both findings are reviewed with their digests, and the helpers the reasons rest on take theirs, _pre_clone_fold included. - #1690's SPI forest-release test froze origin/main's SPI output and receipts; this branch's keyed draws move them, as the test foresees. The macOS arm64 digests are recorded from this code. Linux x86_64's need a recording under Docker, which this machine lacks, so those two tests skip there and the same-run checks still run. The owner-manager rule rewrites owned_company_carries_on_property_business after the draw, as it does the trade flag, and on the synthetic fixture's draws it moves one drawn person, so the flag joins the targets rewritten after the draw. Checks: main's changed tests, the pin tests and the kernel-binding test pass (1,931, then the shared-buffer scan's 99 and the SPI forest-release test's 48 after the two reviews), and so does the H2 clone-first test at one and four clones (34). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The US release tool hashed and parsed the 3.73 GB SIPP 2023 file once for each of five donor tables. It now reads the file once, and each stage builds its donor table from the shared December rows.
read_sipp_december_person_rows(new modulesipp_december_person_rows.py) reads the union of the five donors' columns (99 columns).build_sipp_2023_{financial_asset,ssi_disability,head_start,vehicle,voluntary_filing}_donorreplace the per-donor path loaders.load_sipp_2023_ssi_disability_donorstays because the ACS local-area build calls it with a path._mainfrees the December rows after the voluntary-filing stage and keeps no donor table in a local variable. The aliassipp_vehicle_donor_pathis gone.How the read keeps each donor's table
The old loaders did not parse the file the same way, so the read works in two steps per 100,000-row chunk:
low_memory=True, keeping the requested columns as unconverted text.low_memory=False, so each column's type is inferred over the whole chunk from the same tokens as a direct parse.The chunk size is
SIPP_PERSON_FILE_CHUNK_ROWS(100,000), the default of bothread_sipp_december_person_rowsandload_sipp_2023_ssi_disability_donor. Column types are inferred per chunk and the old loaders all read 100,000-row chunks, so the donor tables match theirs only at this size; a test pins it.The remaining differences between the old reads are kept explicitly:
SSUIDas text. The other four get the inferred type.low_memory=True. They now refuse a column whose values that parse could have converted differently: text in a column, an integer cell of more than 15 digits, or a negative zero in afloat64column. This refusal is deliberately broader than the cases that actually differ.SSUIDof 309 or more digits used to be read as text by the financial-asset loader, while the other four loaders raisedOverflowError. The shared read now raises thatOverflowErrorfor all five. RealSSUIDvalues have 12 digits.The read also refuses a file with a carriage return outside a CRLF pair, or a first row longer than the header, because pandas' row splitting for those files depends on how they are read.
Evidence that outputs are unchanged
SSUIDvalues, blank cells, non-December rows and chunks without December rows. Comparison covers values by bytes, dtypes, column order, row order, index and.attrs.pu2023.csvat the pinned revision (3,726,010,471 bytes, SHA-2565c30439e…33ee2), all five donor tables from the origin/main loaders and from this branch are identical: values by bytes, dtypes, column order, row order, index and.attrs. The shapes are 20,000 × 20 (financial assets), 9,346 × 21 (SSI), 785 × 8 (Head Start), 16,841 × 21 (vehicles) and 22,296 × 8 (voluntary filing).The two
test_cached_full_donor_*tests pass against the real file. The pinned Head Start and SSI source audits, which run when the file matches the pins, also held in the real-file run.Memory and time
Measured on a 32 GB Mac without the US engine installed. With the engine, the SSI donor build also constructs a tax-benefit system, as its loader did before.
On the real file, the December rows of the 99 requested columns hold 31.3 MB (39,513 rows).
Retention choice. I compared keeping the December rows until the last SIPP stage with building all five donors immediately and keeping those:
Peak and between-stage RSS overlap, and the table difference is about 25 MB. I kept the December rows because each donor's build and any failure stay in that donor's own stage.
Memory held after the read. RSS stays about 0.5–0.7 GB above its pre-read level after the read, although only 32 MB of tables are live. In the origin/main run, RSS during the last two loaders peaked within about 0.1 GB of the level after imports. This is memory the allocator has not returned to the system. I measured it on macOS only, so whether it adds to later stages on the Linux build machines is not known.
Stage timing changes
scf_wealth_inputsstage reported bytelemetry.stage(...). The SSI, Head Start, vehicle and voluntary-filing stages only build their tables.scf_wealth_inputsinstead of at the first stage that needed it.fetch_sipp_2023_financial_asset_donorand once in the read, instead of six times.Other notes
sipp_financial_assets.py,sipp_vehicles.pyandssi_disability_criteria.pymoves the seed-protocol source digests, so the second commit re-pins them withtools/repin_us_spec_engine_contracts.py,tools/generate_us_bundle_from_constants.pyandtools/spec_engine_coverage.py._maincall sites as the change that frees release objects after their last use, so whichever merges second resolves that text conflict.Tests
Run individually by node ID: all of
test_us_sipp_december_person_rows.py, the migrated donor tests, the SSI and ACS loader tests,test_main_writes_diagnostics_before_post_calibration_gate_failurein every mode, the re-pinned digest tests, and the module classification and pool import-graph tests intest_us_spine_blindness.py, andtest_the_batterys_binding_identity_adds_only_the_leaf_and_its_importsintest_transport_evidence_kernels.py, which now listsipp_december_person_rows. The twotest_cached_full_donor_*tests pass against the real file.🤖 Generated with Claude Code