Repository navigation
fix: harden optimizer and energy runtime recovery - #647
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d575e3f645
ℹ️ 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".
| if h == nil || h.Status == telemetry.StatusOffline { | ||
| return false |
There was a problem hiding this comment.
Exclude faulted drivers from history usability
When a driver reports a device fault but still emits fresh readings, DriverHealth.Status remains ok while IsOnline() is false. The old EV/V2X history totals used SumOnlineEVW/SumOnlineV2XW, which skipped those faulted drivers; this new predicate only rejects StatusOffline, so a faulted charger or V2X device is counted in ev_w, v2x_w, and load_house_w until it stops emitting. Please use !h.IsOnline() here so faulted-but-fresh devices do not corrupt history totals.
Useful? React with 👍 / 👎.
* ci: stop new direct reads of cached telemetry outside the telemetry package A reading stays in telemetry.Store after its driver goes stale, offline or faulted. Every direct reader of RawW, SmoothedW, ReadingsByType or ReadingsByDriver must check driver health itself, and review caught the missing check in #36, #85, #310, #647, #664 and #740. The check counts those reads per file outside go/internal/telemetry and fails when a pull request adds one. Existing reads (147 today) may only go down. The error names the health-gated accessors to use instead. On the merged commits of #36, #85, #310 and #647 it fails. * ci: count telemetry reads across platforms and validate exceptions Signed-off-by: Fredrik Ahlgren <[email protected]> --------- Signed-off-by: Fredrik Ahlgren <[email protected]>
What changed
Root causes
Core coupled legacy history to the atomic sample/ledger write and could reuse cached readings after their source reading had aged out. Initial Modbus dialing also failed driver registration before the existing reconnect loop could run. The optimizer sidecar used separate timeout defaults and transport behavior that made process fallback less reliable.
Validation
make verifymake verify-allthrough the pre-push hookgo test -race ./cmd/ftw ./internal/state ./internal/modbusBoth user-visible changes include Changesets.