Skip to content

test(transcript): give the degraded-path handler test its own kb - #592

Merged
plind-junior merged 3 commits into
testfrom
fix/transcript-handler-test-hermetic
Jul 29, 2026
Merged

test(transcript): give the degraded-path handler test its own kb#592
plind-junior merged 3 commits into
testfrom
fix/transcript-handler-test-hermetic

Conversation

@plind-junior

@plind-junior plind-junior commented Jul 29, 2026

Copy link
Copy Markdown
Member

What changed

test_handler_returns_degraded_when_absent now builds its own KB under
tmp_path and chdirs into it before calling handle_request, matching
the store fixture pattern the other jsonl handler tests already use. it
also pins VOUCH_CLAUDE_PROJECTS_DIR and CODEX_HOME at empty dirs, so
the absence it asserts is the raw transcript's rather than whatever the
machine happens to have.

Why

ci is red on test itself (be43b22), and every PR based on it inherits
the failure — that's what #589 is hitting.

the test called handle_request with no KB of its own, so _store()
resolved whatever .vouch/ the cwd sat under. on a developer checkout
that's the repo's own KB, so it passed locally. /.vouch/ is gitignored,
so in CI there is nothing to find: discover_root raised
KBNotFoundError, _h_session_transcript turned it into a RuntimeError
before load_transcript ever ran, and the envelope came back
ok: falseassert False is True.

the two sibling handler tests were never affected because they fail
validation before _store() is reached.

What might break

nothing. test-only change; no .vouch/ layout, kb.* behaviour or
on-disk shape is touched.

VEP

not a surface change.

Tests

  • make check passes locally (lint + mypy + pytest)
  • verified in a .vouch-less worktree, which is the actual CI
    condition: 1907 passed, 30 skipped, exit 0. the same worktree on
    the parent commit reproduces 1 failed.
  • CHANGELOG.md updated under ## [Unreleased]

Summary by CodeRabbit

  • Bug Fixes
    • Fixed session transcript handling when transcript data is unavailable, ensuring the expected degraded response is returned reliably in CI environments.
    • Improved failure diagnostics for transcript handling tests by including response details in assertion messages.

test_handler_returns_degraded_when_absent called handle_request with no
kb of its own, so _store() resolved whatever .vouch/ the cwd sat under.
that is the repo's own kb on a developer checkout - the test passed
locally - and nothing at all in ci, where .vouch/ is gitignored, so the
handler raised KBNotFoundError and the envelope came back ok: false.

the test now builds a kb under tmp_path and chdirs into it, matching the
store-fixture pattern the other jsonl handler tests use, and pins
VOUCH_CLAUDE_PROJECTS_DIR and CODEX_HOME at empty dirs so the absence it
asserts is the raw transcript's rather than the machine's.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The degraded kb.session_transcript test now avoids ambient .vouch/ state by using a fixture KB and empty locator directories. Its assertion also includes the response payload for clearer failures.

Changes

Transcript degraded-path test

Layer / File(s) Summary
Isolate degraded transcript path
CHANGELOG.md, tests/test_session_transcript.py
The test uses a fixture KB with empty transcript locator directories and reports resp when the expected successful response assertion fails.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • vouchdev/vouch#593: Updates the same degraded transcript test to avoid ambient .vouch/ state.

Suggested labels: storage

Suggested reviewers: kurosawareiji7007-hub

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: making the degraded-path transcript handler test use its own knowledge base.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/transcript-handler-test-hermetic

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance tests tests and fixtures size: XS less than 50 changed non-doc lines ci: passing ci is green labels Jul 29, 2026
test had already landed an equivalent hermetic fix for
test_handler_returns_degraded_when_absent in c89ca20 (via #589), so both
sides edited the same test and the same changelog block.

resolved to test's version of the test: it uses the file's existing
`store` fixture, which is the idiom the sibling transcript tests already
follow (test_session_transcript.py:145 points the locator at
`store.kb_dir / "none"` the same way). this branch's `, resp` assertion
message survives — it is the one piece not duplicated, and it puts the
envelope in the failure output when this regresses again.

the changelog keeps one entry instead of two, and drops the stray `)`
line c89ca20 left behind under `### Fixed`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_session_transcript.py`:
- Around line 214-215: Extend the assertions in the transcript-absence test to
verify that resp["result"]["reason"] starts with “raw transcript not found for
session”. Keep the existing resp["ok"] and available assertions unchanged so the
test specifically distinguishes missing transcripts from other
unavailable-transcript cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cffe2065-7a70-4e66-aa03-d628085c3d67

📥 Commits

Reviewing files that changed from the base of the PR and between aa34e22 and f36f0d8.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • tests/test_session_transcript.py

Comment on lines +214 to 215
assert resp["ok"] is True, resp
assert resp["result"]["available"] is False

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the missing-transcript reason as well.

available: False also covers unreadable and oversized transcripts, so this test does not verify the intended raw-transcript-absence path. Assert that resp["result"]["reason"] starts with raw transcript not found for session.

Suggested assertion
     assert resp["ok"] is True, resp
     assert resp["result"]["available"] is False
+    assert resp["result"]["reason"].startswith("raw transcript not found for session")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assert resp["ok"] is True, resp
assert resp["result"]["available"] is False
assert resp["ok"] is True, resp
assert resp["result"]["available"] is False
assert resp["result"]["reason"].startswith("raw transcript not found for session")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_session_transcript.py` around lines 214 - 215, Extend the
assertions in the transcript-absence test to verify that
resp["result"]["reason"] starts with “raw transcript not found for session”.
Keep the existing resp["ok"] and available assertions unchanged so the test
specifically distinguishes missing transcripts from other unavailable-transcript
cases.

@plind-junior
plind-junior merged commit f17e21f into test Jul 29, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: passing ci is green docs documentation, specs, examples, and repo guidance size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant