Skip to content

huami legacy: refuse fetch start with a zero or rolled-over date - #108

Merged
abdulsaheel merged 2 commits into
mainfrom
fix/huami-start-date
Dec 5, 2026
Merged

abdulsaheel merged 2 commits into
mainfrom
fix/huami-start-date

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

parseHuamiFetchStart fed raw date bytes to DateTime.utc, so an unclocked band (all zeros) gave year -1 and every minute got banked at a nonsense timestamp. month 13 / feb 31 rolled over silently. now returns null for year < 2000 or any field that normalised. same idea as #106 for the other parser.

Summary by Sourcery

Prevent invalid Huami legacy start dates from being accepted.

Bug Fixes:

  • Reject Huami legacy fetch-start dates with years before 2000 or invalid fields that normalize into a different date.

Tests:

  • Add coverage for zero, rolled-over, and valid fetch-start dates.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Reject fetch-start dates before 2000 and dates whose fields DateTime.utc would normalize, preventing invalid band clocks from producing nonsense timestamps.

  • lib/src/huami_legacy.dart L100-110

Tests

Cover zero, rolled-over, and valid dates to verify fetch-start parsing refuses invalid timestamps.

  • test/huami_legacy_test.dart L37-45

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

Warning

Review limit reached

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

Next included review available in 59 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

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: a1d55bab-c964-449d-9e56-6d6203374cf4
Commits

Reviewing files that changed from the base of the PR and between 13086d7 and 7fde351.

Files selected for processing: 2

  • lib/src/huami_legacy.dart
  • test/huami_legacy_test.dart
  • 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

@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/huami_legacy.dart:103


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

Comment thread lib/src/huami_legacy.dart Resolved
@abdulsaheel
abdulsaheel merged commit 91f8a26 into main Dec 5, 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