Repository navigation
fix(savings): reject long telemetry gaps - #892
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81323b3c2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "history_coverage_pct": ds.HistoryCoverage, | ||
| "priced_coverage_pct": ds.PricedCoverage, |
There was a problem hiding this comment.
Use coverage before presenting savings as complete
When a day has price slots but no usable telemetry—or loses intervals to the new 20-minute gap limit—resolutionFor still returns "slot" while these fields report partial or zero coverage. The existing consumers ignore the new fields: web/components/savings-periods.js:25-33 treats every non-no_prices day as complete, and web/components/ftw-savings-card.js:685-700 renders the aggregate totals without a coverage warning. Consequently, the tested prices-without-history case is shown to operators as a complete +0 saved result, and partially covered periods are shown as authoritative totals; update the card/period completeness logic to account for history and priced coverage.
Useful? React with 👍 / 👎.
What
value_scope: site_totalwith an explicit no-PV/no-battery baselinesaved_oresemanticsWhy
The old integrator applied the next power sample across any gap. A long outage could therefore create energy, cost and reported savings. The endpoint also looked like an optimizer metric even though it combines PV, battery, export and vehicle timing value.
This removes fabricated value and exposes how much data supports each result. It does not claim incremental optimizer gain.
Part of #885.
Tests
go test ./internal/state ./internal/apimake verifymake verify-all, including linux/arm64, linux/amd64 and windows/amd64 buildsBehavior
Cold-tier daily points and any other raw cadence above 20 minutes now report missing coverage instead of extrapolating power. No database migration is needed. The API additions are backward-compatible.