Merge fallout (my resolution errors, all caught by CI): - hermes_cli/backup.py + gateway.py: `theirs` on those hunks re-imported clusters HEAD had already moved to backup_restore.py / kept in the facade. backup.py loses the 349-line duplicate (main's #110179 fix is ported into backup_restore._import_db_member); the systemd service-unit cluster returns to gateway.py (PM's _prepare_service_launcher / _pm_managed_node_dirs / _systemd_command have no home in main's extraction) with main's utf-8-sig read. gateway_service_unit.py is dropped. - gateway/run.py: main's plugin-update chore is not profile-scoped (the housekeeping ordering test pins the scope/drain sequence). - pyproject + 30 test files: `import yaml` -> `import hermes_yaml as yaml` (pm-clean has no pyyaml); gateway/config._bundled_platform_manifest_name reads through hermes_yaml. - tests re-seamed onto pm-clean's shape: residency admission (installed_engine), supervisor child env (binary is a constructor argument), update import guard (update_cmd_deps is gone; our probe already scrubs PYTHONPATH — both #115032 invariants pass), shallow-count git responses (stash path asks `status --porcelain -z`); dropped tests for retired code (_run_node_bootstrap/_ensure_tui_node, Windows resume demotion). - tests/tools/test_local_env_blocklist.py: restore the two helpers the suite-reduction commit dropped and the blocklist import. Real fixes: - pm: classify_uv_failure/ResolutionConflict move beside the uv runner (pm.environment, stdlib-only). pm.workspace imports tomllib at module level and cannot load on the 3.10 bootstrap python that streams uv output in the Docker arm64 image. - tools/browser_tool.warm_agent_browser_npx_cache: back as a permanent definition — it is on the frozen old-updater surface, and the revert-scheduled compat pointer does not count. - hermes_cli/memory_setup: the dashboard's pip row uses pm.environments. running_from_selected_environment for installed vs restart_required. - scripts/windows-build-deps.ps1: export DISTUTILS_USE_SDK/MSSdk so setuptools trusts the primed MSVC environment instead of asking vswhere (`env -i` test runner on win32-arm64 compiling ruamel-yaml-clib); run_tests.sh forwards them. - tests/pm/test_windows_build_deps.py: start the protocol test from a parent env without the toolchain variables the runner job already exports. - tests/conftest.py scrubs HERMES_BUNDLED_PLUGINS (Nix-wrapped hermes on the dev host); tests/home_io_guard.py treats sys.path site-packages under the real home as the interpreter's installation (PM-activated developer shell). - tests-js: four `curly` lint errors from main's new scripts.
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Concrete CLI sinks own filtering; generic agent callbacks remain observable."""
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
import hermes_yaml as yaml
|
|
|
|
from agent.status_output import StatusOutputMixin
|
|
from hermes_cli.cli_stream_mixin import CLIStreamMixin
|
|
|
|
|
|
class Agent(StatusOutputMixin):
|
|
suppress_status_output = True
|
|
platform = "cli"
|
|
|
|
def _touch_activity(self, *args):
|
|
pass
|
|
|
|
|
|
class CLI(CLIStreamMixin):
|
|
_spinner_text = ""
|
|
|
|
def _invalidate(self):
|
|
pass
|
|
|
|
|
|
@pytest.mark.parametrize("setting", [None, False, True])
|
|
def test_cli_notice_and_wait_callbacks_keep_default_output(tmp_path, monkeypatch, setting):
|
|
import cli
|
|
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
|
(tmp_path / "config.yaml").write_text(yaml.safe_dump(
|
|
{} if setting is None else {"display": {"suppress_warning_notifications": setting}}))
|
|
printed = []
|
|
monkeypatch.setattr(cli, "_cprint", printed.append)
|
|
surface = CLI()
|
|
agent = Agent()
|
|
surface.agent = agent
|
|
agent.notice_callback = surface._on_notice
|
|
agent.thinking_callback = surface._on_thinking
|
|
agent._emit_notice(SimpleNamespace(level="warn", text="arbitrary warning wording"))
|
|
agent._emit_diagnostic_wait("arbitrary retry wording")
|
|
surface._flush_credit_notices()
|
|
assert bool(printed) is not (setting is True)
|
|
assert surface._spinner_text == ("" if setting is True else "arbitrary retry wording")
|
|
agent._emit_notice(SimpleNamespace(level="info", text="ordinary progress"))
|
|
agent._emit_wait_notice("⚠ requested progress")
|
|
surface._flush_credit_notices()
|
|
assert "ordinary progress" in printed[-1]
|
|
assert surface._spinner_text == "⚠ requested progress"
|