From 9a678442e9fb676d960f351599fc6532f76e31ea Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Wed, 20 May 2026 22:08:38 +0800 Subject: [PATCH] fix(msg): unswap markRead import aliases in Bridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `markGroupMsgAsRead` / `markPrivateMsgAsRead` Bridge methods were calling the wrong underlying implementations because the alias names on the import line were swapped: - `markPrivateMessageRead as markGroupMsgAsRead_` meant calling `bridge.markGroupMsgAsRead(groupId, …)` actually fired the c2c (private) read-report wire shape with `groupId` shoved into the `userId` slot — the server then resolved a uid for what was really a groupId and posted to the wrong route. - `markGroupMessageRead as markPrivateMsgAsRead_` was the mirror: `bridge.markPrivateMsgAsRead(userId, …)` fired the group read- report shape with `userId` in the `groupUin` field. Realigned to the intended pairing. The underlying implementations in `actions/group-message.ts` are already covered by `tests/actions/group-message.test.ts` (asserts both hit `SsoReadedReport` with their proper wire shapes); they pass unchanged because they always tested the action-layer functions directly, never the Bridge facade where the swap lived. Caught while planning the #6 Api-on-ctx refactor — preserving the swap into the new MessageApi would have carried the bug forward. --- packages/core/src/bridge/bridge.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/src/bridge/bridge.ts b/packages/core/src/bridge/bridge.ts index 6fe43827..29263c96 100644 --- a/packages/core/src/bridge/bridge.ts +++ b/packages/core/src/bridge/bridge.ts @@ -78,8 +78,14 @@ import { uploadPrivateFile as uploadPrivateFile_, } from './actions/group-file'; import { - markPrivateMessageRead as markGroupMsgAsRead_, - markGroupMessageRead as markPrivateMsgAsRead_, + // ⚠️ pre-fix history note: these two aliases were swapped here + // (`markPrivateMessageRead as markGroupMsgAsRead_` / + // `markGroupMessageRead as markPrivateMsgAsRead_`), meaning + // `bridge.markGroupMsgAsRead(groupId, …)` actually fired the c2c + // read-report wire shape with `groupId` in the `userId` slot, and + // vice versa. Realigned with their intended names. + markGroupMessageRead as markGroupMsgAsRead_, + markPrivateMessageRead as markPrivateMsgAsRead_, recallGroupMessage as recallGroupMessage_, recallPrivateMessage as recallPrivateMessage_, setGroupEssence as setGroupEssence_,