8000 Remove the SoftwareDiagnostics "LOGIC" template from clusters by andy31415 · Pull Request #39977 · project-chip/connectedhomeip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

andy31415
Copy link
Contributor

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.

Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a 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.

@github-actions github-actions bot added the app label Jul 11, 2025
@andy31415 andy31415 requested a review from Copilot July 11, 2025 19:59
@andy31415
Copy link
Contributor Author

/gemini review

Copy link
Contributor
@Copilot 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

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 and InjectedDiagnosticsSoftwareDiagnosticsLogic 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 a ScopedDiagnosticsProvider<NullProvider>, which can be confusing. Consider renaming it to scopedNullProvider or nullProviderOverride 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 to scopedWatermarksProvider 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 to scopedAllProvider or allProviderOverride for consistency.
        ScopedDiagnosticsProvider<AllProvider> allProvider;

Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a 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.

Copy link
github-actions bot commented Jul 11, 2025

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)
platform target config section 48704fe 1d37a89 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1102622 1102624 2 0.0
RAM 179010 179010 0 0.0
bl702 lighting-app bl702+eth FLASH 656030 656022 -8 -0.0
RAM 134961 134961 0 0.0
bl702+wifi FLASH 833212 833210 -2 -0.0
RAM 124517 124517 0 0.0
bl706+mfd+rpc+littlefs FLASH 1065330 1065328 -2 -0.0
RAM 117373 117373 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 894876 894874 -2 -0.0
RAM 105660 105660 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 978594 978592 -2 -0.0
RAM 109852 109852 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 763128 763104 -24 -0.0
RAM 103368 103368 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 774668 774644 -24 -0.0
RAM 108536 108536 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 721008 721008 0 0.0
RAM 96940 96940 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 705300 705300 0 0.0
RAM 97148 97148 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548850 548866 16 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581842 581818 -24 -0.0
RAM 205344 205344 0 0.0
efr32 lock-app BRD4187C FLASH 955016 955008 -8 -0.0
RAM 126564 126564 0 0.0
BRD4338a FLASH 749468 749340 -128 -0.0
RAM 251912 251912 0 0.0
window-app BRD4187C FLASH 1049576 1049464 -112 -0.0
RAM 122760 122760 0 0.0
esp32 all-clusters-app c3devkit DRAM 102272 102272 0 0.0
FLASH 1780616 1780590 -26 -0.0
IRAM 83862 83862 0 0.0
m5stack DRAM 121156 121156 0 0.0
FLASH 1747894 1747878 -16 -0.0
IRAM 117071 117071 0 0.0
linux air-purifier-app debug unknown 4856 4856 0 0.0
FLASH 2796646 2796680 34 0.0
RAM 117320 117320 0 0.0
all-clusters-app debug unknown 5672 5672 0 0.0
FLASH 6198206 6198332 126 0.0
RAM 531216 532096 880 0.2
all-clusters-minimal-app debug unknown 5536 5536 0 0.0
FLASH 5473562 5473238 -324 -0.0
RAM 228008 227928 -80 -0.0
bridge-app debug unknown 5568 5568 0 0.0
FLASH 4807802 4807450 -352 -0.0
RAM 207712 207616 -96 -0.0
camera-app debug unknown 8976 8976 0 0.0
FLASH 6945771 6945419 -352 -0.0
RAM 230168 230072 -96 -0.0
camera-controller debug unknown 9216 9216 0 0.0
FLASH 14386923 14389035 2112 0.0
RAM 661528 662488 960 0.1
chip-tool debug unknown 6272 6272 0 0.0
FLASH 14743639 14763429 19790 0.1
RAM 655232 656192 960 0.1
chip-tool-ipv6only arm64 unknown 40672 40736 64 0.2
FLASH 12718695 12733351 14656 0.1
RAM 701480 702440 960 0.1
closure-app debug unknown 5536 5536 0 0.0
FLASH 4790656 4790304 -352 -0.0
RAM 200584 200504 -80 -0.0
fabric-admin debug unknown 5952 5952 0 0.0
FLASH 12804169 12806249 2080 0.0
RAM 654264 655224 960 0.1
fabric-bridge-app debug unknown 4816 4816 0 0.0
FLASH 4593134 4592780 -354 -0.0
RAM 193424 193360 -64 -0.0
fabric-sync debug unknown 5056 5056 0 0.0
FLASH 5741245 5741341 96 0.0
RAM 491728 492608 880 0.2
lighting-app debug+rpc+ui unknown 6280 6280 0 0.0
FLASH 5694593 5694241 -352 -0.0
RAM 209944 209848 -96 -0.0
lock-app debug unknown 5488 5488 0 0.0
FLASH 4836482 4836160 -322 -0.0
RAM 197192 197096 -96 -0.0
ota-provider-app debug unknown 4856 4856 0 0.0
FLASH 4446986 4447020 34 0.0
RAM 186112 186112 0 0.0
ota-requestor-app debug unknown 4736 4736 0 0.0
FLASH 4519108 4519142 34 0.0
RAM 188984 188984 0 0.0
shell debug unknown 4288 4288 0 0.0
FLASH 3076572 3076252 -320 -0.0
RAM 147344 147248 -96 -0.1
thermostat-no-ble arm64 unknown 9832 9824 -8 -0.1
FLASH 4236319 4235983 -336 -0.0
RAM 233304 233216 -88 -0.0
tv-app debug unknown 5824 5824 0 0.0
FLASH 6106237 6106365 128 0.0
RAM 615976 616856 880 0.1
tv-casti 10000 ng-app debug unknown 5352 5352 0 0.0
FLASH 12888029 12907245 19216 0.1
RAM 771728 772560 832 0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 888100 888092 -8 -0.0
RAM 166162 166162 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 897252 897208 -44 -0.0
RAM 145100 145100 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 858424 858416 -8 -0.0
RAM 141049 141049 0 0.0
nxp contact mcxw71+release FLASH 624800 624768 -32 -0.0
RAM 63164 63164 0 0.0
lock mcxw71+release FLASH 776008 775976 -32 -0.0
RAM 67820 67820 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1632532 1632412 -120 -0.0
RAM 211104 211104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1576708 1576588 -120 -0.0
RAM 208472 208472 0 0.0
light cy8ckit_062s2_43012 FLASH 1449500 1449380 -120 -0.0
RAM 197184 197184 0 0.0
lock cy8ckit_062s2_43012 FLASH 1481756 1481636 -120 -0.0
RAM 224904 224904 0 0.0
qpg lighting-app qpg6200+debug FLASH 744232 744192 -40 -0.0
RAM 94292 94292 0 0.0
lock-app qpg6200+debug FLASH 753852 753812 -40 -0.0
RAM 94320 94320 0 0.0
stm32 light STM32WB5MM-DK FLASH 465292 465268 -24 -0.0
RAM 141376 141376 0 0.0
telink bridge-app tl7218x FLASH 702340 702322 -18 -0.0
RAM 93600 93600 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 794072 794050 -22 -0.0
RAM 44016 44016 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 782478 782456 -22 -0.0
RAM 100912 100912 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 709590 709572 -18 -0.0
RAM 54240 54240 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 746184 746166 -18 -0.0
RAM 77404 77404 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 722910 722892 -18 -0.0
RAM 36996 36996 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 603014 602992 -22 -0.0
RAM 112532 112532 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 818032 818014 -18 -0.0
RAM 99164 99164 0 0.0
tizen all-clusters-app arm unknown 5096 5092 -4 -0.1
FLASH 1695816 1695560 -256 -0.0
RAM 91444 91400 -44 -0.0
chip-tool-ubsan arm unknown 20768 20800 32 0.2
FLASH 21076194 21098610 22416 0.1
RAM 9169420 9178492 9072 0.1

