From b37b17f7d8f8067099d771984cd91a0434b51f37 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Thu, 9 Jul 2026 23:13:40 +0800 Subject: [PATCH] fix(protocol): guard identity.findGroup in group decoder (#212) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 9b470d0 added ctx.identity.findGroup() to the group-message decoder for the group_name cache fallback, but several suites mock a minimal identity without findGroup, so decodeGroupMessage threw at runtime once the typecheck gate (fixed in 5e73d69) let CI reach the test phase — forward / packet-pipeline-stranger-resolve / msg-push-handler. Optional-chain the call: the real IdentityService always has findGroup; only test mocks omit it, and an absent cache simply yields no fallback name. --- packages/protocol/src/msg-push/decoders/group-message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/src/msg-push/decoders/group-message.ts b/packages/protocol/src/msg-push/decoders/group-message.ts index 2578bcf1..8e4f3aec 100644 --- a/packages/protocol/src/msg-push/decoders/group-message.ts +++ b/packages/protocol/src/msg-push/decoders/group-message.ts @@ -47,6 +47,6 @@ export const decodeGroupMessage: MsgPushDecoder = (ctx) => { // Group name: prefer the message's own wire field (ResponseGrp field 7 — // fresh even right after a rename), fall back to the cached group list, else // leave it empty. `ev.groupId` is set above from grp.groupUin. - ev.groupName = grp?.groupName || ctx.identity.findGroup(ev.groupId)?.groupName || ''; + ev.groupName = grp?.groupName || ctx.identity.findGroup?.(ev.groupId)?.groupName || ''; return [ev]; };