Subscribe to guild member lists (op 14) so other members and presences show #197
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-member-list"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: #192 (
fix-live-protocol, itself on #189). Merge those first; this PR's diff againstmainincludes them until then.Symptom
On a real instance the member list showed only the logged-in user. The real server puts only the session's own member (and the members in voice) into
READY.guilds[].members/GUILD_CREATE, andguilds[].presencesis always empty; everyone else arrives only inGUILD_MEMBER_LIST_UPDATEafter the client subscribes with op 14. The client never subscribed, and its fixtures put every member intoREADY.What the original does (fork citations)
LAZY_REQUEST(fluxer_app/src/features/gateway/transport/GatewaySocket.ts:669-673, types inGatewaySubscriptionLedger.ts:3-12):{subscriptions: {<guild>: {active: true, sync: true}}}(GatewayGuildSubscriptionSynchronizer.ts:29-50, called fromGatewaySessionPool.ts:112,364-370andguild/events/GuildCreate.ts:90-100; flushed again when the connection is ready,PooledGatewayConnection.ts:918-933);{<guild>: {active: true, sync: true (first time per session), member_list_channels: {<channel>: [[0, 99]]}}}(member/state/MemberSidebar.ts:975-1015,member/hooks/useMemberListSubscription.ts:33,51-350), widened by scroll position (channel/components/ChannelMembers.tsx:279-314) and resent after every reconnect (useMemberListSubscription.ts:310-321,MemberSidebar.ts:839-843). No explicit unsubscribe on channel/guild switch: the server keeps one member list per session (fluxer_gateway/src/session/session_guilds.erl:79-157,guild/guild_member_list_subscribe.erl:57-71).members: [...](presence subscriptions) only for open profiles (presence/state/MemberPresenceSubscription.ts).GUILD_MEMBER_LIST_UPDATE {guild_id, id, channel_id, member_count, online_count, groups: [{id, count}], ops: [{op: "SYNC", range, items: [{group} | {member}]}]}— onlySYNCexists (guild/guild_member_list_read.erl:114-165,369-371,443-473; client drops other ops,guild/events/GuildMemberListUpdate.ts:63-99). Sent once after the subscription (guild/guild_subscription_handler.erl:330-356) and the whole subscribed ranges again on every change (guild_dispatch_member_list.erl,guild_member_list_sync_batch.erl). Groups: hoisted roles by hoist position,online,offline(guild_member_list_groups.erl); offline group hidden above 1,000 (guild_member_list_read.erl:489-503).member.useris full; itspresenceis the full presence (user included) when visible online, and{"status":"offline","mobile":false,"afk":false}without user otherwise (guild_member_list_connected.erl:24-44,86-104,presence/presence_payload.erl).GUILD_SYNC: the guild ready object again aftersync/an active switch (guild/guild_unified_subscriptions.erl:194-204,guild_sessions_passive.erl:60-80).PRESENCE_UPDATEs go only to sessions that named the user inmembers(guild/guild_presence.erl:162-215); guild members' presences otherwise come only in the member list.GUILD_MEMBERS_CHUNKanswers op 8 only; the web app does not use it for the member list.Changes
gateway::member_list:LazyRequest/GuildSubscription/MemberListRange(op 14),GatewayEvent::GuildMemberListUpdatewithMemberListGroup,MemberListOp::{Sync, Unknown},MemberListItem::{Group, Member, Unreadable}(an unreadable row keeps its slot),MemberListPresence(useroptional).GatewayEvent::GuildSync. Fixturefixtures/gateway/guild_member_list_update.json, teststests/member_list.rs.MemberLists(app.member_lists): sends op 14 as above while the gateway session is live (again afterREADY/RESUMED), keeps the server list of the channel subscribed last per guild, widens the ranges to cover the whole list up to 10 ranges (1,000 rows).selectors::members::member_listuses it (groups, order,MemberGroup::count); without an answer it falls back to what READY had. Member rows fillUsers,PresenceStateand the guild's members.GUILD_CREATE/GUILD_SYNCnow add their (partial) members instead of replacing them. Replay test checks member-list rows.MemberGroupModel::count).GUILD_CREATEs carry only the signed-in member and no guild presences; op 14 is answered withGUILD_MEMBER_LIST_UPDATElaid out like the server's; a timelinePRESENCE_UPDATEresends the list. New end-to-end testapps/fluxer/tests/runtime.rs::the_member_list_arrives_after_subscribing(fails without the subscription).Screenshot goldens: unchanged and pixel-identical; the basic scenario now also applies the member-list fixture and renders the same groups.
Also depends on a subscription the client does not send / handle
MESSAGE_CREATE(except mentions), no typing and member events, onlyPASSIVE_UPDATES, which is not handled → #196. The selected guild is made active here.PRESENCE_UPDATEneedsmembers: [...](the web app uses it only for open profiles); presences of members not in a loaded list row are unknown (shown offline).threads,thread_member_lists) are not sent; threads are not modelled.🤖 Generated with Claude Code
The server deduplicates users in READY: guilds[].members[].user is {"id"} only and the full users are in the top-level `users` list (session_ready_collect.erl). fluxer-proto required a full user on every member, so a real READY failed to parse as a whole and the client showed no guilds, no DMs and "Unknown User". - fluxer-proto: `UserRef` (full user or `{"id"}` reference) for GuildMember::user, Presence::user (the offline PRESENCE_UPDATE sent when a friend/group-DM subscription is dropped) and GUILD_MEMBER_REMOVE's user (always a reference). `ReadyPayload::resolve_users()` fills the references from `users` and `user`. - Every list of ReadyPayload / GuildReadyData is read leniently: a malformed entry is dropped with a warning instead of losing the session; a malformed guild object leaves `properties: None`. Adds `tracing` to fluxer-proto for that warning. - fluxer-core: members and presences that are references add nothing to the user cache; names come from READY.users, unknown users show as Unknown User. - fixtures/gateway/ready.json now has the real structure (member user references, `users` with every member, relationships without `user`, empty guild presences, sessions/version/...), with the same fake identities. The devserver resolves it before indexing message authors. - tests/replay.rs in fluxer-core: with FLUXER_REPLAY_DIR set, replays a --record recording through the parsers and the store and reports mismatches by key path and redacted error only; skipped otherwise. - Regression tests: references resolved via `users`, an unknown member user id kept, malformed members/channels/users/guilds dropped without failing READY, references in GUILD_MEMBER_REMOVE and PRESENCE_UPDATE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>The real server sends only the user's own member in READY and no guild presences; the other members arrive in GUILD_MEMBER_LIST_UPDATE after an op 14 (LAZY_REQUEST) subscription, which the client never sent. - fluxer-proto: LazyRequest/GuildSubscription/MemberListRange, the GUILD_MEMBER_LIST_UPDATE and GUILD_SYNC dispatches, with a fixture. - fluxer-core: MemberLists sends {active, sync} on guild select and the shown channel's member list ranges, again after every reconnect; keeps the server list and feeds member_list, users and presences from it; falls back to READY's members when no answer comes. GUILD_CREATE and GUILD_SYNC add their partial members instead of replacing them. - fluxer-ui: group headers show the server's count. - fluxer-devserver: READY and GUILD_CREATE carry only the signed-in member; op 14 is answered with a server-shaped member list, and presence changes resend it. New end-to-end test. Follow-ups: #195 (scroll ranges past 1,000 rows), #196 (PASSIVE_UPDATES). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>