test(tui_gateway): isolate verification.status not_applicable test from stray tmp markers

test_verification_status_outside_workspace_is_not_applicable passed tmp_path as
the cwd and asserted status == not_applicable, relying on tmp_path having no
project-marker ancestor. _marker_root() walks up to ~6 levels, so a stray marker
in a shared tmp-root ancestor (e.g. a /tmp/package.json left by another tool)
made project_facts_for() resolve tmp_path as a workspace and flip the status to
unverified. Green in clean CI, red on any dev box with a polluted /tmp.

Force the no-facts precondition by monkeypatching project_facts_for -> None so
the test deterministically exercises the not_applicable branch regardless of
ambient filesystem state. Test-only; no production change.
This commit is contained in:
teknium1 2026-07-06 03:21:23 -07:00 committed by Teknium
parent 4df2536f21
commit 83e6a487eb

View file

@ -6476,7 +6476,17 @@ def test_verification_status_returns_recorded_evidence(tmp_path):
assert verification["evidence"]["scope"] == "full"
def test_verification_status_outside_workspace_is_not_applicable(tmp_path):
def test_verification_status_outside_workspace_is_not_applicable(monkeypatch, tmp_path):
# A cwd with no project facts (outside any code workspace) must report
# not_applicable. Force the "no facts" precondition rather than relying on
# tmp_path's ancestors being pristine — a stray marker file in a shared
# tmp-root ancestor (e.g. /tmp/package.json left by another tool) would
# otherwise make _marker_root() resolve tmp_path as a workspace and flip
# the status to "unverified".
import agent.coding_context as coding_context
monkeypatch.setattr(coding_context, "project_facts_for", lambda _cwd=None: None)
home = tmp_path / ".hermes"
home.mkdir()
token = set_hermes_home_override(home)