Skip to content

cmdGetDataRange: take a profile like its siblings - #66

Closed
abdulsaheel wants to merge 1 commit into
mainfrom
fix/get-data-range-gen5-profile
Closed

abdulsaheel wants to merge 1 commit into
mainfrom
fix/get-data-range-gen5-profile

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

control.dart already decodes GET_DATA_RANGE (0x22) as dual-profile (!profile.isGen5 || status == 1) but the request-side builder never got the treatment the sibling opcodes got in #55-#63 — it always framed gen4 (8-byte crc8), so a gen5 caller of the primary cmdGetDataRange would build a frame the strap can't parse.

there was already a separate cmdGetDataRangeGen5 doing the right thing with the gen5 envelope + empty payload, duplicating the profile-param pattern into a second function instead of extending the primary one like every sibling did. folded it in and deleted the dupe.

edge doesn't call either builder (it frames GET_DATA_RANGE itself via _send), so no runtime blast radius, this is purely fixing the protocol package's public API.

  • cmdGetDataRange(seq, {profile}) now branches payload/envelope by profile, default unchanged (gen4, [0x00] body)
  • removed cmdGetDataRangeGen5 + its export
  • added a test asserting the gen5 path matches the old dedicated function's frame
  • updated doc_conformance_test.dart's existing gen5 GET_DATA_RANGE assertion to go through the primary builder

dart test green (631 passed, 4 skipped, same skip count as main).

Summary by Sourcery

Update GET_DATA_RANGE command construction to support profile-specific framing through the primary API.

Bug Fixes:

  • Make the primary GET_DATA_RANGE command builder generate the correct gen4 or gen5 frame based on the selected profile.

Enhancements:

  • Remove the redundant dedicated gen5 GET_DATA_RANGE builder and route conformance coverage through the profile-aware API.

Tests:

  • Add coverage confirming the gen5 profile path produces the expected empty-payload frame.

control.dart already decodes GET_DATA_RANGE as dual-profile but the
builder always framed gen4. folds cmdGetDataRangeGen5 into the same
{profile} pattern as the other builders instead of keeping a separate
gen5-only function.

@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 7 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 21 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: 8535f5e7-ca2a-46e0-9bf1-8b35fe7ed764

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6ad6a and ef6f6ca.

📒 Files selected for processing (4)
  • lib/openstrap_protocol.dart
  • lib/src/commands.dart
  • test/doc_conformance_test.dart
  • test/whoop_protocol_update_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 (collapsed on small PRs)

Reviewer's Guide

Makes the public cmdGetDataRange builder profile-aware, preserving the gen4 default while producing the gen5 envelope with an empty payload; removes the duplicate gen5 API and updates coverage to verify the unified implementation.

Sequence diagram for profile-aware GET_DATA_RANGE framing

sequenceDiagram
    participant Caller
    participant cmdGetDataRange
    participant buildCommand
    participant Strap
    Caller->>cmdGetDataRange: cmdGetDataRange(seq, profile)
    alt profile is gen5
        cmdGetDataRange->>buildCommand: buildCommand(seq, Cmd.getDataRange, [], profile)
        buildCommand-->>Strap: Gen5 envelope with empty payload
    else profile is gen4
        cmdGetDataRange->>buildCommand: buildCommand(seq, Cmd.getDataRange, [0x00], profile)
        buildCommand-->>Strap: Gen4 envelope with 0x00 payload
    end
Loading

File-Level Changes

Change Details Files
Unified GET_DATA_RANGE request construction under the primary profile-aware builder.
  • Added an optional gen4-defaulted profile parameter.
  • Selected the gen4 body or empty gen5 body and passed the profile through envelope construction.
  • Removed the redundant gen5-specific builder and public export.
lib/src/commands.dart
lib/openstrap_protocol.dart
Updated conformance and command tests to validate the unified gen5 path.
  • Routed the existing gen5 documentation conformance assertion through cmdGetDataRange.
  • Added coverage for the gen5 envelope, empty payload, padding, and frame validity.
test/doc_conformance_test.dart
test/whoop_protocol_update_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

Copy link
Copy Markdown
Contributor Author

subsumed by #65 (already merged), which covers cmdGetDataRange's gen5 profile param as part of the broader gen5-framing sweep. closing, not a real gap.

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