Phase 12: remove phone-relay dashcam upload feature

Removes the phone-relay feature entirely per the Phase 11 finding
that it hit a fundamental phone-OS limitation (a browser page can't
route WiFi and cellular traffic simultaneously, no code fix possible)
- see PLAN.md for the full test writeup.

- app.py: dropped /api/dash/pending, /api/dash/file/<path>,
  /api/dash/relay/config, /api/dash/relay/heartbeat,
  /api/dash/relay/stop, /api/dash/relay/mark_uploaded routes and
  their now-unused imports (os, send_file, abort, safe_join).
- modules/app_upload.py: dropped list_pending_dashcam_files(),
  relay_heartbeat()/relay_stop()/is_relay_active(),
  RELAY_LEASE_SECONDS/_relay_lease_until, and the relay-lease check
  inside _upload_dashcam_files()/get_status(). Kept the chunked
  upload protocol, dashcam_hash_cache/_hash_dashcam_file() (still
  used by the Pi's own background uploader), and DASHCAM_CHUNK_SIZE -
  none of that was relay-specific.
- templates/dash.html: removed the 'Relay via phone' card.
- static/js/dash.js: removed all relay JS (relayOneFile,
  fetchChunkWithRetry, uploadChunkWithRetry, heartbeat timers,
  pending-file list rendering).
- server/app.py: removed the CORS after_request hook, added solely
  for the phone's cross-origin browser calls (the Pi's own Python
  requests-based client was never subject to CORS).
- readme.md: dropped the phone-relay feature bullet, updated the
  project-status blurb to explain the removal + point at the planned
  native Android app as the real fix for that use case.
- PLAN.md: marked Phase 12 done with a verification writeup.

Verified: py_compile on all touched Python files, node --check on
dash.js, grepped all touched files for any leftover relay/RELAY
reference (none), and smoke-tested by importing app.py + hitting it
with Flask's test client - app starts cleanly, every relay route is
gone from url_map, and both / and /dash still render HTTP 200 with
zero 'relay' occurrences in /dash's HTML.

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-09 17:12:30 -04:00
co-authored by Copilot
parent 0b729adb28
commit f17c5c8681
7 changed files with 46 additions and 430 deletions
+26 -15
View File
@@ -643,23 +643,34 @@ workaround currently in place for that specific case.
**Side-fix from this test session**: found and fixed a real, unrelated bug in `yaris-netwatch.sh`
during this same test — see the Phase 6 update above.
### Phase 12: Remove phone-relay feature — 🚧 PLANNED
### Phase 12: Remove phone-relay feature — ✅ DONE
Undo Phase 11 cleanly given the Phase 11 update above (fundamental browser platform limitation,
not fixable). Remove:
not fixable). Removed:
- `app.py`: `/api/dash/pending`, `/api/dash/file/<path>`, `/api/dash/relay/config`,
`/api/dash/relay/heartbeat`, `/api/dash/relay/stop`, `/api/dash/relay/mark_uploaded` routes.
- `modules/app_upload.py`: `list_pending_dashcam_files()`, `_hash_dashcam_file()`/hash-cache
plumbing if unused elsewhere, `relay_heartbeat()`/`relay_stop()`/`is_relay_active()`,
`RELAY_LEASE_SECONDS`, and the `is_relay_active()` check inside `_upload_dashcam_files()`.
- `templates/dash.html` / `static/js/dash.js`: the "Relay via phone" card and all its JS
(`relayOneFile`, `fetchChunkWithRetry`, `uploadChunkWithRetry`, heartbeat timers, etc).
- `server/app.py`: the CORS `after_request` hook was added solely for the phone's cross-origin
browser calls — remove it too (the Pi's own Python `requests`-based client was never
subject to CORS, that's a browser-only enforcement mechanism).
- Keep untouched: the chunked upload protocol itself (`/api/v1/dashcam/upload/chunk` +
`/status`), `dashcam_hash_cache` table (still used by the Pi's own background uploader to
avoid rehashing its 20GB+ backlog every loop), `DASHCAM_CHUNK_SIZE`/Cloudflare 100MB
workaround - none of that is relay-specific.
`/api/dash/relay/heartbeat`, `/api/dash/relay/stop`, `/api/dash/relay/mark_uploaded` routes
(and the now-unused `os`/`send_file`/`abort`/`safe_join` imports they needed).
- `modules/app_upload.py`: `list_pending_dashcam_files()`, `relay_heartbeat()`/`relay_stop()`/
`is_relay_active()`, `RELAY_LEASE_SECONDS`/`_relay_lease_until`, and the `is_relay_active()`
check inside `_upload_dashcam_files()`/`get_status()`.
- `templates/dash.html`: the "Relay via phone" card.
- `static/js/dash.js`: all relay JS (`relayOneFile`, `fetchChunkWithRetry`,
`uploadChunkWithRetry`, heartbeat timers, pending-file list rendering, etc).
- `server/app.py`: the CORS `after_request` hook, added solely for the phone's cross-origin
browser calls (the Pi's own Python `requests`-based client was never subject to CORS - that's
a browser-only enforcement mechanism).
- Kept untouched, as planned: the chunked upload protocol itself
(`/api/v1/dashcam/upload/chunk` + `/status`), `dashcam_hash_cache` table + `_hash_dashcam_file()`
(still used by the Pi's own background uploader to avoid rehashing its 20GB+ backlog every
loop), `DASHCAM_CHUNK_SIZE`/Cloudflare 100MB workaround - none of that is relay-specific.
**Verified**: `python3 -m py_compile` on all touched Python files, `node --check` on `dash.js`,
grepped all five touched files for any leftover `relay`/`RELAY` reference (none found). Smoke-
tested by actually importing `app.py` in a scratch venv and hitting it with Flask's test client:
app imports cleanly (GPS/OBD/SQL/upload startup all log their normal "no hardware" messages, no
crash), `app.url_map` confirms every relay route is gone while `/`, `/dash`, `/dtc`, and the
remaining dashcam/upload API routes are still registered, and both `/` and `/dash` render with
HTTP 200 (`/dash`'s HTML contains zero occurrences of "relay").
### Phase 13: Power-loss resilience & watchdog — 🚧 PLANNED
**New phase, not code-dependent on anything else — OS/hardware-level, can be done anytime,