fix(safety): add stop_array to DESTRUCTIVE_ACTIONS, add error propagation test

stop_array can cause data loss for running containers/VMs that depend on
array shares — requires confirm=True like other destructive mutations.

- Add stop_array to DESTRUCTIVE_ACTIONS and desc_map in array.py
- Update safety audit KNOWN_DESTRUCTIVE[array] to include stop_array
- Add stop_array negative/positive tests (test_array.py, safety tests)
- Add test_snapshot_wraps_bare_exception to test_live.py (bare Exception
  from subscribe_once is wrapped by tool_error_handler into ToolError)

748 tests passing
This commit is contained in:
Jacob Magar
2026-03-15 20:02:33 -04:00
parent 252ec520d1
commit 94850333e8
4 changed files with 29 additions and 4 deletions

View File

@@ -95,7 +95,7 @@ MUTATIONS: dict[str, str] = {
""",
}
DESTRUCTIVE_ACTIONS = {"remove_disk", "clear_disk_stats"}
DESTRUCTIVE_ACTIONS = {"remove_disk", "clear_disk_stats", "stop_array"}
ALL_ACTIONS = set(QUERIES) | set(MUTATIONS)
ARRAY_ACTIONS = Literal[
@@ -163,6 +163,7 @@ def register_array_tool(mcp: FastMCP) -> None:
desc_map = {
"remove_disk": f"Remove disk **{disk_id}** from the array. The array must be stopped first.",
"clear_disk_stats": f"Clear all I/O statistics for disk **{disk_id}**. This cannot be undone.",
"stop_array": "Stop the Unraid array. Running containers and VMs may lose access to array shares.",
}
confirmed = await elicit_destructive_confirmation(ctx, action, desc_map[action])
if not confirmed: