Skip to content

Move data model types from basic-types.h to DataModelTypes.h #39146

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 7 commits into
base: master
Choose a base branch
from

Conversation

jennygaz
Copy link
Contributor

Fixes #38417

Testing

Tested with the same workflows in my own repo, passing most and some only failed due to not pulling docker images properly.

Copy link

PR #39146: Size comparison from f8f3c49 to 340fc16

Full report (1 build for stm32)
platform target config section f8f3c49 340fc16 change % change
stm32 light STM32WB5MM-DK FLASH 464964 464964 0 0.0
RAM 141488 141488 0 0.0

@tersal
Copy link
Contributor

tersal commented May 29, 2025

I see some changes in the auto generated code (zzz_generated folder), just want to confirm if this change will not be overwritten by some tool like ZAP or whatever one is used to generate that code.

@mergify mergify bot added the conflict label May 30, 2025
@jennygaz
Copy link
Contributor Author

@tersal Not really, the tests already build it again and test it, so if the tests were to fail when building then there'd be issues. That's not the case since we changed the BUILD.gn file which changes part of the code generation.

@jennygaz jennygaz closed this Jun 2, 2025
@jennygaz jennygaz force-pushed the refactor-data-model-types branch from d63c2a1 to 8ce15ad Compare June 2, 2025 16:19
@mergify mergify bot removed the conflict label Jun 2, 2025
@jennygaz jennygaz reopened this Jun 2, 2025
@jennygaz
Copy link
Contributor Author

jennygaz commented Jun 2, 2025

/gemini review

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 effectively refactors common data model types by moving them from src/app/util/basic-types.h to src/lib/core/DataModelTypes.h. This centralization is a positive step for maintainability and clarity, placing these fundamental types in a more appropriate core location. The changes appear correct and maintain existing functionality for consumers of basic-types.h.

One minor suggestion regarding the PR title: "Refactor data model types to include basic-types.h" could be slightly ambiguous. Perhaps a title like "Move data model types from basic-types.h to DataModelTypes.h" or "Centralize data model types into DataModelTypes.h" might more directly reflect the changes made. This is just a suggestion for clarity.

Overall, good work on this refactoring!

Summary of Findings

  • Redundant include in basic-types.h: In src/app/util/basic-types.h, the #include <cstdint> (previously on line 26, now effectively line 26 in the full file context post-diff) appears redundant as lib/core/DataModelTypes.h (included on line 29) already includes <cstdint>. This was not added as a review comment due to severity settings.
  • Empty namespace in basic-types.h: The file src/app/util/basic-types.h now contains an empty namespace declaration: namespace chip {} // namespace chip (line 31 post-diff). This seems unnecessary if the file's primary role is now an include forwarder. This was not added as a review comment due to severity settings.
  • File Doxygen comment in basic-types.h: The Doxygen comment for src/app/util/basic-types.h (lines 18-22 in the full file context) states it's 'The include file for all the types for the data model...'. Since the types are now defined in DataModelTypes.h and only included here, this description might benefit from a slight update to reflect its current role. This was not added as a review comment due to severity settings.

Merge Readiness

The code changes are well-structured and achieve the goal of centralizing data model types. Based on the review criteria and severity settings, no medium or higher severity issues were found in the diff. The pull request appears to be in good shape for merging. As a reviewer, I am not authorized to approve pull requests, so please ensure it undergoes any further necessary review and approval processes.

@jennygaz jennygaz changed the title Refactor data model types to include basic-types.h Move data model types from basic-types.h to DataModelTypes.h Jun 2, 2025
Copy link

github-actions bot commented Jun 2, 2025

PR #39146: Size comparison from 49594a5 to 1524ff9

Increases above 0.2%:

