summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_app_settings_plugin.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-10 17:49:58 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-10 17:49:58 +0200
commit07ff8b4f6143039fcc74b8cf7c423282bce093c1 (patch)
tree89e095aeef9f5ad0bcbe7b3e6cfdc67d36bcbba8 /packages/meshbay-hub/tests/test_app_settings_plugin.py
parent1e6f3861a1570029897a30b42121836fd03565c1 (diff)
downloadmeshbay-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-hub/tests/test_app_settings_plugin.py')
-rw-r--r--packages/meshbay-hub/tests/test_app_settings_plugin.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/meshbay-hub/tests/test_app_settings_plugin.py b/packages/meshbay-hub/tests/test_app_settings_plugin.py
index 892fd09..af86f12 100644
--- a/packages/meshbay-hub/tests/test_app_settings_plugin.py
+++ b/packages/meshbay-hub/tests/test_app_settings_plugin.py
@@ -254,17 +254,19 @@ def test_each_app_takes_a_list_of_directories(app, prop):
f"{app} still reads {singular} — one shape per idea")
-def test_an_older_node_still_fills_the_lists():
+def test_the_lists_are_read_under_one_name_each():
"""
- A node speaking MNP 1.0 sends `video_root`, not `video_directories`.
- Reading the missing plural as "nothing configured" would empty a working
- Videos tab on every group hosted by a node that has not been upgraded.
+ One name per app on the ack — `<app>_directories`, always a list. A second
+ name for the same answer means a page that reads whichever it thinks of
+ first, and a node that fills only the other one empties a working tab.
"""
page = GROUP_PAGE.read_text(encoding="utf-8")
block = page[page.index("setAppDirectories({"):]
block = block[:block.index("setChatDirectory")]
- assert "ack.video_root" in block and "ack.audio_root" in block
- assert "ack.photo_roots" in block
+ assert "ack.video_directories" in block and "ack.music_directories" in block
+ assert "ack.photo_directories" in block
+ for gone in ("ack.video_root", "ack.audio_root", "ack.photo_roots"):
+ assert gone not in block, f"{gone} is a second name for the same answer"
def test_the_search_cache_reads_both_shapes():