Skip to content

fix hr ceiling missing uneven-motion holds + stale doc cleanup - #55

Closed
abdulsaheel wants to merge 1 commit into
mainfrom
audit/fixes-round1-analytics
Closed

fix hr ceiling missing uneven-motion holds + stale doc cleanup#55
abdulsaheel wants to merge 1 commit into
mainfrom
audit/fixes-round1-analytics

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

sessionHrCeiling was giving up on a start index right after checking the minimal duration-qualifying window's motion average, so a real held ceiling with motion concentrated at the edges (quiet middle) never got found. now it keeps extending the window (capped at 4x holdSeconds) until motion actually corroborates.

also cleaned up a few stale doc claims in README/ALGORITHMS: hardcoded test count (was 290, actually 624 passed / 6 skipped), workout family still mentioned explicit/retroactive detection that's deleted, and both docs still pointed at foundations/ppg_sqi.dart which doesn't exist anymore.

Summary by Sourcery

Improve session heart-rate ceiling detection for uneven-motion efforts and bring project documentation up to date.

Bug Fixes:

  • Allow held heart-rate ceiling candidates to extend beyond the minimum qualifying duration until motion corroborates them, with a bounded search span.
  • Stop evaluating a candidate once motion corroborates the sustained heart-rate ceiling or the maximum extension is reached.

Documentation:

  • Update README and algorithm documentation to remove obsolete PPG signal-quality and explicit workout-detection references and reflect the current test totals.

…o docs

sessionHrCeiling bailed on the first duration-qualifying window even when its
motion average failed the gate, so a real held ceiling with motion
concentrated at the edges (quiet middle) never got found. now it keeps
extending the window (capped at 4x holdSeconds) until motion actually
corroborates before giving up on a start index.

also fixed a few stale doc claims: test count was hardcoded at 290 (actual is
624 passed / 6 skipped), the workout family still advertised explicit/
retroactive detection that was deleted, and both README and ALGORITHMS.md
still pointed at foundations/ppg_sqi.dart which doesn't exist on main.
@sourcery-ai

sourcery-ai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fix session HR ceiling detection for efforts whose corroborating motion is concentrated near the edges by extending each duration-qualified window up to a 4x hold-duration cap before rejecting it, while cleaning stale API references and updating documentation test counts.

Flow diagram for extended HR ceiling motion corroboration

flowchart TD
    A[Start candidate index] --> B[Extend window through samples]
    B --> C{Duration qualifies?}
    C -->|No| B
    C -->|Yes| D{Span exceeds 4x holdSeconds?}
    D -->|Yes| E[Reject candidate]
    D -->|No| F[Compute motion average]
    F --> G{Motion meets gate?}
    G -->|No| B
    G -->|Yes| H{Higher sustained HR than best?}
    H -->|Yes| I[Update HrCeiling]
    H -->|No| J[Stop this candidate]
    I --> J
Loading

File-Level Changes

Change Details Files
Extend candidate HR-hold windows until motion corroborates, while bounding the search span.
  • Allow motion-gate failures on the minimum qualifying duration to continue extending the same start index.
  • Cap each candidate window at four times the requested hold duration to avoid unbounded scanning.
  • Record the earliest motion-qualified window and retain the highest sustained HR ceiling across starts.
  • Update complexity comments to reflect the bounded repeated scans.
lib/src/onehz/workout/observed_max_hr.dart
Remove stale documentation references to deleted APIs and correct repository test-count claims.
  • Remove the obsolete PPG signal-quality index from the foundations documentation.
  • Remove deleted explicit workout detection from the algorithm table and describe automatic detection as non-explicit/non-retroactive.
  • Replace the outdated test count with the current passed, skipped, and total counts.
ALGORITHMS.md
README.md

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

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 40 minutes.

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: Pro Plus

Run ID: 6376c026-f5ac-4a22-9e2c-1c0469a3dc9d

📥 Commits

Reviewing files that changed from the base of the PR and between 187e026 and 0c1f73a.

📒 Files selected for processing (3)
  • ALGORITHMS.md
  • README.md
  • lib/src/onehz/workout/observed_max_hr.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 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@abdulsaheel

Copy link
Copy Markdown
Contributor Author

squashed into #59 for one clean review — closing this round.

@abdulsaheel
abdulsaheel deleted the audit/fixes-round1-analytics branch August 29, 2026 13:16
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