fix(msg-push): Event0x210 subType=38 is the troop-shortcut-bar push, not friend-related
Earlier this commit acknowledged subType 38 as a placeholder
"FriendGrayTipInfo" because none of the LagrangeDev-family projects
(Lagrange V2 / lagrange-python / LagrangeGo / acidify) have a
handler for it — they all just fall through with a generic
"unknown subType" debug log. The "best guess" gray-tip framing was
wrong.
A contributor traced it through the decompiled stock QQ Android
client to `com.tencent.imcore.message.ext.codec.decoder.msgType0x210
.SubType0x26` (tsuzcx/qq_apk @ afe46ef). The payload is
`submsgtype0x26.MsgBody` dispatching on `uint32_sub_cmd`:
- 0x1 → `UpdateAppUnreadNum`: a list of
`{group_code, app_id, unread_num}` keeping group-internal
"mini-app" badge counts (e.g. `appId=101846662` / `101896870`
for the troop shortcut bar) in sync.
- 0x3 → `UpdateDiscussAppInfo`: `{conf_uin, app_tip_notify.text}`
discussion-group app tips, routed through `getGAudioHandler()`.
- 0x4 → delegated to the troop online-push handler.
None of these have a meaningful OneBot mapping — they're
QQ-client-UI state pushes (badge counts, in-app tips), not
conversation events. Rename the enum entry to `GroupAppStatePush`
to reflect the actual semantics, cite the decompiled source
inline, and keep the silent-drop behaviour from the previous
attempt. Tests + decoder routing follow the rename.
628/628 tests pass (unchanged), typecheck clean.
This commit is contained in:
3 files changed
+93
No files matched your search
@@ -7,6 +7,7 @@ import { GroupChangeSchema, OperatorInfoSchema } from '../src/bridge/proto/notif
|
||||
import type { GroupMemberJoin } from '../src/bridge/events';
|
||||
import type { PacketInfo } from '../src/protocol/types';
|
||||
import { protoEncode } from '../src/protobuf/decode';
|
||||
import { subscribeLogs } from '../src/utils/logger';
|
||||
|
||||
const SELF_UIN = '10001';
|
||||
const GROUP_ID = 123456789;
|
||||
@@ -98,3 +99,65 @@ describe('parseMsgPush group member increase', () => {
|
||||
expect(event.operatorUid).toBe(operator.uid);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => {
|
||||
// Tracked back to the stock-QQ-android decompiled decoder
|
||||
// `com.tencent.imcore.message.ext.codec.decoder.msgType0x210.SubType0x26`
|
||||
// — it's the QQ-client-internal "troop shortcut bar" / discussion
|
||||
// app state push (badge counts + in-app tips), not a chat event.
|
||||
// We acknowledge it via `Event0x210SubType.GroupAppStatePush` and
|
||||
// drop silently — no OneBot-level event, and — critically —
|
||||
// **no** "unknown subType=38" fallback log spam anymore.
|
||||
function makeEvent0x210Packet(subType: number, content = new Uint8Array(0)): PacketInfo {
|
||||
const body = protoEncode({
|
||||
message: {
|
||||
responseHead: { fromUin: 22222, type: 0, sigMap: 0 },
|
||||
// 528 = Event0x210
|
||||
contentHead: { msgType: 528, subType, timestamp: 1710000000 },
|
||||
body: { msgContent: content },
|
||||
},
|
||||
status: 0,
|
||||
} as any, PushMsgSchema);
|
||||
return {
|
||||
pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1,
|
||||
retCode: 0, fromClient: false, body,
|
||||
};
|
||||
}
|
||||
|
||||
it('returns [] for subType 38 without falling through to the MsgPush.Unknown log', () => {
|
||||
const captured: string[] = [];
|
||||
const unsubscribe = subscribeLogs((entry) => {
|
||||
// Only care about the spam that the prior implementation produced
|
||||
// ("MsgPush.Unknown" with subType=38). Other modules log freely
|
||||
// during identity setup etc., we ignore them.
|
||||
if (entry.scope === 'MsgPush.Unknown' && /subType=38/.test(entry.message)) {
|
||||
captured.push(entry.message);
|
||||
}
|
||||
});
|
||||
try {
|
||||
const events = parseMsgPush(makeEvent0x210Packet(38), makeIdentity());
|
||||
expect(events).toEqual([]);
|
||||
expect(captured).toEqual([]); // no "unknown subType=38" debug log
|
||||
} finally {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
|
||||
it('still flags genuinely-unknown subTypes via MsgPush.Unknown (regression guard)', () => {
|
||||
// Counterpart to the silent-on-38 case: anything we *haven't*
|
||||
// claimed in the enum should still hit the fallback so it's
|
||||
// visible to whoever's tailing debug logs.
|
||||
const captured: string[] = [];
|
||||
const unsubscribe = subscribeLogs((entry) => {
|
||||
if (entry.scope === 'MsgPush.Unknown' && /subType=999/.test(entry.message)) {
|
||||
captured.push(entry.message);
|
||||
}
|
||||
});
|
||||
try {
|
||||
parseMsgPush(makeEvent0x210Packet(999), makeIdentity());
|
||||
expect(captured.length).toBeGreaterThan(0);
|
||||
} finally {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user