Files
hermes-agent/tests/hermes_cli/test_gateway_task_probe.py
T
Jibin Rajan Varghese db63214c7b perf(desktop): reduce Windows startup I/O and blocking checks
- Cache source hashes with metadata validation that detects source edits.
- Skip Node/npm checks when launching an up-to-date packaged app.
- Drain packaged console output into asynchronous rotating logs.
- Query gateway task state through COM without loading ScheduledTasks.
- Validate renderer assets using Vite's manifest, retaining torn-bundle
  detection and the legacy fallback.

Add regression coverage for cache invalidation, console draining,
toolchain-free launches, gateway probing, and renderer validation.

Validation: 98 Python tests and 19 renderer tests passed.
2026-09-16 16:18:17 -05:00

29 lines
1.0 KiB
Python

"""The startup supervisor probe must not load the slow CIM ScheduledTasks module."""
import subprocess
import uuid
from unittest.mock import patch
import pytest
from hermes_cli.gateway import _windows_scheduled_task_state
@pytest.mark.windows_only
def test_task_query_without_powershell_module_autoload():
real_run = subprocess.run
def run_without_modules(command, **kwargs):
command = list(command)
command[-1] = ("$ErrorActionPreference='Stop'; $PSModuleAutoLoadingPreference='None'; "
+ command[-1])
result = real_run(command, **kwargs)
assert result.returncode == 0, result.stderr
return result
# A random absent task exercises real COM/RPC and task-name quoting without
# creating, stopping or changing any scheduled task on the developer's host.
task_name = "Hermes_test_'" + uuid.uuid4().hex
with patch("hermes_cli.gateway.subprocess.run", side_effect=run_without_modules):
assert _windows_scheduled_task_state(task_name) == "MISSING"