Skip to content

gen5: record HELLO revision instead of gating parsing - #35

Merged
abdulsaheel merged 1 commit into
OpenStrap:mainfrom
DropTabl:fix/gen5-hello-revision-not-gated
Aug 26, 2026
Merged

gen5: record HELLO revision instead of gating parsing#35
abdulsaheel merged 1 commit into
OpenStrap:mainfrom
DropTabl:fix/gen5-hello-revision-not-gated

Conversation

@DropTabl

@DropTabl DropTabl commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Why

Gen5HelloInfo.parse currently rejects a complete WHOOP 5 HELLO response whenever its revision byte is not exactly 1.

The official WHOOP Android 5.458.0 parser does not use that byte as an equality gate. It records the revision and reads the established fixed-offset HELLO layout through byte 103. Consequently, the current check can discard an otherwise compatible HELLO response and prevent connection readiness after a firmware revision change.

This aligns the parser with the behavior recovered from the official client while retaining a defensive length check for independent implementations.

What changed

  • Removed the helloRevision == 1 parser requirement.
  • Continued exposing the received revision through helloRevision.
  • Retained the 104-byte minimum-length guard.
  • Replaced the old rejection test with a regression test proving that a complete non-1 HELLO body:
    • parses using the established fixed offsets;
    • preserves its revision byte; and
    • retains the expected identity, battery, firmware and wrist-state fields.

Compatibility and safety

  • Revision-1 HELLO responses are unchanged.
  • No command, frame or wire encoding changes.
  • Short bodies remain rejected.
  • Non-success command responses still do not publish HELLO information.
  • A non-1 revision is not interpreted using invented offsets; it follows the same fixed-offset behavior as the inspected official parser.

Evidence

The inspected official parser records the revision without an explicit revision == 1 gate and reads the fixed offsets through byte 103.

Validation

  • dart analyze — no issues
  • dart test — 374 passed
  • Four external-fixture tests skipped because whoop_hist.jsonl is not present beside the repository
  • git diff --check origin/main...HEAD — clean

Summary by CodeRabbit

  • Bug Fixes
    • Gen5 hello messages with revision values other than 1 are now accepted.
    • The detected revision is retained while message details continue to be decoded consistently.

The official 5.458.0 parser records body[0] but reads the fixed
revision-1 offsets regardless of its value; only the short-body
rejection is a real parse failure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCrELi9LMQr55gW9hCJoeN
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 763cedea-7e8a-4fd2-92a4-a8a136a8688c

📥 Commits

Reviewing files that changed from the base of the PR and between f01ad07 and 918eab3.

📒 Files selected for processing (2)
  • lib/src/control.dart
  • test/gen5_historical_test.dart

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


📝 Walkthrough

Walkthrough

Gen5HelloInfo.parse now accepts any hello revision, records the revision byte, and continues decoding fields from the fixed revision-1 offsets. The historical test now verifies this behavior for revision 2.

Changes

Gen5 Hello Revision Handling

Layer / File(s) Summary
Revision parsing and validation
lib/src/control.dart, test/gen5_historical_test.dart
Gen5HelloInfo.parse no longer rejects revisions other than 1. The parser records the revision and decodes the existing fields. The test verifies revision 2 parsing and field values.

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

Merge Risk: ⚪ Minimal · up to 918ea

This localized parser change removes an overly strict revision gate while retaining the length check and regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: abdulsaheel, localhoop, sunny-noop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: Gen5 HELLO parsing now records the revision instead of rejecting non-1 revisions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)


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.

@abdulsaheel
abdulsaheel merged commit 6664854 into OpenStrap:main Aug 26, 2026
3 checks passed
DropTabl added a commit to DropTabl/edge that referenced this pull request Aug 26, 2026
…ntics; flag the pending OpenStrap#35 repin

Three follow-ups on the bootstrap review:

A Memfault chunk is real inbound traffic on the link, so it now advances
_lastRx like every other notification — a strap volunteering crash data
must not look silent to the staleness fuse and get its link bounced.

New regression test for the SET_CLOCK result split the contract implies:
a FAILURE result inside a non-null response object still satisfies
readiness (only a null result fails, one write,
no resend) — but the strap did NOT take the write, so the phone-suspect
history deferral computed off the pre-correction reading stays live;
clearing it is reserved for an accepted correction.

The protocol pin stays at 4ce8f02 (OpenStrap#33's tree, whose parser still nulls
any non-1 hello revision — under the mandatory hello that means a future
revision bump cannot connect). OpenStrap/protocol#35 lifts that gate; the
pending repin is now documented at BOTH pin locations — pubspec.yaml's
ref and kProtocolPin in derivation_engine.dart — with the rule that every
pin location moves together to the main merge commit (the pin-equality
test fails a partial repin) and the kAlgoVersion no-bump reasoning to
re-verify against the actual merge diff.
DropTabl added a commit to DropTabl/edge that referenced this pull request Aug 26, 2026
…ision gate is gone

All three pin locations move together to protocol main @ 6664854, the
OpenStrap/protocol#35 merge commit. The old pin's parser returned null
for any hello body whose revision byte was not 1; under this branch's
mandatory-hello bootstrap that made a future firmware revision bump
unable to connect. OpenStrap#35 records the byte instead of gating on it.

NO kAlgoVersion bump, verified against the full 4ce8f02..6664854 diff:
OpenStrap#35's one code change widens which HELLO bodies PARSE (hello feeds
connection identity/state, not the derivation pipeline); OpenStrap#34, also in
the hop, only ADDS files (oura + generic-HRS wire formats nothing here
imports); the rest is comment rewording. No decoder for a persisted
record moves, so no stored number can.
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.

2 participants