Repository navigation
bug(approvals): Account & Payment columns on Approval queue show '-' instead of data (followup to #713) #733
Description
Symptom (user-reported)
The Account and Payment columns are now shown, but they have no data, only a dash ("-").
PR #713 added the Account, Term, Payment, Monthly Cost columns to the Approval queue. The columns render, but every row shows - for Account, Payment, and (when not already set) Monthly Cost.
Root cause
The data lives in the right place on the backend but executionToHistoryRow / projectRecommendationFields in internal/api/handler_history.go never copy it onto the synthesised PurchaseHistoryRecord:
- Account:
executionToHistoryRowreadsexec.CloudAccountID, but pending executions created by the web bulk-purchase flow (handler_purchases.gonear L1399, the only constructor for these rows) never setCloudAccountID. The per-recommendationCloudAccountIDIS available viarecs[i].CloudAccountIDbut is not consulted. - Payment:
projectRecommendationFieldspopulatesService,ResourceType,Region,Term,UpfrontCost,EstimatedSavings, and (single-rec only)MonthlyCostfrom the recommendation, but never setsrow.Paymentin either branch — even thoughRecommendationRecord.Paymentexists and is populated by every constructor. - MonthlyCost (multi-rec only): same gap; only the single-rec branch maps it.
Net effect: the frontend reads account_id == "" and payment == "" and renders the - fallback for every Approval-queue row.
Proposed fix
In internal/api/handler_history.go:
executionToHistoryRow: whenexec.CloudAccountID == nil, fall back torecs[i].CloudAccountIDcollapsed via a newcollapseRecommendationAccounthelper (mirrorscollapseRecommendationProvider). Returns the shared value across recs, or""when they disagree (the-rendering then stays correct for an honestly-heterogeneous basket).projectRecommendationFields:- Single-rec: set
row.Payment = r.Paymentalongside the existing field projections. - Multi-rec: set
row.Payment = collapseRecommendationPayment(recs)(same pattern) androw.MonthlyCost = sum(recs[i].MonthlyCost).
- Single-rec: set
Add regression tests:
- Extend
TestHandler_getHistory_IncludesPendingso its recs carryCloudAccountID,Payment, andMonthlyCost; assert the pending row carriesAccountID,Payment,MonthlyCost. - New single-rec sub-test that asserts a 1-rec execution passes Payment through.
- Extend
history-approval-queue.test.tswith a test that mocks the API response with the three populated fields and asserts the cells show real values, not the-fallback.
Followup to
#713 (merged) — this is the second pass on the same change, fixing the data-population gap on the backend side.
Activity
fix(approvals): populate Account/Payment/MonthlyCost on Approval queu…
cristim commentedon May 28, 2026
Verified shipped: PRs #734 (commit 550a5, merged 2026-05-27) and #738 (commit 67385, merged 2026-05-27) are both in feat/multicloud-web-frontend. handler_history.go now populates Account and Payment fields from recommendation records on Approval queue rows; tests added in handler_history_test.go and history-approval-queue.test.ts.