Skip to content

Allocate APS sequence numbers directly - #6

Closed
puddly wants to merge 2 commits into
devfrom
puddly/aps-seq-fix
Closed

Allocate APS sequence numbers directly#6
puddly wants to merge 2 commits into
devfrom
puddly/aps-seq-fix

Conversation

@puddly

@puddly puddly commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Flagged in zigpy/ziggurat#56.

APS sequence numbers should be decoupled from the ZCL TSN that zigpy is (erroneously) passing through to the radio library. No other radio library actually passes through the APS sequence number so this doesn't really affect production networks.

Copilot AI review requested due to automatic review settings July 31, 2026 18:18
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c92f735) to head (b2d72cd).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev        #6   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines         1681      1687    +6     
=========================================
+ Hits          1681      1687    +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

Pull request overview

This PR decouples APS sequence number allocation from the ZCL transaction sequence number (TSN) previously propagated via packet.tsn, aligning behavior with other radio libraries and addressing zigpy/ziggurat#56.

Changes:

  • Introduces an internal APS sequence counter in ControllerApplication and uses it for all outgoing unicast/broadcast/groupcast frames.
  • Allocates APS sequence numbers at send-time (within the concurrency limiter) to better reflect the order frames are sent to the server.
  • Updates application and legacy tests to assert the new APS sequence numbering behavior (starting at 1).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
zigpy_ziggurat/zigbee/application.py Adds an internal APS sequence counter and uses it instead of packet.tsn when building outbound send requests.
tests/test_legacy.py Updates legacy-protocol send assertions to match the new internally allocated APS sequence values.
tests/test_application.py Updates packet helpers and send tests to stop relying on tsn for APS sequence and to assert the new counter behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@puddly puddly closed this Aug 1, 2026
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