The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(doctor): describe full workspace npm audit scope
Darwin Wub9dda06bbf6d
diff --git a/hermes_cli/doctor_tools.py b/hermes_cli/doctor_tools.pyindex a493dcff75e..5a8fd87dafb 100644--- a/hermes_cli/doctor_tools.py+++ b/hermes_cli/doctor_tools.py@@ -445,7 +445,7 @@ def _audit_one(npm_bin: str, npm_dir, label: str, audit_extra: list[str], manual" (the next `hermes update` reinstalls from the committed lockfile)")check_warn(f"{label} deps", f"({critical} critical, {high} high, {moderate} moderate — {remedy})")if workspace_scoped:- check_info(" ^ build-time tooling (not runtime); if manual npm remediation "+ check_info(" ^ workspace audit includes runtime and build dependencies; if manual npm remediation ""errors with an arborist crash it's a known npm bug — clears via a lockfile bump")else:check_info(f" ^ {detail}; report/pin the fix in package-lock.json — see #116774")diff --git a/tests/hermes_cli/test_doctor_workspace_audit.py b/tests/hermes_cli/test_doctor_workspace_audit.pynew file mode 100644index 00000000000..9543afbad3d--- /dev/null+++ b/tests/hermes_cli/test_doctor_workspace_audit.py@@ -0,0 +1,34 @@+"""Workspace audit warnings must reflect their runtime and build dependency scope."""++import json+import subprocess+from unittest.mock import patch++import pytest++from hermes_cli import doctor_tools++[email protected]("workspace, runtime_package", [("web", "react-router"), ("ui-tui", "undici")])+def test_workspace_runtime_findings_are_not_dismissed_as_build_tooling(workspace, runtime_package, tmp_path, capsys):+ audit_args = ["npm", "audit", "--json", "--workspace", workspace]+ audit_output = json.dumps({+ "vulnerabilities": {+ runtime_package: {"severity": "high", "isDirect": True},+ "vitest": {"severity": "moderate", "isDirect": True},+ },+ "metadata": {"vulnerabilities": {"high": 1, "moderate": 1}},+ })+ result = subprocess.CompletedProcess(audit_args, 1, stdout=audit_output)+ issues = []++ with patch.object(doctor_tools.subprocess, "run", return_value=result) as run:+ doctor_tools._audit_one("npm", tmp_path, f"{workspace} workspace", audit_args[3:], issues)++ assert run.call_args.args[0] == audit_args+ output = capsys.readouterr().out+ assert "runtime and build dependencies" in output+ assert "not runtime" not in output+ assert "1 high, 1 moderate" in output+ assert "upstream lockfile bump" in output+ assert issues == [f"{workspace} workspace has 2 npm vulnerabilities"]