Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@puddly
Copy link
Collaborator

@puddly puddly commented Oct 14, 2025

In preparation for NabuCasa/silabs-firmware-builder#118, I'm extending the network info JSON with a next-hop route table. While the EmberZNet structures reference route status, route age, cost, and so on, we do not actually need any of this information to restore the route table: we just need the destination node and the next-hop node.

Switch format around

Switch to a simple dict

Fix route table unit tests

Add `tx_power`

Fix Z2M backup test
Copilot AI review requested due to automatic review settings October 14, 2025 18:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds route table functionality to network backup and restore operations. This change extends the network info JSON structure to include next-hop routing information, which is essential for fully restoring network state.

  • Adds a route_table field to the NetworkInfo dataclass as a dictionary mapping destination nodes to next-hop nodes
  • Updates backup format version from 1 to 2 to accommodate the new route table field
  • Implements serialization/deserialization logic for route tables in both internal format and Open Coordinator backup format

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
zigpy/state.py Adds route_table field to NetworkInfo and implements serialization/deserialization
zigpy/backups.py Updates backup format version and adds route table handling in backup conversions
tests/test_backups.py Updates test fixtures to include route table data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.31%. Comparing base (dc622c8) to head (976fe1a).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1686   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files          62       62           
  Lines       12048    12055    +7     
=======================================
+ Hits        11965    11972    +7     
  Misses         83       83           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, one small note about tx_power still being in a comment:

obj["node_info"]["version"] = None
version = 1

# Version 2 introduced the `route_table` and `tx_power` fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tx_power field doesn't seem to be included in this PR yet:

Suggested change
# Version 2 introduced the `route_table` and `tx_power` fields
# Version 2 introduced the `route_table` field

If you merge the other PR shortly after this, feel free to leave it in.

@puddly puddly merged commit 102be33 into zigpy:dev Oct 21, 2025
14 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.

2 participants