"""Untrusted execution arguments must fail before planning or archive writes.""" import asyncio from dataclasses import asdict import pytest from obliteratus.mcp_server import create_server from tests import test_mcp_execution as cases execution_case = cases.execution @pytest.mark.parametrize("changes", [ {"method": 123}, {"output_root": 123}, {"model": "private-model-identifier"}, {"model": {"kind": "local"}}, {"model": {"kind": "local", "identifier": 123}}, {"model": {"kind": "local", "identifier": "private-model-identifier", "extra": "private"}}, {"resources": "private-resources"}, {"resources": {"parameters": 1000.0}}, {"resources": {"parameters": True}}, {"resources": {"parameters": 1000, "raw_argv": "private-option"}}, ]) def test_execution_argument_types_are_rejected_without_writes(execution_case, changes): pytest.importorskip("mcp") tools, model, spawned = execution_case server = create_server(tools.policy) request = {"model": asdict(model), "method": "basic", "output_root": str(tools.policy.archive_root), "resources": {"parameters": 1000}} request.update(changes) async def scenario(): rejected = await server.call_tool("plan_run", request) assert rejected.is_error assert rejected.content[0].text == "MCP request rejected (invalid, unavailable, or exceeds limits)." assert "private" not in rejected.model_dump_json() assert not (await server.call_tool("server_status", {})).is_error asyncio.run(scenario()) assert list(tools.policy.archive_root.iterdir()) == [] assert not spawned