Skip to content

luteal flags: skip closed cycles over the 60 day cap - #118

Merged
abdulsaheel merged 3 commits into
mainfrom
fix/luteal-cap-closed-cycle
Dec 6, 2026
Merged

abdulsaheel merged 3 commits into
mainfrom
fix/luteal-cap-closed-cycle

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

a forgotten period log (84 day gap) marked weeks of nights luteal, so a real sustained temp rise came out as lutealConfound and the alert got dropped. closed cycles longer than cycleLengthImplausibleGapDays are now skipped, same rule cycle_lengths already uses. one test added.

Summary by Sourcery

Keep implausibly long closed cycles from contributing luteal flags.

Bug Fixes:

  • Exclude closed cycles longer than the 60-day cap from luteal flags, preventing missed period logs from marking temperatures as luteal.

Tests:

  • Add coverage for cycles over the cap being skipped and cycles exactly at the cap still counting.

Summary by CodeRabbit

  • Bug Fixes
    • Luteal phase indicators now exclude dates from cycles longer than 60 days, so unusually long gaps between logs do not affect results.
    • Cycles exactly 60 days long continue to count when determining the luteal phase.
    • Added coverage for cycles that exceed the limit and those that meet it exactly, helping confirm both cases are handled as expected.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Import the shared cycle-gap cap and use it to exclude overlong closed cycles from luteal flags, documenting the missed-log rule.

  • lib/src/onehz/wellness/temp_health.dart L24, L281-283, L321-322

Tests

Verify that gaps over the cap are skipped while a closed cycle exactly at the cap still counts.

  • test/luteal_flags_test.dart L28-40

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 Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

lutealFlags skips dates in cycles longer than the configured implausible-gap limit. The documentation describes longer closed cycles as missed logs. Tests cover a gap above the limit and a closed cycle at the limit.

Changes: Luteal cycle filtering

Layer / File(s) Summary
Cycle length guard and boundary tests
lib/src/onehz/wellness/temp_health.dart, test/luteal_flags_test.dart, lib/src/onehz/registry/group_registry.dart
lutealFlags skips cycles longer than cycleLengthImplausibleGapDays. The documentation describes longer closed cycles as missed logs. Tests cover a gap above the cap and a closed cycle exactly at the cap. The registry source-file closure includes cycle_lengths.dart.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: mikenrafter

Merge Risk: Minimal · up to 3f2ae

This change stops closed cycles longer than 60 days, which usually come from a forgotten period log, from labeling temperatures as luteal. The behavior change is narrow and has tests for both the over-cap and at-cap cases. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "luteal flags: skip closed cycles over the 60 day cap" matches the main change. The diff makes lutealFlags in temp_health.dart skip dates in closed cycles longer than cycleLengthImplausibleG…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "luteal flags: skip closed cycles over the 60 day cap" matches the main change. The diff makes lutealFlags in temp_health.dart skip dates in closed cycles longer than cycleLengthImplausibleGapDays (60 days), and the tests cover the over-cap skip and the at-cap case. The title names the function and the rule, so a reviewer scanning history can tell what changed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2b2f8963-413e-4cae-974a-e220eee1af91
Commits

Reviewing files that changed from the base of the PR and between bf8d49b and 3f2ae4b.

Files selected for processing: 1

  • lib/src/onehz/registry/group_registry.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@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 found 1 issue

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: lib/src/onehz/wellness/temp_health.dart:24


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread lib/src/onehz/wellness/temp_health.dart Resolved
@abdulsaheel
abdulsaheel merged commit 26034e9 into main Dec 6, 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