project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.55k stars 2.04k forks source link

Make sure Leave event is emitted on internal deletions of fabrics #19936

Open tcarmelveilleux opened 2 years ago

tcarmelveilleux commented 2 years ago

Problem

The Basic Info cluster Leave event is required to be generated when a fabric is removed. It is not certain this is generated in every instance of fabric removal.

Proposed Solution

Damian-Nordic commented 2 years ago

@tcarmelveilleux Note that after https://github.com/project-chip/connectedhomeip/commit/e5e09f5c00 Leave event is no longer generated because ACLs are removed first and then generating a report fails with UNSUPPORTED_ACCESS error. I onced fixed it by moving this part to operational-credentials-server.cpp to have a better control over the order of the operation (see https://github.com/project-chip/connectedhomeip/pull/18434), but maybe we should do the other way around. The point is to execute all the actions in a single listener because otherwise it's very easy to break things by changing order of initialization of certain components.

bzbarsky-apple commented 2 years ago

https://github.com/project-chip/connectedhomeip/issues/21012 tracks the ordering issue there.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

bzbarsky-apple commented 1 year ago

We now generate Leave events in FabricWillBeRemoved, which is a notification from the fabric table. So any fabric removal that the fabric table knows about will generate the event.

@tcarmelveilleux Are you worried about fabric removals directly from storage, bypassing the fabric table?