From ed67f9aacccf8deaccf36a40fa8be129774e769a Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 23 Jul 2026 08:05:55 -0700 Subject: [PATCH] test(slack): adapt main's marker-mechanism tests to workspace-scoped markers Two tests on main pinned the pre-#20583 bare-ts marker mechanism (_mentioned_threads entries and _slash_command_contexts key shape). The salvaged workspace scoping intentionally changes both: - _mentioned_threads now records (team_id, ts) markers when the event carries a team id, so the top-level-mention test asserts the scoped tuple. - _slash_command_contexts keys are (team_id, channel, user) 3-tuples when the slash payload includes team_id. Follow-up to the #20583 cherry-pick (jordanhubbard). --- tests/gateway/test_slack.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/gateway/test_slack.py b/tests/gateway/test_slack.py index d59f15e98d82..ce98f69cb09f 100644 --- a/tests/gateway/test_slack.py +++ b/tests/gateway/test_slack.py @@ -4979,7 +4979,13 @@ class TestThreadReplyHandling: }) adapter_with_session_store.handle_message.assert_called_once() - assert "555.000" in adapter_with_session_store._mentioned_threads + # Workspace-scoped marker (#20583): the event carries team T_TEAM, so + # the registered marker is (team_id, ts) — identical thread ts values + # in two workspaces must never wake each other's bot. + assert ( + "T_TEAM", + "555.000", + ) in adapter_with_session_store._mentioned_threads @pytest.mark.asyncio async def test_thread_reply_with_mention_strips_bot_id( @@ -7715,8 +7721,9 @@ class TestTrackingStructureBounds: respond = AsyncMock() # noqa: F841 — kept for shape clarity await adapter._handle_slash_command(command) assert len(adapter._slash_command_contexts) <= adapter._SLASH_CTX_MAX - # Newest stash survives. - assert ("C1", "U9") in adapter._slash_command_contexts + # Newest stash survives. Keys are workspace-scoped 3-tuples (#20583) + # because the slash payload carries team_id. + assert ("T1", "C1", "U9") in adapter._slash_command_contexts def test_bot_message_ts_active_thread_survives_churn(self, adapter): """#51019 regression: an active thread registered early must survive