mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-25 17:18:11 +00:00
test(slack): pin catch-all event matcher registration and non-shadowing
Regression test for the catch-all ack: a re.compile(r'.*') event matcher must be registered (after every named handler, so it never shadows message/app_mention/reaction/file routing) and must match unhandled subscribed event types like member_joined_channel / channel_archive / pin_added. Salvaged from #64218 (test half only — its adapter-side catch-all is a duplicate of #38847, which landed as the base commit of this cluster with first-submitter credit). Fixes #6572. Co-authored-by: shivasymbl <sdevinarayanan@asymbl.com>
This commit is contained in:
parent
390ddfd028
commit
565ea19a49
1 changed files with 20 additions and 0 deletions
|
|
@ -346,6 +346,26 @@ class TestAppMentionHandler:
|
|||
expected
|
||||
), f"Slack slash regex does not match {expected}"
|
||||
|
||||
# Catch-all generic matcher must be registered after the named handlers
|
||||
# so it does not shadow them. It fires for any event type not already
|
||||
# claimed by a named handler (issue #6572).
|
||||
import re as _re2
|
||||
catchall_patterns = [e for e in registered_events if isinstance(e, _re2.Pattern)]
|
||||
assert catchall_patterns, (
|
||||
"A catch-all re.compile(r'.*') event matcher must be registered to "
|
||||
"silence Bolt WARNING+404 for unhandled subscribed event types. "
|
||||
f"Registered events: {registered_events!r}"
|
||||
)
|
||||
catchall = catchall_patterns[-1]
|
||||
# Must match event types that have no named handler.
|
||||
for unsupported_type in ("member_joined_channel", "channel_archive", "pin_added"):
|
||||
assert catchall.match(unsupported_type), (
|
||||
f"Catch-all matcher must match {unsupported_type!r}"
|
||||
)
|
||||
# Must also match the named types (the named handlers are registered
|
||||
# first so they take priority; the catch-all is a safety net only).
|
||||
assert catchall.match("message")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_connect_uses_profile_scoped_app_token(self):
|
||||
"""Socket Mode must use the active profile's app token in multiplex mode."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue