diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-15 12:57:51 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-15 12:57:51 +0200 |
| commit | a86bced1640ac1a695b95ac68b95e3fc581e687d (patch) | |
| tree | fe8ea8af945e139a2308eb19ad572e10a41b05e4 /packages/meshbay-node/src/meshbay_node/transport | |
| parent | 988a0eecd522431980174910db28e45a63ff2710 (diff) | |
| download | meshbay-a86bced1640ac1a695b95ac68b95e3fc581e687d.tar.gz | |
refactor(chat): no thread_id — chat has no threads
Nothing ever set it (the page and the CLI sent null) and nothing read it
(the node's get_thread had no caller). It is no longer sent by the page or
the CLI, in clear or in the sealed payload, nor relayed or served by the
node; get_thread and its index are gone, and the protocol and design docs
no longer name it.
The node still accepts a chat_msg carrying one, from the desktop apps and
CLIs already installed, and drops it. The column stays, empty, in chat.db:
a node downgraded to an older version names it in every query.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/transport')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/transport/webrtc/chat.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc/chat.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc/chat.py index ed2c43a..5bc9dbb 100644 --- a/packages/meshbay-node/src/meshbay_node/transport/webrtc/chat.py +++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/chat.py @@ -75,7 +75,7 @@ _LINK_PREVIEW_RATE_NODE = 60 # C5a; this is the same question asked of the path nobody had asked it of. # # 64 KB of ciphertext is about sixty thousand characters. The sealed payload is -# the text, a thread id, a display name and a timestamp: an attachment is a file +# the text, a display name and a timestamp: an attachment is a file # on a root and travels as a reference (§4.5), so nothing legitimate comes close. MAX_CHAT_CIPHERTEXT = 64 * 1024 # Per account per group, not per connection: a second tab does not make a person @@ -330,18 +330,14 @@ class ChatMixin: # anyone on the node. gctx = self._group_ctx() chat_store = gctx.get("chat_store") - # The two fields that travel in clear beside the ciphertext (the sealed - # envelope carries its own). Stored and relayed to every member, so they - # are what they claim to be and no larger: a name as long as a username, - # a thread id as long as a message id. Anything else is dropped. + # The one field that travels in clear beside the ciphertext (the sealed + # envelope carries its own). Stored and relayed to every member, so it is + # what it claims to be and no larger: a name as long as a username. + # Anything else is dropped. A `thread_id` from an older client is + # ignored: chat has no threads. sender_name = msg.get("sender_name", "") if not isinstance(sender_name, str) or len(sender_name) > 64: sender_name = "" - thread_id = msg.get("thread_id") - id_like = (isinstance(thread_id, int) and not isinstance(thread_id, bool) - or isinstance(thread_id, str) and len(thread_id) <= 64) - if thread_id is not None and not id_like: - thread_id = None # Two shapes, and keeping them apart is what makes this deployable. # @@ -387,7 +383,7 @@ class ChatMixin: self._spawn(self._store_chat_message( chat_store, iteration=msg.get("iteration", 0), payload=raw, - thread_id=thread_id, sender_name=sender_name, + sender_name=sender_name, format=fmt, epoch=epoch, device=device, nonce=nonce, sig=sig, )) @@ -398,7 +394,6 @@ class ChatMixin: "sender_id": self._user_id, "sender_name": sender_name, "payload": payload, - "thread_id": thread_id, "timestamp": time.time(), "format": fmt, "epoch": epoch, @@ -613,7 +608,6 @@ class ChatMixin: "sender_id": m.sender_id, "sender_name": m.sender_name or names.get(m.sender_id, ""), "timestamp": m.timestamp, - "thread_id": m.thread_id, "format": m.format, "epoch": m.epoch, "device": m.device, |