diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/ops.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops.py b/packages/meshbay-node/src/meshbay_node/ops.py index f7f6190..11694c3 100644 --- a/packages/meshbay-node/src/meshbay_node/ops.py +++ b/packages/meshbay-node/src/meshbay_node/ops.py @@ -728,7 +728,12 @@ async def remove_root(state: dict, group_id: str, root_name: str) -> dict: live_roots.roots = [ r for r in live_roots.roots if fold(r.name) != target] - result_roots = live_roots.describe() if live_roots else [] + # Built from config when there is no live set, never returned empty: an + # empty list is a *valid answer* meaning "this group has no directories", + # and the client cannot tell it from "the node could not say". It would + # blank the operator's table on an op that succeeded. + result_roots = (live_roots.describe() if live_roots + else RootSet.build([asdict(r) for r in cfg.roots]).describe()) log.info("Root removed: %s from group %s", root_name, group_id[:8]) return {"status": "removed", "name": root_name, "group_id": group_id, @@ -788,7 +793,12 @@ async def update_root(state: dict, group_id: str, root_name: str, *, lr.removable = removable break - result_roots = live_roots.describe() if live_roots else [] + # Built from config when there is no live set, never returned empty: an + # empty list is a *valid answer* meaning "this group has no directories", + # and the client cannot tell it from "the node could not say". It would + # blank the operator's table on an op that succeeded. + result_roots = (live_roots.describe() if live_roots + else RootSet.build([asdict(r) for r in cfg.roots]).describe()) log.info("Root updated: %s (writable=%s, removable=%s) in group %s", root_name, match.writable, match.removable, group_id[:8]) |