diff --git a/BUGS.md b/BUGS.md index 61012b7..d849859 100644 --- a/BUGS.md +++ b/BUGS.md @@ -67,7 +67,12 @@ the authoritative, issue-by-issue record lives **here**. --- ### BUG-03 — DTC/MIL codes are never persisted; lost on OBD disconnect or reboot -- **Status**: `OPEN` + +- **Status**: `FIXED` (commit `e2f2314`; pending deploy/verify → CLOSED) +- **Fix**: Persist MIL + codes to SQLite on each poll (`save_dtc_state`), `/api/dtc` falls back to + the persisted snapshot when OBD is offline, `get_overview_stats` counts the real `dtc` table, + and a schema migration rebuilds the unused `NAME/STATUS/DTC_ID` table. Cleared codes are tracked + via `IS_SET` + `FIRST_SEEN_AT`/`LAST_SEEN_AT`. Tests: `tests/test_dtc_persistence.py`. - **Severity**: Medium (lost diagnostic data; also a stats bug) - **Area**: `modules/app_obd.py`, `modules/app_sql.py`, `get_overview_stats` - **Phase**: Phase 26 @@ -101,7 +106,6 @@ the authoritative, issue-by-issue record lives **here**. two systems agree. Note this may re-split/recompute existing server trips — get owner sign-off before recomputing, and re-run `scripts/recompute_trips.py` after the fix. - **Acceptance**: A real drive with a parked gap produces the same number of trips on the server - as on the Pi. --- diff --git a/PLAN.md b/PLAN.md index 39c6225..f72244c 100644 --- a/PLAN.md +++ b/PLAN.md @@ -1876,7 +1876,8 @@ lands. The current known issues from the road test (also recorded in `BUGS.md`): unicast fallback can be extended to the AP subnet. 2. **BUG-02 (micro-USB power port damaged).** Hardware-only (worn power connector). Action is documentation + owner hard-wiring 5V/GND to the GPIO header pins; no code. -3. **BUG-03 (DTCs not persisted).** The SQLite `dtc` table is created but never written or read; +3. **BUG-03 (DTCs not persisted).** ✅ FIXED (`e2f2314`) — The SQLite `dtc` table is created but never + written or read; DTC codes/MIL live only in memory in `app_obd.py` and vanish on OBD disconnect/reboot. `get_overview_stats` also queries a non-existent `dtc_codes` table. Fix: persist on each poll, read back when disconnected, fix the stats query, add a "cleared/since" concept. @@ -1884,7 +1885,8 @@ lands. The current known issues from the road test (also recorded in `BUGS.md`): speed + sustained GPS displacement, inactivity gap); the server splits only by *time gap* and filters by duration. Parked idle tracking rows bridge two drives into one server-side trip. Fix: mirror the Pi's motion-boundary logic server-side. -5. **BUG-05 (server replay speed_source).** Server `get_trip_route` hardcodes `speed_source: "gps"` + +5. **BUG-05 (server replay speed_source).** ✅ FIXED (`e2f2314`) — Server `get_trip_route` hardcodes `speed_source: "gps"` even when OBD speed is present (it already returns raw `speed`). Fix: mirror the Pi's `obd if speed>0 else gps` logic. 6. **BUG-06 (server timezone is UTC-shifted).** `tracking_points.recorded_at` is `TIMESTAMPTZ` @@ -1900,6 +1902,13 @@ lands. The current known issues from the road test (also recorded in `BUGS.md`): *server* delete endpoint, and there is no `DELETE /api/trip/` route on the Pi. Fix: add all four pieces and make the delete endpoint configurable in `history.js`. +**Progress (2026-08-11):** **BUG-03** ✅ FIXED (commit `e2f2314` — DTC/MIL persisted to SQLite on +each poll, `/api/dtc` falls back to persisted state when OBD is offline, `get_overview_stats` +fixed to use the real `dtc` table, cleared/since tracked via `IS_SET`/`FIRST_SEEN_AT`/ +`LAST_SEEN_AT`, plus a schema migration and `tests/test_dtc_persistence.py`). **BUG-05** ✅ FIXED +(commit `e2f2314` — server route `speed_source` mirrors the Pi's `obd if speed>0 else gps`). +Both pending deploy/verify. The remaining items (BUG-01, 02, 04, 06, 07, 08) stay open. + **Acceptance for Phase 26:** every `BUGS.md` entry in scope is fixed, regression-tested, deployed, marked resolved, and the corresponding fix recorded here.