diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-10 17:49:58 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-10 17:49:58 +0200 |
| commit | 07ff8b4f6143039fcc74b8cf7c423282bce093c1 (patch) | |
| tree | 89e095aeef9f5ad0bcbe7b3e6cfdc67d36bcbba8 /packages/meshbay-common/src/meshbay_common/protocol.py | |
| parent | 1e6f3861a1570029897a30b42121836fd03565c1 (diff) | |
| download | meshbay-07ff8b4f6143039fcc74b8cf7c423282bce093c1.tar.gz | |
refactor(mnp)!: one operation for an app's folders, not one per app
`video_root`, `audio_root` and `photo_roots` are gone — the messages, the
signed operations, the handlers, the `ops` wrappers, the three scalars on the
handshake ack, and the client's handlers for their acks. `app_directories`
does the same thing for every application, keyed by the app's own registry
name, and it is what the SPA has been sending.
The three were the same instruction three times, differing only in the key they
wrote and whether they carried a string or a list. That shape is what made
adding an application mean adding a message type, an op, a handler and a widget;
it also meant three validation paths, and the older ones validated nothing —
a typo was stored and then quietly matched no entry, an app showing an empty tab
with no way to tell "misconfigured" from "no files yet".
**What stays, and why.** `Roster.LEGACY_DIR_KEYS` still reads `video_root` and
friends out of `group_settings`: that is a key on an operator's disk, not on the
wire, and a node upgraded into this must find its own configuration. The Search
page still reads its own older cache keys, for the same reason — the cache
outlives a deploy. `CTX_ALIASES` keeps only `chat`, which is the one app whose
second name something still reads.
The two per-app policy test files go with the messages. What only they held —
the real challenge/response path from message to database, which no other test
exercises — is retargeted at `app_directories` in
`test_app_directories_signed.py`, and the handler's own refusals (unknown app,
malformed `directories`, nobody to authorize it) join `test_app_directories.py`.
Node and common suites 1368 passed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsoWC3GmhNdwVFomW3QjH3
Diffstat (limited to 'packages/meshbay-common/src/meshbay_common/protocol.py')
| -rw-r--r-- | packages/meshbay-common/src/meshbay_common/protocol.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/packages/meshbay-common/src/meshbay_common/protocol.py b/packages/meshbay-common/src/meshbay_common/protocol.py index 5bd1206..1dfa519 100644 --- a/packages/meshbay-common/src/meshbay_common/protocol.py +++ b/packages/meshbay-common/src/meshbay_common/protocol.py @@ -156,8 +156,6 @@ class MNP: SET_SCAN_SETTINGS_ACK = "set_scan_settings_ack" MEDIA_META_REQ = "media_meta_req" # client → node: TMDB metadata for a path MEDIA_META_RESP = "media_meta_resp" # node → client: TMDB metadata (or none) - VIDEO_ROOT = "video_root" # operator → node: which folder is the Videos entry point - VIDEO_ROOT_ACK = "video_root_ack" TMDB_CONFIG = "tmdb_config" # operator → node: set custom TMDB token/language (node-wide) TMDB_CONFIG_ACK = "tmdb_config_ack" # node → everyone: new TMDB config (never the token) TMDB_ENABLED = "tmdb_enabled" # operator → node: enable/disable TMDB for this group @@ -183,15 +181,6 @@ class MNP: # TMDB poster or a MusicBrainz cover. AUDIO_TRANSCODE_REQ = "audio_transcode_req" # client → node: transcode this file id AUDIO_TRANSCODE_RESP = "audio_transcode_resp" # node → client: cache hash/size/mime - # Which folder is the Music app's entry point for this group — same - # shape as VIDEO_ROOT above. - AUDIO_ROOT = "audio_root" # operator → node: which folder is the Music entry point - AUDIO_ROOT_ACK = "audio_root_ack" - # Which folder(s) are the Photos app's entry points for this group — a - # *set*, unlike VIDEO_ROOT/AUDIO_ROOT above, since a photo library is - # routinely scattered across several unrelated folders (docs/photos.md §2.1). - PHOTO_ROOTS = "photo_roots" # operator → node: the whole root set, replaced - PHOTO_ROOTS_ACK = "photo_roots_ack" # Device linking. A new device files a request bound to a code it displays; # an already-pinned device of the same account approves it. Neither the hub # nor the node can produce the countersignature. @@ -224,9 +213,8 @@ class MNP: ROOT_REMOVE = "root_remove" # operator → node: remove a root from a group ROOT_REMOVE_ACK = "root_remove_ack" # node → operator: confirmed # One message for every application's directories, keyed by the app's own - # name — adding an app adds no message type. VIDEO_ROOT / AUDIO_ROOT / - # PHOTO_ROOTS above are the same instruction under three earlier names and - # are still handled, for clients that predate this. + # name — adding an app adds no message type, and no application has one of + # its own. APP_DIRECTORIES = "app_directories" # operator → node: an app's folder(s) APP_DIRECTORIES_ACK = "app_directories_ack" # Chat's own two: where attachments are written (a destination, so it must |