Upgrade weight-only raw Wi-Fi syncs when the full body-comp record arrives#49
Merged
Conversation
…rives; 1.7.20 The raw Wi-Fi fallback syncs a weight-only measurement when the phone app hasn't processed a weigh-in yet. When the app later processes the same weigh-in, the processed record either duplicated the day in Garmin (ids differ) or was skipped as already synced, stranding the user on weight-only (ids match). Raw measurements are now flagged weight_only in the sync database. When a full record arrives for a local date with a pending weight-only sync, the weight-only Garmin entry is deleted (matched by weight, fail-open) and the full record uploads in its place. Fixes #48 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #48.
The problem
The raw Wi-Fi fallback (#46) syncs a weight-only measurement when the phone app hasn't processed a weigh-in yet. If the user later opens the app, the same weigh-in comes back as a processed record with full body composition, and one of two bad things happened:
The fix
One mechanism covers both cases:
weight_onlyflag, stored in the sync database (with a migration for existing databases; old rows all predate the raw fallback, so they are correctly treated as full records).If the delete fails, the upload proceeds anyway. Worst case is the duplicate we already had, and the body comp still lands.
Tests
13 new tests across all four layers (parser flag, state tracking and migration, Garmin delete, and full sync flows for both failure modes plus regression guards for the corrected re-weigh and other-source cases). 277 pass.
🤖 Generated with Claude Code