AUD-04-02 — add write gate + confirm discipline (DD-385 Phase W)
The blade had no write gate and no confirm parameter anywhere — every mutating tool (override, revert, restart, accept-device, replace-stignore, …) fired ungated, unlike every sibling blade. This brings syncthing up to the class baseline: - All 13 mutating tools now require SYNCTHING_WRITE_ENABLED=true (models.require_write, env read at call time) and refuse with a clear message when the gate is off. - Destructive/disruptive operations additionally require confirm=true: syncthing_override_folder, syncthing_revert_folder, syncthing_restart, syncthing_accept_device, syncthing_accept_folder, syncthing_set_ignores. Refusals explain what the operation would do. These six are now annotated destructiveHint: true. - New ConfirmWriteParams / ConfirmFolderWriteParams models; confirm field added to AcceptDeviceInput, AcceptFolderInput, SetIgnoresInput. - Server-level FastMCP instructions document the gate + confirm contract; README, SKILL.md, and stallari-plugin.yaml (setup field + env entry) updated to match. - Regression suite tests/test_write_gate.py: gated-off refusal (all 13, unset + non-"true" value), gated-on-without-confirm refusal (all 6 destructive), gated-on-with-confirm proceeds (mocked), and non-destructive-needs-no-confirm. Existing write-tool tests updated to enable the gate + pass confirm. 201 tests green. Version 0.8.0 → 0.9.0 (behaviour-affecting safety gate). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
17 files changed
+389
-48
No files matched your search
@@ -6,7 +6,7 @@ import pytest
|
||||
import respx
|
||||
from httpx import Response
|
||||
|
||||
from syncthing_mcp.models import EmptyInput
|
||||
from syncthing_mcp.models import ConfirmWriteParams, EmptyInput
|
||||
from syncthing_mcp.registry import reload_instances
|
||||
from tests.conftest import (
|
||||
BASE_URL,
|
||||
@@ -59,7 +59,7 @@ class TestSystemErrors:
|
||||
|
||||
|
||||
class TestClearErrors:
|
||||
async def test_clear(self, mock_api):
|
||||
async def test_clear(self, mock_api, write_enabled_env):
|
||||
from syncthing_mcp.tools.system import syncthing_clear_errors
|
||||
|
||||
mock_api.post("/rest/system/error/clear").respond(status_code=200, content=b"")
|
||||
@@ -100,11 +100,11 @@ class TestRestartRequired:
|
||||
|
||||
|
||||
class TestRestart:
|
||||
async def test_restart(self, mock_api):
|
||||
async def test_restart(self, mock_api, write_enabled_env):
|
||||
from syncthing_mcp.tools.system import syncthing_restart
|
||||
|
||||
mock_api.post("/rest/system/restart").respond(status_code=200, content=b"")
|
||||
result = json.loads(await syncthing_restart(EmptyInput()))
|
||||
result = json.loads(await syncthing_restart(ConfirmWriteParams(confirm=True)))
|
||||
assert result["status"] == "restart_initiated"
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user