fix(test-seams): monkeypatch.setattr facade aliases — also patch the defining module (57 files)

Tests did monkeypatch.setattr(<facade module>, name) where name is now defined in a
sibling module and the production path reads the sibling's binding. Where production
reads through BOTH bindings the setattr is duplicated onto the defining module (import
added next to the existing alias import); where only the sibling reads it the target is
repointed. Seams whose production readers go through the facade are left alone.
This commit is contained in:
Teknium
2026-09-03 19:33:28 -07:00
parent c50b91039d
commit ba030bc0db
57 changed files with 499 additions and 4 deletions
@@ -23,6 +23,7 @@ import threading
import pytest
from tools import approval as A
import tools.approval_detection as approval_detection
from tools import approval_context
from tools import approval_context
from tools import approval_smart
@@ -294,6 +295,11 @@ def test_terminal_smart_deny_owner_override_is_one_operation(gw_session, monkeyp
"detect_dangerous_command",
lambda command: (True, "owner-override-test-danger", f"risk:{command}"),
)
monkeypatch.setattr(
approval_detection,
"detect_dangerous_command",
lambda command: (True, "owner-override-test-danger", f"risk:{command}"),
)
monkeypatch.setattr(
"tools.tirith_security.check_command_security",
lambda _command: {"action": "allow", "findings": [], "summary": ""},
@@ -349,6 +355,10 @@ def test_smart_escalate_still_persists_session_choice(gw_session, monkeypatch):
A, "detect_dangerous_command",
lambda command: (True, key, f"risk:{command}"),
)
monkeypatch.setattr(
approval_detection, "detect_dangerous_command",
lambda command: (True, key, f"risk:{command}"),
)
monkeypatch.setattr(
"tools.tirith_security.check_command_security",
lambda _command: {"action": "allow", "findings": [], "summary": ""},
@@ -371,6 +381,10 @@ def test_terminal_smart_deny_pending_payload_is_one_operation(gw_session, monkey
A, "detect_dangerous_command",
lambda command: (True, "pending-smart-deny", f"risk:{command}"),
)
monkeypatch.setattr(
approval_detection, "detect_dangerous_command",
lambda command: (True, "pending-smart-deny", f"risk:{command}"),
)
monkeypatch.setattr(
"tools.tirith_security.check_command_security",
lambda _command: {"action": "allow", "findings": [], "summary": ""},