Fix JointFabricDatastore ownership, lifetime, and sync edge cases#71453
Fix JointFabricDatastore ownership, lifetime, and sync edge cases#71453vijs wants to merge 1 commit intoproject-chip:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces significant enhancements to the Joint Fabric Datastore and synchronization logic, including support for 'regular' device commissioning, improved in-flight command management, and more robust handling of ACL and Group Key Set data. The changes also include a major refactor of the unit tests to use a more descriptive tracking delegate. Key feedback items include critical safety concerns regarding iterator invalidation in asynchronous callbacks within JointFabricDatastore.cpp, misleading variable names in JFADatastoreSync.cpp, and inconsistent error status codes when resources are not found.
| keySetWrite.groupKeySet.epochKey2 = cbContext->objectToWrite.Value().epochKey2; | ||
| keySetWrite.groupKeySet.epochStartTime2 = cbContext->objectToWrite.Value().epochStartTime2; | ||
|
|
||
| chip::Controller::ClusterBase groupsCluster(exchangeMgr, sessionHandle, kRootEndpointId); |
There was a problem hiding this comment.
|
PR #71453: Size comparison from ad11a88 to cebf5f1 Full report (34 builds for bl602, bl616, 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 #71453 +/- ##
==========================================
- Coverage 54.31% 54.27% -0.05%
==========================================
Files 1576 1576
Lines 108247 108317 +70
Branches 13401 13428 +27
==========================================
- Hits 58796 58784 -12
- Misses 49451 49533 +82 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| uint64_t JointFabricDatastore::GetEndpointStorageKey(NodeId nodeId, EndpointId endpointId) const | ||
| { | ||
| return (static_cast<uint64_t>(nodeId) << 16) | static_cast<uint64_t>(endpointId); |
There was a problem hiding this comment.
NodeId is 64-bit already, so this loses the upper 16-bits.
We need a comment on why this is safe (I do not believe it is ...)
There was a problem hiding this comment.
also the static cast for nodeID is then not needed (otherwise it makes it seem like we upcast, but we do not)
There was a problem hiding this comment.
Simplified this logic to remove all casts and conversions. Please review the updated implementation.
|
PR #71453: Size comparison from 17a6004 to e03244d Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
|
PR #71453: Size comparison from d86a220 to 58264e2 Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
Summary
Improves JointFabric Datastore memory safety and reliability by fixing ownership and lifetime bugs, tightening refresh and sync edge cases, and adding targeted unit tests to prevent regressions.
Changes
Testing