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:
DrSmoothl
2026-05-19 14:04:43 +08:00
parent ff5fc651d0
commit 604dbc3f64
3 changed files with 93 additions and 0 deletions
@@ -25,6 +25,11 @@ export const decodeEvent0x210: MsgPushDecoder = (ctx) => {
case Event0x210SubType.FriendRequestNotice: return decodeFriendRequest(ctx);
case Event0x210SubType.FriendRecallNotice: return decodeFriendRecall(ctx);
case Event0x210SubType.FriendPokeNotice: return decodeFriendPoke(ctx);
case Event0x210SubType.GroupAppStatePush:
// QQ-client-internal troop shortcut bar / discussion app state
// push — no OneBot-level event. See enum comment for the
// decompiled-source breakdown of the sub_cmd dispatch.
return [];
}
unknownLog.debug('Event0x210 unknown subType=%d', ctx.head.subType);
return [];
@@ -31,4 +31,29 @@ export enum Event0x210SubType {
FriendRequestNotice = 35,
FriendRecallNotice = 138,
FriendPokeNotice = 290,
/**
* Group-app state push (troop shortcut bar / discussion app).
*
* Sourced from the decompiled stock QQ Android client decoder at
* `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}` entries the QQ client uses
* to keep group-internal "mini-app" badges (e.g. `appId=101846662`
* / `101896870` for the shortcut bar) in sync.
* - 0x3 → `UpdateDiscussAppInfo`: `{conf_uin, app_tip_notify.text}`
* for discussion-group app tips, routed to `getGAudioHandler()`.
* - 0x4 → delegated to the troop online-push handler.
*
* None of these have a OneBot event mapping — they're QQ-client-UI
* state pushes (unread badges, in-app tips), not user-visible
* conversation events. Acknowledge the subType so it doesn't keep
* showing up as "unknown" in debug logs and drop it silently.
* Lagrange V2 / lagrange-python / LagrangeGo / acidify all also
* fall through on this one because they don't surface the shortcut
* bar either.
*/
GroupAppStatePush = 38,
}
@@ -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();
}
});
});