Copy link
github-actions bot commented Jul 12, 2025

PR #39977: Size comparison from 48704fe to 140301e

Increases above 0.2%:

platform target config section 48704fe 140301e change % change
linux camera-app debug RAM 230168 230656 488 0.2
Full report (56 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 48704fe 140301e change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1102622 1102624 2 0.0
RAM 179010 179010 0 0.0
bl702 lighting-app bl702+eth FLASH 656030 656022 -8 -0.0
RAM 134961 134961 0 0.0
bl702+wifi FLASH 833212 833210 -2 -0.0
RAM 124517 124517 0 0.0
bl706+mfd+rpc+littlefs FLASH 1065330 1065328 -2 -0.0
RAM 117373 117373 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 894876 894874 -2 -0.0
RAM 105660 105660 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 978594 978592 -2 -0.0
RAM 109852 109852 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 763128 763104 -24 -0.0
RAM 103368 103368 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 774668 774644 -24 -0.0
RAM 108536 108536 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 721008 721008 0 0.0
RAM 96940 96940 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 705300 705300 0 0.0
RAM 97148 97148 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548850 548866 16 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581842 581818 -24 -0.0
RAM 205344 205344 0 0.0
efr32 lock-app BRD4187C FLASH 955016 955008 -8 -0.0
RAM 126564 126564 0 0.0
BRD4338a FLASH 749468 749340 -128 -0.0
RAM 251912 251912 0 0.0
window-app BRD4187C FLASH 1049576 1049464 -112 -0.0
RAM 122760 122760 0 0.0
esp32 all-clusters-app c3devkit DRAM 102272 102272 0 0.0
FLASH 1780616 1780590 -26 -0.0
IRAM 83862 83862 0 0.0
m5stack DRAM 121156 121156 0 0.0
FLASH 1747894 1747878 -16 -0.0
IRAM 117071 117071 0 0.0
linux air-purifier-app debug unknown 4856 4856 0 0.0
FLASH 2796646 2796680 34 0.0
RAM 117320 117320 0 0.0
all-clusters-app debug unknown 5672 5672 0 0.0
FLASH 6198206 6198332 126 0.0
RAM 531216 532096 880 0.2
all-clusters-minimal-app debug unknown 5536 5536 0 0.0
FLASH 5473562 5473238 -324 -0.0
RAM 228008 227928 -80 -0.0
bridge-app debug unknown 5568 5568 0 0.0
FLASH 4807802 4807450 -352 -0.0
RAM 207712 207616 -96 -0.0
camera-app debug unknown 8976 8976 0 0.0
FLASH 6945771 6948171 2400 0.0
RAM 230168 230656 488 0.2
camera-controller debug unknown 9216 9216 0 0.0
FLASH 14386923 14389035 2112 0.0
RAM 661528 662488 960 0.1
chip-tool debug unknown 6272 6272 0 0.0
FLASH 14743639 14763429 19790 0.1
RAM 655232 656192 960 0.1
chip-tool-ipv6only arm64 unknown 40672 40736 64 0.2
FLASH 12718695 12733351 14656 0.1
RAM 701480 702440 960 0.1
closure-app debug unknown 5536 5536 0 0.0
FLASH 4790656 4790304 -352 -0.0
RAM 200584 200504 -80 -0.0
fabric-admin debug unknown 5952 5952 0 0.0
FLASH 12804169 12806249 2080 0.0
RAM 654264 655224 960 0.1
fabric-bridge-app debug unknown 4816 4816 0 0.0
FLASH 4593134 4592780 -354 6D47 -0.0
RAM 193424 193360 -64 -0.0
fabric-sync debug unknown 5056 5056 0 0.0
FLASH 5741245 5741341 96 0.0
RAM 491728 492608 880 0.2
lighting-app debug+rpc+ui unknown 6280 6280 0 0.0
FLASH 5694593 5694241 -352 -0.0
RAM 209944 209848 -96 -0.0
lock-app debug unknown 5488 5488 0 0.0
FLASH 4836482 4836160 -322 -0.0
RAM 197192 197096 -96 -0.0
ota-provider-app debug unknown 4856 4856 0 0.0
FLASH 4446986 4447020 34 0.0
RAM 186112 186112 0 0.0
ota-requestor-app debug unknown 4736 4736 0 0.0
FLASH 4519108 4519142 34 0.0
RAM 188984 188984 0 0.0
shell debug unknown 4288 4288 0 0.0
FLASH 3076572 3076252 -320 -0.0
RAM 147344 147248 -96 -0.1
thermostat-no-ble arm64 unknown 9832 9824 -8 -0.1
FLASH 4236319 4235983 -336 -0.0
RAM 233304 233216 -88 -0.0
tv-app debug unknown 5824 5824 0 0.0
FLASH 6106237 6106365 128 0.0
RAM 615976 616856 880 0.1
tv-casting-app debug unknown 5352 5352 0 0.0
FLASH 12888029 12907245 19216 0.1
RAM 771728 772560 832 0.1
nxp contact mcxw71+release FLASH 624800 624768 -32 -0.0
RAM 63164 63164 0 0.0
lock mcxw71+release FLASH 776008 775976 -32 -0.0
RAM 67820 67820 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1632532 1632412 -120 -0.0
RAM 211104 211104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1576708 1576588 -120 -0.0
RAM 208472 208472 0 0.0
light cy8ckit_062s2_43012 FLASH 1449500 1449380 -120 -0.0
RAM 197184 197184 0 0.0
lock cy8ckit_062s2_43012 FLASH 1481756 1481636 -120 -0.0
RAM 224904 224904 0 0.0
qpg lighting-app qpg6200+debug FLASH 744232 744192 -40 -0.0
RAM 94292 94292 0 0.0
lock-app qpg6200+debug FLASH 753852 753812 -40 -0.0
RAM 94320 94320 0 0.0
stm32 light STM32WB5MM-DK FLASH 465292 465268 -24 -0.0
RAM 141376 141376 0 0.0
telink bridge-app tl7218x FLASH 702340 702322 -18 -0.0
RAM 93600 93600 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 794072 794050 -22 -0.0
RAM 44016 44016 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 782478 782456 -22 -0.0
RAM 100912 100912 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 709590 709572 -18 -0.0
RAM 54240 54240 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 746184 746166 -18 -0.0
RAM 77404 77404 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 722910 722892 -18 -0.0
RAM 36996 36996 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 603014 602992 -22 -0.0
RAM 112532 112532 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 818032 818014 -18 -0.0
RAM 99164 99164 0 0.0
tizen all-clusters-app arm unknown 5096 5092 -4 -0.1
FLASH 1695816 1695560 -256 -0.0
RAM 91444 91400 -44 -0.0
chip-tool-ubsan arm unknown 20768 20800 32 0.2
FLASH 21076194 21098610 22416 0.1
RAM 9169420 9178492 9072 0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0