mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-09-07 15:07:17 +00:00
sameGroupClaim (device_projection.go, used to validate a member's claim agrees with the master's) compared roles via a device-ID-keyed map, making it order-insensitive. webtypes.replaceGroup's change detection used reflect.DeepEqual on the whole *Group, which is order-sensitive for Roles.Roles. Both the polled /getGroup response and the pushed groupUpdated event populate Roles.Roles directly from XML unmarshaling in wire order, so nothing guarantees a pair's roles list in the same order across two reads -- DeepEqual could then report a spurious "changed" for a pair that didn't actually change. Extracted the order-insensitive comparison into models.SameGroup as the single shared implementation (also handles the nil/nil case correctly, unlike the old sameGroupClaim, which mattered for replaceGroup's existing "no prior group" path). Both call sites now use it; the duplicate sameGroupClaim is gone. Added TestApplyGroupEventIgnoresRoleOrder, verified to fail against the prior DeepEqual-based logic and pass with this fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>