Repository navigation
test: Give the MCP resource error tests an archive to fail inside - #5175
Conversation
Five `TestResourceErrorEnvelopes` cases asserted a code they never reached. `read_server` builds a server with no archive at all, so each resource opened an absent index tier and returned before touching whatever the test had patched. The three `internal_error` cases were reaching the generic handler via a bare `sqlite3.OperationalError`; the two `not_found` cases were reaching an `except sqlite3.OperationalError` arm. Both were green for the wrong reason. #5162 typed that refusal as `archive_tier_unavailable` and the coincidence stopped holding. The expected codes were right; the fixtures were not. `seeded_read_server` installs a real seeded archive as the runtime service scope, so the injected faults now actually fire. The two `not_found` cases drop their `_get_polylogue` patch entirely -- it was inert, since neither resource calls it -- and rely on the resource resolving an unresolvable token itself. Anti-vacuity, measured rather than asserted: deleting the injected fault from `test_sessions_resource_internal_error` now fails the test. Before this change it still passed. The behaviour #5162 introduced keeps deliberate coverage of its own, against the bare `read_server`, instead of being an accident three other tests depended on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 55 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Five MCP resource-error tests were asserting a code they never reached. This clears them, and adds deliberate coverage for the behaviour that exposed them.
Evidence
Receipt
.cache/verify/runs/20260914T233651Z-all-207009-89ddea6b(verify_all, job 1699, 22,540 selected, 29 failed).Caveat on that receipt: its
run.jsonrecordsgit_head: f7964acd12b25134c0e2e4cd8f73f9e6557a4a4f— the tip of branchrebase-5165, notmasterand not an ancestor of it — andfinal_git_head: 724d17535. The shared checkout advanced across 7 merged PRs during the run, so it is not evidence of a frozen tree. I re-ran all 29 node ids at truemasterHEAD: 17 reproduce, 12 do not. These 5 are among the 17.Root cause
All five come from one place, and in none of them did the intended trigger execute. The
read_serverfixture builds a server with no archive at all. Every one of these resources opens the index tier first, so it returned before touching what the test had patched.They were green for the wrong reason on both sides:
internal_errorcases: absent tier raised a baresqlite3.OperationalError, which fell into the genericelseofserver_support._exception_to_error_json→internal_error;not_foundcases: the sameOperationalErrorhit an explicitexcept sqlite3.OperationalError: … code="not_found"arm inserver_resources.py.#5162 typed that refusal as
archive_tier_unavailable, and the coincidence stopped holding.git show --stat 817eec6f4touches no MCP file — these tests were never considered.Separately, the two
not_foundcases patchedpolylogue.mcp.server._get_polylogue, which neither resource calls. That patch was inert regardless of the tier.Per-failure classification
test_stats_resource_internal_errorOperationalError→ generic handler, not the patchedArchiveStore.statsfaulttest_sessions_resource_internal_errorarchive_session_list_payloadnever calledtest_origin_recent_resource_internal_errortest_session_resource_not_foundOperationalError→ thenot_foundarm;_get_polyloguepatch inerttest_messages_resource_not_foundNo product defect.
archive_tier_unavailableis the correct answer for the input these fixtures actually presented. Notably the expected codes were right all along — the fixtures were wrong — so this does not retarget a single assertion downward.Solution
seeded_read_server: a read-role server whose runtime service scope is a real, seeded archive.build_server()is what installs the scope, so it runs before the scope is read back and swapped.internal_errorcases move to it, keeping their patches and their expected code. The injectedRuntimeError("boom")now actually fires.not_foundcases move to it and drop the inert_get_polyloguepatch, relying on the resource resolving an unresolvable token itself (resolve_session_id→KeyError→code="not_found"). Present tier, absent session — which is what the test names claim._seed_archiveis hoisted to module scope;TestNativeReadSurfaceHonorsContract._seednow delegates to it rather than duplicating the body.test_resource_on_an_absent_index_tier_is_typed_not_internal, against the bareread_server, so fix: Report an absent index tier as a typed first-run outcome #5162's behaviour has coverage of its own instead of being an accident three other tests leaned on.Anti-vacuity
Measured, not asserted. With the injected fault deleted from
test_sessions_resource_internal_error:Before this change that same deletion still passed — the definition of vacuous.
not_foundcases: red ifresolve_session_idstops raisingKeyErrorfor an unresolvable token, or ifserver_resourcesstops catching(KeyError, ValueError)and lets it reach the generic handler asinternal_error.ArchiveTierUnavailableErrorbranch in_exception_to_error_jsonis removed — it returns tointernal_error.Verification
26 passed (21 + the 5 repaired, of which one is new).
Schema closure
OUT of the derived schema-identity closure. Test-only change; no product file touched. Does not need to land before an archive rebuild.
Residuals
internal_error; the full suite will say.internal_errortests that patch a pre-archive call site (tags,session_tree,readiness) were already non-vacuous and are untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK