docs: add BUG-23 — Pi/server trip counts diverge (57 vs 10)
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user