From 36a97658c0aa3b79c6cb823d18334e0acf9bde5f Mon Sep 17 00:00:00 2001 From: Tejas Chopra Date: Mon, 3 Aug 2026 05:34:38 -0700 Subject: [PATCH] test: stop the suite POSTing beacon events to production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _scrub_developer_headroom_env deletes every HEADROOM_* var so tests are hermetic. That now includes HEADROOM_BEACON, which defaults to on — so the fixture that exists for isolation is exactly what switched the beacon on, and with HEADROOM_TELEMETRY_ENDPOINT scrubbed too it fell back to the real production endpoint. Every test reaching the outcome funnel POSTed a live session event. Caught by finding 10 unexplained objects in the corpus after a local run; CI would have done the same on every push. Adds an autouse fixture pinning HEADROOM_BEACON=off, ordered after the scrub by depending on it. Tests that want the beacon on set the var themselves. Co-Authored-By: Claude Opus 5 (1M context) --- tests/conftest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 38de51499..2aecdbc4a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,6 +30,21 @@ def _scrub_developer_headroom_env(monkeypatch): monkeypatch.delenv("ANTHROPIC_CUSTOM_HEADERS", raising=False) +# The scrub above deletes every HEADROOM_* var — which includes HEADROOM_BEACON, +# and the beacon defaults to ON. So scrubbing for hermeticity is precisely what +# switches it on, and with HEADROOM_TELEMETRY_ENDPOINT scrubbed too it falls back +# to the real production endpoint. Every test that reaches the outcome funnel +# then POSTs a session event for real: observed writing into the live corpus +# during a local run, and CI would do the same on every push. +# +# Depends on the scrub fixture so it is guaranteed to run after it rather than +# relying on declaration order. A test that wants the beacon on just sets the +# var itself — monkeypatch inside the test wins over this. +@pytest.fixture(autouse=True) +def _disable_telemetry_beacon(monkeypatch, _scrub_developer_headroom_env): + monkeypatch.setenv("HEADROOM_BEACON", "off") + + # The MCP install ledger defaults to ``~/.headroom/mcp_installs.json``, so any # test that registers a server (directly or through `wrap`) writes into the # developer's REAL ledger — observed adding a live `claude/serena` entry during a