Repository navigation
Drop the report columns API v1 removes from sim's table models - #1111
Merged
Merged
Conversation
API v1's revision 4e30076d4b9f drops reports.label, description and user_id, report_runs.trigger and its four cliff columns, and budget_window_runs.trigger, with the foreign key, index and check on them. The models still map all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Report loses label, description and user_id, with its key to users and that column's index. ReportRun loses trigger and its four cliff columns, with their check. BudgetWindowRun loses trigger. ReportRunTrigger and ReferencedUser have no other use, so they go too. No statement named these columns already, apart from the models themselves, so the models work on a database that still has them, where new rows leave them null, and on one without them. The test fixtures stop writing them so they run against both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixture selected every column the model maps, so it would fail on a database without one of them, whichever release it tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_tables counted eight enum columns, two of them the trigger columns. test_mapped_classes repeated the foreign key total test_tables already checks along with the keys themselves, so it no longer states one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two completion tests lost what they checked when the report run's cliff columns went, so they now check that no cliff_impacts row appears. Also drop two names that came from the removed trigger values and the remaining notes that shared rows hold no label, user or trigger, which no longer describe any column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no cliff_impacts row seeded, the two completion tests could not see an update of one, and the Modal worker role can't insert one. They now seed a pending result for each side and check it stays unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
v2plan/c1-42-drop-report-columns
branch
from
November 24, 2026 20:30
decbea8 to
8d220f9
Compare
#1099 rewrote three passages beside C1 · 42's removals: the Stage 12 worker document's cliff paragraph, KeyedEconomyReport's docstring and the entry project's re-run section. Each keeps #1099's include_cliffs text and drops the sentences about the per-user and cliff columns API v1 removes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
public-api-commit moves from d2b5dc31 to 825a9b3c9, API v1's merge of PolicyEngine/policyengine-api#4335 (C1 · 41). Its revision 4e30076d4b9f drops reports.label, description and user_id, report_runs.trigger and its four cliff columns, and budget_window_runs.trigger, with their foreign key, index and check, none of which sim's models declare any more. Its privilege manifest no longer grants updates of the four cliff columns. The `Public API schema` job's comparison now builds those tables without them, so test_the_models_match_the_public_api_tables can pass. The commit also contains PolicyEngine/policyengine-api#4329 and #4333, which change no table or grant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1099 added test_a_request_losing_the_report_run_adds_the_winners_runs_calculations on main, and it inserts a competing report run with trigger="initial". The merge of main into this branch kept it, but ReportRun no longer maps trigger, which API v1 drops, so the insert failed to compile ("Unconsumed column names: trigger") and failed the Public API schema job. The insert now leaves the column out, as every other report run insert does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
marked this pull request as ready for review
November 25, 2026 18:27
anth-volk
added a commit
that referenced
this pull request
Nov 25, 2026
main now pins API v1's merge of the report column drops (825a9b3c), and its table models drop the columns C1 · 41 drops. Nothing conflicted. 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.
Fixes #1110
Sim's mapped classes of
reports,report_runsandbudget_window_runsno longer declare the nine columns that API v1's revision4e30076d4b9fdrops (PolicyEngine/policyengine-api#4335, C1 · 41), or the foreign key, index and check constraint it drops with them.public-api-commitmoves to825a9b3c9, API v1's merge of #4335.Follows #1096 (C1 · 38), merged as
770091fc, which stops the v2 runtime writingreport_runs' four cliff columns.What changed
Reportno longer declareslabel,description,user_id,fk_reports_user_id_usersorix_reports_user_id.ReportRunno longer declarestrigger,baseline_cliff_gap,baseline_cliff_share,reform_cliff_gap,reform_cliff_shareorck_report_runs_cliff_impact_complete.BudgetWindowRunno longer declarestrigger.recalculatestays.ReportRunTrigger, the enum of the twotriggercolumns, andReferencedUser, the model ofusersthat onlyreports.user_idreferenced, had no other use, so they are removed with their exports. Sim's foreign keys to API v1's tables go from 20 to 19, and its enum columns from 8 to 6.test_a_model_maps_none_of_the_columns_api_v1_dropsandtest_a_model_declares_no_constraint_or_index_api_v1_drops, fail if any of them returns.c1-42-drop-report-columns.removed.md.libs/policyengine-simulation-persistence/public-api-commitmoves fromd2b5dc310to825a9b3c9, API v1's merge of Drop the per-user and cliff columns from v2 report rows policyengine-api#4335. That commit also contains #4329 and #4333, which change no table or grant.With #1096, no statement names these columns, and none selects or inserts whole rows of these three classes, so the change removes declarations only.
Deploy order
This release and C1 · 41's revision can be applied in either order, as long as a sim release with #1096 is in production first. C1 · 41 already requires that.
No deployed code compares these tables with the models: the live schema check in
validation.pycovers only thestage12_evaluation_*tables.The pinned API v1 commit
At
825a9b3c9,tests/test_public_api_schema.py::test_the_models_match_the_public_api_tablesfinds no differences, so no test is expected to fail. At the previous pin,d2b5dc310, it found 12: the nine columns, the foreign key, the index and the check.Tests
Test-first:
65bcb8d0adds the failing guard tests before the change. Only selected tests ran, each by node ID. They ran against two disposable PostgreSQL 17 databases, each built with API v1's migration chain and privilege manifest:without: API v1 at825a9b3c9, the new pinned commit, revision4e30076d4b9f, which drops the columns.with: API v1 atd2b5dc310, the previous pinned commit, revisionbc334f9877b7, which still has them.withoutwithtest_the_models_match_the_public_api_tablesfails with the 12 differences aboveThe service cases cover creates, re-runs, budget windows, and writes by both database roles. The runtime cases cover report run completion, the budget window store, household runs, the stuck-run sweep and cliff results.
Sim's checks pass: the pinned Ruff format and lint, the rules registry, the quality guards including file length, the lock checks, and Pyright for the two persistence libraries and the entry project.
Review
Four review rounds.
59f4eea0.8d220f96: the two completion tests seed a pending cliff result for each side and require it unchanged. They fail when completion is changed to update those rows.mainand the move ofpublic-api-commit, found one bug:test_a_request_losing_the_report_run_adds_the_winners_runs_calculations, which Start each side's cliff calculation when a report asks for cliffs #1099 added, still insertedreport_runs.trigger, and thePublic API schemajob failed on it. Fixed in1a00cbf8.Merge with #1099
#1099 (C1 · 39) merged first.
653e47d1mergesmainand resolves three conflicts, indocs/migration/stage-12-modal-worker-foundation.md,keyed_economy_records.pyand the entry project'sREADME.md: each keeps #1099'sinclude_cliffstext and drops the sentences about the columns API v1 removes.1a00cbf8stops one test #1099 added insertingreport_runs.trigger.🤖 Generated with Claude Code