Repository navigation
test: type mcp and ui surface contracts - #288
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 27 minutes and 6 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ 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 |
## Summary - Add typed MCP surface protocols for test helpers and fixtures. - Replace dynamic MCP/security/UI test annotations with concrete fixture, callback, repository, and parameter data types. - Route async MCP prompt/tool invocations through the shared surface helper instead of direct untyped calls. ## Problem The mypy cleanup campaign still had dynamic seams in MCP and UI tests. These tests exercised real contracts, but their fixtures and parameter tables were typed as `Any`, which kept strict checking from proving the surface shapes. ## Solution Typed the MCP server-under-test managers via lightweight protocols in `tests/infra/mcp.py`, converted the MCP fixture and tests to those contracts, and tightened UI rendering/TUI tests with explicit fixture and parameter aliases. Runtime assertions now narrow mixed parameterized case data where the test matrix intentionally carries multiple shapes. Ref #281 ## Verification - `ruff check tests/infra/mcp.py tests/unit/mcp/conftest.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_mcp_edge_cases.py tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.py` - `mypy tests/infra/mcp.py tests/unit/mcp/conftest.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_mcp_edge_cases.py tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.py` - `pytest -q tests/unit/mcp tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.py` - `PATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quick`
MCP and UI tests exercised real contracts, but their fixtures and parameter tables were typed as `Any`, keeping strict checking from proving the surface shapes. Adds typed MCP surface protocols in `tests/infra/mcp.py` for test helpers and fixtures; converts the MCP fixture and tests to those contracts. Replaces dynamic MCP/security/UI test annotations with concrete fixture, callback, repository, and parameter data types. Routes async MCP prompt/tool invocations through the shared surface helper instead of direct untyped calls. Tightens UI rendering/TUI tests with explicit fixture and parameter aliases; runtime assertions now narrow mixed parameterized case data where the test matrix intentionally carries multiple shapes. Verification: ruff + mypy + pytest over MCP, security, UI, TUI, and visual-UI suites; devtools verify --quick green. Ref #281
MCP and UI tests exercised real contracts, but their fixtures and parameter tables were typed as `Any`, keeping strict checking from proving the surface shapes. Adds typed MCP surface protocols in `tests/infra/mcp.py` for test helpers and fixtures; converts the MCP fixture and tests to those contracts. Replaces dynamic MCP/security/UI test annotations with concrete fixture, callback, repository, and parameter data types. Routes async MCP prompt/tool invocations through the shared surface helper instead of direct untyped calls. Tightens UI rendering/TUI tests with explicit fixture and parameter aliases; runtime assertions now narrow mixed parameterized case data where the test matrix intentionally carries multiple shapes. Verification: ruff + mypy + pytest over MCP, security, UI, TUI, and visual-UI suites; devtools verify --quick green. Ref #281
MCP and UI tests exercised real contracts, but their fixtures and parameter tables were typed as `Any`, keeping strict checking from proving the surface shapes. Adds typed MCP surface protocols in `tests/infra/mcp.py` for test helpers and fixtures; converts the MCP fixture and tests to those contracts. Replaces dynamic MCP/security/UI test annotations with concrete fixture, callback, repository, and parameter data types. Routes async MCP prompt/tool invocations through the shared surface helper instead of direct untyped calls. Tightens UI rendering/TUI tests with explicit fixture and parameter aliases; runtime assertions now narrow mixed parameterized case data where the test matrix intentionally carries multiple shapes. Verification: ruff + mypy + pytest over MCP, security, UI, TUI, and visual-UI suites; devtools verify --quick green. Ref #281
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Problem
The mypy cleanup campaign still had dynamic seams in MCP and UI tests. These tests exercised real contracts, but their fixtures and parameter tables were typed as
Any, which kept strict checking from proving the surface shapes.Solution
Typed the MCP server-under-test managers via lightweight protocols in
tests/infra/mcp.py, converted the MCP fixture and tests to those contracts, and tightened UI rendering/TUI tests with explicit fixture and parameter aliases. Runtime assertions now narrow mixed parameterized case data where the test matrix intentionally carries multiple shapes.Ref #281
Verification
ruff check tests/infra/mcp.py tests/unit/mcp/conftest.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_mcp_edge_cases.py tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.pymypy tests/infra/mcp.py tests/unit/mcp/conftest.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_mcp_edge_cases.py tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.pypytest -q tests/unit/mcp tests/unit/security/test_mcp_security.py tests/unit/ui/test_ui.py tests/unit/ui/test_tui.py tests/unit/ui/test_ui_visual.pyPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quick