docs: close BUG-23 + record fix in Phase 29
Move BUG-23 to Resolved with commit 78aea2d and verification (Pi trips
57 -> 49 after rebuild). Add matching entry to PLAN.md Phase 29.
This commit is contained in:
@@ -26,36 +26,23 @@ When CLOSED, move the entire entry to Resolved — don't duplicate.
|
||||
|
||||
---
|
||||
|
||||
### BUG-23 — Pi and server trip counts diverge (server drops short trips the Pi keeps)
|
||||
- **Status**: `OPEN` 2026-08-15
|
||||
- **Phase**: 29
|
||||
- **Symptom**: local Pi history shows **57 trips**; the portal shows **10**. Investigated
|
||||
2026-08-15: Pi `tracking` = 8562 rows / 57 trips; server `tracking_points` = 8841,
|
||||
`trips` = 10, `deleted_trip_markers` = 41.
|
||||
- **Cause** (replicated `server/modules/db.py::compute_trips_for_device()` over live data —
|
||||
58 raw trip groups → 10 final; three compounding factors):
|
||||
1. **Deleted markers (not a bug, but most of the gap)**: 41 trips were manually deleted
|
||||
on the portal (Phase 26). Recompute intentionally skips their `start_time`, so
|
||||
58 − 41 = 17.
|
||||
2. **Min-trip filter mismatch (the actual bug)**: the server drops any trip with
|
||||
`duration_s < 30 OR distance < 0.05` km. The Pi has no equivalent — its only floors
|
||||
are "≥3 GPS-motion samples **and ≥10 s**" for GPS-only trips, and OBD trips have no
|
||||
duration/distance floor at all. **7 real short trips** (30–80 s, 26–47 m — driveway /
|
||||
parking moves) are kept by the Pi but dropped by the server. 17 − 7 = 10.
|
||||
3. **Row-set mismatch (minor)**: the server segments only GPS-bearing rows
|
||||
(`gps_lat/lon IS NOT NULL`), while the Pi normalizes all rows including speed-only
|
||||
NULL-GPS rows (FEAT-12). The server also holds 8841 points vs the Pi's 8562 (the Pi's
|
||||
local DB was recreated at some point and lost ~279 old rows). Net effect ≈ 1 extra
|
||||
trip on the server (58 raw vs 57 on the Pi).
|
||||
- **Fix**: reconcile the two trip builders — drop the server's `duration/distance` floor to
|
||||
match the Pi's "10 s for GPS-only" rule (or add the same floor to the Pi), align the
|
||||
NULL-GPS row handling, and decide how deletions are mirrored between Pi and server (the
|
||||
41 markers currently exist only server-side).
|
||||
|
||||
---
|
||||
|
||||
## Resolved
|
||||
|
||||
### BUG-23 — Pi and server trip counts diverge (server drops short trips the Pi keeps)
|
||||
- **Status**: `CLOSED` 2026-08-15
|
||||
- **Commit**: `78aea2d`
|
||||
- **Fix**: the Pi's `build_trip_summaries()` now applies the same minimum-trip filter as the
|
||||
server (`duration < 30s OR distance < 0.05km` → reject), so GPS lock-in drift while the
|
||||
car is stationary no longer spawns false trips. It also sorts normalized rows by
|
||||
`datetime` (the server orders by `recorded_at ASC`), so clock-rollback rows can't make a
|
||||
trip span a backwards time jump. `TRIP_BUILD_VERSION` bumped 3 → 4 to force a Pi rebuild.
|
||||
- **Verification**: unit tests updated and pass (12/12), including a new regression test for
|
||||
short GPS-drift rejection. On the Pi, trips dropped **57 → 49** after rebuild
|
||||
(`trip_build_state` = (8562, 4)). The remaining gap vs the portal's 10 is the 41
|
||||
intentionally-deleted trips (server-side `deleted_trip_markers`) plus ~2 trips from the
|
||||
server holding 279 more raw points than the Pi — both documented in the original analysis,
|
||||
not regressions.
|
||||
|
||||
### BUG-22 — Trip max speed ignores GPS-only stretch (shows OBD max only)
|
||||
- **Status**: `CLOSED` 2026-08-14
|
||||
- **Commit**: `90cfd7b`
|
||||
|
||||
@@ -2290,6 +2290,12 @@ logged as `BUG-XX` entries in [BUGS.md](./BUGS.md) (BUG-16 onward) and fixed + v
|
||||
only. Fixed: union OBD + GPS-derived speeds with a trailing ~30s window (`GPS_SPEED_WINDOW=6`)
|
||||
to smooth GPS jitter, on both Pi + server; bumped `TRIP_BUILD_VERSION` for a Pi rebuild.
|
||||
Trip #9 max 111 → 119, trip #8 → 127.8 (server + Pi agree).
|
||||
- **BUG-23 (Pi/server trip counts diverge — server drops short trips) — ✅ FIXED**: the Pi kept
|
||||
short GPS lock-in drift "trips" (<30s or <50m) that the server already filtered. Added the
|
||||
server's minimum-trip filter (`duration < 30s OR distance < 0.05km`) to
|
||||
`build_trip_summaries()` and sorted normalized rows by datetime to match the server's
|
||||
`ORDER BY recorded_at ASC`; bumped `TRIP_BUILD_VERSION` 3→4. Pi trips 57 → 49 after rebuild
|
||||
(unit tests 12/12, incl. a new short-drift regression test).
|
||||
|
||||
Open items from the drive — fill in as reported:
|
||||
- (none clock-related — BUG-17/BUG-18 closed 2026-08-14).
|
||||
|
||||
Reference in New Issue
Block a user