|
Option C Tools
|
Classes | |
| class | TestHITLFirstCallRequiresConfirmation |
| class | TestHITLSecondCallExecutes |
| class | TestFormatDoubleGuardE2E |
| class | TestBothCallsWriteAuditRecords |
| class | TestPolicyShortCircuit |
| class | TestValidationShortCircuit |
| class | TestRateLimitAcrossHITL |
| class | TestPrivilegeEscalation |
Functions | |
| McpMetrics | _isolated_metrics () |
| tuple[ServerState, McpAuditLogger] | _make_write_state (Path tmp_path, str sandbox_output="Done.", int sandbox_exit_code=0, str profile="default", bool safe_mode=False, int rate_limit=30, str session_id="hitl-test-session") |
| dict | _last_audit_record (McpAuditLogger logger) |
Purpose
-------
Integration tests for the Phase 5B HITL (Human-in-the-Loop) pipeline.
Responsibilities
----------------
- Verify write-tool first-call (confirm=False) returns confirmation
string; second-call (confirm=True) executes via mock sandbox.
- Verify oct_format double-guard (apply + confirm) and dry-run path.
- Verify audit records for both HITL calls.
- Verify policy denial and validation failure short-circuit before HITL.
- Verify rate-limit state preserved across calls.
- Verify T-06 privilege escalation and T-06b strict-profile denial.
Diagnostics
-----------
Domain: MCP-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- Tests use mock sandbox and ``tmp_path``; no real subprocess is
spawned.
|
protected |
McpMetrics on a private CollectorRegistry — avoids ``Duplicated timeseries`` collisions across tests.
Definition at line 59 of file test_mcp_hitl.py.
|
protected |
Read the last line from the audit log as a dict.
Definition at line 106 of file test_mcp_hitl.py.
|
protected |
Build a ServerState with SafetyGate for HITL integration tests.
Definition at line 68 of file test_mcp_hitl.py.