fix: sync-freshness banner, burst validation, and UI/UX polish - #39
Merged
Merged
Conversation
Fixes a persistent "last data > 1hr behind" regression: the freshness signal only ever read decoded_onehz's max timestamp (misses R10-lite records) and only ever refreshed at app boot; now reads the rec_ts_hw sync cursor and refreshes on every successful persist (onDataStored), foreground or background. Also makes HISTORY_END packet-count validation advisory instead of a hard gate — a mismatch used to discard an entire buffered chunk and re-request it forever, since the band's reported count and our tally don't have fully-confirmed semantics; every buffered record already passed CRC32 + plausibility checks, so a count mismatch was never real evidence of bad data. UI/UX: Profile screen gets a working back button (AppScaffold) and drops decorative icons + the Storage section; Today screen fixes a list-reflow glitch behind the freshness banner (stable keys) and adds context to the weekly steps card; MetricRow drops its per-row icon (icon spam) and fixes numeric clipping (FittedBox, never ellipsis); Journey/Timeline merge into one multi-vital lookback; workout-type icons wired through a new shared workout_types.dart seam.
abdulsaheel
added a commit
that referenced
this pull request
Aug 7, 2026
Five conflicted files, all reconciled to keep BOTH sides' intent rather than picking a winner. kAlgoVersion / changelog. Both branches wrote a v55 and a v56 with different content: main's are the nap + strain work (#204), this branch's are the step and movement-minute rebuild. Main's stay as history; this branch's three entries are renumbered 55/56/57 -> 57/58/59 and the constant becomes 59. Strict monotonicity is load-bearing, not cosmetic -- the derive gate matches algo_version EXACTLY while the read seam serves MAX(algo_version), so a version that goes backwards writes rows nobody reads and re-derives forever. Note: git had silently DROPPED this branch's v57 entry (the absent-steps tier/labelling follow-up) when resolving the overlapping tail toward main. It is restored here as v59; the code it documents was never lost, only its changelog. Analytics pin. Neither side was right: HEAD had #35's PR-BRANCH head (38a8636, never on main) and main had the older #38 merge (c3a30be). Now 1fb34dce = analytics main @ #35 merge, which carries all three hops this release needs -- #38 (nap detector), #39 (the awake-HR baseline P0 that shipped inside #38), and #35 (the sibling half of THIS branch). Verified against the SHA: absent `dailyStepEstimate`, present `dailyActiveMinutes`. Health export delete list. The two intents compose rather than conflict, so `_rewriteTypes` is now `healthDeleteTypes(isApplePlatform:)` MINUS STEPS: * main's helper drops the sleep types and HEART_RATE on Android, where the native SleepSessionRecord writer and the minute-HR batch own their cleanup; * STEPS comes off on top, because nothing writes steps any more -- deleting a type we never write would run on every re-export of the not-yet-finalized tail forever, and a false `delete()` flips `success`, so it could stall a day's export cursor permanently. The historical fabricated samples are handled once by `_purgeLegacyStepsIfNeeded`, outside success accounting. Also kept main's Android sleep-session write alongside this branch's one-shot purge, and kept this branch's removal of the steps EXPORT (writing our derived copy back would double-count against the phone's own HealthKit pedometer rows, which we now read). healthSyncNow. Composed: the export runs through main's single-flight guard, and the phone-steps sync stays gated on `phoneStepsEnabled`. flutter analyze clean; full suite 1324 passing, 0 failing.
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
AppState.lastRecordAt) only ever readdecoded_onehz's max timestamp (misses R10-lite historical records, which land insamplesinstead) and only ever refreshed once at app boot. Now reads therec_ts_hwsync cursor (the same frontier RecordGate/backfill policies already trust) and refreshes on every successful persist via the existingonDataStoredhook — covers foreground bursts, background/headless drains, and live-triggered stores uniformly, with no race window against the async commit.burstPacketCountMatchesas a small pure/testable function plus regression tests covering the real failure shape observed in the field.AppScaffold), dropped ~6 decorative/meaningless icons from personal-info rows (Sex→heart, Height→activity, etc.) and the "Storage" section (static notice, no content).Keys. Weekly steps card relabeled with context ("Steps goal (week)").MetricRow(shared "label left, value right" row powering Sleep/Heart/Respiratory/Skin-temp trend lists): dropped the per-row leading icon (repetitive across a whole screen of rows) and fixed numeric clipping — value now shrinks viaFittedBoxinstead of silently ellipsizing.lib/ui/workouts/workout_types.dartseam, replacing three divergent per-screen icon tables.pubspec.lockagainst real git-ref dependencies (was accidentally committed with local path overrides baked in — CI has never actually tested this state since the regression landed).Test plan
flutter analyzeclean (only the pre-existingglassBoxReadinessdeprecation baseline)flutter test --concurrency=1→ 376/376 pass, including 4 new regression tests for the burst-validation fixmain-branch git-ref dependencies (not local path overrides) — matches what CI resolves