Skip to content

fix: make MCP tests FastMCP 2.x/3.x compatible and quote ag-grid column names#38633

Closed
aminghadersohi wants to merge 3 commits intoapache:masterfrom
aminghadersohi:amin/fix-mcp-tool-registration-test
Closed

fix: make MCP tests FastMCP 2.x/3.x compatible and quote ag-grid column names#38633
aminghadersohi wants to merge 3 commits intoapache:masterfrom
aminghadersohi:amin/fix-mcp-tool-registration-test

Conversation

@aminghadersohi
Copy link
Contributor

@aminghadersohi aminghadersohi commented Mar 13, 2026

SUMMARY

Two CI fixes for issues broken on master:

  1. MCP tool registration tests (test_mcp_tool_registration.py): CI pins FastMCP 2.14.3 which uses private _tool_manager API, while local dev may use FastMCP 3.x which removed those privates and added public list_tools() etc. Added compatibility helpers that detect the FastMCP version via hasattr and use the appropriate API.

  2. 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 produced user_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

# MCP tests (Python)
pytest tests/unit_tests/mcp_service/test_mcp_tool_registration.py -x -q

# ag-grid tests (Jest shard 7 in CI)
# The buildQuery.test.ts "should quote simple column names without parentheses" test should pass

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

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>
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Mar 13, 2026

Code Review Agent Run #ab329b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: bba7d1e..bba7d1e
    • tests/unit_tests/mcp_service/test_mcp_tool_registration.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

AI Code Review powered by Bito Logo

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.69%. Comparing base (1867336) to head (bba7d1e).
⚠️ Report is 7 commits behind head on master.

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     
Flag Coverage Δ
hive 40.61% <ø> (?)
mysql 61.65% <ø> (?)
postgres 61.71% <ø> (?)
presto 40.62% <ø> (?)
python 61.98% <ø> (?)
sqlite 61.35% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

aminghadersohi and others added 2 commits March 13, 2026 14:10
…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>
@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 13, 2026
@aminghadersohi aminghadersohi changed the title fix(mcp): use public FastMCP API in tool registration tests fix: make MCP tests FastMCP 2.x/3.x compatible and quote ag-grid column names Mar 13, 2026
@aminghadersohi
Copy link
Contributor Author

Closing - both fixes are now on master (FastMCP 3.1.0 via #38562, ag-grid test via #38636)

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-45
      The 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

AI Code Review powered by Bito Logo

Comment on lines 535 to +537
const wrappedExpression = isExpression
? `(${expression})`
: expression;
: `"${expression}"`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQL Dialect Incompatibility in Label Resolution

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
Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants