Skip to content

The agent that grows with you

test(config): regression guard so config.yaml comment loss cannot come back

teknium143504da0e599
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 83c064eabde..a5b0c90f62c 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -193,6 +193,11 @@ jobs:
- name: Forbid literal /tmp paths outside the baseline
run: python scripts/check_no_tmp_literals.py
+ # config.yaml is hand-edited and commented; a PyYAML dump of it destroys every comment
+ # (#92554, regressed repeatedly). All writers go through hermes_cli.config.atomic_config_write.
+ - name: Forbid config.yaml writers that bypass the comment-preserving writer
+ run: python scripts/check_config_yaml_writers.py
+
# The OS lanes import only files carrying the matching marker, so a test that fakes
# macOS (is_macos -> True, sys.platform -> "darwin") without `macos_only` is green on
# Linux over a faked branch and never runs on macOS (#111866, AGENTS.md § Don't fake the host OS).
diff --git a/scripts/check_config_yaml_writers.py b/scripts/check_config_yaml_writers.py
index 32cce5eeab5..217ea2017e1 100755
--- a/scripts/check_config_yaml_writers.py
+++ b/scripts/check_config_yaml_writers.py
@@ -87,7 +87,7 @@ def scan_file(path: Path) -> list[str]:
elif _func_name(node.func) == "write_text" and isinstance(node.func, ast.Attribute):
receiver = ast.get_source_segment(src, node.func.value) or ""
body = ast.get_source_segment(src, node) or ""
- if CONFIG_PATH_RE.search(receiver) and re.search(r"\bdump\(", body):
+ if CONFIG_PATH_RE.search(receiver) and "dump(" in body:
flag(node, f"write_text of a YAML dump onto a config path ({receiver})")
return problems