From 94dcffa2cbc22ee0df2a00685d4afa319ea3f908 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sat, 15 Aug 2026 15:56:32 -0400 Subject: [PATCH] =?UTF-8?q?docs:=20add=20BUG-23=20=E2=80=94=20Pi/server=20?= =?UTF-8?q?trip=20counts=20diverge=20(57=20vs=2010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root-caused the discrepancy by replicating the server's trip builder over live data: 58 raw groups -> 51 after the server's duration/distance floor (7 short trips dropped that the Pi keeps) -> 10 after skipping 41 deleted trip markers. Documents the min-trip filter mismatch and the row-set mismatch as the actual bugs. --- BUGS.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/BUGS.md b/BUGS.md index 6f3e52f..c18aeba 100644 --- a/BUGS.md +++ b/BUGS.md @@ -26,6 +26,34 @@ 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-22 — Trip max speed ignores GPS-only stretch (shows OBD max only)