feat(types): Complete strict static analysis and typing track
This commit is contained in:
@@ -3,7 +3,6 @@ Tests for architecture_boundary_hardening_20260302 — Phase 2.
|
||||
Tasks 2.1-2.4: MCP tool config exposure + MUTATING_TOOLS + HITL enforcement.
|
||||
"""
|
||||
import tomllib
|
||||
import pytest
|
||||
from project_manager import default_project
|
||||
|
||||
MUTATING_TOOLS = {"set_file_slice", "py_update_definition", "py_set_signature", "py_set_var_declaration"}
|
||||
@@ -101,9 +100,8 @@ def test_mutating_tools_excludes_read_tools():
|
||||
|
||||
def test_mutating_tool_triggers_pre_tool_callback(monkeypatch):
|
||||
"""When a mutating tool is called and pre_tool_callback is set, it must be invoked."""
|
||||
import ai_client
|
||||
import mcp_client
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
callback_called = []
|
||||
def fake_callback(desc, base_dir, qa_cb):
|
||||
callback_called.append(desc)
|
||||
@@ -113,12 +111,11 @@ def test_mutating_tool_triggers_pre_tool_callback(monkeypatch):
|
||||
tool_name = "set_file_slice"
|
||||
args = {"path": "foo.py", "start_line": 1, "end_line": 2, "new_content": "x"}
|
||||
# Simulate the logic from all 4 provider dispatch blocks
|
||||
out = ""
|
||||
_res = fake_callback(f"# MCP MUTATING TOOL: {tool_name}", ".", None)
|
||||
if _res is None:
|
||||
out = "USER REJECTED: tool execution cancelled"
|
||||
pass
|
||||
else:
|
||||
out = mcp_client.dispatch(tool_name, args)
|
||||
mcp_client.dispatch(tool_name, args)
|
||||
assert len(callback_called) == 1, "pre_tool_callback must be called for mutating tools"
|
||||
assert mock_dispatch.called
|
||||
|
||||
|
||||
Reference in New Issue
Block a user