test_config_drift.py
1 """Regression tests for removed dead config keys. 2 3 This file guards against accidental re-introduction of config keys that were 4 documented or declared at some point but never actually wired up to read code. 5 Future dead-config regressions can accumulate here. 6 """ 7 8 import inspect 9 10 11 def test_delegation_default_toolsets_removed_from_cli_config(): 12 """delegation.default_toolsets was dead config — never read by 13 _load_config() or anywhere else. Removed. 14 15 Guards against accidental re-introduction in cli.py's CLI_CONFIG default 16 dict. If this test fails, someone re-added the key without wiring it up 17 to _load_config() in tools/delegate_tool.py. 18 19 We inspect the source of load_cli_config() instead of asserting on the 20 runtime CLI_CONFIG dict because CLI_CONFIG is populated by deep-merging 21 the user's ~/.hermes/config.yaml over the defaults (cli.py:359-366). 22 A contributor who still has the legacy key set in their own config 23 would cause a false failure, and HERMES_HOME patching via conftest 24 doesn't help because cli._hermes_home is frozen at module import time 25 (cli.py:76) — before any autouse fixture can fire. Source inspection 26 sidesteps all of that: it tests the defaults literal directly. 27 """ 28 from cli import load_cli_config 29 30 source = inspect.getsource(load_cli_config) 31 assert '"default_toolsets"' not in source, ( 32 "delegation.default_toolsets was removed because it was never read. " 33 "Do not re-add it to cli.py's CLI_CONFIG default dict; " 34 "use tools/delegate_tool.py's DEFAULT_TOOLSETS module constant or " 35 "wire a new config key through _load_config()." 36 )