fix: make MCP tests FastMCP 2.x/3.x compatible and quote ag-grid column names#38633
fix: make MCP tests FastMCP 2.x/3.x compatible and quote ag-grid column names#38633aminghadersohi wants to merge 3 commits intoapache:masterfrom
Conversation
FastMCP removed private _tool_manager, _prompt_manager, and _resource_manager attributes. Use the public async list_tools(), list_prompts(), and list_resources() methods instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review Agent Run #ab329bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #38633 +/- ##
==========================================
- Coverage 65.01% 63.69% -1.33%
==========================================
Files 1817 2529 +712
Lines 72348 129270 +56922
Branches 23044 29787 +6743
==========================================
+ Hits 47038 82334 +35296
- Misses 25310 45473 +20163
- Partials 0 1463 +1463
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…d 3.x CI pins FastMCP 2.14.3 (uses private _tool_manager API) while local dev may use 3.x (uses public async list_tools API). Add compatibility helpers that check for the private API first and fall back to public. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When resolving label names to their underlying SQL expressions, simple column identifiers should be double-quoted for SQL safety. Complex expressions (with parentheses, CASE, newlines) are already wrapped in parentheses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review Agent Run #e8daf7
Actionable Suggestions - 1
-
superset-frontend/plugins/plugin-chart-ag-grid-table/src/buildQuery.ts - 1
- SQL Dialect Incompatibility in Label Resolution · Line 535-537
Additional Suggestions - 1
-
tests/unit_tests/mcp_service/test_mcp_tool_registration.py - 1
-
Missing Type Hints · Line 27-45The new helper functions are missing return type hints, which violates the coding standard requiring explicit type annotations for all functions. Please add -> Set[str] to _get_tool_names, -> int to _get_prompt_count, and -> Set[str] to _get_resource_uris, along with importing Set from typing.
-
Review Details
-
Files reviewed - 2 · Commit Range:
bba7d1e..4d6beeb- tests/unit_tests/mcp_service/test_mcp_tool_registration.py
- superset-frontend/plugins/plugin-chart-ag-grid-table/src/buildQuery.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| const wrappedExpression = isExpression | ||
| ? `(${expression})` | ||
| : expression; | ||
| : `"${expression}"`; |
There was a problem hiding this comment.
This change incorrectly wraps simple SQL expressions in double quotes when resolving labels in AG Grid complex filters. Since Superset supports multiple SQL dialects (e.g., MySQL uses backticks, SQL Server uses brackets), hardcoding double quotes will generate invalid SQL for many databases, leading to query failures. The original behavior of leaving simple expressions unquoted was correct.
Code suggestion
Check the AI-generated fix before applying
| const wrappedExpression = isExpression | |
| ? `(${expression})` | |
| : expression; | |
| : `"${expression}"`; | |
| const wrappedExpression = isExpression | |
| ? `(${expression})` | |
| : expression; |
Code Review Run #e8daf7
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
SUMMARY
Two CI fixes for issues broken on master:
MCP tool registration tests (
test_mcp_tool_registration.py): CI pins FastMCP 2.14.3 which uses private_tool_managerAPI, while local dev may use FastMCP 3.x which removed those privates and added publiclist_tools()etc. Added compatibility helpers that detect the FastMCP version viahasattrand use the appropriate API.ag-grid buildQuery (
buildQuery.ts): When resolving label names to their underlying SQL column expressions, simple column identifiers were not being double-quoted. The test expects"user_status"but the code produceduser_status. Fixed by wrapping simple (non-expression) column names in SQL double-quotes.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - test fix and minor code fix
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION