The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: keep the invariant tests for the ledger bound and the AX-walk bound
kshitijk4poor9fd07283d432
diff --git a/tests/tools/test_computer_use_ax_walk_bound.py b/tests/tools/test_computer_use_ax_walk_bound.pyindex 016923a67ac..70171d24553 100644--- a/tests/tools/test_computer_use_ax_walk_bound.py+++ b/tests/tools/test_computer_use_ax_walk_bound.py@@ -10,7 +10,6 @@ from __future__ import annotationsfrom typing import Any, Dict, List, Optional-import pytestfrom tools.computer_use import cua_backendfrom tools.computer_use.cua_backend_capture import _CaptureMixin@@ -38,11 +37,6 @@ def _write_config(tmp_path, body: str) -> None:class TestAxWalkBound:- def test_default_is_a_finite_bound(self):- """No config line: the walk is bounded, not unbounded. The whole point of the fix."""- assert cua_backend._DEFAULT_AX_MAX_ELEMENTS > 0- assert cua_backend._cua_configured_ax_max_elements() == cua_backend._DEFAULT_AX_MAX_ELEMENTS-def test_configured_value_reaches_the_driver_args(self, tmp_path, monkeypatch):"""End to end through the loader the backend uses: config.yaml -> get_window_state args."""_write_config(tmp_path, "computer_use:\n ax_max_elements: 350\n")@@ -57,25 +51,6 @@ class TestAxWalkBound:assert cua_backend._cua_configured_ax_max_elements() == 0assert "max_elements" not in _StubCapture()._gws_args()- def test_unusable_value_fails_to_the_default_not_to_unbounded(self, tmp_path, monkeypatch):- """A junk config line is a latency regression, never a silent revert to walking everything."""- _write_config(tmp_path, "computer_use:\n ax_max_elements: plenty\n")- monkeypatch.setenv("HERMES_HOME", str(tmp_path))- assert cua_backend._cua_configured_ax_max_elements() == cua_backend._DEFAULT_AX_MAX_ELEMENTS-- def test_negative_values_are_clamped(self, tmp_path, monkeypatch):- _write_config(tmp_path, "computer_use:\n ax_max_elements: -5\n")- monkeypatch.setenv("HERMES_HOME", str(tmp_path))- assert cua_backend._cua_configured_ax_max_elements() == 0-- def test_bound_rides_alongside_the_target(self, tmp_path, monkeypatch):- """The bound is an addition: pid/window_id addressing is untouched."""- _write_config(tmp_path, "computer_use:\n ax_max_elements: 250\n")- monkeypatch.setenv("HERMES_HOME", str(tmp_path))- args = _StubCapture()._gws_args()- assert args["pid"] == 607 and args["window_id"] == 382- assert args["max_elements"] == 250-class TestCappedWalkHint:"""When the driver's walk stopped at the bound, the spill file is not the full tree — say so."""diff --git a/tests/tools/test_skill_ledger.py b/tests/tools/test_skill_ledger.pyindex d908de3fab1..f87b3d1199d 100644--- a/tests/tools/test_skill_ledger.py+++ b/tests/tools/test_skill_ledger.py@@ -600,7 +600,8 @@ def test_backup_fill_ignores_tar_path_traversal(ledger_env):)# Malicious members are not.assert not any(p.endswith("evil.md") or p.endswith("outside.md") for p in paths)-import json++from pathlib import Pathimport pytest@@ -674,41 +675,3 @@ def test_trim_oldest_when_still_over_cap(ledger_env, monkeypatch):after=[{"path": "my-skill/z2.md", "sha256": "b" * 64}], evidence={"pad": "z" * 3000})assert skill_ledger.ledger_path().stat().st_size <= int(8192 * 0.8)assert "{not json at all" in skill_ledger.ledger_path().read_text(encoding="utf-8")---def test_disabled_threshold_never_touches_the_file(ledger_env, monkeypatch):- """ledger_max_bytes: 0 keeps the append-only contract: no- rewrite ever happens, however large the file is."""- from tools import skill_ledger-- import hermes_cli.config as _cfg-- monkeypatch.setattr(_cfg, "load_config", lambda *a, **k: {- "skills": {"ledger": True, "ledger_max_bytes": 0}})-- _append_padded(skill_ledger, "patch", "z" * 4096, n=4)- raw = skill_ledger.ledger_path().read_text(encoding="utf-8")-- skill_ledger._maintain_size()-- assert skill_ledger.ledger_path().read_text(encoding="utf-8") == raw---def test_maintenance_failure_never_blocks_append(ledger_env, monkeypatch):- """Telemetry contract: a broken maintenance sweep logs and leaves the- appended entries on disk."""- from tools import skill_ledger-- import hermes_cli.config as _cfg-- monkeypatch.setattr(_cfg, "load_config", lambda *a, **k: {- "skills": {"ledger_max_bytes": 8192}})-- def _boom(*a, **k):- raise OSError("disk full")-- monkeypatch.setattr(skill_ledger, "compact_ledger", _boom)- # appends past the threshold hit the broken sweep and must survive it- _append_padded(skill_ledger, "patch", "w" * 4096, n=6)-- assert len(skill_ledger.list_entries()) == 6