Caught by my own broader test scope after Devin fixes — three test files asserted on user-visible strings that were renamed by the bootstrap PR but the assertions weren't updated: - tests/test_api_query_guardrail.py:110 — asserted `da fetch in suggestion` on /api/query 400 response. Renamed to `agnes snapshot create`. - tests/test_query_materialized_error_message.py:56 — asserted `da sync` in materialized-not-yet error detail. Renamed to `agnes pull`. - tests/test_cli_error_render.py:71 — fixture data + assertion both carried `da fetch`. Updated to `agnes snapshot create`. Plus an actual content miss: docs/setup/claude_settings.json (a template shipped to operators) still installed `da sync` / `da sync --upload-only` hooks. The companion test file (tests/test_setup_hooks_template.py) was asserting that legacy state. Updated both: - Template hooks: `agnes pull --quiet` / `agnes push --quiet` - Test assertions + function name match the new commands
33 lines
1.3 KiB
Python
33 lines
1.3 KiB
Python
"""The shipped Claude settings template must point hooks at `agnes pull` / `agnes push`, not the deleted server/scripts."""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
TEMPLATE = REPO_ROOT / "docs" / "setup" / "claude_settings.json"
|
|
|
|
|
|
def test_template_has_session_start_agnes_pull():
|
|
cfg = json.loads(TEMPLATE.read_text())
|
|
starts = cfg.get("hooks", {}).get("SessionStart", [])
|
|
assert starts, "SessionStart hook missing"
|
|
cmds = [h["command"] for entry in starts for h in entry.get("hooks", [])]
|
|
assert any("agnes pull" in c for c in cmds), (
|
|
f"Expected `agnes pull` in SessionStart, got {cmds}"
|
|
)
|
|
|
|
|
|
def test_template_has_session_end_upload():
|
|
cfg = json.loads(TEMPLATE.read_text())
|
|
ends = cfg.get("hooks", {}).get("SessionEnd", [])
|
|
cmds = [h["command"] for entry in ends for h in entry.get("hooks", [])]
|
|
assert any("agnes push" in c for c in cmds), (
|
|
f"Expected `da sync --upload-only` in SessionEnd, got {cmds}"
|
|
)
|
|
|
|
|
|
def test_template_drops_dead_server_scripts_reference():
|
|
raw = TEMPLATE.read_text()
|
|
assert "server/scripts/collect_session.py" not in raw, (
|
|
"Template still references the deleted server/scripts/collect_session.py — "
|
|
"the SessionEnd hook would silently fail."
|
|
)
|