mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(themes): E2E live skin switch — config write → skin.changed broadcast
This commit is contained in:
parent
3ba6eebc7c
commit
428a0534ee
1 changed files with 33 additions and 0 deletions
|
|
@ -2017,6 +2017,39 @@ def test_slow_completion_does_not_block_fast_handler(completion_method, server):
|
|||
released.set()
|
||||
|
||||
|
||||
def test_skin_live_switch_end_to_end(server, tmp_path, monkeypatch):
|
||||
"""Real config + skin files: activating a skin (as `hermes config set` does)
|
||||
makes the per-tool reconcile broadcast skin.changed with the resolved palette.
|
||||
Exercises _load_cfg → _skin_sig → resolve_skin → _emit with no mocks in between."""
|
||||
import hermes_cli.skin_engine as skin_engine
|
||||
|
||||
(tmp_path / "skins").mkdir()
|
||||
(tmp_path / "skins" / "midnight.yaml").write_text(
|
||||
"name: midnight\ndescription: t\ncolors:\n banner_title: '#00ffcc'\n background: '#001010'\n"
|
||||
)
|
||||
monkeypatch.setattr(skin_engine, "get_hermes_home", lambda: tmp_path)
|
||||
monkeypatch.setattr(server, "_hermes_home", tmp_path)
|
||||
monkeypatch.setattr(server, "_last_skin_sig", None, raising=False)
|
||||
server._cfg_cache = server._cfg_mtime = server._cfg_path = None
|
||||
|
||||
emitted = []
|
||||
monkeypatch.setattr(server, "_emit", lambda ev, sid, payload=None: emitted.append((ev, payload)))
|
||||
|
||||
# Baseline (default) — seeds the signature.
|
||||
(tmp_path / "config.yaml").write_text("display:\n skin: default\n")
|
||||
server._broadcast_skin_if_changed()
|
||||
emitted.clear()
|
||||
|
||||
# Activate midnight, as `hermes config set display.skin midnight` would.
|
||||
time.sleep(0.01) # ensure the config mtime moves
|
||||
(tmp_path / "config.yaml").write_text("display:\n skin: midnight\n")
|
||||
server._broadcast_skin_if_changed()
|
||||
|
||||
assert [ev for ev, _ in emitted] == ["skin.changed"]
|
||||
assert emitted[0][1]["name"] == "midnight"
|
||||
assert emitted[0][1]["colors"]["banner_title"] == "#00ffcc"
|
||||
|
||||
|
||||
def test_broadcast_skin_if_changed_on_any_signature_move(server, monkeypatch):
|
||||
"""A skin the agent changes mid-turn goes live once per real move: a name
|
||||
switch (incl. switch-then-revert) OR an in-place color edit to the active skin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue