test(kanban): add failing test for list_profiles_on_disk with custom HERMES_HOME

list_profiles_on_disk() hardcodes Path.home() / ".hermes" / "profiles",
ignoring HERMES_HOME when set to a custom root (e.g. /opt/data).

Add test_list_profiles_on_disk_custom_root to cover this case.

Related to #18442, #18985.
This commit is contained in:
Clooooode 2026-05-03 11:39:40 +12:00 committed by Teknium
parent 8163d37192
commit 1964b0565b

View file

@ -902,12 +902,13 @@ def test_list_profiles_on_disk(tmp_path, monkeypatch):
"""list_profiles_on_disk returns directories under ~/.hermes/profiles/
that contain a config.yaml."""
monkeypatch.setattr(Path, "home", lambda: tmp_path)
monkeypatch.delenv("HERMES_HOME", raising=False)
profiles = tmp_path / ".hermes" / "profiles"
profiles.mkdir(parents=True)
(profiles / "researcher").mkdir()
(profiles / "researcher" / "config.yaml").write_text("model: {}\n")
(profiles / "writer").mkdir()
(profiles / "writer" / "config.yaml").write_text("model: {}\n")
for name in ("researcher", "writer"):
d = profiles / name
d.mkdir()
(d / "config.yaml").write_text("model: {}\n")
(profiles / "empty_dir").mkdir()
# A stray file; should be ignored.
(profiles / "stray.txt").write_text("noise")
@ -916,6 +917,20 @@ def test_list_profiles_on_disk(tmp_path, monkeypatch):
assert names == ["researcher", "writer"]
def test_list_profiles_on_disk_custom_root(tmp_path, monkeypatch):
"""list_profiles_on_disk respects a custom HERMES_HOME root."""
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
profiles = tmp_path / "profiles"
profiles.mkdir(parents=True)
for name in ("researcher", "writer"):
d = profiles / name
d.mkdir()
(d / "config.yaml").write_text("model: {}\n")
names = kb.list_profiles_on_disk()
assert names == ["researcher", "writer"]
def test_known_assignees_merges_disk_and_board(tmp_path, monkeypatch):
"""known_assignees unions profiles on disk with currently-assigned
names, and reports per-status counts."""