From 7ee942c822d8920c0a9e4cab60f54a3d7f778158 Mon Sep 17 00:00:00 2001 From: kurosawareiji7007-hub Date: Wed, 29 Jul 2026 09:42:41 -0700 Subject: [PATCH] fix(test): give session_transcript handler test a temp KB the degraded-when-absent case called handle_request with no discoverable .vouch root, so _store raised KBNotFoundError and CI failed on py3.13. chdir into a fixture KB and empty the Claude/Codex search roots instead. --- CHANGELOG.md | 1 + tests/test_session_transcript.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12980eb5..08cafbdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to vouch are documented here. Format follows ## [Unreleased] ### Fixed +- **`kb.session_transcript` handler test needs a KB** : `test_handler_returns_degraded_when_absent` now chdirs into a temp KB and points Claude/Codex search roots at empty dirs, so the handler can return the degraded payload instead of raising `KBNotFoundError`. - **`kb.search` excludes retracted claims and archived pages** (#581): `search_kb` now drops `ARCHIVED` / `SUPERSEDED` / `REDACTED` claims and `ARCHIVED` pages the same way `kb.context` already does, so lifecycle diff --git a/tests/test_session_transcript.py b/tests/test_session_transcript.py index 19c0a6d9..5af1a244 100644 --- a/tests/test_session_transcript.py +++ b/tests/test_session_transcript.py @@ -196,9 +196,17 @@ def test_handler_bad_agent_is_invalid_request() -> None: assert resp["error"]["code"] == "invalid_request" -def test_handler_returns_degraded_when_absent() -> None: +def test_handler_returns_degraded_when_absent( + store: KBStore, monkeypatch: pytest.MonkeyPatch +) -> None: from vouch.jsonl_server import handle_request + # handle_request discovers the KB via cwd; point both agent search roots + # at empty dirs so the locator misses and returns the degraded payload. + monkeypatch.chdir(store.root) + monkeypatch.setenv("VOUCH_CLAUDE_PROJECTS_DIR", str(store.kb_dir / "no-claude")) + monkeypatch.setenv("CODEX_HOME", str(store.kb_dir / "no-codex")) + resp = handle_request({ "id": "3", "method": "kb.session_transcript", "params": {"session_id": "11111111-1111-1111-1111-111111111111"},