The moment a real MASKANX_OPERATOR_TOKENS got set in Settings >
Environments (this session, for the first time on this machine), 28 tests
in test_campaign_launch.py started failing with 401 instead of the status
each was actually testing.
Cause: adclaw/__init__.py calls load_envs_into_environ() at import time,
so envs.json — the exact file the Settings UI writes — becomes ambient
environment for every test process, not only the ones that opt in.
Most campaign tests deliberately exercise the unauthenticated path and
never send an operator header; once a real token map exists,
require_operator starts demanding one they don't send.
This was already named as a deferred minor in the Phase 2 ledger
("test_campaign_api client fixture does not delenv MASKANX_OPERATOR_TOKENS")
but scoped to one file. It affects nine. An autouse fixture in
tests/conftest.py clears it before every test; a test that wants a token
still gets one, since its own monkeypatch.setenv runs after and overrides
it. Confirmed narrowly scoped: adding only this one delenv brought the
suite from 28 failed back to 1212 passed with nothing left over — no need
to guess at a wider blast radius.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>