Merge branch 'simp/r3-00-cliA' into simp/r3-00

This commit is contained in:
Teknium
2026-09-02 19:50:21 -07:00
7 changed files with 1851 additions and 2933 deletions
+804 -2925
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -241,5 +241,6 @@ class TestCLIDefaultsHaveAuxiliaryKeys:
# test runs on Windows where the default locale is cp1252.
source = Path(_cli_mod.__file__).read_text(encoding="utf-8")
assert "auxiliary_config = defaults.get(\"auxiliary\"" in source
assert "_AUXILIARY_TASK_ENV" in source
assert "AUXILIARY_VISION_PROVIDER" in source
assert "AUXILIARY_VISION_MODEL" in source
+3 -2
View File
@@ -1086,9 +1086,10 @@ class TestMergeVerdictCache:
def test_cache_is_bounded(self, monkeypatch, tmp_path):
"""The cache file must not grow without limit across sessions."""
import cli
from hermes_cli import worktree_ops
path = tmp_path / "verdicts.json"
monkeypatch.setattr(cli, "_worktree_merge_cache_path", lambda: path)
monkeypatch.setattr(cli, "_WORKTREE_MERGE_CACHE_MAX", 10)
monkeypatch.setattr(worktree_ops, "_worktree_merge_cache_path", lambda: path)
monkeypatch.setattr(worktree_ops, "_WORKTREE_MERGE_CACHE_MAX", 10)
cli._save_worktree_merge_cache({f"sha{i}..sha{i}:20": True for i in range(50)})
assert len(cli._load_worktree_merge_cache()) == 10
+4 -2
View File
@@ -111,6 +111,7 @@ class TestMaintainPackHealth:
def test_repacks_at_threshold(self, repo, monkeypatch):
import cli
from hermes_cli import worktree_ops
made = self._make_packs(repo, 6)
# Behavior contract, not a snapshot: different git builds consolidate
@@ -119,7 +120,7 @@ class TestMaintainPackHealth:
# strictly more packs than the threshold we set — so the maintenance
# pass has something real to consolidate.
threshold = 2
monkeypatch.setattr(cli, "_PACK_SPRAWL_THRESHOLD", threshold)
monkeypatch.setattr(worktree_ops, "_PACK_SPRAWL_THRESHOLD", threshold)
assert made > threshold, f"fixture failed to produce sprawl (made={made})"
cli._maintain_pack_health(str(repo))
@@ -130,9 +131,10 @@ class TestMaintainPackHealth:
def test_noop_below_threshold(self, repo, monkeypatch):
import cli
from hermes_cli import worktree_ops
made = self._make_packs(repo, 2)
monkeypatch.setattr(cli, "_PACK_SPRAWL_THRESHOLD", 50)
monkeypatch.setattr(worktree_ops, "_PACK_SPRAWL_THRESHOLD", 50)
cli._maintain_pack_health(str(repo))
+1 -2
View File
@@ -73,8 +73,7 @@ def _extract_dict_keys(source: str, dict_name: str) -> set[str]:
def _cli_env_map_keys() -> set[str]:
"""terminal config keys bridged by cli.load_cli_config() (via _mirror_config_to_env)."""
import cli
source = inspect.getsource(cli._mirror_config_to_env)
return _extract_dict_keys(source, "env_mappings")
return set(cli._TERMINAL_ENV_MAPPINGS.keys())
def _gateway_env_map_keys() -> set[str]:
+2 -2
View File
@@ -782,13 +782,13 @@ class TestWorktreeSymlinkFallback:
def test_source_has_symlink_fallback(self):
root = Path(__file__).resolve().parents[2]
source = (root / "cli.py").read_text(encoding="utf-8")
source = (root / "hermes_cli" / "worktree_ops.py").read_text(encoding="utf-8")
# Look for the try/except that handles OSError around os.symlink
# with a shutil.copytree fallback.
assert "os.symlink(str(src_resolved), str(dst))" in source
assert "except (OSError, NotImplementedError)" in source
assert "shutil.copytree" in source
assert 'sys.platform == "win32"' in source
assert 'sys.platform != "win32"' in source
# ---------------------------------------------------------------------------