fix reconciled-orphan health export leak + stale telemetry docs - #313
fix reconciled-orphan health export leak + stale telemetry docs#313abdulsaheel wants to merge 1 commit into
Conversation
the round-3 fix only skipped the direct export call for a crash-orphaned workout, but the periodic exportAll pass still picked it up minutes later since nothing marked the row as having a fake end_ts. flag it (end_ts_fabricated) and skip it in _writeOneWorkout too. also fixed README/SECURITY claiming diagnostics telemetry is on by default on github builds - it's opt-in/off everywhere, matches PRIVACY.md and the actual code.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThe PR closes a periodic-export leak for crash-orphaned workouts by persisting and enforcing a fabricated end-timestamp marker, adds regression tests for the full behavior, and updates privacy documentation to state that diagnostics telemetry is disabled by default in every build. Sequence diagram for preventing fabricated workout exportsequenceDiagram
participant AppState
participant LocalDb
participant HealthExporter
participant Health
AppState->>LocalDb: putSession(status=done, end_ts, end_ts_fabricated=1)
HealthExporter->>HealthExporter: exportAll()
HealthExporter->>HealthExporter: _writeOneWorkout()
alt end_ts_fabricated == 1
HealthExporter-->>HealthExporter: skip
else real completed workout
HealthExporter->>Health: write workout
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the flag is set incorrectly, a legitimate workout could be skipped from Health export, but the session remains locally stored and can be repaired or re-exported after correcting the flag. Reverting restores the prior export behavior, while the existing fabricated-workout leak is not harm introduced by this change.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
squashed into #314 for one clean review — closing this round. |
User description
round 3 only skipped the direct exportWorkoutId call for a crash-orphaned live workout, but the periodic exportAll pass still picked the row up a few minutes later since nothing on it said the end_ts was fake. added an end_ts_fabricated flag set at reconcile time and checked in _writeOneWorkout so it's skipped everywhere, not just that one call site.
also fixed README.md and SECURITY.md saying diagnostics telemetry is "on by default in github release builds" - it isn't, it's off by default everywhere until you flip it in settings, code and PRIVACY.md both already agreed on that.
Summary by Sourcery
Prevent fabricated completion times from leaking into health exports and align telemetry documentation with the actual opt-in behavior.
Bug Fixes:
Documentation:
Tests:
PR Type
Bug fix, Documentation, Tests
Description
Prevents crash-orphaned workouts with fabricated end times from leaking into Apple Health or Health Connect during periodic exports.
Adds a database migration appending the
end_ts_fabricatedcolumn to thesessionstable to persistently flag reconciled orphans.Updates
README.mdandSECURITY.mdto accurately reflect that diagnostics telemetry is disabled by default across all builds.Diagram Walkthrough
File Walkthrough
1 files
Adds end_ts_fabricated column to sessions table2 files
Skips health export for workouts with fabricated end timesFlags reconciled stale live workouts with end_ts_fabricated2 files
Adds assertion for end_ts_fabricated flag on stale orphansAdds test verifying fabricated workouts are not exported2 files
Corrects telemetry default state documentationCorrects telemetry default state documentation