Skip to content

glassbox: guard SWC gate against quantized rhr/temp baselines - #75

Merged
abdulsaheel merged 1 commit into
mainfrom
fix/glassbox-swc-quantum
Sep 19, 2026
Merged

abdulsaheel merged 1 commit into
mainfrom
fix/glassbox-swc-quantum

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

readiness_composite and overreaching_conjunction both gate their 0.5scale worth-mentioning check with dispersionBelowQuantum. readiness_glassbox does the same 0.5scale standardization on the same rhr/temp channels but never got the guard when that fix landed. edge's crossday_pipeline still wires real whole-bpm rhr + integer-adc temp into glassBoxReadiness, so a baseline sitting near a quantization boundary (e.g. alternating 58/59 bpm) could get named a narrative driver off 1-bpm rounding noise.

adds quantum to GlassBoxInput (mirrors ReadinessInput.quantum), uses dispersionBelowQuantum to suppress the beyondUsualSpread flag when the baseline dispersion doesn't clear the input's own quantization step. narrative-only — doesn't touch the score or drop the input.

test added: alternating 58/59 bpm history no longer names rhr as a driver.

Summary by Sourcery

Guard glassbox readiness narratives against baselines whose dispersion does not exceed the input’s measurement quantum.

Bug Fixes:

  • Prevent quantization-level baseline variation from being incorrectly identified as a readiness narrative driver.

Enhancements:

  • Add per-input measurement quantum support to glassbox readiness gating while preserving existing scoring and input inclusion behavior.

Tests:

  • Add coverage confirming alternating whole-bpm RHR values are not reported as a driver.

readiness_composite and overreaching_conjunction both already gate their
0.5*scale worth-mentioning check with dispersionBelowQuantum, since a
whole-bpm rhr (or integer skin-temp adc) baseline alternating between two
adjacent values has a nonzero MAD that's really rounding noise, not real
dispersion. readiness_glassbox does the identical 0.5*scale standardization
on the same channels but never got the guard, so crossday_pipeline's rhr/temp
inputs could get named as narrative drivers on pure quantization.

adds a quantum field to GlassBoxInput (mirrors ReadinessInput.quantum) and
uses it in the beyond gate. narrative-only change, doesn't touch the score.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @abdulsaheel, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 days and 5 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: f84f46f6-a5c1-401f-a061-c4d0cfef8e9d

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe51c7 and 2a624b9.

📒 Files selected for processing (2)
  • lib/src/onehz/human/readiness_glassbox.dart
  • test/onehz/human_test.dart

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

The glass-box readiness narrative now accounts for each input’s measurement quantum before labeling a value as beyond its usual spread, preventing whole-bpm or integer-ADC quantization noise from becoming a narrative driver while preserving scoring behavior. A regression test covers an alternating 58/59 bpm baseline.

File-Level Changes

Change Details Files
Add quantization-aware suppression for glass-box narrative driver detection.
  • Extend GlassBoxInput with an optional per-input measurement quantum, defaulting to continuous measurements.
  • Reuse dispersionBelowQuantum to disable beyondUsualSpread when baseline dispersion is below that quantum.
  • Keep readiness scores and input inclusion unchanged; only narrative driver labeling is affected.
lib/src/onehz/human/readiness_glassbox.dart
Cover quantized baseline behavior with a regression test.
  • Test alternating 58/59 bpm history with quantum 1.
  • Verify the input is not marked beyond usual spread and produces no driver narrative.
test/onehz/human_test.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@abdulsaheel
abdulsaheel merged commit 01e8b6e into main Sep 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant