Follow-up discovered during Issue #52 read-only audit on exact runtime/develop SHA 4b00b81e3f85c012504ea99b8b50f02d742d378e.
Observed live store state after successful HA restart:
server_history_ready=false
server_history_source=local_fallback
server_history_reason=upstream_vehicle_unavailable
last_sync=2026-09-02T19:59:43Z
This means PR #51's historical /trips transport is present but the current runtime never reached it because ServerHistoryManager._resolve_upstream() did not resolve a client/vehicle during initialization.
Current lifecycle is fragile:
async_setup_entry() starts server_history.async_initialize() immediately in the background;
async_initialize() resolves the upstream client/vehicle and, on failure, schedules only three retries;
_retry_initialize() sleeps 5 seconds, so the manager gives up after a short startup window;
- after those retries there is no later reacquisition/resync trigger when Stellantis Vehicles becomes fully available.
Current resolution path also depends first on the selected HA device's config_entries relation and only then checks that entry's runtime_data / legacy cache. The upstream's current supported runtime contract is ConfigEntry.runtime_data = StellantisVehicles, with per-VIN coordinators stored on that object.
Required investigation/fix:
- On the live runtime, determine exactly which resolution step fails after restart: selected device reference, device
config_entries, upstream config entry lookup, runtime_data, async_get_coordinator_by_vin(vin), or cached _vehicle VIN match.
- Keep VIN verification strict. Never bind to a different vehicle merely because only one upstream entry exists.
- Make upstream resolution resilient to startup ordering. A missed initial lookup must not permanently disable server history for the whole HA uptime.
- Prefer a narrow local solution in
sv_dashboard; do not modify or monkey-patch andreadegiovine/homeassistant-stellantis-vehicles.
- A safe fallback may scan loaded
stellantis_vehicles config entries when the device-registry link is absent/stale, but only accept an entry whose already-cached coordinator/vehicle matches the exact configured VIN.
- Add a cancellable delayed/background reacquisition strategy (or equivalent event-driven retry) so
upstream_vehicle_unavailable can recover later without blocking HA startup or creating an unbounded tight loop.
- Once resolution succeeds, run the normal historical sync and canonical rebuild, update readiness/source truthfully, and refresh entities.
- Preserve local fallback while unresolved and preserve archived server rows; do not mark them fresh until a successful sync.
- Add regression tests for startup-order miss → later recovery, stale/missing device-registry config-entry linkage, strict VIN mismatch rejection, cancellation/unload, and no duplicate concurrent sync loops.
This issue should be solved before relying on Issue #52's historical server-row backfill in the UI, because while server_history_ready=false the Trip History card intentionally uses its Recorder/local fallback path.
No main promotion or release until runtime validation on an exact merged develop SHA.
Follow-up discovered during Issue #52 read-only audit on exact runtime/develop SHA
4b00b81e3f85c012504ea99b8b50f02d742d378e.Observed live store state after successful HA restart:
This means PR #51's historical
/tripstransport is present but the current runtime never reached it becauseServerHistoryManager._resolve_upstream()did not resolve a client/vehicle during initialization.Current lifecycle is fragile:
async_setup_entry()startsserver_history.async_initialize()immediately in the background;async_initialize()resolves the upstream client/vehicle and, on failure, schedules only three retries;_retry_initialize()sleeps 5 seconds, so the manager gives up after a short startup window;Current resolution path also depends first on the selected HA device's
config_entriesrelation and only then checks that entry'sruntime_data/ legacy cache. The upstream's current supported runtime contract isConfigEntry.runtime_data = StellantisVehicles, with per-VIN coordinators stored on that object.Required investigation/fix:
config_entries, upstream config entry lookup,runtime_data,async_get_coordinator_by_vin(vin), or cached_vehicleVIN match.sv_dashboard; do not modify or monkey-patchandreadegiovine/homeassistant-stellantis-vehicles.stellantis_vehiclesconfig entries when the device-registry link is absent/stale, but only accept an entry whose already-cached coordinator/vehicle matches the exact configured VIN.upstream_vehicle_unavailablecan recover later without blocking HA startup or creating an unbounded tight loop.This issue should be solved before relying on Issue #52's historical server-row backfill in the UI, because while
server_history_ready=falsethe Trip History card intentionally uses its Recorder/local fallback path.No
mainpromotion or release until runtime validation on an exact mergeddevelopSHA.