Repository navigation
Stop mapping the report columns the next v2 revision drops - #4333
Merged
Merged
Conversation
Whole-row reads of reports, report runs and budget-window runs name none of the per-user columns a later revision drops, the tables keep them, run reads no longer answer a trigger, and create_report_run takes none. The report fixtures stop storing those columns, so the reads are tested on rows that hold none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Report leaves out label, description and user_id, and ReportRun and BudgetWindowRun leave out trigger, so API v1 neither selects nor writes them. The tables keep the columns, so there is no revision, and a release of this code keeps serving /v2/reports while a later revision drops them. Run items and budget-window run items no longer have a trigger field, and create_report_run takes none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # policyengine_api/data/v2/models/reports.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A catalog publication test stops passing a label the model discards, and a report-run test is named for what it now covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4333 +/- ##
==========================================
- Coverage 93.78% 93.77% -0.01%
==========================================
Files 413 413
Lines 23537 23528 -9
Branches 3662 3661 -1
==========================================
- Hits 22073 22064 -9
Misses 848 848
Partials 616 616
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… v2plan/c1-40a-stop-mapping-report-columns
… v2plan/c1-40a-stop-mapping-report-columns
… v2plan/c1-40a-stop-mapping-report-columns
C1 · 40's branch brings #4327's rule api.data.orm-only, which refuses sa.Column(...) anywhere. As C1 · 40 does for the four cliff columns, the five per-user columns (reports.label, description and user_id, and both run tables' trigger) are SQLModel fields again, still left out of the mappers by exclude_properties. Tests stop writing them through the models, which can't set an excluded column; the privilege tests set trigger through BudgetWindowRunColumns and ReportRunColumns, and the column-mapping tests read the stored schema instead of Core tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests The model and shared-row tests read trigger and label from the mappers, which leave them out since the base's ORM-only rule made them SQLModel fields under exclude_properties; they now read the stored schema or leave the columns out. The malformed-key test no longer inserts label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared-rows test reads label and both triggers through the column classes, as the rule requires (ReportColumns gains label), instead of the models' class attributes, which are the tables' Core columns. The column-mapping tests check again that the five columns have no server default, and that both triggers keep the shared enum type. The guide and docstrings name every column the mappers leave out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The column-only classes take trigger's type from the user records' mapper, which holds the same enum, and the trigger type test compares the runs' type with the user records' instead of checking a name alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mapping-report-columns
anth-volk
marked this pull request as ready for review
November 25, 2026 14:57
anth-volk
added a commit
that referenced
this pull request
Nov 25, 2026
Revision d417fe8b1b17 now sits on 4e30076d4b9f, master's head, instead of 9d1d12a7ac58. Autogenerating it again from 4e30076d4b9f gives the same operations, which its docstring and the migrations skill now say. - The head constant, the revision chain test, this revision's own test, the lifecycle script and its workflow test, and the skill's downgrade-chain paragraph name the new order: d417fe8b1b17, 4e30076d4b9f, bc334f9877b7, 9d1d12a7ac58. - Master now runs every database statement through the ORM (rule api.data.orm-only). test_alembic_v2_user_dynamics.py and the saved-dynamic fixture in test_v2_user_identity_persistence.py move from Core connections and SQL text to the owner's Sessions, mapped classes and add_row; the rule's test listed their 20 findings before the change and none after. - Both sides raised the import test's table count from 50 to 51; it is 52 with cliff_impacts and user_dynamics. - The report column drops test of the deploy's privilege steps upgraded only to 4e30076d4b9f, so apply refused while user_dynamics was declared but absent. It now upgrades to the head before applying, as the deploy does. Each of those tests was seen failing by node ID before the change and passes after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
This branch was previously 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.
Fixes #4332
Summary
Reportno longer mapslabel,descriptionoruser_id, andReportRunandBudgetWindowRunno longer maptrigger. The columns stay in__table_args__, so the tables don't change and there is no revision.Report.userandUser.reportsgo, andcreate_report_runtakes no trigger./v2/reportsrun items and budget-window run items no longer havetrigger. Run lists, report reads, and create and re-run answers all change. A user's trigger stays onuser_report_run_associations.Why it ships separately
The deploy upgrades the v2 schema before new code takes traffic. The next revision, in the PR that follows this one, drops these columns and
report_runs' four cliff columns, so the release serving at that moment must name none of them. With #4329, which stops mapping the four cliff columns, this release is that one.Deploy order
Migration notes
/v2/reports, on FastAPI. Nothing moves between Flask and FastAPI.triggerfield is removed from run items. v3 has it only in its generated types and calls no/v2/reportsroute.Testing
privileges.pyno longer naming the cliff columns, 30 report read, create and re-run cases pass.alembic -c alembic-v2.ini checkfinds nothing to generate, andreconcile_v2_privileges.py applyandverifypass.lint-imports,python -m scripts.rules validate,run_quality_guards.pyandmake typecheck-v2pass. Explicit mypy on the changedpolicyengine_api/data/v2/files reports 20 errors, the same count as the base branch.🤖 Generated with Claude Code