summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_task_lifetime.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-24 12:43:47 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-24 16:45:38 +0200
commitd60768b3812f30cf4109e2a5dab498d916262572 (patch)
tree7059b9cff6efa0270dd87ccc91c90ce8a2fcb86c /packages/meshbay-node/tests/test_task_lifetime.py
parentdb400a438853036cfd3518873ea47beabe304718 (diff)
downloadmeshbay-d60768b3812f30cf4109e2a5dab498d916262572.tar.gz
refactor(node): dispatch MNP messages through a table
The pre-authentication guards stay explicit code, in the same order and text. After the handshake, a table maps each type to its handler and to whether it runs as a task, the choice each branch made; the three inline blocks become StreamingMixin methods, unchanged. The dispatch golden is identical, including types that are not strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_task_lifetime.py')
-rw-r--r--packages/meshbay-node/tests/test_task_lifetime.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/meshbay-node/tests/test_task_lifetime.py b/packages/meshbay-node/tests/test_task_lifetime.py
index a8445fa..6f0abb7 100644
--- a/packages/meshbay-node/tests/test_task_lifetime.py
+++ b/packages/meshbay-node/tests/test_task_lifetime.py
@@ -249,7 +249,10 @@ def test_chunks_wait_for_room_on_the_channel(session):
def test_answering_a_chunk_does_not_block_the_message_loop(session):
"""It waits for buffer room, and the acks that free it arrive on this loop."""
- assert "self._spawn(self._do_file_request(msg))" in session, (
+ from meshbay_common.protocol import MNP
+ from meshbay_node.transport.webrtc.dispatch import _HANDLERS, SPAWNED
+
+ assert _HANDLERS[MNP.FILE_REQUEST] == ("_do_file_request", SPAWNED), (
"answering inline would stall the uploads whose acks drain the buffer")