Repository navigation
feat(recs): plumb provider SavingsPercentage to GUI (CLI/GUI parity; AWS missing on_demand_cost shows '—') #1106
Description
Gap
The CLI/reporter shows AWS's authoritative rec.SavingsPercentage directly (internal/reporter/reporter.go:45, sourced from AWS EstimatedMonthlySavingsPercentage in parser_ri.go; the Azure and GCP converters also set SavingsPercentage). But SavingsPercentage is dropped at the API boundary -- it was never on config.RecommendationRecord, so it is never serialized to the frontend.
Because of that, the GUI re-derives the effective savings % client-side via effectiveSavingsPct(savings, on_demand_cost, ...). That recomputation:
- can drift from the provider's authoritative number, and
- returns
null/ "—" whenon_demand_costis missing even though the provider gave a real % (the fix(frontend/recs): return null from effectiveSavingsPct on AWS reconstruction fallback (followup to #321) #323 case).
The CLI never has these problems because it uses the provider value directly. This is a CLI-vs-GUI parity gap on a money-path display.
Fix (full-stack)
- Backend struct (
internal/config/types.go): add nullableRecommendationRecord.SavingsPercentage *float64(nil = provider did not report a %). Persisted via the recommendations row's JSONBpayloadcolumn -- no DDL/migration needed (recs are stored as JSONB; same asOnDemandCost). Absent represented as nil, never 0. - Mapping (
internal/scheduler/scheduler.goconvertRecommendations, the only builder mapping a common rec to a record): setSavingsPercentage: nonZeroPtr(rec.SavingsPercentage), parity withOnDemandCost. A provider 0 round-trips as nil. - Frontend type (
frontend/src/types.ts): addsavings_percentage?: number | nulltoLocalRecommendation. - Frontend display/sort (
frontend/src/recommendations.ts): the effective-% column and its sort accessor preferr.savings_percentagewhen it is a finite, non-null number; fall back toeffectiveSavingsPct(r)otherwise. Net effect: GUI shows the same number the CLI shows, and AWS recs missingon_demand_costshow the provider % instead of "—".
Scope
Full-stack (Go struct + scheduler mapping + frontend type + display/sort), implemented in PR #1104 alongside the net-savings fix.
Activity
feat(recs): plumb provider SavingsPercentage to GUI for CLI/GUI parity
feat(recs): plumb provider SavingsPercentage to GUI for CLI/GUI parity
feat(recs): plumb provider SavingsPercentage to GUI for CLI/GUI parity (