Repository navigation
fix: answer Discord members asked before READY as pending, not unsupported - #60
Merged
Merged
Conversation
…orted
A Members request that came before READY found no server described yet and was refused as Unsupported ("Discord cannot do this yet"). The member pane takes a refusal as a failed page it does not ask for again, and the details pane drops it, so a list opened while connecting stayed empty after the account connected. Before READY the answer is now pending with no members, as a cache miss after connect already is. Both ask again every 250 ms, and once READY has placed the Watch the list is subscribed and fills. Nothing is placed from the early request. Once any server is known, one that is not is still refused.
Refs #43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
#51 makes a Watch sent before READY take effect once READY arrives. A
Membersrequest sent in that same window still failed.members.rs::memberslooks the conversation's server up instate.guilds, which READY fills, and answeredError { Unsupported, "Discord cannot do this yet" }when the server was missing. On a restart the stored tree is on screen before READY, so this happens as the app opens.The GUI treats that answer as a final failure, not as data still to come:
gui/people/members.rs::landed) records the page as failed, shows "Couldn't load members" and does not retry. OnlyOffline, slow or gone sockets, and "Discord did not send the member list." are retried.gui/people/info.rs::ask_members) ignores any answer that is notMembers, so its inline members never come.So a list opened while connecting stayed empty after the account connected. Issue #43 asks that "a member-cache miss should not be mistaken for an empty roster", and this was one.
Fix
In
members.rs::members: if the server is unknown and no server is known at all (state.guildsis empty, i.e. READY has not said what they are), answerMembers { pending: true }with no sections or members. That is the answer a cache miss after connect already gets.Watchedis left alone, so nothing is placed or subscribed from the early request. READY'srewatch(#51) places the Watch.Both GUI callers already handle pending: they re-ask every 250 ms while the page is wanted. After READY the next ask opens the list, the window is subscribed, and the members fill when Discord's SYNC arrives. Once any server is known, a request for one that is not is still refused as before. That case covers a server the user has left whose conversations are still stored.
Known edge: an account in no servers at all, asking for a stored conversation of a server it has left, now gets pending (the pane keeps polling locally) and not the refusal. That needs an account with zero servers, and the polls are local cache reads.
Validation
members_asked_before_ready_are_pending_and_fill_after_connectincrates/chatd/tests/discord.rs. It connects once so the server is stored, then delays READY 1.5 s with fix: subscribe the Discord member viewport a Watch chose before READY #51'sready_afterand restarts chatd. It asks for 4105's members before READY and asserts they are pending and empty. It waits forConnected, asks again until the op 37 for 4105 goes out, pushes a SYNC, and asserts the members fill. On main it fails withError { code: Unsupported, detail: "Discord cannot do this yet" }. It passes with this change.member_viewport_selected_before_ready_is_subscribed_after_connect, run together 5 times: 5/5 passed.cargo test -p chatd --test discord: 32 passed.cargo test -p chatd: 292 passed, 0 failed, 0 ignored (136 lib unit tests, plus blobs 14, calls 10, discord 32, e2e 25, messages 5, playback 4, polish 12, signal 10, slack 15, teams 7, telegram 17, upload 5).cargo clippy -p chatd --all-targets: nothing in the touched files. On main clippy already stops atgateway.rs'swhile beat.ready(clippy::while_immutable_condition, from fix: pace Discord member subscriptions so a scroll cannot spend the Gateway budget #52), which this PR does not touch. With that lint allowed, it is clean here.Refs #43
🤖 Generated with Claude Code