Skip to content

Skip unresolved group members during optimistic publish replay - #32485

Open
MaxRink wants to merge 6 commits into
Koenkk:devfrom
MaxRink:z2m-publish-unresolved-members
Open

Skip unresolved group members during optimistic publish replay#32485
MaxRink wants to merge 6 commits into
Koenkk:devfrom
MaxRink:z2m-publish-unresolved-members

Conversation

@MaxRink

@MaxRink MaxRink commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Per the message in this thread, optimistic group publish could crash while replaying membersState if one group member no longer resolves.

This adds a defensive guard so unresolved group members are skipped with a warning instead of dereferencing undefined.ID.

Fixes #31951.

@MaxRink
MaxRink force-pushed the z2m-publish-unresolved-members branch from d0f5603 to da58a4d Compare July 4, 2026 21:54
@MaxRink
MaxRink marked this pull request as ready for review July 4, 2026 23:20
@MaxRink
MaxRink changed the base branch from master to dev July 5, 2026 09:50
Comment thread lib/extension/publish.ts Outdated
@Koenkk

Koenkk commented Jul 5, 2026

Copy link
Copy Markdown
Owner

replaying membersState if one group member no longer resolves.

I'm wondering how this can happen? Sounds like inconsistency in the database.db, can you reproduce this?

@MaxRink
MaxRink force-pushed the z2m-publish-unresolved-members branch from eced5d6 to d9c015c Compare July 5, 2026 14:08
@MaxRink
MaxRink force-pushed the z2m-publish-unresolved-members branch from 7354dc3 to 0b6899f Compare August 12, 2026 00:59

@luantaraschi luantaraschi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I found one mismatch between the patch and the issue it claims to fix. In the Zigbee2MQTT 2.10.1 source referenced by #31951, line 192 is endpointOrGroupID = localTarget.ID. The reported Shelly failure therefore occurs after re.endpoint(endpointName) returns undefined. This patch and its regression test exercise a different path: scene_recall on a group with an unresolved entry in converter-produced membersState.

I ran the new targeted test and pnpm run check; both passed. The defensive group handling looks consistent, but the test does not reproduce the switch_type_sw1 or switch_mode_sw1 failure from #31951. Could you either add a reproduction for that Shelly endpoint path, or remove Fixes #31951 and link this change to the unresolved-group scenario it covers?

@MaxRink
MaxRink force-pushed the z2m-publish-unresolved-members branch from 0b6899f to 75ef67c Compare August 14, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't change switch type (Shelly gen 4)

4 participants