Symptom (QA row 278, Purchases page > Approval queue step 1.6)
When an admin clicks Cancel on a pending purchase request in the Approval queue:
- Counts for pending and cancelled purchases update correctly.
- BUT Total Upfront Spent, Monthly Saving, and Annual Savings all update as if the cancelled purchase had been approved, adding its committed/saved amounts to the KPIs.
A cancelled purchase represents zero committed spend and zero realized savings. The KPIs must exclude cancelled-status executions.
Reproduction
- Send a high-cost commitment for approval (so the delta is large and visible).
- Note the Total Upfront Spent / Monthly Saving / Annual Savings KPIs on the Purchases page.
- Click Cancel on that pending request in the Approval queue.
- Observe: pending count -1, cancelled count +1 (correct). But Total Upfront Spent +cost_of_cancelled_purchase, Monthly Saving +its_savings, etc. (wrong — these should stay unchanged.)
Fix direction
Trace the KPI aggregation:
- Likely a backend handler that sums all execution rows without filtering on
status (or status set is too permissive, e.g., status IN ('approved', 'completed', 'cancelled') instead of status IN ('approved', 'completed')).
- Search for "Total Upfront Spent" / "Monthly Saving" / "Annual Savings" in
internal/api/ and frontend/src/.
- The cancel-purchase mutation likely transitions to
cancelled but doesn't subtract from these aggregates (or the GET handler includes cancelled in the SUM).
Whichever is the data source, exclude status='cancelled' from these three aggregates.
Tests required
- API integration test: create N approved purchases + 1 pending; capture KPI values; cancel the pending; assert KPIs unchanged.
- UI test: same scenario in the browser; assert the displayed numbers don't change after cancellation.
Source of finding
QA verification spreadsheet row 278 (step 1.6 of Approval queue).
Symptom (QA row 278, Purchases page > Approval queue step 1.6)
When an admin clicks Cancel on a pending purchase request in the Approval queue:
A cancelled purchase represents zero committed spend and zero realized savings. The KPIs must exclude cancelled-status executions.
Reproduction
Fix direction
Trace the KPI aggregation:
status(or status set is too permissive, e.g.,status IN ('approved', 'completed', 'cancelled')instead ofstatus IN ('approved', 'completed')).internal/api/andfrontend/src/.cancelledbut doesn't subtract from these aggregates (or the GET handler includes cancelled in the SUM).Whichever is the data source, exclude
status='cancelled'from these three aggregates.Tests required
Source of finding
QA verification spreadsheet row 278 (step 1.6 of Approval queue).