Skip to content

overreaching_conjunction: guard against quantized rhr dispersion - #73

Merged
abdulsaheel merged 1 commit into
mainfrom
fix/overreaching-rhr-quantum-guard
Sep 19, 2026
Merged

abdulsaheel merged 1 commit into
mainfrom
fix/overreaching-rhr-quantum-guard

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

alternating whole-bpm rhr baselines (58/59 type) give a small nonzero mad, not real dispersion, just rounding noise. illness_cusum, readiness_composite, and event_detection already guard this exact rhr channel with dispersionBelowQuantum. overreaching_conjunction never got the same guard, so a 1bpm rise on the elevated nights could clear a ~0.25-0.5bpm gate and fire the "both facts point the same way" card on nothing.

fix mirrors event_detection's inline style: dispersionBelowQuantum(rhrBaselineWindow, 1.0) folded into the existing absent path, no new abstraction.

added a regression test: alternating 58/59 baseline abstains, real-dispersion baseline still fires normally.

Summary by Sourcery

Guard overreaching conjunction detection against false positives from unresolvable whole-bpm resting-heart-rate dispersion.

Bug Fixes:

  • Prevent overreaching conjunction alerts caused by quantization noise in whole-bpm resting-heart-rate baselines.

Tests:

  • Add regression coverage confirming quantized baselines abstain while genuinely dispersed baselines continue to trigger valid conjunctions.

…sion

alternating whole-bpm rhr baselines (e.g 58/59) give a small nonzero mad
that isn't real dispersion, just rounding noise. illness_cusum, readiness
and event_detection already guard this exact channel with
dispersionBelowQuantum, this one didn't, so a 1bpm rise could clear the
gate and fire the conjunction card on nothing.

@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 6 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 35 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: 906603b0-d89d-4821-b969-7509461b9d7e

📥 Commits

Reviewing files that changed from the base of the PR and between 8285710 and 1acdd4b.

📒 Files selected for processing (2)
  • lib/src/onehz/human/overreaching_conjunction.dart
  • test/onehz/overreaching_conjunction_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 PR adds a 1 bpm dispersionBelowQuantum guard to overreaching_conjunction’s RHR gate, preventing false-positive conjunction cards from alternating whole-bpm baselines while retaining behavior for genuinely dispersed baselines. Regression tests cover both abstention and normal firing.

Flow diagram for quantized RHR dispersion guard

flowchart TD
    A["RHR baseline window"] --> B["robustBaseline"]
    B --> C["dispersionBelowQuantum(rhrBaselineWindow, 1.0)"]
    C -->|true| D["gate = null"]
    C -->|false| E["gate = 0.5 * scale"]
    D --> F["Metric.absent"]
    E --> G{"centre, gate, and base.sufficient valid?"}
    G -->|no| F
    G -->|yes| H["OverreachingConjunction metric"]
Loading

File-Level Changes

Change Details Files
Suppress overreaching conjunction evaluation when whole-bpm RHR baseline variation is below the measurement quantum.
  • Apply dispersionBelowQuantum with a 1 bpm quantum to the RHR baseline.
  • Fold the quantization result into the existing absent/invalid gate path while preserving normal scale-based gating.
  • Document that alternating adjacent whole-bpm readings represent rounding noise rather than true dispersion.
lib/src/onehz/human/overreaching_conjunction.dart
Add regression coverage for quantized and genuinely dispersed RHR baselines.
  • Verify an alternating 58/59 baseline abstains despite a 1 bpm recent rise.
  • Verify a materially dispersed baseline still produces a conjunction result.
  • Use a qualifying load metric and recent RHR values to exercise both branches.
test/onehz/overreaching_conjunction_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 eed6dc9 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