b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""Regression tests for curator skill activity timestamps."""
|
|
|
|
import importlib
|
|
from datetime import datetime, timedelta, timezone
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def _write_skill(skills_dir: Path, name: str) -> None:
|
|
skill_dir = skills_dir / name
|
|
skill_dir.mkdir(parents=True, exist_ok=True)
|
|
(skill_dir / "SKILL.md").write_text(
|
|
f"---\nname: {name}\ndescription: test skill\n---\n\n# {name}\n",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def curator_modules(tmp_path, monkeypatch):
|
|
home = tmp_path / ".hermes"
|
|
(home / "skills").mkdir(parents=True)
|
|
monkeypatch.setenv("HERMES_HOME", str(home))
|
|
monkeypatch.setattr(Path, "home", lambda: tmp_path)
|
|
|
|
import tools.skill_usage as skill_usage
|
|
import agent.curator as curator
|
|
|
|
importlib.reload(skill_usage)
|
|
importlib.reload(curator)
|
|
return home, skill_usage, curator
|
|
|
|
|
|
def test_recent_view_activity_prevents_false_stale_transition(curator_modules, monkeypatch):
|
|
home, skill_usage, curator = curator_modules
|
|
skills_dir = home / "skills"
|
|
_write_skill(skills_dir, "recently-viewed")
|
|
|
|
now = datetime(2026, 4, 30, tzinfo=timezone.utc)
|
|
created_at = (now - timedelta(days=60)).isoformat()
|
|
last_viewed_at = (now - timedelta(days=1)).isoformat()
|
|
skill_usage.save_usage({
|
|
"recently-viewed": {
|
|
"created_at": created_at,
|
|
"last_viewed_at": last_viewed_at,
|
|
"view_count": 1,
|
|
"state": "active",
|
|
}
|
|
})
|
|
monkeypatch.setattr(curator, "get_stale_after_days", lambda: 30)
|
|
monkeypatch.setattr(curator, "get_archive_after_days", lambda: 90)
|
|
|
|
counts = curator.apply_automatic_transitions(now=now)
|
|
|
|
assert counts["marked_stale"] == 0
|
|
assert skill_usage.get_record("recently-viewed")["state"] == "active"
|