fix(oidb): correct 0x9083 field layout so fetch_emoji_like returns users

Two bugs collapsed fetch_emoji_like into a perma-empty list with status=ok
and no error output:

1. Req fields 4 and 5 were swapped (emojiType on field 4 / emojiId on
   field 5). The sibling 0x9082 OidbGroupReaction has field 4 = code
   (string) and field 5 = type (uint), and 0x9083 mirrors that layout —
   verified against LagrangeDev/LagrangeV2
   `Internal/Packets/Service/SetGroupReaction.cs`. With our swap the
   wire types also mismatched (varint vs length-delim), so the server
   protobuf decoder dropped both fields and returned an empty list
   without ever surfacing an error.

2. Resp `inner.userInfo` was declared as a single message, but the
   server emits one entry per liker (repeated). Even after fixing the
   req, multi-user responses would have collapsed into the last entry.

Map the decoded array on the InteractionApi side and filter uin=0
placeholders. Test now mocks two users to exercise the repeated path.
This commit is contained in:
DrSmoothl committed 2026-05-21 22:10:33 +08:00
1 parent e088167476
commit 737b121dfe
3 files changed
+22 -7

No files matched your search

+6 -2
View File
@@ -87,8 +87,12 @@ export class InteractionApi {
const env = makeOidbEnvelope<Oidb0x9083Req>(0x9083, 1, req);
const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9083_1', protobuf_encode<OidbBase<Oidb0x9083Req>>(env));
const resp = protobuf_decode<OidbBase<Oidb0x9083Resp>>(respBytes).body;
const uin = resp?.inner?.userInfo?.uin;
const users = uin ? [{ uin: Number(uin) }] : [];
// userInfo is repeated on the wire — one entry per liker. The pre-fix
// schema treated it as single, which made multi-user responses collapse
// into one and (when paired with the swapped req fields) yield [].
const users: Array<{ uin: number }> = (resp?.inner?.userInfo ?? [])
.map(u => ({ uin: Number(u?.uin ?? 0) }))
.filter(u => u.uin > 0);
const respCookie = resp?.cookie ? Buffer.from(resp.cookie).toString('base64') : '';
return { users, cookie: respCookie, isLast: !respCookie };
}
@@ -78,13 +78,13 @@ describe('apis/interaction', () => {
vi.mocked(oidb.runOidb).mockResolvedValueOnce(
protobuf_encode<OidbBase<Oidb0x9083Resp>>({
body: {
inner: { userInfo: { uin: 10001n } },
inner: { userInfo: [{ uin: 10001n }, { uin: 20002n }] },
cookie: new Uint8Array([0xCA, 0xFE]),
} as any,
}),
);
const out = await new InteractionApi(bridge as any).getEmojiLikes(12345, 99, '128516');
expect(out.users).toEqual([{ uin: 10001 }]);
expect(out.users).toEqual([{ uin: 10001 }, { uin: 20002 }]);
expect(out.cookie).toBe(Buffer.from([0xCA, 0xFE]).toString('base64'));
expect(out.isLast).toBe(false);
});
+14 -3
View File
@@ -512,11 +512,18 @@ export interface FaceroamOpResp {
field3?: pb<3, uint_32>;
item?: pb<4, FaceroamOpRespItem>;
}
// 0x9083_1: fetch emoji-like user list. Field numbers must mirror the
// sibling 0x9082 reaction Req (OidbGroupReaction): field 4 = emoji_id
// (string), field 5 = emoji_type (uint). The pre-fix definition had
// these two swapped, which silently dropped both fields on the server
// side (wire type mismatch → protobuf decoder discards) and made every
// call return an empty list with no error. Cross-checked against
// Lagrange.Core V2 `Internal/Packets/Service/SetGroupReaction.cs`.
export interface Oidb0x9083Req {
groupId?: pb<2, uint_64>;
sequence?: pb<3, uint_32>;
emojiType?: pb<4, uint_32>;
emojiId?: pb<5, string>;
emojiId?: pb<4, string>;
emojiType?: pb<5, uint_32>;
cookie?: pb<6, bytes>;
field7?: pb<7, uint_32>;
count?: pb<8, uint_32>;
@@ -527,7 +534,11 @@ export interface Oidb0x9083RespUserInfo {
field3?: pb<3, uint_32>;
}
export interface Oidb0x9083RespInner {
userInfo?: pb<1, Oidb0x9083RespUserInfo>;
// The server returns one entry per liker — must be repeated. A single
// field collapses N wire entries into "last writer wins", so groups
// with multiple likers used to come back as a single user (or empty
// if the wire layout shifted).
userInfo?: pb_repeated<1, Oidb0x9083RespUserInfo>;
field4?: pb<4, uint_32>;
}
export interface Oidb0x9083Resp {