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

Skip to content

Conversation

@TheJulianJES
Copy link
Contributor

Before this change, default=frozendict would set the frozendict class itself for kwargs.
However, as we'll only use ZCLCommandButtonMetadata when command_button is called, which defaults to frozendict() for kwargs, the issue didn't manifest itself.

Still, we should fix this, either by doing default=frozendict() or factory=frozendict. As this default will never be really used and we already use factory for constant_attributes, I also went with that.
With default=frozendict(), we'd have the same instance for all ZCLCommandButtonMetadata. With factory, a new one for each. To us, this doesn't really matter, but see the other points I made 😄

Copilot AI review requested due to automatic review settings October 14, 2025 09:57
Copy link
Contributor

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

Fixes a dataclass field definition issue where ZCLCommandButtonMetadata.kwargs was incorrectly using default=frozendict instead of factory=frozendict, which would assign the class itself rather than an instance.

  • Changed default=frozendict to factory=frozendict for the kwargs field
  • Ensures each instance gets a new frozendict() instance rather than sharing the class object
  • Aligns with the existing pattern used for constant_attributes field

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 (42dcee5) to head (37fa56d).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1685   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files          62       62           
  Lines       12045    12048    +3     
=======================================
+ Hits        11962    11965    +3     
  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.

@TheJulianJES TheJulianJES merged commit e53ac03 into zigpy:dev Oct 14, 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.

1 participant