fix(mcp): add AliasChoices to chart/dashboard/dataset request schemas#41597
Draft
aminghadersohi wants to merge 1 commit into
Draft
fix(mcp): add AliasChoices to chart/dashboard/dataset request schemas#41597aminghadersohi wants to merge 1 commit into
aminghadersohi wants to merge 1 commit into
Conversation
LLM callers commonly send 'id' instead of 'identifier', 'columns' instead of 'select_columns', etc. Pydantic silently drops unrecognized field names and falls back to defaults, causing requests to behave as if the field was never sent. Add validation_alias=AliasChoices(...) and populate_by_name=True to the chart, dashboard, and dataset MCP request schemas that were still using the bare field name, matching the pattern already used by OpenSqlLabRequest and GenerateDashboardRequest.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41597 +/- ##
==========================================
- Coverage 64.42% 64.42% -0.01%
==========================================
Files 2668 2668
Lines 147182 147194 +12
Branches 33947 33947
==========================================
+ Hits 94821 94828 +7
- Misses 50646 50649 +3
- Partials 1715 1717 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
idinstead ofidentifier, orcolumnsinstead ofselect_columns. Pydantic silently drops unrecognized keys and falls back to field defaults, so these requests behaved as if the field was never sent at all.validation_alias=AliasChoices(...)plusmodel_config = ConfigDict(populate_by_name=True)to the chart, dashboard, and dataset MCP request schemas that were missing them, following the existing pattern already used byOpenSqlLabRequestandGenerateDashboardRequest.GetChartInfoRequest,ListChartsRequest,GenerateExploreLinkRequest,UpdateChartRequest,UpdateChartPreviewRequest,GetChartDataRequest,GetChartPreviewRequest,GetChartSqlRequest,ListDashboardsRequest,GetDashboardInfoRequest,AddChartToDashboardRequest,ListDatasetsRequest,GetDatasetInfoRequest.Test plan
ruff format/ruff checkclean on all changed filesmypyandpylintpre-commit hooks pass on all changed filesid/chart_id/dashboard_id/dataset_id→identifier,columns→select_columns,dashboard/chart→dashboard_id/chart_id) intest_chart_schemas.py,test_dashboard_schemas.py, and a newtest_dataset_schemas.pymysqlclientfailed to build in this sandbox due to missing native libs)