Skip to content

multivariateAnomaly: carry persistence run across unscored nights - #121

Merged
abdulsaheel merged 2 commits into
mainfrom
fix/mv-anomaly-gap
Dec 6, 2026
Merged

abdulsaheel merged 2 commits into
mainfrom
fix/mv-anomaly-gap

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

abstain branches zeroed the run and the scored branch reset on any gap, so alternate-night illness patterns never reached persistDays. added maxGapNights=2 like illnessCusum/temp_health.

Summary by CodeRabbit

  • New Features
    • Anomaly detection now preserves a persistence run across up to two unscored nights by default. The allowed gap can be configured.
  • Bug Fixes
    • Nights that cannot be evaluated because of insufficient baseline data or a degenerate baseline no longer interrupt an anomaly persistence run. Gaps beyond the configured limit still reset the run, preventing separated candidate nights from being combined.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Sorry @abdulsaheel, you've used your 10,000 reviewed lines for this month.

Reviews resume on 9 December 2026.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

multivariateAnomaly now accepts a maximum unscored-night gap. Candidate persistence continues across eligible unscored nights and resets when the calendar-day gap exceeds the configured limit. Regression tests cover a one-night gap and a three-night gap.

Changes: Anomaly persistence

Layer / File(s) Summary
Configure and apply the persistence window
lib/src/onehz/wellness/anomaly.dart, test/onehz/wellness_test.dart
multivariateAnomaly adds maxGapNights, defaulting to 2. Insufficient or degenerate baseline nights no longer reset the candidate run. The run resets when the calendar-day gap exceeds 1 + maxGapNights. Tests cover persistence across one unscored night and reset after three unscored nights.

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

Change: Bug fix

Merge Risk: Minimal · up to a0113

This change lets short gaps of unscored nights keep a candidate persistence run alive, so alternate-night patterns can now reach the persistence threshold. Longer gaps still reset the run. No concrete merge-blocking risk was found.

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 names the main change: multivariateAnomaly now carries its persistence run across unscored nights. The raw summary says the function gains maxGapNights (default 2) so the run survives up to …
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 names the main change: multivariateAnomaly now carries its persistence run across unscored nights. The raw summary says the function gains maxGapNights (default 2) so the run survives up to that many unscored nights, and the PR objectives describe the same goal. The title is specific and matches the changeset.

  • 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: 7451ea43-68d8-4f8f-9f97-f87aeffb6421
Commits

Reviewing files that changed from the base of the PR and between a8476ae and a011384.

Files selected for processing: 2

  • lib/src/onehz/wellness/anomaly.dart
  • test/onehz/wellness_test.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.

@abdulsaheel
abdulsaheel merged commit 26a3497 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