Skip to content

Stop mapping the report columns the next v2 revision drops - #4333

Draft
anth-volk wants to merge 7 commits into
v2plan/c1-40-report-cliffsfrom
v2plan/c1-40a-stop-mapping-report-columns
Draft

anth-volk wants to merge 7 commits into
v2plan/c1-40-report-cliffsfrom
v2plan/c1-40a-stop-mapping-report-columns

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Fixes #4332

Summary

  • Report no longer maps label, description or user_id, and ReportRun and BudgetWindowRun no longer map trigger. The columns stay in __table_args__, so the tables don't change and there is no revision.
  • Report.user and User.reports go, and create_report_run takes no trigger.
  • /v2/reports run items and budget-window run items no longer have trigger. Run lists, report reads, and create and re-run answers all change. A user's trigger stays on user_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

  1. Store one cliff result per simulation run in the v2 database, with grants #4327 and Read report cliffs from simulation runs' cliff results, and take include_cliffs on re-runs #4329
  2. This PR
  3. The PR that drops the columns

Migration notes

  • Route group covered: /v2/reports, on FastAPI. Nothing moves between Flask and FastAPI.
  • API contract change: the trigger field is removed from run items. v3 has it only in its generated types and calls no /v2/reports route.
  • The migration contract documents regenerate unchanged.

Testing

  • The tests this PR adds or changes pass by node ID against disposable PostgreSQL 17.
  • With this code on a database where the nine columns were dropped by hand, and privileges.py no longer naming the cliff columns, 30 report read, create and re-run cases pass.
  • alembic -c alembic-v2.ini check finds nothing to generate, and reconcile_v2_privileges.py apply and verify pass.
  • ruff, ruff format, lint-imports, python -m scripts.rules validate, run_quality_guards.py and make typecheck-v2 pass. Explicit mypy on the changed policyengine_api/data/v2/ files reports 20 errors, the same count as the base branch.
  • The full suites were not run locally.

🤖 Generated with Claude Code

anth-volk and others added 5 commits November 19, 2026 02:58
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

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.61%. Comparing base (60fc6a1) to head (6fcb6b2).

Additional details and impacted files
@@                      Coverage Diff                       @@
##           v2plan/c1-40-report-cliffs    #4333      +/-   ##
==============================================================
- Coverage                       93.63%   93.61%   -0.02%     
==============================================================
  Files                             409      409              
  Lines                           23366    23352      -14     
  Branches                         3657     3656       -1     
==============================================================
- Hits                            21878    21862      -16     
- Misses                            874      875       +1     
- Partials                          614      615       +1     
Flag Coverage Δ
integration 57.92% <100.00%> (-0.02%) ⬇️
unit 90.91% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant