aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_ops.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:19 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:19 +0200
commit2e9490ca27047ae03e495d397abbe1aec1b2273a (patch)
tree26f850a88565846a139868a4b85c715734751a41 /packages/meshbay-node/tests/test_ops.py
parentc8af746c846b5dbc792f7e4f0d806647d513cc5c (diff)
downloadmeshbay-2e9490ca27047ae03e495d397abbe1aec1b2273a.tar.gz
feat: unified group management, public groups, and activity-based sidebar
Create Group wizard (Electron-only) consolidates 6 steps across 4 interfaces into a single multi-step page: group creation on hub, node attachment, root selection via folder picker, GEK initialization, and auto-pairing — all in one flow. Browser SPA keeps its current behavior unchanged. Public group support (Option A — GEK for all groups): - All groups have GEK regardless of visibility; open-join groups auto-admit via TOFU when join_policy is "open" - Key rotation blocked for public groups (API guard + UI hidden) - Hub signaling allows WebRTC offers for nodes hosting open-join groups even when the caller isn't a member yet - attach_group writes join_policy to node.toml - Daemon loads GEK for all groups, not just private ones - Known-device path in join_request now auto-admits to open-join groups Node loopback API bridge (Electron IPC): - node:detect, node:call, node:pairing-code IPC handlers in main process - Renderer never sees tokens, paths, or keys (session token = physical access) - platform.js node namespace for UI consumption - Loopback endpoints: roots CRUD, member-upload toggle, reload Bug fixes: - Root change detection: removed premature ctx["roots"] updates from add_root and remove_root that prevented indexer retarget on reload - Duplicate offline message: global fallback now gated on !group - Signaling membership check: fallback to open-join groups for non-members Sidebar groups sorted by last_activity_at (most recent first): - New Group.last_activity_at column with Alembic migration - POST /v1/groups/{id}/activity endpoint, called on connect and chat send - Client-side sort + throttled hub updates (1/min) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_ops.py')
-rw-r--r--packages/meshbay-node/tests/test_ops.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/packages/meshbay-node/tests/test_ops.py b/packages/meshbay-node/tests/test_ops.py
index f7fd259..d2ccc0d 100644
--- a/packages/meshbay-node/tests/test_ops.py
+++ b/packages/meshbay-node/tests/test_ops.py
@@ -63,7 +63,9 @@ def test_the_http_adapter_adds_no_logic():
source = inspect.getsource(ui)
# Every endpoint that performs an operation routes through _op(...).
for endpoint in ("operator_pair", "create_invite", "revoke_member",
- "unpin_member", "init_gek", "attach_group", "delete_file"):
+ "unpin_member", "init_gek", "attach_group", "delete_file",
+ "add_root", "remove_root", "set_member_upload",
+ "reload_config"):
start = source.index(f"async def {endpoint}(")
body = source[start:start + 700]
assert "_op(" in body.split("\n\n")[0] + body, (
@@ -177,3 +179,45 @@ async def test_an_unhosted_group_offers_what_it_does_host(tmp_path):
await ops.delete_file(state, "z" * 32, "a" * 64)
assert exc.value.status == 404
assert exc.value.extra.get("available")
+
+
+# ── Upload policy (set_member_upload) ───────────────────────────────────────
+
+async def test_set_member_upload_toggles_and_persists(tmp_path):
+ from meshbay_node.roster import Roster
+ state = _state(tmp_path)
+ roster = Roster(db_path=tmp_path / "roster.db")
+ await roster.open()
+ state["roster"] = roster
+ state["node_user_id"] = "operator"
+
+ out = await ops.set_member_upload(state, "g" * 32, True)
+
+ assert out["allowed"] is True
+ assert state["groups_ctx"]["g" * 32]["member_upload"] is True
+
+ out2 = await ops.set_member_upload(state, "g" * 32, False)
+
+ assert out2["allowed"] is False
+ assert state["groups_ctx"]["g" * 32]["member_upload"] is False
+
+
+# ── Reload ──────────────────────────────────────────────────────────────────
+
+async def test_reload_config_calls_reload_fn(tmp_path):
+ state = _state(tmp_path)
+ called = []
+ async def fake_reload():
+ called.append(True)
+ state["reload_fn"] = fake_reload
+
+ out = await ops.reload_config(state)
+
+ assert out["status"] == "reloaded"
+ assert called
+
+
+async def test_reload_config_without_fn_is_refused(tmp_path):
+ state = _state(tmp_path)
+ with pytest.raises(ops.OpError, match="Reload not available"):
+ await ops.reload_config(state)