Repository navigation
Add Table 1.4's partnership and S corporation legs - #437
Merged
Merged
Conversation
This recarves the Table 1.4 half of #180 onto main. Eight measures (returns and amounts, with net income and with net loss, for partnerships and for S corporations) read SOI Table 1.4 columns 67-74 in TY2022 and TY2023 and 55-62 in TY2021, and each build checks those column numbers. TY2020 publishes the two legs combined, so a per-measure `years` list scopes the eight measures away from it, and the TY2020 record layout keeps its hash. Microcosm's fiscal target registry already maps these measure ids to the entity leaves from PolicyEngine/microcosm#1258. #180's Form 8960 package stays on its branch: nothing in Microcosm reads it since d1472 closed PolicyEngine/microcosm#722's lane. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r1 of #437 found that a `years` list could leave out a year that `column_by_year` maps, and the build then dropped the measure at that year without an error. A measure's `years` must now cover exactly the years of every `*_by_year` map it declares, in both directions; two tests pin the two refusals. The bundle test's consumer-facts row count moves with the fact count (2,243,428), and the harness guide documents the per-measure `years` field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r2 of #437 found two gaps in the year-scope check. A `*_by_year` value that is not a map was skipped, so the build later failed with "No source artifact" and a default bundle would skip Table 1.4. An integer payload key raised AttributeError. The check now refuses the first with a named error and ignores non-string keys. A new test pins string year keys and both refusals, and the harness guide's year-scope section moves ahead of the pinned-artifact section so it no longer sits over unrelated paragraphs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#350 raised the bundle test's fact, irs_soi and tax_unit counts by 408 on the same lines this branch raises by 160. Each resolved count is main's value plus 160: fact_count and the consumer-facts row count 2,243,836, irs_soi 44,531, tax_unit 45,836. The semantic duplicate count takes main's 4,135; the eight Table 1.4 concepts appear in no other package on main, so they add none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main 5d3b0ef adds chronicle#435's Scottish second homes and chronicle#420's items 12 and 13 (2,387 facts) and build-bundle --slim. The bundle test's three fact-count pins conflicted; each resolves to main's 2,246,063 plus this branch's 160 Table 1.4 legs: 2,246,223. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
November 12, 2026 14:55
juaristi22
added a commit
that referenced
this pull request
Nov 12, 2026
Brings in #437, Table 1.4's partnership and S corporation legs. The one conflict is the bundle test's fact count, which both changes move: 2,246,063 plus #437's 160 SOI facts and #438's 66,230 is 2,312,453. Each side's other pins are untouched by the other and kept as they are. 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.
Recarves the Table 1.4 half of #180 onto current main, so Microcosm's partnership and S corporation targets have facts to bind to.
Why
PolicyEngine/microcosm#1258 split the PUF donor's Schedule E line 32 into partnership and S corporation leaves (merged as PolicyEngine/microcosm#1261 under d2183). Microcosm's fiscal target registry already maps
partnership_net_income_amount,partnership_net_loss_amount,s_corporation_net_income_amount,s_corporation_net_loss_amountand all four returns ids to those leaves (packages/microcosm-build/src/microcosm/build/us_runtime/fiscal_targets.py:187-190, 271-274on Microcosm main). Chronicle main declares none of these measure ids, so those targets can't bind; d1489 recorded that the entity legs bind once these facts land.What changes
packages/irs_soi/table_1_4/source_package.yaml: eight measures (returns and amounts, with net income and with net loss, for partnerships and for S corporations), ordinals 29-36, reading columns 67-74 in TY2022 and TY2023 and 55-62 in TY2021. Each build checks the column numbers against the workbook's numbered header row. The package label now reads "income items by AGI class".chronicle/source_package.py: a measure may declareyears. TY2020 publishes the two legs combined, so the eight measures skip it. The loader refuses an empty, non-integer or repeated year list, and any*_by_yearmap (column_by_year,expected_column_header_by_year) whose years differ fromyearsin either direction, so a year added to the maps alone can't drop a measure without an error.docs/agent-source-package-harness.mddocuments the per-measureyearsfield.years, a missing header-map year, and string year keys with non-map values); two new property tests (year-scope membership and range sums); and recounted Table 1.4, suite and bundle totals.#180's Form 8960 package stays on its branch: nothing in Microcosm reads it since d1472 closed PolicyEngine/microcosm#722's lane. #180 closes as superseded when this merges.
Invariants
yearswhilecolumn_by_yearstill maps it, or dropping 2022 from the header map, refuses the build. With the reverse check deleted, the first test fails.yearsapplies exactly to the listed years, and a measure without it applies to every year. The test checks every non-empty subset of 2020-2024 against every year from 2019 to 2025.22ed3e367531f2331f744623, the value on main.expected column header 66, got 67.Verification
Direct calls on a tree built from main plus this change, without pytest's runner (the build host holds pytest while free disk sits under 45 GB):
years, a missing header-map year), the string-key test, the membership property, the range sums for three years, the Table 1.4 facts test, the SOI targets test and the Table 1.4 suite test.tax_unitatcountry:0100000US. The suite reports 1,332 constraints (1,044 on main), with 8 concept alignments and 2,460 covered cells unchanged.ruff checkpasses on every changed file.ruff format --checkpasses on the test files;chronicle/source_package.pyalready needs formatting on main.CI is the first run of
tests/test_chronicle_bundle.py. The PR raises its counts by 160 (fact count, consumer-facts row count,irs_soi,tax_year:2023,country:0100000US,tax_unit), the size of the TY2023 package build above. The bundle builds every source at 2023 only, and the eight new concepts appear nowhere else in Chronicle, so the semantic duplicate count stays at main's 4,135.Commit 17a8978 merges main, where #350 raised four of those counts (fact count, consumer-facts rows,
irs_soi,tax_unit) by 408. Each resolved count is main's value plus 160 (fact count and consumer-facts rows 2,243,836,irs_soi44,531,tax_unit45,836). The 17 direct calls pass again on the merged tree, andruff checkpasses with the repo's rules.Review
Review r1 (an independent Opus 5.5 agent, at 3eb9eca) asked for changes. It found one blocker: the bundle test's consumer-facts row count stayed at 2,243,268. It found one should-fix: a
yearslist could leave out a year its maps cover and drop the measure silently. And it found four nits: the header-map years went unchecked, the Microcosm line numbers were off, the harness guide didn't documentyears, and (optional) the new amount measures carry no concept-alignment fields. Commit 1b8bb0f fixes the blocker, the should-fix and the header-map and guide nits, and this body corrects the line numbers. Its read of the workbooks confirms each column's header in TY2021-2023, that TY2020 has only the combined "Partnership and S corporation" column, and that the TY2021 and TY2022 all-returns facts equal their cells (× 1,000 for the four amount measures). The concept-alignment fields stay off the new amount measures: they are optional, seven Table 1.4 amount measures on main also lack them, and Microcosm binds on the measure id.Review r2 (the same agent, at 1b8bb0f) approved with nits. It reran every r1 case and found each fix in place (the concept-alignment fields stay off, as agreed), and it checked all 480 new TY2021-2023 facts against their cells and header numbers with no mismatch. It found two remaining gaps: a non-map
*_by_yearvalue went unchecked, and an integer payload key raised AttributeError. Commit b2eb2bc fixes both and adds a test that pins string year keys, which kills the one mutant r2 found surviving.Review r3 (the same agent, at b2eb2bc) approved with nits. It ran both fixes: a list where a map belongs now refuses with a named error, so a default bundle fails loudly instead of skipping Table 1.4, and an integer payload key no longer raises. Every mutant aimed at the fixes fails the new test, all 17 direct calls pass, and ruff passes. Its three nits were wording in this body (the × 1,000 scope, the Tests bullet and the Verification count), and this body fixes all three.
Review r4 (the same agent, at 17a8978) approved the merge. Each resolved count matches main plus this PR's 160, no hunk from either side went missing,
chronicle/source_package.pystays byte-identical to b2eb2bc, and #333's source-table-year test doesn't cover Table 1.4, whose title names no tax year. It reran the 17 direct calls andruff checkon the merged tree.Downstream
Microcosm reads these facts only after its pinned feed moves. The next feed rebuild (the one that carries #434's SSI tables into PolicyEngine/microcosm#1573) should include this. That rebuild changes Microcosm's target set, so it goes through d2680's rule or the d2603 build's receipt.
🤖 Generated with Claude Code