From 83e6a487ebd0d81786e2516e0fc8acd857ce4a29 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Mon, 6 Jul 2026 03:21:23 -0700 Subject: [PATCH] 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. --- tests/test_tui_gateway_server.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.py index 2c0a6be4e7b..b48e6c36ca9 100644 --- a/tests/test_tui_gateway_server.py +++ b/tests/test_tui_gateway_server.py @@ -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)