fix(env): wire EXCLUDE_SOURCES through get_config + SKILL.md integration
The original PR added EXCLUDE_SOURCES filtering to pipeline.available_sources()
and to the check-config.sh banner, but env.py::get_config() builds its config
dict from a hardcoded keys list that didn't include EXCLUDE_SOURCES. The
result: setting EXCLUDE_SOURCES in the environment silently no-op'd through
the Python pipeline. Only the bash hook (which reads shell env directly)
worked. The PR's unit tests didn't catch this because they construct config
dicts directly, bypassing get_config().
Changes:
- Add ('EXCLUDE_SOURCES', '') to env.py's keys list so the env var actually
propagates into config.
- Add an end-to-end regression test that goes through get_config() rather
than constructing config dicts directly.
- Document EXCLUDE_SOURCES in SKILL.md's source-list checklist so the model
invoking the skill knows to subtract excluded sources before displaying
the active-sources line. (Per AGENTS.md: engine flags without SKILL.md
prose are incomplete — the agent invoking the skill won't know the flag
exists.)
This commit is contained in:
@@ -956,5 +956,29 @@ class TestExcludeSources(unittest.TestCase):
|
||||
self.assertIn("reddit", sources)
|
||||
|
||||
|
||||
class TestExcludeSourcesEndToEnd(unittest.TestCase):
|
||||
"""Wiring regression: EXCLUDE_SOURCES from the process environment must
|
||||
reach available_sources() via env.get_config(). The unit tests above
|
||||
construct config dicts directly; this one exercises the env-to-config
|
||||
path so a missing entry in env.py's keys list is caught immediately."""
|
||||
|
||||
def test_exclude_sources_from_env_propagates_through_get_config(self):
|
||||
import os
|
||||
from unittest.mock import patch as _patch
|
||||
from lib import env as env_mod
|
||||
from importlib import reload
|
||||
with _patch.dict(os.environ, {
|
||||
"LAST30DAYS_CONFIG_DIR": "",
|
||||
"EXCLUDE_SOURCES": "tiktok,instagram",
|
||||
"SCRAPECREATORS_API_KEY": "fake",
|
||||
}, clear=False):
|
||||
reload(env_mod)
|
||||
cfg = env_mod.get_config()
|
||||
self.assertEqual(cfg.get("EXCLUDE_SOURCES"), "tiktok,instagram")
|
||||
sources = pipeline.available_sources(cfg)
|
||||
self.assertNotIn("tiktok", sources)
|
||||
self.assertNotIn("instagram", sources)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user