Repository navigation
fix(loadpoint): accept newer delayed car charge readings - #1648
Conversation
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14e3e47c33
ℹ️ 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 !observedAt.IsZero() { | ||
| // Compare car measurements by source time, not cloud delivery time. | ||
| lp.socConfirmedAt = observedAt |
There was a problem hiding this comment.
Preserve source time through the unknown-history fallback
After a mid-session restart, a delayed measurement from before the first retained energy sample makes deliveredAt fail, so go/cmd/ftw/main.go:2986-2987 falls back to AnchorVehicleSoC, which passes a zero timestamp and records the receipt time instead. A later cloud reading that was measured after the first but before that receipt is then rejected by VehicleSoCSupersedes, leaving the ordering bug in place for cold-start/recovery sessions; preserve the original observedAt even when anchoring must fall back to the current energy value.
AGENTS.md reference: AGENTS.md:L24-L25
Useful? React with 👍 / 👎.
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Master's AnchorVehicleSoCAt now adopts a reading from before the connection without adding energy. For the session's car a reading from before the plug-in is the level the session started from, so it seeds the session with all of its energy. A restored session keeps its real plug-in time and whether it asked car.which. Master's new anchor-order test reads the level instead of the removed PlanningStartSoC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master's AnchorVehicleSoCAt now adopts a reading from before the connection without adding energy. For the session's car a reading from before the plug-in is the level the session started from, so it seeds the session with all of its energy. A restored session keeps its real plug-in time and whether it asked car.which. Master's new anchor-order test reads the level instead of the removed PlanningStartSoC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master's AnchorVehicleSoCAt now adopts a reading from before the connection without adding energy. For the session's car a reading from before the plug-in is the level the session started from, so it seeds the session with all of its energy. A restored session keeps its real plug-in time and whether it asked car.which. Master's new anchor-order test reads the level instead of the removed PlanningStartSoC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master's AnchorVehicleSoCAt now adopts a reading from before the connection without adding energy. For the session's car a reading from before the plug-in is the level the session started from, so it seeds the session with all of its energy. A restored session keeps its real plug-in time and whether it asked car.which. Master's new anchor-order test reads the level instead of the removed PlanningStartSoC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A delayed car reading measured at 10:10 and received at 10:40 made Core reject a later reading measured at 10:20. The first reading's receipt time had become the timestamp that the next car measurement needed to beat.
Keep the measurement time when confirming a vehicle anchor. The public update timestamp still records receipt, and the estimate still includes energy delivered since the measurement. A newer manual correction keeps precedence over older car measurements.
When restart or trimmed history leaves the earlier energy unknown, keep the same raw-SoC fallback that the control loop already used, but retain the measurement time. Only known energy after the reading advances the estimate; unknown earlier energy is not added.
Validation:
make verifypassed, including the bundled native worker checks.This change is independent of the forecast recovery and reserve pricing in #1644.