Skip to content

The agent that grows with you

test(config): remote is a real backend now; unconfigured remote still fails closed

Ben Barclay1e10f59220ea
diff --git a/tests/hermes_cli/test_config_backend.py b/tests/hermes_cli/test_config_backend.py
index 95cd403a548..17a2d8bc627 100644
--- a/tests/hermes_cli/test_config_backend.py
+++ b/tests/hermes_cli/test_config_backend.py
@@ -20,6 +20,33 @@ def home(tmp_path):
class TestRouting:
+ def test_default_is_file(self, home):
+ assert cb.get_config_backend().name == "file"
+ assert cb.supports_file_tooling() is True
+
+ def test_unknown_backend_fails_closed(self, home, monkeypatch):
+ # No config value can select the backend, and an unknown one never falls back to the file.
+ monkeypatch.setenv(cb.BACKEND_ENV, "bogus")
+ with pytest.raises(cb.ConfigBackendUnavailable):
+ cb.get_config_backend()
+ with pytest.raises(cb.ConfigBackendUnavailable):
+ cb.read_config_doc(home / "config.yaml")
+
+ def test_unconfigured_remote_backend_fails_closed_on_read(self, home, monkeypatch):
+ # Selected from the env alone; without its plane identity the first read exits, and the
+ # local config.yaml is never used as a fallback (D2).
+ from plugins.config_backends import remote
+ (home / "config.yaml").write_text("a: 1\n", encoding="utf-8")
+ monkeypatch.setenv(cb.BACKEND_ENV, "remote")
+ monkeypatch.delenv("HERMES_CONFIG_INSTANCE_ID", raising=False)
+ remote._reset_for_tests()
+ try:
+ assert cb.get_config_backend().name == "remote"
+ with pytest.raises(cb.ConfigBackendUnavailable, match="Remote Config"):
+ cb.read_config_doc(home / "config.yaml")
+ finally:
+ remote._reset_for_tests()
+
def test_explicit_non_config_file_never_reaches_the_backend(self, home, monkeypatch):
# Only ``<home>/config.yaml`` is a user layer; any other file is read where it is.
def no_backend():