You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "EnxDev (via GitHub)" <gi...@apache.org> on 2026/10/12 20:30:36 UTC
[PR] fix(mcp): keep the saved chart variant when update_chart omits it [superset]
EnxDev opened a new pull request, #45221:
URL: https://github.com/apache/superset/pull/45221
### SUMMARY
`update_chart` (and `update_chart_preview`) changed the chart's viz type whenever the config left out the field that picks the variant. `XYChartConfig.kind` defaults to `line`, `TableChartConfig.viz_type` to `table` and `BigNumberChartConfig.show_trendline` to `False`, so an update that only touched a metric turned a saved bar chart into a line chart, an ag-grid table into a plain table, and a big number with trendline into a plain big number. Because the viz type changed, the update then went through the cross-viz merge, which keeps only the bounded preserve registry, so `show_value`, `page_length`, `table_timestamp_format`, `compare_lag` and `start_y_axis_at_zero` were dropped and `row_limit` went back to its default.
The fix uses the existing `resolve_update_config` plugin hook, which is there to complete a partial update config from the saved form data. The xy, table and big number plugins now fill the omitted variant from the saved chart when that chart belongs to the same plugin. A variant the caller names still wins, and a saved chart of another type still gets the schema default.
Two details for big number:
- The trendline needs its temporal column, so an omitted `temporal_column` is inherited from the saved `granularity_sqla`. It is inherited without being added to `model_fields_set`. A named `temporal_column` makes the merge drop the saved time filters, and an update that never mentioned the column shouldn't lose the chart's time range. `normalize_column_refs` rebuilds the config with `exclude_unset`, so it carries the inherited column across the same way.
- On a dataset rebind the saved column belongs to the previous dataset, so nothing is inherited and the behaviour is unchanged.
Scope, measured against the table in #45210 on current master:
| Case from the issue | Before | After |
|---|---|---|
| `ag-grid-table`, config without `viz_type` | becomes `table` | stays `ag-grid-table`, saved settings kept |
| xy bar, config without `kind` | becomes a line chart | stays a bar chart, saved settings kept |
| big number with trendline, `show_trendline` omitted | becomes `big_number_total` | keeps the trendline and its settings |
| pie, only `row_limit` named | already fixed by #43771 | unchanged |
| xy bar to line with `kind: "line"` | cross-viz merge | unchanged |
The last row is left alone on purpose. An explicit variant change goes through `FORM_DATA_UPDATE_PRESERVE_KEYS`, which already keeps filters, `color_scheme`, `show_legend` and `legendOrientation` and deliberately drops plugin-specific controls. Whether a variant change inside one chart type should count as a same-viz update is a design call for that registry, so this PR doesn't close the issue by itself.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable, backend only.
### TESTING INSTRUCTIONS
```bash
pytest tests/unit_tests/mcp_service/chart/tool/test_update_chart.py -k "kind or viz_type or trendline or rebind_does_not_inherit"
```
The new tests run a config through the same steps the tool uses (`resolve_update_config`, `normalize_column_refs`, `_build_update_payload`). Six of them fail on master.
Manually, through an MCP client:
1. Save a bar chart with `show_value` on and a custom `row_limit`.
2. Call `update_chart` with `generate_preview: false` and a config that has `chart_type: "xy"`, `x` and `y` but no `kind`.
3. Read the saved params: `viz_type` is still `echarts_timeseries_bar` and the other settings are untouched. On master it's `echarts_timeseries_line`, `show_value` is gone and `row_limit` is back to the default.
### ADDITIONAL INFORMATION
- [x] Has associated issue: #45210
- [ ] 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.com/claude-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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): keep the saved chart variant when update_chart omits it [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45221:
URL: https://github.com/apache/superset/pull/45221#issuecomment-6132232180
## CodeAnt PR Risk: Low Risk
- The PR appears safe to merge; it preserves saved chart variants and Big Number trendlines when update options are omitted.
- Tests cover retaining saved settings, explicitly replacing variants, and avoiding reuse of a trendline column after a dataset rebind.
**Assessed commit:** `eb54c8f50a63`
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): keep the saved chart variant when update_chart omits it [superset]
Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev merged PR #45221:
URL: https://github.com/apache/superset/pull/45221
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): keep the saved chart variant when update_chart omits it [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45221:
URL: https://github.com/apache/superset/pull/45221#issuecomment-6132697969
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45221?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `10.25641%` with `35 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 64.79%. Comparing base ([`ea06872`](https://app.codecov.io/gh/apache/superset/commit/ea0687222a58fa69edae52e21b79a497ab4b2f23?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9efaf4e`](https://app.codecov.io/gh/apache/superset/commit/9efaf4e767372716a9aa018bd3353db0d0f2cf4f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45221?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/mcp\_service/chart/plugins/big\_number.py](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Fplugins%2Fbig_number.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvcGx1Z2lucy9iaWdfbnVtYmVyLnB5) | 4.54% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/mcp\_service/chart/plugins/xy.py](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Fplugins%2Fxy.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvcGx1Z2lucy94eS5weQ==) | 20.00% | [8 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/mcp\_service/chart/plugins/table.py](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Fplugins%2Ftable.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvcGx1Z2lucy90YWJsZS5weQ==) | 14.28% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #45221 +/- ##
===========================================
- Coverage 82.98% 64.79% -18.20%
===========================================
Files 3026 3026
Lines 195842 195879 +37
Branches 45719 45730 +11
===========================================
- Hits 162520 126910 -35610
- Misses 30111 66140 +36029
+ Partials 3211 2829 -382
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.83% <10.25%> (-0.01%)` | :arrow_down: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.62% <10.25%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.80% <10.25%> (-33.77%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.68% <10.25%> (-0.02%)` | :arrow_down: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/45221/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45221?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org