From 733fcfa4ce4e6a03bd34a9354be2ba46e8ecef72 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 3 Aug 2026 23:00:51 -0700 Subject: [PATCH] [eric] tests: mcp-offer suite isolates from the developer's real settings, a live dismissal was failing it --- backend/tests/test_mcp_offer.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/tests/test_mcp_offer.py b/backend/tests/test_mcp_offer.py index fe0939b4..957ebd3b 100644 --- a/backend/tests/test_mcp_offer.py +++ b/backend/tests/test_mcp_offer.py @@ -7,6 +7,8 @@ loudly instead of shipping a silent gate bypass. """ import asyncio + +import pytest from types import SimpleNamespace import backend.apps.agents.core.mcp_preflight as pf @@ -24,6 +26,14 @@ def p_settings(dismissed=None): return SimpleNamespace(dismissed_mcp_suggestions=dismissed or {}) +@pytest.fixture(autouse=True) +def p_isolated_settings(monkeypatch): + """run_preflight reads the REAL settings.json; a suggestion the developer dismissed in their + own app silently failed this suite (caught live 2026-08-04, Eric dismissed Google Workspace + mid-evening). Every test starts from empty dismissals; dismissal tests override explicitly.""" + monkeypatch.setattr(pf, "load_settings", p_settings) + + def test_offer_resolves_both_display_name_and_hotpath_slug(monkeypatch): # The hot-path passes a sanitized slug ("google-workspace"); the curated id is a display name ("Google Workspace"). Both must resolve, so the wiring isn't a load-bearing string. monkeypatch.setattr(pf, "load_all_tools", lambda: []) # nothing enabled