Skip to content

gen4 set alarm reply: don't read the echoed epoch's low byte as alarm status - #107

Merged
abdulsaheel merged 3 commits into
mainfrom
fix/alarm-status-gen4-echo
Dec 5, 2026
Merged

abdulsaheel merged 3 commits into
mainfrom
fix/alarm-status-gen4-echo

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

payload[3] on the gen4 set reply is the epoch's low byte, so alarm_status was random. skip it for that layout, edge already handles the echo.

Summary by Sourcery

Correct alarm-status decoding for gen4 SET replies that echo the stored epoch.

Bug Fixes:

  • Prevent gen4 SET alarm replies that echo a plausible epoch from exposing the epoch’s low byte as an alarm status.

Tests:

  • Add coverage for gen4 epoch echoes, status-shaped replies, gen5 behavior, and the epoch plausibility threshold.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected alarm response handling for compatible gen4 devices: echoed alarm times are no longer shown as alarm status values.
    • Preserved alarm status reporting for responses that include a status, including gen5 responses.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Skip alarm-status decoding for gen4 SET replies whose revision and plausible echoed epoch identify the epoch-echo layout.

  • lib/src/constants.dart L545-547
  • lib/src/control.dart L969-978

Tests

Cover gen4 epoch-echo suppression and status preservation, including gen5 behavior and the plausible-epoch boundary.

  • test/control_plane_offsets_test.dart L298-324, L615-618 (+8 small edits)

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

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The gen4 SET_ALARM_TIME decoder now omits alarm_status when the reply matches the echoed-epoch layout. Tests cover the epoch threshold, status-shaped replies, and gen5 behavior. The AlarmStatus documentation describes this exception.

Changes: Gen4 alarm reply decoding

Layer / File(s) Summary
Decode and verify echoed alarm times
lib/src/constants.dart, lib/src/control.dart, test/control_plane_offsets_test.dart
The decoder omits alarm_status for qualifying gen4 SET_ALARM_TIME epoch echoes. Other status-shaped replies retain the status decode. Documentation and tests describe and check this behavior, including the threshold and gen5 cases.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • OpenStrap/protocol#92: Moves alarm-set reply echo reading from edge into this repository. This change updates decoding of that same reply.

Suggested reviewers: droptabl

Merge Risk: Minimal · up to b5e9d

This change stops gen4 alarm-set replies that echo the stored epoch from being misread as an alarm status. Other replies keep their existing status decoding, and the tests cover the boundary and gen5 behavior. 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: the gen4 SET_ALARM_TIME reply handler no longer reads the low byte of the echoed epoch as alarm status. The raw summary confirms the decoder now suppresses alarm_statu…
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: the gen4 SET_ALARM_TIME reply handler no longer reads the low byte of the echoed epoch as alarm status. The raw summary confirms the decoder now suppresses alarm_status for the gen4 echoed-time layout, which matches the title's subject and intent. The title is specific and concise.

  • 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: 058496e6-cb89-4c62-bca5-923b79ac5756
Commits

Reviewing files that changed from the base of the PR and between bbd2df0 and b5e9d51.

Files selected for processing: 3

  • lib/src/constants.dart
  • lib/src/control.dart
  • test/control_plane_offsets_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.

@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 2 issues

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: lib/src/control.dart:975


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

Comment thread lib/src/control.dart Resolved
Comment thread lib/src/control.dart Resolved

@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.

Sourcery assessment

Approved.

@abdulsaheel
abdulsaheel merged commit 13086d7 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