Files
6krrt/tests/test_suite_ignores_machine_overlay.py
adlee-was-taken 80d0e6ae8e fix(config): stop the test suite reading the machine's config.local.yaml
Sweep finding #12.

load_config merges the sibling config.local.yaml and dispatcher.cfg binds at
import, so the suite inherited whatever this deployment had configured. With
`classifier.mode: local_encoder` in the overlay -- the setting this
deployment actually runs -- nine tests failed with assertions like
`assert 'local_encoder' == 'local_llm'`: five in test_classifier_backoff,
three in test_gaming_mode, one in test_classifier_modes_dispatch.

Reproduced both directions on the same tree before the fix: overlay absent
1523 passed, overlay present 9 failed. So a deployment that had configured
anything could not run its own tests clean, and the failures looked like
regressions rather than a fixture problem -- which is the expensive part.

`ROUTER_IGNORE_LOCAL_CONFIG` makes load_config skip the overlay, and
tests/conftest.py sets it as a module-level statement rather than a fixture:
it has to happen before the first `import dispatcher` in any test module,
and pytest imports conftest first.

An explicit `include_overlay` parameter goes with it, because the blanket
env var broke the five tests in test_config.py that exercise overlay
merging on their own tmp files -- behaviour that is the thing under test,
not an accident of the developer's machine. Those now opt in. The default
stays None, meaning "consult the environment", so the production path is
unchanged.

Verified after the fix: 1613 pass with the real overlay in place and 1613
pass without it, identically.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRQXz5SYZYVWscxS1QqF6U
2026-09-08 18:51:22 -04:00

3.9 KiB