Add explicit Assistant listener registration mode#1519
Open
Cr1stal wants to merge 6 commits into
Open
Conversation
ee9fb84 to
18fae4a
Compare
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
Addresses #1346 by adding an explicit Assistant registration mode to
App.assistant()andAsyncApp.assistant().By default,
app.assistant(assistant)continues to behave as it does today: it registers Assistant as middleware. This preserves the existing Assistant middleware dispatch path and keepsapp.use(assistant)/app.middleware(assistant)behavior unchanged.Apps can now opt into listener-based registration:
In this mode, Assistant handlers are registered as normal App listeners. This lets assistant-specific handlers participate in the App listener pipeline and inherit app-level middleware such as authorization, auditing, rate limiting, or request enrichment.
The PR also adds an internal listener registry so Assistant listeners can be evaluated before broad catch-all listeners without exposing a general listener priority API. Registration order is preserved within Assistant listeners and ordinary App listeners, and sync/async behavior is kept mirrored.
Testing
./scripts/format.sh --no-install./scripts/lint.sh --no-install./scripts/run_tests.sh tests/slack_bolt/app/test_app_assistant_middleware.py(14 passed)./scripts/run_mypy.sh --no-install(Success: no issues found in 235 source files)./scripts/install_all_and_run_tests.sh(924 passed,81 warnings; mypy:Success: no issues found in 235 source files)Category
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.