gate select_wrist decode on cmd_status - #59
Conversation
…plies a failed select_wrist write still returned a SelectWristResponse built from stale payload bytes, no different from the fixed getBatteryPackInfo/getHello cases. added the status==1 check + a test for the failure case.
There was a problem hiding this comment.
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 17 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
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. Comment |
Reviewer's GuideThe PR aligns select_wrist decoding with other SET-style responses by requiring cmd_status == 1, preventing failed writes from being represented as successful confirmations, and adds a regression test for stale payload data on failure. Sequence diagram for status-gated wrist selection response decodingsequenceDiagram
participant Device
participant Parser as parseCommandResponse
participant Consumer
Device->>Parser: select_wrist response with status and payload
alt status == 1
Parser->>Parser: SelectWristResponse(revision, payload)
Parser-->>Consumer: dec[select_wrist]
else status != 1
Parser-->>Consumer: no select_wrist response
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
select_wrist reply was decoded unconditionally, unlike every other set-style
confirmation in this file (battery pack info, hello, clock, data range) which
all check cmd_status first. a failed write (bad wrist value, refused
mid-handshake) still returned a SelectWristResponse built from stale payload
bytes, indistinguishable from a real success.
fix: gate it on status == 1, matching the getHello precedent. added a test
for the failure case.
Summary by Sourcery
Only decode select-wrist confirmations when the command reports success.
Bug Fixes:
Tests:
Summary by CodeRabbit