From 4e330d4bd6d6bf7bb92af093aa61b1f3c04e1718 Mon Sep 17 00:00:00 2001 From: Mohammad Abdul Sahil <127765312+abdulsaheel@users.noreply.github.com> Date: Sat, 19 Sep 2026 14:49:48 +0530 Subject: [PATCH 1/3] crossday: wire quantum:1 into glassbox rhr/temp inputs analytics#75 added GlassBoxInput.quantum to guard the SWC 'worth mentioning' gate against quantized baselines (same fix #73 already made to overreaching_conjunction on this same rhr channel). repin + wire quantum:1 on the rhr and temp _glassInput calls, matching readiness_composite's quantum:1 on the same two channels. no kAlgoVersion bump: this only changes whether a driver gets NAMED in glassBoxReadiness's deprecated narrative, not the score. --- lib/compute/crossday_pipeline.dart | 6 +++++- pubspec.lock | 4 ++-- pubspec.yaml | 13 ++++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/compute/crossday_pipeline.dart b/lib/compute/crossday_pipeline.dart index fbf0bf9be..ea633bb4b 100644 --- a/lib/compute/crossday_pipeline.dart +++ b/lib/compute/crossday_pipeline.dart @@ -182,7 +182,8 @@ Map buildCrossDayBundle( final gbInputs = []; final gbRmssd = _glassInput('hrv', rmssdList, ana.wHrv, lowerIsBetter: false); if (gbRmssd != null) gbInputs.add(gbRmssd); - final gbRhr = _glassInput('rhr', rhrList, ana.wRhr, lowerIsBetter: true); + final gbRhr = + _glassInput('rhr', rhrList, ana.wRhr, lowerIsBetter: true, quantum: 1); if (gbRhr != null) gbInputs.add(gbRhr); final gbResp = _glassInput('resp', respList, ana.wResp, lowerIsBetter: true); if (gbResp != null) gbInputs.add(gbResp); @@ -192,6 +193,7 @@ Map buildCrossDayBundle( _absList(tempList), ana.wTemp, lowerIsBetter: true, + quantum: 1, ); if (gbTemp != null) gbInputs.add(gbTemp); // NOT the headline score — `readinessComposite` is, and it is computed @@ -795,6 +797,7 @@ ana.GlassBoxInput? _glassInput( List series, double weight, { required bool lowerIsBetter, + double quantum = 0, }) { if (series.isEmpty || series.last == null) return null; final history = [ @@ -807,6 +810,7 @@ ana.GlassBoxInput? _glassInput( history: history, weight: weight, lowerIsBetter: lowerIsBetter, + quantum: quantum, ); } diff --git a/pubspec.lock b/pubspec.lock index 096af89e7..dd5a96004 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -937,8 +937,8 @@ packages: dependency: "direct main" description: path: "." - ref: eed6dc92375ce1336fc4e31d13a0718f45e163cf - resolved-ref: eed6dc92375ce1336fc4e31d13a0718f45e163cf + ref: "2a624b97303f38877841df9068c72a52b67e5dc9" + resolved-ref: "2a624b97303f38877841df9068c72a52b67e5dc9" url: "https://github.com/OpenStrap/analytics.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 98fcf3aab..db8cfb3f8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -462,7 +462,18 @@ dependencies: # rounding noise. Verified: # `git show eed6dc9:lib/src/onehz/human/overreaching_conjunction.dart | # grep dispersionBelowQuantum` - ref: eed6dc92375ce1336fc4e31d13a0718f45e163cf + # + # analytics PR #75 (branch fix/glassbox-swc-quantum @ 2a624b9): + # readiness_glassbox's SWC gate had the same gap #73 fixed on + # overreaching_conjunction -- glassBoxReadiness does the identical + # 0.5*scale standardization on the same rhr/temp channels edge wires in + # below (`_glassInput('rhr', ...)` / `_glassInput('temp', ...)`), never + # gated by dispersionBelowQuantum. Adds `GlassBoxInput.quantum`. PR open, + # not yet merged to main -- pinned to its branch head SHA directly + # (fixed commit, not a floating ref) since edge's `_glassInput` calls + # below need the new field to pass `quantum: 1`. Re-pin to main once #75 + # merges. Narrative-only change, no kAlgoVersion bump needed. + ref: 2a624b97303f38877841df9068c72a52b67e5dc9 # BLE — flutter_blue_plus is the maintained cross-platform GATT client. flutter_blue_plus: ^1.36.8 From c1d54dcaa669590989e228cb7284ce5ab2cca41f Mon Sep 17 00:00:00 2001 From: Mohammad Abdul Sahil <127765312+abdulsaheel@users.noreply.github.com> Date: Sat, 19 Sep 2026 14:54:45 +0530 Subject: [PATCH 2/3] crossday: drop wrong quantum on temp glassbox input skin_temp_z is already a z-score (onehz_pipeline's skinTempZ, computed against the raw-ADC baseline with its own quantum:1 guard on that raw dispersion before the z exists) -- continuous, not integer-quantized. Applying quantum:1 again here stood the units up wrong, unlike readiness_composite's tempInput which genuinely gets the raw ADC mean. rhr stays quantum:1 (it's whole-bpm raw). caught by review on #441. --- lib/compute/crossday_pipeline.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/compute/crossday_pipeline.dart b/lib/compute/crossday_pipeline.dart index ea633bb4b..b8ac75fbb 100644 --- a/lib/compute/crossday_pipeline.dart +++ b/lib/compute/crossday_pipeline.dart @@ -187,13 +187,17 @@ Map buildCrossDayBundle( if (gbRhr != null) gbInputs.add(gbRhr); final gbResp = _glassInput('resp', respList, ana.wResp, lowerIsBetter: true); if (gbResp != null) gbInputs.add(gbResp); - // temp: use absolute z so "further from your baseline" is worse. + // temp: use absolute z so "further from your baseline" is worse. `tempList` + // here is `skin_temp_z` — already a z-score against the raw-ADC baseline + // (onehz_pipeline.dart's `skinTempZ`, which has its OWN quantum:1 guard on + // the raw-ADC dispersion before the z is computed at all). It's continuous, + // not integer-quantized, so no quantum here (unlike readiness_composite's + // `tempInput`, which is fed the raw ADC mean and genuinely needs quantum:1). final gbTemp = _glassInput( 'temp', _absList(tempList), ana.wTemp, lowerIsBetter: true, - quantum: 1, ); if (gbTemp != null) gbInputs.add(gbTemp); // NOT the headline score — `readinessComposite` is, and it is computed From 385675d338fa5e4a325426d902b8b8b3cb0ae05f Mon Sep 17 00:00:00 2001 From: Mohammad Abdul Sahil <127765312+abdulsaheel@users.noreply.github.com> Date: Sat, 19 Sep 2026 15:02:12 +0530 Subject: [PATCH 3/3] repin analytics to #75's merged main sha, bump kAlgoVersion to 95 updated kAnalyticsPin/pubspec ref from the branch-head pin to the merged main sha now that analytics#75 landed. also bumping kAlgoVersion since this changes the stored readiness_glassbox drivers list for real users, even though it's narrative-only not a headline score change - caught by db_serve_version_and_reads_test's pin/version consistency check. --- lib/compute/derivation_engine.dart | 14 ++++++++++++-- pubspec.lock | 4 ++-- pubspec.yaml | 25 ++++++++++++++----------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/lib/compute/derivation_engine.dart b/lib/compute/derivation_engine.dart index b0e89730b..e0dc49cb2 100644 --- a/lib/compute/derivation_engine.dart +++ b/lib/compute/derivation_engine.dart @@ -1690,7 +1690,17 @@ import 'substrate.dart'; // illness_cusum/readiness_composite/event_detection. Without it, a 1bpm rise // could clear the gate and fire the "both facts point the same way" card on // nothing. kAnalyticsPin repinned to analytics PR #73's merged main SHA. -const int kAlgoVersion = 94; +// +// 94 → 95 (`glassBoxReadiness` rhr/temp quantum guard, analytics PR #75): +// same gap as #73, but on the stored "readiness_glassbox" narrative/drivers +// key crossday_pipeline still writes — glassBoxReadiness never gated its +// 0.5*scale rhr/temp standardization with dispersionBelowQuantum, so a +// quantized baseline (e.g. alternating 58/59 bpm) could get named a driver +// off rounding noise. edge's `_glassInput` calls now pass `quantum: 1` on +// both channels. kAnalyticsPin repinned to analytics PR #75's merged main +// SHA. This changes the stored drivers list for real users, so it gets a +// version bump despite being narrative-only, not a headline-score change. +const int kAlgoVersion = 95; /// The sibling SHAs this version was derived against, asserted against /// pubspec.yaml in test/db_serve_version_and_reads_test.dart. /// @@ -1859,7 +1869,7 @@ const int kAlgoVersion = 94; // picking one single-device SHA over the other. Verified: `1cf8e61` (this // branch's own pin) IS an ancestor of `fe1464d` — the wearfit protocol // commit is already folded in, nothing is lost by moving to the tip. -const String kAnalyticsPin = 'eed6dc92375ce1336fc4e31d13a0718f45e163cf'; +const String kAnalyticsPin = '01e8b6e02b2370ae42490a678e6a0a4e3569104c'; // Repinned to analytics main's tip, which carries BOTH PR #72 (hrv_freq // Welch gap guard) and PR #73 (overreachingConjunction rhr quantum guard) — // the two independent kAlgoVersion bumps above (93 and 94). Verified both diff --git a/pubspec.lock b/pubspec.lock index dd5a96004..9c9ec0da3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -937,8 +937,8 @@ packages: dependency: "direct main" description: path: "." - ref: "2a624b97303f38877841df9068c72a52b67e5dc9" - resolved-ref: "2a624b97303f38877841df9068c72a52b67e5dc9" + ref: "01e8b6e02b2370ae42490a678e6a0a4e3569104c" + resolved-ref: "01e8b6e02b2370ae42490a678e6a0a4e3569104c" url: "https://github.com/OpenStrap/analytics.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index db8cfb3f8..b8b0f4444 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -463,17 +463,20 @@ dependencies: # `git show eed6dc9:lib/src/onehz/human/overreaching_conjunction.dart | # grep dispersionBelowQuantum` # - # analytics PR #75 (branch fix/glassbox-swc-quantum @ 2a624b9): - # readiness_glassbox's SWC gate had the same gap #73 fixed on - # overreaching_conjunction -- glassBoxReadiness does the identical - # 0.5*scale standardization on the same rhr/temp channels edge wires in - # below (`_glassInput('rhr', ...)` / `_glassInput('temp', ...)`), never - # gated by dispersionBelowQuantum. Adds `GlassBoxInput.quantum`. PR open, - # not yet merged to main -- pinned to its branch head SHA directly - # (fixed commit, not a floating ref) since edge's `_glassInput` calls - # below need the new field to pass `quantum: 1`. Re-pin to main once #75 - # merges. Narrative-only change, no kAlgoVersion bump needed. - ref: 2a624b97303f38877841df9068c72a52b67e5dc9 + # analytics PR #75 (MERGED to main @ 01e8b6e): readiness_glassbox's SWC + # gate had the same gap #73 fixed on overreaching_conjunction -- + # glassBoxReadiness does the identical 0.5*scale standardization on the + # same rhr/temp channels edge wires in below (`_glassInput('rhr', ...)` + # / `_glassInput('temp', ...)`), never gated by dispersionBelowQuantum. + # Adds `GlassBoxInput.quantum`. Re-pinned from #75's branch head to main + # now that it's merged. Verified: + # `git show 01e8b6e:lib/src/onehz/human/readiness_glassbox.dart | + # grep dispersionBelowQuantum` + # Changes the stored "readiness_glassbox" drivers list for real users + # (see derivation_engine.dart's 94 -> 95 changelog entry), so this got + # a kAlgoVersion bump despite being narrative-only, not a headline-score + # change. + ref: 01e8b6e02b2370ae42490a678e6a0a4e3569104c # BLE — flutter_blue_plus is the maintained cross-platform GATT client. flutter_blue_plus: ^1.36.8