Fix #170: cycling/rowing workouts weren't being suggested - #171
Conversation
autoDetectWorkouts' motion-confirmation gate was tuned for arm-swing activities and silently dropped every low-limb-swing cardio window (cycling/rowing — wrist stays still on a handlebar/oar) regardless of HR signal strength. Repins to analytics#32 (fix/issue-170-...), which adds an HR-onset bypass instead of loosening the raw %HRR bar (that was tried and rejected upstream — it reopens false positives from fever/anxiety/heat plateaus). kAlgoVersion 50 -> 51 (analytics-output change: which suggestions autoDetectWorkouts emits). PR branch head, not main — analytics#32 is still open. Repin to the merge commit once it lands.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR increments the derivation algorithm version to 51 and pins ChangesWorkout detection analytics
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 52b8e9b)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 52b8e9b
Previous suggestionsSuggestions up to commit 4976e60
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@pubspec.yaml`:
- Around line 60-61: Update the openstrap_analytics dependency pin in
pubspec.yaml to a full commit SHA containing the upstream three-minute
onset-window correction, replacing the current
422c8b8b9631770b07bc571b6fbe904ef59e5052 reference. Keep the dependency source
and surrounding configuration unchanged.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5a4e4c62-b553-477d-b6e3-e17203cc2ace
⛔ Files ignored due to path filters (1)
pubspec.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
lib/compute/derivation_engine.dartpubspec.yaml
|
Persistent review updated to latest commit 52b8e9b |
User description
Fixes #170.
Root cause
autoDetectWorkouts's motion-confirmation gate (motionConfirmMean = 0.15, mean L2 gravity-delta/s) is tuned for arm-swing activities like walking/running. It unconditionally drops any sustained-elevated-HR window where the wrist stays still — exactly what happens gripping a handlebar/oar during cycling/rowing — regardless of how strong the HR signal is. That's why a real 1h50m road cycling session (avg ~117W, HR 100-140, peak 157 bpm) produced no suggestion at all.Fix
mainonce that merges):AutoWorkoutDetectornow bypasses the motion gate on a genuine HR onset — mean bpm over the first 3 min of the candidate span must rise ≥25 bpm vs. the 3 min immediately before it (Whipp & Wasserman 1972 phase-II kinetics: real exertion shows a fast HR rise right at onset).kAlgoVersion50 → 51 (this changes which suggestionsautoDetectWorkoutsemits).Test plan
dart testin analytics — 386 passed, no failures (see analytics#32 for the new onset-gate tests).flutter test --concurrency=1— 1055 passed, no regressions.flutter analyze— clean.pubspec.lockresolved-refmatches) withpubspec_overrides.yamlmoved aside, per the repo's CI-reproduction convention.PR Type
Bug fix
Description
Fixes cycling/rowing workouts never being auto-detected (issue Auto-detect misses 1h50m road cycling session despite peak HR 157 bpm #170)
Repins
openstrap_analyticsto PR-branch head of analytics#32 (HR-onset bypass)Bumps
kAlgoVersion50 → 51 (changesautoDetectWorkoutssuggestions output)Diagram Walkthrough
File Walkthrough
derivation_engine.dart
Bump kAlgoVersion to 51 for workout detection fixlib/compute/derivation_engine.dart
kAlgoVersionfrom 50 to 51cycling/rowing detection
to main
pubspec.yaml
Repin analytics to HR-onset bypass PR-branch headpubspec.yaml
openstrap_analyticsgit ref from5d421918...(analytics#31 tip)to
422c8b8b...(analytics#32 PR-branch head)be repinned to merge commit once analytics#32 lands
onsetRiseBpmpresencein
auto_detect.dart)Summary by CodeRabbit