Skip to content

feat: add Firebase Firestore engine telemetry#14

Closed
cortexark wants to merge 2 commits intomainfrom
feat/firebase-telemetry
Closed

feat: add Firebase Firestore engine telemetry#14
cortexark wants to merge 2 commits intomainfrom
feat/firebase-telemetry

Conversation

@cortexark
Copy link
Copy Markdown
Owner

Summary

  • Adds Firebase Firestore SDK (iOS only) for remote engine quality baselining
  • Each dashboard refresh uploads a PipelineTrace with per-engine scores, confidence levels, and timing (never raw HealthKit values)
  • Traces are stored under users/{sha256(appleUserId)}/traces/{autoId} for per-user querying
  • Includes telemetry consent toggle in Settings (always enabled in DEBUG builds)
  • Wires up FirestoreAnalyticsProvider to the existing AnalyticsProvider protocol for general event tracking

New files

File Purpose
iOS/Models/PipelineTrace.swift Trace data model with per-engine sub-structs
iOS/Services/EngineTelemetryService.swift Firestore upload service + SHA256 user ID hashing
iOS/Services/FirestoreAnalyticsProvider.swift AnalyticsProvider → Firestore events

Modified files

File Change
project.yml Add Firebase SPM package (iOS target only)
iOS/ThumpiOSApp.swift Firebase init + telemetry setup at startup
iOS/ViewModels/DashboardViewModel.swift Per-engine timing + trace upload
iOS/Views/SettingsView.swift Telemetry consent toggle

Test plan

  • Create Firebase project and download GoogleService-Info.plist
  • Create Firestore database in Firebase Console
  • xcodegen generate succeeds
  • iOS build passes ✅
  • watchOS build passes (no Firebase dependency) ✅
  • Run on simulator → dashboard refresh → verify trace document in Firestore Console
  • Toggle consent off in Settings → verify no uploads in production mode
  • Verify documents contain only scores/timing, no raw HealthKit values

Add per-engine timing and trace upload to Firestore for remote quality
baselining. Each dashboard refresh records computed scores, confidence
levels, and durations — never raw HealthKit values — tied to a SHA256-
hashed Apple Sign-In user ID.

- Add Firebase SDK (FirebaseFirestore) to iOS target via SPM
- Create PipelineTrace model with per-engine sub-structs
- Create EngineTelemetryService singleton for Firestore uploads
- Create FirestoreAnalyticsProvider for general analytics events
- Instrument DashboardViewModel.refresh() with per-engine timing
- Add telemetry consent toggle in Settings (always on in DEBUG)
- Initialize Firebase and telemetry service at app startup
…l docs

- Add launch free year: all users get full Coach access for 1 year
  from first sign-in with no subscription required
- Add LaunchCongratsView shown once after first sign-in
- Update Settings subscription section to show free year status
  with days remaining instead of upgrade button
- Add Firestore telemetry integration tests that upload mock
  health data through all 9 engines and read back to validate
- Add privacy policy and terms of service covering HealthKit,
  Firebase telemetry, push notifications, and solo dev protections
- Add GoogleService-Info.plist to .gitignore
@cortexark cortexark closed this Mar 15, 2026
@cortexark cortexark deleted the feat/firebase-telemetry branch March 15, 2026 08:48
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.

1 participant