Repository navigation
Conversation
Each chunk's frame carries only the columns its rows' idtl levels ask for, and pd.concat keeps columns in order of first appearance. So a column's position depended on which chunk first carried it: a 2021 idtl=0 record followed by a 2022 idtl=2 record put frate in column 8, and the reverse put it in column 40. run() now reorders the joined frame to one canonical order: the identifiers, the implemented columns in mapping order, then the marginal rates. That is the order a single-idtl batch already has, so those batches are unchanged. Refs #1426 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Hypothesis properties of the ordering: same columns back, known ones in canonical order, unknown ones after in arrival order, values kept under their names; and one layout whichever chunk comes first. - run() applies the ordering to what the simulation pass returns. - Real runs: the two mixed batches from #1426 get the full-detail layout, each record's values match the full batch column by column, and batches with a single idtl level (0, 2, 5) are unchanged from the frame _run_once produced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
October 12, 2026 00:11
- Say "relative order" rather than "position": which columns appear still depends on what the batch asks for. - Qualify "single-idtl batches keep their layout" to batches whose chunks carry the same columns. A year whose taxsimid values are all blank dropped that column, and pd.concat then put it last; it now comes first. Test that case with the layout _run_once returned for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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
Fixes #1426. The order of columns in
PolicyEngineRunneroutput depended on what else was in the batch. The same two records putfratein column 8 or column 40, depending only on which tax year carriedidtl=0.The runner simulates one tax year at a time. Each chunk's frame carries only the columns its rows'
idtllevels ask for, and the chunks are joined withpd.concat, which keeps columns in order of first appearance. A chunk that asks only for the standard columns putsfrate, srateahead of the full-detail columns a later chunk adds.Change
run()now puts the joined frame in one canonical order: the three identifiers, the implemented columns in the order of thepolicyengine_to_taxsimmapping, then the marginal rates. The order is derived from the mapping, not listed by hand.That is the order a batch already had when all its chunks carried the same columns, so batches with a single
idtllevel normally keep their layout. Which columns appear still depends on what the batch asks for; their relative order no longer does. Per decision d1312 this keeps the runner's current layout and does not move to TAXSIM's header order.What changes for users: only batches whose chunks carry different column sets. In practice that is batches that mix
idtllevels across tax years, which now get the same layout as a full-detail batch, and the rare batch where one year'staxsimidvalues are all blank, which used to puttaxsimidlast and now puts it first. Values are unchanged.The ordering is applied where
run()returns, not at thepd.concatlines, to stay clear of #1406 and #1423, which edit those lines.Invariants
idtlbatches unless one year's IDs are all blank.Invariants 1, 3 and 4 have Hypothesis property tests on the ordering function. Invariants 1, 2 and 3 are also checked on real runs.
Verification
Run on this branch (base
mainat 72fdc04), macOS, with the 11 tests intests/test_output_column_layout.py.mainat be55c81)run()wiring test and the mixed-batch layout test. The single-idtland value tests pass, as they shouldruff format --check .The real-run tests take each batch's frame from
_run_once, before ordering, and compare it with the ordered frame. So "unchanged" is measured against what the runner produced before this change, foridtl0, 2 and 5. The two mixed batches are the ones from #1426. The no-op run used a copy of the package onPYTHONPATH; the branch itself was not edited.Review
An independent review (GPT-6.1 Sol) approved with no blocking findings. It ran the tests, confirmed the no-op version fails them, and found one case the "unchanged" claim missed: a year whose
taxsimidvalues are all blank. The third commit qualifies the claim, rewords "position" as "relative order", and tests that case. It found no positional use of runner columns inpolicyengine_taxsim/,tests/,r-package/ordashboard/.Not covered
StitchedRunnersends pre-2021 rows to the TAXSIM binary. A batch with only such rows comes back in TAXSIM's own layout; a batch that also has later years uses PolicyEngine's layout with the TAXSIM-only columns after it. That difference stays, since d1312 keeps each current layout.RemoteTaxsimRunnerover 2,000 rows. It joins 2,000-row batches the same way (remote_taxsim_runner.pyline 216). I read that code but did not run it against the service; tracked separately in RemoteTaxsimRunner: column positions may depend on batch order for inputs over 2,000 rows #1439.axiom: n/a: emulator output layout, no policy change
🤖 Generated with Claude Code