platform target config section 49594a5 1524ff9 change % change
telink lighting-app-ota-factory-data tlsr9118bdk40d FLASH 600610 604478 3868 0.6
Full report (75 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 49594a5 1524ff9 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1102196 1102196 0 0.0
RAM 179058 179058 0 0.0
bl702 lighting-app bl702+eth FLASH 655302 655302 0 0.0
RAM 135009 135009 0 0.0
bl702+wifi FLASH 832792 832792 0 0.0
RAM 124573 124573 0 0.0
bl706+mfd+rpc+littlefs FLASH 1065480 1065480 0 0.0
RAM 117405 117405 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 895026 895026 0 0.0
RAM 105708 105708 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 978750 978750 0 0.0
RAM 109892 109892 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 820516 820516 0 0.0
RAM 120224 120224 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 832120 832120 0 0.0
RAM 125376 125376 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 777640 777640 0 0.0
RAM 113780 113780 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 761956 761956 0 0.0
RAM 113988 113988 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548158 548158 0 0.0
RAM 205192 205192 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581606 581606 0 0.0
RAM 205384 205384 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 662621 662621 0 0.0
RAM 77504 77504 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 682465 682465 0 0.0
RAM 80144 80144 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 682465 682465 0 0.0
RAM 80144 80144 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 639405 639405 0 0.0
RAM 72572 72572 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 623989 623989 0 0.0
RAM 73816 73816 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 643625 643625 0 0.0
RAM 76368 76368 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 643625 643625 0 0.0
RAM 76368 76368 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 644909 644909 0 0.0
RAM 76816 76816 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 664625 664625 0 0.0
RAM 79368 79368 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 664625 664625 0 0.0
RAM 79368 79368 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 619577 619577 0 0.0
RAM 70928 70928 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 639429 639429 0 0.0
RAM 73560 73560 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 639429 639429 0 0.0
RAM 73560 73560 0 0.0
efr32 lock-app BRD4187C FLASH 946796 946796 0 0.0
RAM 132036 132036 0 0.0
BRD4338a FLASH 776008 776008 0 0.0
RAM 173256 173256 0 0.0
window-app BRD4187C FLASH 1039656 1039648 -8 -0.0
RAM 128164 128164 0 0.0
esp32 all-clusters-app c3devkit DRAM 103544 103544 0 0.0
FLASH 1809908 1809908 0 0.0
IRAM 83862 83862 0 0.0
m5stack DRAM 122412 122412 0 0.0
FLASH 1774554 1774554 0 0.0
IRAM 117071 117071 0 0.0
linux air-purifier-app debug unknown 4848 4848 0 0.0
FLASH 2786574 2786574 0 0.0
RAM 117016 117016 0 0.0
all-clusters-app debug unknown 5664 5664 0 0.0
FLASH 6385368 6385368 0 0.0
RAM 537568 537568 0 0.0
all-clusters-minimal-app debug unknown 5528 5528 0 0.0
FLASH 5468430 5468430 0 0.0
RAM 227976 227976 0 0.0
bridge-app debug unknown 5560 5560 0 0.0
FLASH 4800908 4800908 0 0.0
RAM 207632 207632 0 0.0
camera-app debug unknown 8864 8864 0 0.0
FLASH 6910331 6910331 0 0.0
RAM 228888 228888 0 0.0
camera-controller debug unknown 9168 9168 0 0.0
FLASH 14264875 14264875 0 0.0
RAM 657256 657256 0 0.0
chip-tool debug unknown 6248 6248 0 0.0
FLASH 14638053 14638053 0 0.0
RAM 650736 650736 0 0.0
chip-tool-ipv6only arm64 unknown 40440 40440 0 0.0
FLASH 12609844 12609844 0 0.0
RAM 697080 697080 0 0.0
fabric-admin debug unknown 5928 5928 0 0.0
FLASH 12709621 12709621 0 0.0
RAM 650136 650136 0 0.0
fabric-bridge-app debug unknown 4808 4808 0 0.0
FLASH 4586812 4586812 0 0.0
RAM 193344 193344 0 0.0
fabric-sync debug unknown 5064 5064 0 0.0
FLASH 5733733 5733733 0 0.0
RAM 490016 490016 0 0.0
lighting-app debug+rpc+ui unknown 6272 6272 0 0.0
FLASH 5650209 5650209 0 0.0
RAM 209864 209864 0 0.0
lock-app debug unknown 5496 5496 0 0.0
FLASH 4835210 4835210 0 0.0
RAM 197096 197096 0 0.0
ota-provider-app debug unknown 4848 4848 0 0.0
FLASH 4438712 4438712 0 0.0
RAM 185968 185968 0 0.0
ota-requestor-app debug unknown 4728 4728 0 0.0
FLASH 4508184 4508184 0 0.0
RAM 188600 188600 0 0.0
shell debug unknown 4256 4256 0 0.0
FLASH 3082892 3082892 0 0.0
RAM 151080 151080 0 0.0
thermostat-no-ble arm64 unknown 9784 9784 0 0.0
FLASH 4232860 4232860 0 0.0
RAM 233416 233416 0 0.0
tv-app debug unknown 5832 5832 0 0.0
FLASH 6098629 6098629 0 0.0
RAM 614248 614248 0 0.0
tv-casting-app debug unknown 5336 5336 0 0.0
FLASH 12786941 12786941 0 0.0
RAM 767120 767120 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 921836 921836 0 0.0
RAM 167468 167468 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 913072 913072 0 0.0
RAM 145712 145712 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 859012 859012 0 0.0
RAM 141095 141095 0 0.0
nxp contact k32w0+release FLASH 592248 592248 0 0.0
RAM 72864 72864 0 0.0
mcxw71+release FLASH 624976 624976 0 0.0
RAM 63196 63196 0 0.0
light k32w0+release FLASH 618340 618340 0 0.0
RAM 72160 72160 0 0.0
k32w1+release FLASH 709512 709512 0 0.0
RAM 72052 72052 0 0.0
lock mcxw71+release FLASH 776144 776144 0 0.0
RAM 67612 67612 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1671524 1671524 0 0.0
RAM 212464 212464 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1575876 1575876 0 0.0
RAM 208512 208512 0 0.0
light cy8ckit_062s2_43012 FLASH 1448308 1448308 0 0.0
RAM 197240 197240 0 0.0
lock cy8ckit_062s2_43012 FLASH 1480588 1480588 0 0.0
RAM 224952 224952 0 0.0
qpg lighting-app qpg6105+debug FLASH 667212 667212 0 0.0
RAM 105196 105196 0 0.0
lock-app qpg6105+debug FLASH 627280 627280 0 0.0
RAM 99816 99816 0 0.0
stm32 light STM32WB5MM-DK FLASH 464956 464956 0 0.0
RAM 141424 141424 0 0.0
telink bridge-app tl7218x FLASH 694200 677444 -16756 -2.4
694200 694200 0 0.0
RAM 102100 90960 -11140 -10.9
102100 102100 0 0.0
light-app-ota-compress-lzma-factory-data tl3218x FLASH 766638 766638 0 0.0
RAM 50252 50252 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 767668 767668 0 0.0
RAM 40544 40544 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 773746 756126 -17620 -2.3
773746 773746 0 0.0
RAM 109424 97672 -11752 -10.7
109424 109424 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 703106 687208 -15898 -2.3
703106 703106 0 0.0
RAM 62812 51780 -11032 -17.6
62812 62812 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 741060 715658 -25402 -3.4
741060 741060 0 0.0
RAM 85984 73592 -12392 -14.4
85984 85984 0 0.0
light-switch-app-ota-shell-factory-data tl3218x_retention FLASH 712986 712986 0 0.0
RAM 37228 37228 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 600610 604478 3868 0.6
600610 600610 0 0.0
RAM 120196 106920 -13276 -11.0
120196 120196 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 809084 791196 -17888 -2.2
809084 809088 4 0.0
RAM 107692 96520 -11172 -10.4
107692 107692 0 0.0
tizen all-clusters-app arm unknown 5300 5300 0 0.0
FLASH 1819708 1819708 0 0.0
RAM 97160 97160 0 0.0
chip-tool-ubsan arm unknown 20644 20644 0 0.0
FLASH 20907966 20907966 0 0.0
RAM 9100368 9100368 0 0.0

Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

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

And followup (or here, either way, but followup is better): to address the rest of #38390 (comment), actually change the zapt to include DataModelTypes.h, right?

@@ -6,7 +6,7 @@
#include <app/data-model/DecodableList.h>
#include <app/data-model/List.h>
#include <app/data-model/Nullable.h>
#include <app/util/basic-types.h>
$include <lib/core/DataModelTypes.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a regen to pass ZAP CI....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed by now! I regenerated the ZAP files and pushed them here

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jennygaz
❌ Jenny Gallegos Cárdenas


Jenny Gallegos Cárdenas seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Followup:DataModelTypes.h should replace basic-types (less util dependencies)
6 participants