-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Remove the SoftwareDiagnostics "LOGIC" template from clusters #39977
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?
Conversation
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 refactors the Software Diagnostics cluster to simplify its implementation by removing a template-based dependency injection mechanism, improving readability.
src/app/clusters/software-diagnostics-server/CodegenIntegration.cpp
Outdated
Show resolved
Hide resolved
/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.
Pull Request Overview
This PR removes the templated logic injection in the Software Diagnostics cluster and consolidates all diagnostic calls to the DeviceLayer
singleton, simplifying both production and test code.
- Forward diagnostic provider calls directly to
DeviceLayer::GetDiagnosticDataProvider()
- Eliminate
DeviceLayerSoftwareDiagnosticsLogic
andInjectedDiagnosticsSoftwareDiagnosticsLogic
classes and the cluster’s template parameter - Introduce
ScopedDiagnosticsProvider
in tests to temporarily override the global provider
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/app/clusters/software-diagnostics-server/software-diagnostics-logic.h | Switched logic methods to call the DeviceLayer singleton and removed provider-injection classes |
src/app/clusters/software-diagnostics-server/software-diagnostics-logic.cpp | Updated thread‐metrics and accepted‐commands calls to use DeviceLayer::GetDiagnosticDataProvider() |
src/app/clusters/software-diagnostics-server/software-diagnostics-cluster.h | Dropped the LOGIC template parameter and updated all calls to use direct methods on SoftwareDiagnosticsLogic |
src/app/clusters/software-diagnostics-server/tests/TestSoftwareDiagnosticsCluster.cpp | Added ScopedDiagnosticsProvider helper and simplified test logic instantiation |
src/app/clusters/software-diagnostics-server/CodegenIntegration.cpp | Adjusted LazyRegisteredServerCluster instantiation to the non‐templated cluster |
Comments suppressed due to low confidence (3)
src/app/clusters/software-diagnostics-server/tests/TestSoftwareDiagnosticsCluster.cpp:90
- [nitpick] The variable
nullProvider
is now aScopedDiagnosticsProvider<NullProvider>
, which can be confusing. Consider renaming it toscopedNullProvider
ornullProviderOverride
for clarity.
ScopedDiagnosticsProvider<NullProvider> nullProvider;
src/app/clusters/software-diagnostics-server/tests/TestSoftwareDiagnosticsCluster.cpp:122
- [nitpick] This variable wraps the provider in an RAII scope but is named
watermarksProvider
. Consider renaming it toscopedWatermarksProvider
to reflect its behavior.
ScopedDiagnosticsProvider<WatermarksProvider> watermarksProvider;
src/app/clusters/software-diagnostics-server/tests/TestSoftwareDiagnosticsCluster.cpp:179
- [nitpick] The name
allProvider
does not convey that this is a scoped override. Consider renaming toscopedAllProvider
orallProviderOverride
for consistency.
ScopedDiagnosticsProvider<AllProvider> allProvider;
src/app/clusters/software-diagnostics-server/software-diagnostics-logic.h
Show resolved
Hide resolved
src/app/clusters/software-diagnostics-server/software-diagnostics-cluster.h
Outdated
Show resolved
Hide resolved
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 refactors the Software Diagnostics cluster to remove the template-based logic provider, simplifying the design and improving readability by directly using the injectable DeviceLayer
singleton. The changes are well-contained and the test adjustments using the new ScopedDiagnosticsProvider
are appropriate. I have one suggestion to improve the robustness of the new test helper class.
src/app/clusters/software-diagnostics-server/tests/TestSoftwareDiagnosticsCluster.cpp
Show resolved
Hide resolved
…eDiagnosticsCluster.cpp Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…dhomeip into remove_template_logic
PR #39977: Size comparison from 48704fe to 1d37a89 Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
src/app/clusters/software-diagnostics-server/software-diagnostics-cluster.h
Outdated
Show resolved
Hide resolved
src/app/clusters/software-diagnostics-server/software-diagnostics-cluster.h
Outdated
Show resolved
Hide resolved
PR #39977: Size comparison from 48704fe to 140301e Increases above 0.2%:
Full report (56 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nxp, psoc6, qpg, stm32, telink, tizen)
|
Summary
This usage was built to faciliate unit testing, however the underlying devicelayer classes are already injectable, so for now it seems more natural to use the singletons directly (since we have to do that to save flash anyway).
This should make the code easier to read.
Testing
unit tests updated, expected to still pass. There is no functional change here really. Only interested in readability and no flash/ram impact.