Repository navigation
fix(mcp): adapt cross-surface parity tests to the six-tool cutover - #3121
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
6fbcfec to
5d28a6e
Compare
31c083f to
6a266bf
Compare
Ref polylogue-t46.8
Problem: devtools verify --all found ~20 tests across
tests/unit/storage/{test_surface_parity_adapters,test_query_parity}.py
and tests/unit/maintenance/{test_scope_filter_envelope_contract,
test_envelope_contracts,test_scope_filter}.py still calling the
individually-named MCP tools (list_sessions, search,
maintenance_preview) retired by the six-tool cutover (#3095),
deterministically failing with KeyError on every run since -- test
debt this session's earlier work left behind, never caught by
`devtools test tests/unit/mcp/` because these files live outside that
directory.
What changed:
- Extended query()'s tool signature and _query_sessions with
min_messages/max_messages/min_words, mirroring the existing
origin/tag/repo/since/until/sort filters -- test_surface_parity_adapters.py
needed these on the session-listing path and the old list_sessions
tool supported them, so this closes a real (if narrow) parameter gap
in query(projection="sessions", ...) rather than watering down the
parity test. Also threaded the same three fields through
_dispatch_run's saved-query replay for symmetry.
- Rewired _MCPSurface in both storage parity test files from
_tools["search"]/_tools["list_sessions"] to
_tools["query"].fn(expression=..., projection="sessions", ...) --
same underlying archive_search_payload/archive_session_list_payload
machinery, so response shape is unchanged.
- Rewired the three maintenance test files'
_tools["maintenance_preview"] call sites to
_tools["maintenance"].fn(operation="preview", ...), and fixed two
stale registration-presence assertions
(test_maintenance_tools_registered_on_admin_server /
test_maintenance_tools_absent_from_read_server) that were checking
for "maintenance_preview"/"maintenance_execute" -- names that never
existed post-cutover, so the assertions were vacuously true rather
than testing anything.
- Found and fixed a real production bug while doing this:
server_cutover.py's _build_mcp_scope_filter only had
MaintenanceScopeFilter imported under TYPE_CHECKING, but its body
constructs one at runtime -- every maintenance(operation="preview"
or "execute") call was raising NameError. Added the runtime import
to the function's existing lazy-import block.
- Marked test_mcp_cost_outlook_tool_uses_shared_envelope xfail
(strict=True, raises=KeyError): the cost_outlook tool has no
six-tool-surface replacement yet -- cost/usage rollup MCP wiring
needs a design decision explicitly deferred this session, tracked in
polylogue-hg97. This turns silent breakage into an honest, tracked
gap that auto-un-xfails once the design lands.
Filed polylogue-p6rz for the remaining ~40-file pre-existing failure
list from the same devtools verify --all run that are NOT MCP-related
(no_color_requested() signature drift, a stale migration-count
assertion, query_units telemetry-key naming) -- confirmed unrelated by
isolated reruns, left untouched here.
Verification: devtools test tests/unit/mcp/ tests/unit/maintenance/
tests/unit/storage/test_surface_parity_adapters.py
tests/unit/storage/test_query_parity.py tests/unit/cost/test_contract_suite.py
tests/unit/verification/test_code_refs_resolve.py (576 passed, 1
xfailed); mypy --strict and ruff clean; devtools render all --check
clean.
Co-Authored-By: Claude <[email protected]>
6a266bf to
74f94f0
Compare
Summary
Fixes ~20 tests left broken by the six-tool MCP cutover (#3095) that still
call individually-named MCP tools which no longer exist, and fixes a real
production bug (
NameError) found while doing so inmaintenance()'spreview/execute path.
Stacked on #3118 (dead-code cleanup) — base branch is
feature/mcp/retire-legacy-registrars, notmaster. Merge #3118 first.Problem
devtools verify --all(the first full run since #3095 merged) foundtests/unit/storage/{test_surface_parity_adapters,test_query_parity}.pyandtests/unit/maintenance/{test_scope_filter_envelope_contract, test_envelope_contracts,test_scope_filter}.pystill callingserver._tool_manager._tools["list_sessions"|"search"|"maintenance_preview"]— tools retired by the cutover. Deterministic
KeyErroron every run,confirmed via isolated reruns (not a fixture-cache artifact). Never caught by
devtools test tests/unit/mcp/because these files live outside thatdirectory, and per-PR CI skips the heavy test suite entirely.
Solution
query()'s signature and_query_sessionswithmin_messages/max_messages/min_words, mirroring the existingorigin/tag/repo/since/until/sortfilters — closes a real(narrow) parameter gap in
query(projection="sessions", ...)rather thanweakening the parity test, since the old
list_sessionstool supportedthese. Also threaded through
_dispatch_run's saved-query replay forsymmetry.
_MCPSurfacefrom_tools["search"]/_tools["list_sessions"]to_tools["query"].fn(expression=..., projection="sessions", ...)— sameunderlying payload-building machinery, response shape unchanged.
_tools["maintenance_preview"]call sites to
_tools["maintenance"].fn(operation="preview", ...), andfixed two registration-presence assertions that were checking for names
(
maintenance_preview/maintenance_execute) that never existedpost-cutover — vacuously true, testing nothing.
server_cutover.py's_build_mcp_scope_filteronly hadMaintenanceScopeFilterimported underTYPE_CHECKING, but constructs one at runtime — everymaintenance(operation="preview"/"execute")call was raisingNameError.Added the runtime import to the function's existing lazy-import block.
test_mcp_cost_outlook_tool_uses_shared_envelopexfail(
strict=True,raises=KeyError):cost_outlookhas no six-tool-surfacereplacement yet — cost/usage rollup MCP wiring needs a design decision
explicitly deferred this session, tracked in
polylogue-hg97.Filed
polylogue-p6rzfor the remaining ~40-file pre-existing failure listfrom the same
--allrun that are not MCP-related (no_color_requested()signature drift, a stale migration-count assertion,
query_unitstelemetry-key naming) — confirmed unrelated by isolated reruns, left
untouched here.
Verification
devtools test tests/unit/mcp/ tests/unit/maintenance/ tests/unit/storage/test_surface_parity_adapters.py tests/unit/storage/test_query_parity.py tests/unit/cost/test_contract_suite.py tests/unit/verification/test_code_refs_resolve.py— 576 passed, 1 xfailed.mypy --strict/ruffclean.devtools render all --checkclean.Ref polylogue-t46.8