test(discord): fix stale component-view fixtures for fail-closed auth - #41334
Closed
teknium1 wants to merge 2 commits into
Closed
test(discord): fix stale component-view fixtures for fail-closed auth#41334teknium1 wants to merge 2 commits into
teknium1 wants to merge 2 commits into
Conversation
…closed auth The component-button auth hardening (f6f3636) made `_component_check_auth` return False when both allowlists are empty (fail closed). This test passed `allowed_user_ids=set()` and expected the model switch to proceed, so it started asserting `events == []` and failed on main. Give the picker an allowlist containing the test user (id 123) so `_check_auth` passes, matching the new contract. Verifies the control-clearing order as intended.
Contributor
🔎 Lint report:
|
Same fail-closed fallout as the model-picker fixture: the auth hardening (f6f3636) rejects empty allowlists, so two ClarifyChoiceView tests that expected the action to proceed (choice fallback when entry missing; Other flips to awaiting-text) started failing on main. Give those two views `allowed_user_ids={"42"}` (matching the default test interaction's user id) so `_check_auth` passes. The rejection/already- resolved tests keep their empty allowlists — those paths short-circuit before the auth check or assert rejection, and remain correct.
Contributor
Author
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.
Summary
Repairs stale test fixtures that broke
main: several Discord component-view tests passed empty allowlists and expected the action to proceed, but the component-button auth hardening (f6f363662) made empty allowlists fail closed.Root cause:
_component_check_authnow returnsFalsewhen both the user and role allowlists are empty (fail closed). Tests that constructed views withallowed_user_ids=set()and expected the interaction to succeed started getting rejected.Changes
tests/gateway/test_discord_model_picker.py:test_model_picker_clears_controls...→allowed_user_ids={"123"}(matches the test interaction'suser.id=123).tests/gateway/test_discord_clarify_buttons.py: the two success-path tests (test_choice_falls_back_to_label_text_when_entry_missing,test_other_flips_entry_to_awaiting_text) →allowed_user_ids={"42"}(matches_make_interaction's default user id).Rejection / already-resolved tests keep their empty allowlists — those paths assert rejection or short-circuit before the auth check, and remain correct.
Validation
test_discord_model_picker.pytest_discord_clarify_buttons.pytest_discord_component_auth.pyorigin/main(main CI is currently red on this cluster); fix is test-only, 3 lines across 2 files.Infographic