From 4976e60afb3176878b8ac4aaedc891e0eead5043 Mon Sep 17 00:00:00 2001 From: abdulsaheel Date: Fri, 31 Jul 2026 22:40:49 +0530 Subject: [PATCH 1/2] Fix #170: repin analytics for the cycling/rowing workout-detection fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- lib/compute/derivation_engine.dart | 14 +++++++++++++- pubspec.lock | 4 ++-- pubspec.yaml | 17 ++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/compute/derivation_engine.dart b/lib/compute/derivation_engine.dart index 526c6e8..61b0d0b 100644 --- a/lib/compute/derivation_engine.dart +++ b/lib/compute/derivation_engine.dart @@ -350,7 +350,19 @@ import 'substrate.dart'; // green: steps.dart carries the new step API, rr_correction.dart has the // signed-dRR `seg.add(x[k])`, advanced_stager.dart has maxAccelCarryForwardSec, // live.dart has kKnownRecordVersions. -const int kAlgoVersion = 50; + +// v51: edge#170 — autoDetectWorkouts' motion-confirmation gate (tuned for +// arm-swing activities) silently dropped every low-limb-swing cardio window +// (cycling/rowing: the wrist stays still on a handlebar/oar) no matter how +// strong the HR signal was. analytics#32 (PR-branch head, pinned above — +// repin to main once merged) adds an HR-ONSET bypass: the gate is skipped +// only when mean bpm over the candidate's first 3 min rises >=25 bpm versus +// the 3 min immediately before it (Whipp & Wasserman 1972 phase-II kinetics), +// which fires on genuine exercise starts but NOT on slow-drifting elevations +// (fever/heat/anxiety) that have no discernible onset — so this changes which +// suggestions autoDetectWorkouts emits without loosening the false-positive +// gate it exists to protect. +const int kAlgoVersion = 51; /// Raw is kept this many days past derivation, then pruned (derived stays). const int rawRetentionDays = 3; diff --git a/pubspec.lock b/pubspec.lock index 8d09bdf..028d006 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -964,8 +964,8 @@ packages: dependency: "direct main" description: path: "." - ref: "5d421918b5111f0158ccdfd9fa7f99eda1fa87b4" - resolved-ref: "5d421918b5111f0158ccdfd9fa7f99eda1fa87b4" + ref: "422c8b8b9631770b07bc571b6fbe904ef59e5052" + resolved-ref: "422c8b8b9631770b07bc571b6fbe904ef59e5052" url: "https://github.com/OpenStrap/analytics.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index aba1ca9..2493747 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,13 +49,16 @@ dependencies: openstrap_analytics: git: url: https://github.com/OpenStrap/analytics.git - # Tip of analytics main — OpenStrap/analytics#31 merged: cardioStager's - # per-epoch robustZ scale is now computed once per night instead of - # re-sorted every epoch (reviewed for DST/incremental-drain staleness — - # none found; it's a pure perf hoist). - # Verified present at THIS sha, not assumed from the PR being merged: - # cardio_stager.dart builds a RobustScale once and robustZ delegates to it. - ref: 5d421918b5111f0158ccdfd9fa7f99eda1fa87b4 + # PR-BRANCH HEAD, not main — OpenStrap/analytics#32 (fix/issue-170-...) + # is open, not yet merged. Repin to the merge commit on main once it + # lands (same pattern v49 used briefly for protocol/analytics PR heads). + # autoDetectWorkouts now bypasses the motion-confirmation gate on a + # genuine HR-onset (fast rise vs. immediately-preceding baseline), + # fixing low-limb-swing cardio (cycling/rowing) going undetected while + # still rejecting slow-drifting elevations (fever/heat/anxiety) that + # have no discernible onset. + # Verified present at THIS sha: `git show :lib/src/onehz/workout/auto_detect.dart | grep onsetRiseBpm`. + ref: 422c8b8b9631770b07bc571b6fbe904ef59e5052 # BLE — flutter_blue_plus is the maintained cross-platform GATT client. flutter_blue_plus: ^1.36.8 From 52b8e9bf574739dfd08d14118efd6c01bd49411c Mon Sep 17 00:00:00 2001 From: abdulsaheel Date: Fri, 31 Jul 2026 22:46:57 +0530 Subject: [PATCH 2/2] Repin analytics to fix/issue-170 branch head after off-by-one fix --- pubspec.lock | 4 ++-- pubspec.yaml | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 028d006..bd6ebe1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -964,8 +964,8 @@ packages: dependency: "direct main" description: path: "." - ref: "422c8b8b9631770b07bc571b6fbe904ef59e5052" - resolved-ref: "422c8b8b9631770b07bc571b6fbe904ef59e5052" + ref: cbbe06addec1cb78b4ea2c75f64e8a281ac09294 + resolved-ref: cbbe06addec1cb78b4ea2c75f64e8a281ac09294 url: "https://github.com/OpenStrap/analytics.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2493747..2b5c900 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,7 +58,10 @@ dependencies: # still rejecting slow-drifting elevations (fever/heat/anxiety) that # have no discernible onset. # Verified present at THIS sha: `git show :lib/src/onehz/workout/auto_detect.dart | grep onsetRiseBpm`. - ref: 422c8b8b9631770b07bc571b6fbe904ef59e5052 + # Moved to the branch's new head (cbbe06a) after CodeRabbit caught a real + # off-by-one in the onset window on analytics#32 (earlyMean was 181s vs + # preMean's 180s) — fixed there, not worth a separate edge changelog line. + ref: cbbe06addec1cb78b4ea2c75f64e8a281ac09294 # BLE — flutter_blue_plus is the maintained cross-platform GATT client. flutter_blue_plus: ^1.36.8