Option C Tools
Loading...
Searching...
No Matches
tests_mcp.test_mcp_safety Namespace Reference

Classes

class  TestNonDestructiveTools
class  TestDestructiveRequiresConfirmation
class  TestDestructiveConfirmed
class  TestFormatDoubleGuard
class  TestFormatConfirmationRequest
class  TestSafetyDecision
class  TestNoReplayState

Functions

 config ()
 gate (config)
 _nondestructive_spec ()
 _write_spec (str tool="oct_format")

Detailed Description

Purpose
-------
Regression tests for :mod:`oct.mcp.safety` — ``SafetyGate`` HITL
enforcement.

Responsibilities
----------------
- Verify ``SafetyGate.check()`` HITL rules (rules 1-5).
- Verify oct_format double guard (apply + confirm).
- Verify non-destructive tools always proceed; destructive tools
  require confirmation.
- Verify ``_format_confirmation_request`` sentinel and content.
- Verify T-08: no stateful replay surface (each call independent).

Diagnostics
-----------
Domain: MCP-TESTS
Levels:
    L2 — test lifecycle
    L3 — assertion details
    L4 — deep tracing

Contracts
---------
- Tests are in-memory safety checks; no subprocess or filesystem writes.

Function Documentation

◆ _nondestructive_spec()

tests_mcp.test_mcp_safety._nondestructive_spec ( )
protected

Definition at line 62 of file test_mcp_safety.py.

Here is the caller graph for this function:

◆ _write_spec()

tests_mcp.test_mcp_safety._write_spec ( str tool = "oct_format")
protected

Definition at line 66 of file test_mcp_safety.py.

◆ config()

tests_mcp.test_mcp_safety.config ( )

Definition at line 53 of file test_mcp_safety.py.

◆ gate()

tests_mcp.test_mcp_safety.gate ( config)

Definition at line 58 of file test_mcp_safety.py.