Read READY as a real Fluxer server sends it (partial member users) #192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-live-protocol"
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 #189 (
fix-altcha-captcha): this branch is based on it so both can be tried together. Merge #189 first.Problem
After a successful login to a real instance the client showed no guilds, no DMs and "Unknown User":
skipping malformed dispatch error=malformed READY dispatch: missing field 'username'. The server deduplicates users in READY:guilds[].members[].useris{"id"}only and the full users are in the top-leveluserslist (session_ready_collect.erl,strip_users_from_guild_members);relationships[]lose theiruser. Our READY fixture had full users everywhere, so nothing caught it.Changes
UserRef(Full(UserPartial)|Id { id }, untagged, round-trips in the form read) forGuildMember::user,Presence::user(the server sends{"id"}in the offline PRESENCE_UPDATE when it drops a friend/group-DM subscription) andGUILD_MEMBER_REMOVE.user(always{"id"}).ReadyPayload::resolve_users()fills references fromusers/user.ReadyPayload/GuildReadyDatais lenient: a malformed entry is dropped with awarn(type + parse error), not the whole READY; a malformed guild object leavesproperties: None. This addstracing(already a workspace dependency) to fluxer-proto, only for that warning.READY.users; a member whose user is unknown is kept and shown as Unknown User.fixtures/gateway/ready.jsonnow has the real structure (member user references,usersholding every member including the logged-in user, relationships withoutuser, empty guild presences,sessions,version,geoip_country_code,webauthn_credentials), with the same fake identities. The devserver resolves it before choosing message authors. Screenshot goldens are unchanged.crates/fluxer-core/tests/replay.rs, skipped unlessFLUXER_REPLAY_DIRpoints at a--recorddirectory. It runs every gateway frame and REST body through the real parsers and the store and reports mismatches by key path and a redacted error only (no values). After READY it checks that guilds, channels, DMs and the user's name reached the store, and prints counts.Server survey (other dispatches)
I checked the server source (gateway and API): outside READY, only GUILD_MEMBER_REMOVE and the offline PRESENCE_UPDATE carry
{"id"}users among the typed dispatches. GUILD_CREATE for a user (only bots get stripped members), GUILD_MEMBER_ADD/UPDATE, message author/mentions, DM recipients and CHANNEL_RECIPIENT_/RELATIONSHIP_ are full. Untyped events that will need the same care when they are modelled: THREAD_MEMBERS_UPDATE (added_members[].presence.useris{"id"}), GUILD_MEMBER_LIST_UPDATE (an offline presence has nouser), and messagemember(never hasuser). VOICE_STATEmembermay benull, which is already handled.Tests
users; an unknown member user id is kept; malformed members, channels, users, guilds and guild objects do not drop READY; references in GUILD_MEMBER_REMOVE and PRESENCE_UPDATE; core: members are named fromusers, an unknown member is kept unnamed, a malformed member does not drop READY.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps pass.🤖 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>