refactor(protocol): own inbound UID-to-UIN resolution in Identity

Inbound person lookup used to be split across decoders, the packet
pipeline, and Bridge closures. Missing identities were filled from
unrelated packet headers, and "who is this person" was coupled to
roster refresh and pending-request enrichment.

Identity now owns both directions of resolution. The hot path stays
synchronous and emits unresolved events on a miss. Only the paths
that already waited before dispatch perform a network lookup, and
that lookup is a profile fetch by UID rather than a member-list
refresh. Pending-request comments and approval flags stay outside
Identity.

Decoders no longer invent a UIN from a group routing header. Private
chat routing still uses a hop's own wire UIN when the hop is named
that way. Inbound misses stay availability-first: they do not throw
and do not mark Identity degraded.
This commit is contained in:
DrSmoothl committed 2026-08-13 14:37:56 +08:00
1 parent d26aef86d8
commit 7d5ca5523b
16 files changed
+334 -187

No files matched your search

@@ -19,7 +19,7 @@ export const decodeGroupAdmin: MsgPushDecoder = (ctx) => {
if (!adminUid) return [];
const groupId = admin.groupUin ?? 0;
const set = !!enableUid;
const userUin = resolveUidToUin(ctx.identity, groupId, adminUid, ctx.fromUin);
const userUin = resolveUidToUin(ctx.identity, groupId, adminUid);
// Keep the in-memory member cache in step with the promotion/demotion.
// `get_group_member_info` serves straight from this cache on its