fix(health): aggregate steps + active calories as daily snapshots, not sums + refreshed screenshots#37
Merged
Conversation
…t sums
Verified against the live store: the bridge reports steps and active_calories
as cumulative daily-total snapshots — same midnight start_time, re-pushed
through the day with a growing end_time. Because dedup keys on end_time, every
snapshot persists, and the old per-day SUM multiplied the real total by the
number of snapshots:
2026-06-08 steps: real 4,607 -> summed 40,674 (~9x)
2026-06-10 steps ("today"): real 330 -> summed 725
2026-06-08 active calories: real 263 -> summed ~1,315
Aggregate per (day, start_time) taking the MAX, then sum across distinct
start_times per day. Correct for both re-reported daily snapshots (one start ⇒
final total) and genuine sub-day intervals (distinct starts ⇒ summed). Fixes
the long-standing steps inflation and keeps the new active-calories series
honest. Tests cover both shapes.
Also regenerates all assets/ screenshots at 1280×900 from a live-data preview
(deep-sleep stages now render, Resting HR populated via the min proxy, Active
Calories tile + chart, corrected steps) and adds a Muscle Balance screenshot
for the new Sets/Volume toggle. README screenshot table updated to match.
Co-Authored-By: Claude Opus 4.8 <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.
Summary
While generating screenshots for the prior fixes I caught a real data bug. The Android bridge reports steps and active_calories as cumulative daily-total snapshots — same midnight
start_time, re-pushed through the day with a growingend_time. Since dedup keys onend_time, every snapshot persists, and the previous per-day SUM multiplied the real total by the number of snapshots.Verified against the live store:
Fix
Aggregate per
(day, start_time)taking the MAX, then sum across distinct start_times per day. Correct for both:This fixes the long-standing steps inflation and keeps the new active-calories series honest. New tests cover both shapes (
TestAggregateHealthCumulativeSnapshots,TestAggregateHealthDistinctIntervalsSum).Screenshots
All
assets/*.pngregenerated at 1280×900 from a live-data preview (deep-sleep stages render, Resting HR populated via the min proxy, Active Calories tile + chart, corrected step counts). Addedscreenshot-stats-balance.pngfor the new Sets/Volume toggle; README table updated.🤖 Generated with Claude Code