Skip to content

test(mcp): prove facets forwards scoped filters - #1570

Merged
Sinity merged 1 commit into
masterfrom
feature/test/mcp-facets-runtime-contract
May 25, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/test/mcp-facets-runtime-contract

Conversation

@Sinity

@Sinity Sinity commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a focused runtime contract for the MCP facets tool so the query-scoped facets surface is pinned beyond the published schema witness.

Problem

#873 requires scoped facets across CLI/API/daemon/MCP. #1569 exposed query in the MCP facets input schema, but a regression could still accept the parameter and then drop it before calling the shared Polylogue.facets() contract.

Solution

The new MCP facets contract test invokes the registered tool with query + provider and asserts that it forwards a ConversationQuerySpec carrying both filters. It also covers the no-filter path and asserts that MCP calls poly.facets(None) for the global view.

Verification

  • pytest -q tests/unit/mcp/test_facets_tool_contract.py tests/unit/mcp/test_query_tool_schema_derivation.py --tb=short → 9 passed
  • ruff format --check tests/unit/mcp/test_facets_tool_contract.py tests/unit/mcp/test_tool_contracts.py → passed
  • ruff check tests/unit/mcp/test_facets_tool_contract.py tests/unit/mcp/test_tool_contracts.py → passed
  • mypy tests/unit/mcp/test_facets_tool_contract.py tests/unit/mcp/test_tool_contracts.py → passed
  • devtools verify --json → PASS, 66 affected pytest nodes selected
  • pre-push devtools verify --quick → PASS

Ref #873

Problem: #873 now exposes query-scoped facets through MCP, but the last slice only proved the published schema and witness. A runtime regression could still drop filters before calling the shared facets contract.

What changed: add a focused MCP facets contract test covering query/provider forwarding into ConversationQuerySpec and the unscoped no-filter path calling poly.facets(None).

Verification: pytest -q tests/unit/mcp/test_facets_tool_contract.py tests/unit/mcp/test_query_tool_schema_derivation.py --tb=short; devtools verify --json.

Ref #873
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 14 minutes and 41 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b79b23e3-e036-46c1-8baa-c713ac6485b1

📥 Commits

Reviewing files that changed from the base of the PR and between d575ede and 3e5c879.

📒 Files selected for processing (1)
  • tests/unit/mcp/test_facets_tool_contract.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/mcp-facets-runtime-contract

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 and usage tips.

@Sinity
Sinity merged commit 1a32533 into master May 25, 2026
4 checks passed
@Sinity
Sinity deleted the feature/test/mcp-facets-runtime-contract branch May 25, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant