Bundle Manrope, fix the offload cap, and prune superseded rows - #168
Conversation
google_fonts fetched Manrope from fonts.gstatic.com on first launch, before the consent screen and contrary to PRIVACY.md. The family is now bundled the same way Barlow Condensed already was, and the dependency is gone. A test fails if either regresses. PRIVACY.md said routes are never sent anywhere but did not mention that drawing a map downloads tiles from CARTO, which reveals the area on screen. Documented, along with the stale pubspec comment that still credited tile.openstreetmap.org.
The cap counted every auto-continue round, so one background wake drained about six rounds no matter how far behind the strap was. It now counts only consecutive rounds that banked nothing; a round that persisted records and advanced the trim token resets it. A 10-minute ceiling bounds the run, which is the limit that actually applies on a background wake.
idx_decoded_rr_ts(rr_ts_ms) was a strict prefix of the (rr_ts_ms, beat_index) unique index, so it served no query the wider index could not, and cost a second b-tree write per beat on the hottest path. A test asserts the planner still uses an index, with no temp b-tree, for the rr_ts_ms range scan. sleep_session_candidates and wake_day_features are keyed (day_id, algo_version), so every kAlgoVersion bump added a generation and nothing removed the old one. Two generations are kept, so a rollback to the previous build still finds rows to read.
A local `flutter pub get` with pubspec_overrides.yaml present rewrites the tracked lock to `path: ../analytics` and drops the resolved-ref, so the lock no longer records which sibling commit was tested. Any local build or test run triggers it, and it has reached main. The guard runs before `pub get` and fails on a path source, or when the lock's resolved-ref does not match the ref pinned in pubspec.yaml — the drift that let a release cite an analytics change its pinned SHA did not contain.
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
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 |
PR Reviewer Guide 🔍(Review updated until commit 4cf736e)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 4cf736e Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 4cf736e
Suggestions up to commit 7cd5d11
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
test/no_runtime_font_fetch_test.dart (1)
28-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the font families the theme actually uses.
The hardcoded list still passes if a new
fontFamilyis added to the type scale without a matchingflutter.fontsentry. Derive the referenced families fromlib/theme(or a shared font-family constant) and assert each is bundled. As per coding guidelines, “Behavior changes, especially regressions … must include regression tests.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/no_runtime_font_fetch_test.dart` around lines 28 - 34, Update the test “every family the type scale uses is bundled” to derive the expected font families from the theme definitions in lib/theme or a shared font-family constant, rather than hardcoding Manrope and Barlow Condensed. Compare every referenced family against pubspec.yaml’s flutter.fonts entries and retain the regression assertion that all theme-used families are bundled.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/test.yml:
- Around line 51-57: Update the workflow guard preceding the flutter pub get
step to explicitly fail when pubspec_overrides.yaml exists, before dependency
installation runs. Preserve the existing committed pubspec.lock sibling-commit
pin validation, and ensure either condition blocks the job rather than allowing
Flutter to use local path overrides.
In `@lib/ble/ble_engine.dart`:
- Around line 2553-2575: Reset the productive streak state before calling
BackfillContinuation.shouldAutoContinue in lib/ble/ble_engine.dart lines
2553-2575, so productive offloads are evaluated with a cleared
consecutive-unproductive count; increment only when an allowed continuation is
unproductive, and clear both auto-continuation run-state fields when the run
ends. Add a stateful regression in test/sync_policy_test.dart lines 207-214
covering a capped unproductive streak followed by a productive offload that must
continue.
In `@PRIVACY.md`:
- Around line 72-74: Update the RouteMapView privacy wording in PRIVACY.md to
replace “only while a map is on screen” with language stating that it occurs
while the map is active or open, while preserving the surrounding disclosures.
In `@pubspec.yaml`:
- Around line 90-91: Update the tile-provider note in the pubspec configuration
comment to say v1 uses live CARTO tiles instead of live OSM tiles, keeping it
consistent with the CARTO provider documented nearby.
---
Nitpick comments:
In `@test/no_runtime_font_fetch_test.dart`:
- Around line 28-34: Update the test “every family the type scale uses is
bundled” to derive the expected font families from the theme definitions in
lib/theme or a shared font-family constant, rather than hardcoding Manrope and
Barlow Condensed. Compare every referenced family against pubspec.yaml’s
flutter.fonts entries and retain the regression assertion that all theme-used
families are bundled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0723da88-1d02-45f6-b267-979c09bcc25d
⛔ Files ignored due to path filters (6)
assets/fonts/Manrope/Manrope-400.ttfis excluded by!**/*.ttfassets/fonts/Manrope/Manrope-500.ttfis excluded by!**/*.ttfassets/fonts/Manrope/Manrope-600.ttfis excluded by!**/*.ttfassets/fonts/Manrope/Manrope-700.ttfis excluded by!**/*.ttfassets/fonts/Manrope/Manrope-800.ttfis excluded by!**/*.ttfpubspec.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
.github/workflows/test.ymlPRIVACY.mdassets/fonts/Manrope/OFL.txtlib/ble/ble_engine.dartlib/compute/derivation_engine.dartlib/data/db.dartlib/sync/sync_policy.dartlib/theme/theme.dartpubspec.yamltest/db_storage_hygiene_test.darttest/no_runtime_font_fetch_test.darttest/sync_policy_test.dart
The streak was reset inside the continue branch, so once it reached the cap the gate saw the stale count and refused the very round that had just banked records. Run state moved into a pure AutoContinueRun so the ordering is testable; a capped streak followed by a productive round now continues, and ending a run restores the full budget. The CI pin guard also fails when pubspec_overrides.yaml is present, since pub get would pick it up and stop testing the pinned SHAs. PRIVACY.md said tiles are fetched only while a map is on screen; RouteMapView is also mounted to render the share image. Corrected, along with a pubspec comment that still said OSM tiles.
b37d1fe to
4cf736e
Compare
|
Persistent review updated to latest commit 4cf736e |
1 similar comment
|
Persistent review updated to latest commit 4cf736e |
User description
Four independent changes.
Manrope is bundled.
google_fontsfetched it from fonts.gstatic.com onfirst launch — before the consent screen, and contrary to PRIVACY.md, which
says the only thing sent automatically is Firebase. It is now bundled the way
Barlow Condensed already was, and the dependency is gone. Verified in the
compiled bundle: FontManifest lists Manrope with all 5 weights. A test fails
if the import, the dependency, or a font asset comes back.
PRIVACY.md names the tile provider. It said routes are never sent
anywhere, without mentioning that drawing a map downloads tiles from CARTO,
which tells CARTO which area is on screen. Also corrects the pubspec comment
that still credited tile.openstreetmap.org.
The auto-continue cap no longer stops a productive offload. It counted
every round, so one background wake drained about six rounds regardless of
backlog. It now counts only consecutive rounds that banked nothing; a round
that persisted records and advanced the trim token resets it. A 10-minute
ceiling bounds the run, which is the limit that actually applies on a
background wake.
Storage.
idx_decoded_rr_ts(rr_ts_ms)was a strict prefix of the(rr_ts_ms, beat_index)unique index, so it served no query the wider indexcould not while costing a second b-tree write per beat. A test asserts the
planner still uses an index, with no temp b-tree.
sleep_session_candidatesand
wake_day_featuresare keyed(day_id, algo_version), so everykAlgoVersion bump added a generation and nothing removed the old one; two
generations are now kept, so a rollback to the previous build still finds rows.
CI guards the sibling pins. A local
flutter pub getwithpubspec_overrides.yamlpresent rewrites the tracked lock topath: ../analyticsand drops the resolved-ref. It happened while preparingthis branch — a
flutter buildre-triggered it after the lock was cleaned —so the guard is here because it was needed. It fails on a path source, and on
lock/pubspec ref drift, which is what let a release cite an analytics change
its pinned SHA did not contain.
No kAlgoVersion bump: nothing here changes an analytics output.
Tests: 1051 pass.
flutter analyzeclean.PR Type
Bug fix, Enhancement, Tests
Description
Bundle Manrope font locally, removing
google_fontsruntime HTTP fetch before consent screenFix auto-continue offload cap: only unproductive rounds spend the budget; add 10-minute wall-clock ceiling
Drop redundant
idx_decoded_rr_tsindex; prune superseded per-day intermediate table generationsAdd CI guard to fail when
pubspec.lockresolves sibling packages from local paths instead of pinned SHAsDiagram Walkthrough
File Walkthrough
3 files
Replace all GoogleFonts.manrope calls with bundled local fontTrack wall-clock start; reset unproductive count on productive roundAdd time ceiling; rename count to unproductive-only semantics1 files
Remove google_fonts dep; declare bundled Manrope font assets2 files
Drop redundant rr index; add pruneSupersededIntermediates methodCall pruneSupersededIntermediates during maintenance prune pass3 files
Tests for dropped index and intermediate generation pruningTests asserting no google_fonts import and all families bundledAdd tests for time ceiling and productive-round cap bypass1 files
Add CI step to guard sibling lock pins against local path drift2 files
Disclose CARTO map tile fetches and IP exposureAdd SIL Open Font License for bundled Manrope familySummary by CodeRabbit
Privacy
Improvements
Fonts
Quality