-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Remove AttributeList from Device Layer #41546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Remove AttributeList from Device Layer #41546
Conversation
|
PR #41546: Size comparison from c1f377d to 3665129 Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41546 +/- ##
==========================================
- Coverage 51.04% 51.03% -0.02%
==========================================
Files 1386 1385 -1
Lines 100958 100920 -38
Branches 13061 13057 -4
==========================================
- Hits 51534 51501 -33
+ Misses 49424 49419 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
It was only used in a single place and probably didn't belong in the device layer in the first place. Use a Span instead for DeviceInforProvider::SetUserLabelList. Also simplify DeviceInforProvider::ClearUserLabelList().
3665129 to
f8b6393
Compare
|
PR #41546: Size comparison from c17e5ba to f8b6393 Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
There was a problem hiding this comment.
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 refactors the user label list handling by replacing the custom AttributeList template class with the standard Span type from the SDK's support library.
- Removed the custom
platform::AttributeListtemplate class and its associated tests - Updated
SetUserLabelListAPI to acceptSpan<const UserLabelType>instead ofAttributeList - Simplified
ClearUserLabelListimplementation to reuseSetUserLabelListwith an empty span
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/include/platform/AttributeList.h | Removed the entire custom AttributeList template class implementation |
| src/include/platform/tests/TestAttributeList.cpp | Removed unit tests for the deleted AttributeList class |
| src/include/platform/tests/BUILD.gn | Removed build configuration for deleted tests |
| src/include/platform/DeviceInfoProvider.h | Updated API signature to use Span<const UserLabelType> instead of AttributeList |
| src/include/platform/PlatformManager.h | Removed unnecessary include of AttributeList.h |
| src/platform/DeviceInfoProvider.cpp | Refactored implementations to work with Span, including simplified ClearUserLabelList and improved validation in AppendUserLabel |
| src/app/clusters/user-label-server/user-label-cluster.cpp | Updated to use std::array and Span instead of AttributeList, with inline validation during decoding |
| src/BUILD.gn | Removed reference to deleted test directory |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request removes the custom AttributeList class from the device layer, replacing its only usage with chip::Span. This is a good simplification that leverages a more standard utility. The implementation in user-label-cluster.cpp is updated to use std::array on the stack and pass a Span to DeviceInfoProvider::SetUserLabelList. Additionally, DeviceInfoProvider::ClearUserLabelList is nicely simplified by reusing SetUserLabelList with an empty span. The changes are clean and improve the codebase. I have one suggestion to improve error reporting consistency.
| { | ||
| ReturnErrorOnFailure(labelList.add(iter.GetValue())); | ||
| auto & label = iter.GetValue(); | ||
| VerifyOrReturnError(IsValidLabelEntry(label), CHIP_IM_GLOBAL_STATUS(ConstraintError)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User label cluster is a code driven clusters, so it has testing infrastructure for unit tests.
Could we test this? Codecov says 58.33333% line coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why it's showing those two lines at the top... that helper method is being removed entirely.
The second 4 lines should now be covered, but I'm not sure how/when codecov refreshes or which CI build it's looking at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Summary
It was only used in a single place and probably didn't belong in the device layer in the first place. Use a Span instead for DeviceInforProvider::SetUserLabelList.
Also simplify DeviceInforProvider::ClearUserLabelList().
Testing
Code is covered by existing tests.