Add partial Health Connect permissions + DB migration retry#241
Merged
Add partial Health Connect permissions + DB migration retry#241
Conversation
Android: - Add HealthConnectPermissions.kt with 6 user-friendly data categories (Activity, Heart & Vitals, Body, Sleep, Nutrition, Reproductive) - Refactor permission state from all-or-nothing boolean to granular grantedPermissions set with derived hasAny/hasAll/categoryStatuses - Redesign sync screen with card-based UI: sync status card, per-category permission cards with individual Grant buttons, Sync Now button - Remove debug-style raw record list - Update background sync worker for partial permissions: filter aggregatable metrics to granted types, skip only if zero permissions - Invalidate changes token when granted types change (forces re-fetch) Backend: - Add schema error detection (42P01 undefined_table, 42703 undefined_column) - Add per-user migration mutex to coalesce concurrent migration attempts - Add automatic migration retry in query() when called with username (not when called with Client directly, preventing infinite recursion) - Login migration remains as eager/happy path; query retry is safety net Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #241 +/- ##
===========================================
+ Coverage 27.20% 27.39% +0.19%
===========================================
Files 175 176 +1
Lines 23517 23642 +125
Branches 2094 2104 +10
===========================================
+ Hits 6397 6476 +79
- Misses 17081 17127 +46
Partials 39 39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Android
HealthConnectPermissions.kt— 6 user-friendly data categories with pure helper functionsMainActivity.kt— Refactored fromhasPermissions: Booleanto granular permission state; card-based sync UI replaces debug record listHealthConnectSyncWorker.kt— Background sync works with partial permissions; filters aggregate metrics to granted typesBackend
connection.ts— Added_isSchemaError,_runMigrationOnce(coalescing mutex), and retry logic inquery()connection.test.ts— 14 unit tests covering schema error detection, mutation coalescing, retry/no-retry pathsTest plan
🤖 Generated with Claude Code