aminghadersohi opened a new pull request, #37187:
URL: https://github.com/apache/superset/pull/37187

   ### SUMMARY
   
   When creating time series charts through the MCP service, users would 
incorrectly see a prompt asking to add the x-axis to filters even when a filter 
for that column already existed. This happened because the frontend performs 
case-sensitive comparison between the x-axis column name and existing filter 
subjects.
   
   For example, if a user creates a chart with `x_axis='order_date'` but the 
dataset has the column named `'OrderDate'`, and there's already a filter with 
`subject='OrderDate'`, the frontend would show the prompt because `'order_date' 
!== 'OrderDate'`.
   
   This fix adds column name normalization to the MCP validation pipeline:
   
   1. Added `_get_canonical_column_name()` to `DatasetValidator` that performs 
case-insensitive matching and returns the actual dataset column name
   2. Added `normalize_column_names()` method that normalizes all column 
references in chart configs (x-axis, y-axis, group_by, filters)
   3. Updated `ValidationPipeline` to normalize column names after validation 
passes, before the config is used to create form_data
   
   After normalization, column names in the form_data match exactly with the 
dataset column names, so the frontend comparison works correctly.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** User creates time series chart with `order_date` as x-axis on 
Vehicle Sales dataset. Gets prompted "The X-axis is not on the filters list" 
even though `OrderDate` filter already exists. Clicking "Yes" adds a duplicate 
`order_date` filter.
   
   **After:** Column names are normalized to match dataset column names 
(`order_date` → `OrderDate`), so the frontend correctly detects the existing 
filter and does not show the prompt.
   
   ### TESTING INSTRUCTIONS
   
   1. Set up a dataset with mixed-case column names (e.g., `OrderDate` instead 
of `order_date`)
   2. Create a time series chart via MCP with the column name in a different 
case (e.g., `x_axis='orderdate'` or `x_axis='order_date'`)
   3. Verify the chart is created without the x-axis filter prompt appearing
   4. Verify existing filters are not duplicated
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to