Skip to content

The agent that grows with you

test(skills): the Hermes-index fetch rides the inspect connection pool

kshitijk4poore0cf8f7f8d20
diff --git a/tests/hermes_cli/test_skills_hub.py b/tests/hermes_cli/test_skills_hub.py
index 4d8fbc426f5..442506360ba 100644
--- a/tests/hermes_cli/test_skills_hub.py
+++ b/tests/hermes_cli/test_skills_hub.py
@@ -285,10 +285,11 @@ def test_resolve_keeps_catalog_meta_when_later_sources_do_not_fetch():
assert matched.__class__ is CatalogSource
-def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatch):
+def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatch, tmp_path):
"""A preview's sequential resolver calls must share its guarded connection pool."""
import hermes_cli.skills_hub as cli_hub
import tools.skills_hub as hub
+ import tools.skills_hub_search as search
from tools.skills_hub_models import SkillBundle, SkillMeta
clients = []
@@ -299,6 +300,9 @@ def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatch
content = b"ok"
headers = {}
+ def json(self):
+ return {"skills": []}
+
class Client:
def __enter__(self):
return self
@@ -312,6 +316,8 @@ def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatch
class Source:
def inspect(self, _identifier):
hub._guarded_http_get("https://example.com/metadata")
+ # The Hermes-index fetch must ride the same pool (no cache → real GET).
+ assert search._load_hermes_index() == {"skills": []}
return SkillMeta("example", "metadata", "test", "example/id", "community")
def fetch(self, _identifier):
@@ -327,6 +333,8 @@ def test_inspect_reuses_one_ssrf_safe_client_for_metadata_and_bundle(monkeypatch
monkeypatch.setattr(hub, "create_ssrf_safe_client", create_client, raising=False)
monkeypatch.setattr(hub, "is_safe_url", lambda _url: True)
monkeypatch.setattr(hub, "check_website_access", lambda _url: None)
+ monkeypatch.setattr(search, "_hermes_index_cache_file", lambda: tmp_path / "hermes-index.json")
+ monkeypatch.setattr(search.httpx, "get", lambda *_a, **_k: pytest.fail("index fetch bypassed the pool"))
result = cli_hub.inspect_skill("example/id")