Skip to content

Add Supabase cloud telemetry and shared observer sessions - #2

Merged
nickessler2004 merged 1 commit into
mainfrom
feat/supabase-cloud-integration
Oct 28, 2026
Merged

nickessler2004 merged 1 commit into
mainfrom
feat/supabase-cloud-integration

Conversation

@nickessler2004

Copy link
Copy Markdown
Owner

Observers can now sign in to Supabase, view authorized driving sessions, follow source-timestamped GPS routes, and receive historical threshold events from three IMUs in real time. Cloud records persist between visits and are shared with explicit read-only observers. Local live simulation and event-only preview remain available without project configuration.

  • Add a versioned migration for sessions, observers, GPS points, threshold events, gateway connection history, and per-IMU T1/T2 configuration. RLS scopes all six tables; owner-checked RPCs control writes and sharing. Realtime publishes five data tables and deliberately excludes sensitive membership changes.
  • Use public publishable/anon frontend configuration plus authenticated user sessions; reject known privileged keys at build time and runtime. Add email/password sign-up/sign-in, confirmation handling, persistent auth, and race-safe sign-out/session switching.
  • Store append-only, idempotent packets with stable UUIDs/sequences, source/receipt timestamps, event threshold snapshots, atomic validation, and closed-session bounds. Reordered/delayed data cannot overwrite history or move the current GPS fix backward. Paginated snapshot reloads and reconnection/reconciliation recover missed notifications.
  • Show live GPS routes and supplied event locations. Separate observer Realtime, GPS freshness (5s), and gateway heartbeat freshness (15s). All cloud IMU current-motion statuses remain unknown/gray: threshold events never fabricate continuous acceleration or infer green from silence.
  • Preserve green A < T1, yellow T1 ≤ A ≤ T2, red A > T2. Support independently persisted configuration for IMUs 1–3 without reclassifying historical event snapshots.
  • Add an owner-controlled cloud test drive for sessions permanently labeled simulated: GPS approximately 1 Hz, heartbeat approximately 5s, sparse threshold events cycling across three IMUs, serialized writes and a bounded idempotent retry queue. Device sessions never receive generated fallback data. No driver phone application or ESP32 firmware is implemented.
  • Document project creation, migration application, Auth/redirect setup, public environment variables, Realtime publication, sharing/revocation, future telemetry RPC payloads, and a two-observer acceptance checklist. Include a cloud screenshot explicitly generated from test fixtures.

Validation completed:

  • npm run build — TypeScript and optimized production build; cloud UI/SDK are loaded on demand.
  • npm test — 80 passing tests, including 11 tests executing the actual migration and RLS in PostgreSQL/PGlite, plus domain, repository, uploader, and auth/session lifetime checks.
  • npm run test:e2e — 23 passing Chromium tests: local demonstrations plus mocked Supabase auth/HTTP/Realtime, two authorized observers, persistent reloads, stale backlog, duplicates/out-of-order records, owner/read-only actions, approximately 1 Hz uploads, and 390px mobile layout.
  • npm run format:check, git diff --check, credential-free production-browser smoke test, and an explicit privileged-key build-rejection check.

No hosted Supabase project was created, migrated, or verified. SQL tests use test-only auth fixtures; browser tests intercept a nonfunctional Supabase test hostname. The user must apply the migration and configure their own project's public URL/key and Auth settings using docs/SUPABASE_SETUP.md. Production deployment, phone gateway, firmware, and a durable phone-side offline outbox are outside this change. Very long sessions may benefit from incremental snapshot/retention optimization later.

@nickessler2004
nickessler2004 merged commit dfe052e into main Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants