Skip to content

fix(telemetry): preserve SoC observation time - #901

Merged
frahlg merged 1 commit into
masterfrom
agent/soc-freshness
Aug 11, 2026
Merged

frahlg merged 1 commit into
masterfrom
agent/soc-freshness

Conversation

@frahlg

@frahlg frahlg commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

  • track the last fresh SoC observation separately from the latest power or metadata update
  • preserve that time across missing SoC and vehicle emits marked soc_fresh=false
  • stop duplicate long-format SoC samples for carried values
  • age vehicle control input from the SoC observation time and reject driver-marked stale data
  • fail closed when an explicit freshness marker is invalid or has no fresh predecessor

Why

Store.Update carried an old SoC into each power-only update, then stamped it with the new reading time and wrote another *_soc sample. Fresh power or metadata could therefore make old vehicle SoC look fresh to the picker and to history.

The new field is internal and additive. A missing soc_fresh marker keeps the old behavior for existing drivers.

Tests

  • make verify-all
  • all telemetry and driver tests with the race detector
  • focused cache/freshness cases 100 times
  • focused race cases 25 times
  • Lua -> Host -> Store -> picker test with non-nil cached SoC
  • old-base regression check: cached data wrote a false SoC sample and stayed selectable before this change

Scope and release gate

This PR lands the Core side of the contract. The current bundled Tesla driver does not emit soc_fresh yet, so this does not claim that the Tesla production cache path is fixed end to end.

The follow-up must update the canonical srcfl/device-drivers Tesla driver, bump and test its version, then move FTW's bundled-driver pin. That work is waiting for the older device-driver PRs that own the shared catalog files. Do not release this as a complete Tesla fix before that pair lands.

Part of #885.

@frahlg
frahlg merged commit 16d33fd into master Aug 11, 2026
14 checks passed
@frahlg
frahlg deleted the agent/soc-freshness branch August 17, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant