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-node/src/meshbay_node/daemon.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-node/src/meshbay_node/daemon.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/daemon.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/daemon.py b/packages/meshbay-node/src/meshbay_node/daemon.py index 371c2f0..5036803 100644 --- a/packages/meshbay-node/src/meshbay_node/daemon.py +++ b/packages/meshbay-node/src/meshbay_node/daemon.py @@ -1198,15 +1198,10 @@ class NodeDaemon: async def _app_directories_ctx(self, group_id: str) -> dict: """ - Each app's configured directories, plus the legacy scalar names the - rest of the tree still reads. + Each app's configured directories, plus the second name an app is + also published under where something reads one (`chat_directory`). - The scalars are derived here rather than stored, so the two can never - disagree: `video_root` is the first of `video_directories` and exists - for MNP 1.0 clients and for the handful of call sites that predate the - list. A group with several video directories reports the first as its - `video_root` — which is what an old client can represent, and all it - could ever have shown. + Derived here rather than stored, so the two can never disagree. """ dirs = {} for app in self.APP_DIR_KEYS: @@ -1406,7 +1401,7 @@ class NodeDaemon: shared index before they have chosen which folder is actually their media library would burn both TMDB's rate limit and the node's CPU on files that were never meant to be in the Videos app at all. Once a - root is set, `_enrich_video_root_now` (called from ops.set_video_root) + root is set, `_enrich_video_root_now` (called when it changes) separately sweeps whatever it already contains — this path alone only ever sees entries new since the last broadcast. """ @@ -1433,7 +1428,7 @@ class NodeDaemon: async def _enrich_video_root_now(self, group_id: str) -> None: """ Videos app: sweep a group's existing index for enrichment right - after its video_root is set or changed (ops.set_video_root). + after its video root is set or changed. The ordinary path above only ever looks at entries new since the last broadcast, so a folder that already had files sitting in it @@ -1528,7 +1523,7 @@ class NodeDaemon: async def _enrich_audio_root_now(self, group_id: str) -> None: """ Music app: sweep a group's existing index right after its - audio_root is set or changed (ops.set_audio_root). Mirrors + audio root is set or changed. Mirrors `_enrich_video_root_now` exactly — the ordinary path above only ever looks at entries new since the last broadcast, so a folder that already had files in it before it became the audio_root would @@ -1594,7 +1589,7 @@ class NodeDaemon: async def _enrich_photo_roots_now(self, group_id: str) -> None: """ Photos app: sweep a group's existing index right after its - photo_roots set changes (ops.set_photo_roots). Mirrors + photo roots change. Mirrors `_enrich_video_root_now`/`_enrich_audio_root_now` — the ordinary path above only ever looks at entries new since the last broadcast, so a folder that already had photos in it before it was added to |