Files
hermes-agent/tests/hermes_cli/test_source_release_probe.py
ethernet cfebdfd466 Own passive source update checks in Python
Use the exact target root and profile for branch, release, and cache decisions. Keep the desktop as a transport and handoff adapter. Remove the competing TypeScript checker and switch the banner, dashboard, and updater count consumers.

Preserve fork origins, unknown counts, publication checks, old-probe recovery, and official SSH branch healing through public HTTPS. Keep the historical unstamped-root policy unchanged.
2026-09-12 19:03:26 -04:00

26 lines
1.0 KiB
Python

"""A desktop check must not reinterpret unreadable channel config as main."""
from pathlib import Path
import os
import subprocess
import sys
import pytest
@pytest.mark.parametrize("content", ["update: [", "- not-a-mapping", b"\xff"])
def test_invalid_config_refuses_desktop_channel_probe(tmp_path, content):
home = tmp_path / "home"
home.mkdir()
config = home / "config.yaml"
config.write_bytes(content.encode() if isinstance(content, str) else content)
root = Path(__file__).resolve().parents[2]
result = subprocess.run(
[sys.executable, "-m", "hermes_cli.source_check", "--install-root", str(root), "--home", str(home)],
cwd=root, env={**os.environ, "HERMES_HOME": str(home), "HERMES_IGNORE_USER_CONFIG": "0"},
capture_output=True, text=True, timeout=30,
)
assert result.returncode != 0, result.stdout + result.stderr
assert '"channel": "main"' not in result.stdout
assert "config" in result.stderr
assert config.read_bytes() == (content.encode() if isinstance(content, str) else content)