test(discord): regression guard for typing-indicator 429 handling (#29671) - #32761
Open
jameslcowan wants to merge 9568 commits into
Open
test(discord): regression guard for typing-indicator 429 handling (#29671)#32761jameslcowan wants to merge 9568 commits into
jameslcowan wants to merge 9568 commits into
Conversation
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.
Summary
Adds regression tests for the Discord typing-indicator 429 handling that landed in #29671. No production code change.
Related to #29671
What was happening
Before #29671,
DiscordAdapter.send_typing's background loop died on the first exception fromclient.http.request, including any 429 rate-limit response. After a single 429, the typing bubble stayed dark for the rest of the turn even though the platform was happy to accept retries afterretry_afterseconds.What the tests guard
test_429_with_retry_after_attribute_keeps_loop_alive: exception carries a numericretry_afterattribute (the shape discord.py emits viaRateLimited). Verifies the loop honors the value, sleeps that long, and keeps trying across three consecutive 429s.test_429_via_response_header_keeps_loop_alive: exception only exposes the retry budget viaresponse.headers["Retry-After"](theHTTPExceptionfallback). Same behavior expected.test_non_rate_limit_exception_still_exits_loop: a plain exception with no extractableretry_aftermust still terminate the loop, matching pre-fix behavior. Guards against an over-eager retry loop on genuinely unrecoverable errors.Verification
Reverting the
except Exceptionblock inplugins/platforms/discord/adapter.pyto its pre-#29671 shape (logger.debug(...); return) makes the two 429 tests fail with the "expected at least N attempts" assertions, confirming the guard actually traps the regression. The non-rate-limit test still passes under both versions, as intended.Local test run