Commit Graph

12 Commits

Author SHA1 Message Date
Amin Ghadersohi
ec178b862c fix(mcp): fix saved-metric name normalization across all chart plugins
Add _get_canonical_metric_name() to DatasetValidator that searches only
available_metrics, preventing a column with matching case-insensitive name
from shadowing a saved metric's canonical casing.

Update all 7 chart plugins (xy, table, pie, big_number, handlebars,
mixed_timeseries, pivot_table) to branch on saved_metric flag: saved
metrics now go through _get_canonical_metric_name while regular column
refs continue to use _get_canonical_column_name.

Fix pre_validate alias handling in xy and mixed_timeseries plugins to
accept Pydantic AliasChoices keys (metrics/x_axis/metrics_b) so payloads
using canonical Superset field names are not incorrectly rejected.

Add TestGetCanonicalMetricName, TestSavedMetricNormalizationCorrectness,
and TestPreValidateAliasHandling test classes covering the collision case
and alias acceptance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 23:04:53 +00:00
Amin Ghadersohi
487f8afc72 refactor(mcp): complete plugin protocol — registry bootstrap, mypy fixes, test repairs
On top of the dead-code elimination in the previous commit:
- Add lazy _ensure_plugins_loaded() bootstrap to ChartTypeRegistry so the
  registry is populated even without importing app.py (fixes isolated test runs)
- Delegate _RegistryProxy methods to module-level functions so bootstrap runs
- Guard register() against empty chart_type strings
- Add generate_name + resolve_viz_type to ChartTypePlugin Protocol and
  BaseChartPlugin; delegate generate_chart_name/_resolve_viz_type in
  chart_utils to the plugin registry
- Add _with_context static helper to BaseChartPlugin (shared by all plugins)
- Fix stale 'five methods' → 'eight methods' docstring in plugin.py
- Add TypeVar _C to normalize_column_names so mypy infers correct return type
- Fix broken tests: update _pre_validate_big_number_config → _pre_validate_chart_type,
  remove deleted TestNormalizeXYConfig/TestNormalizeTableConfig classes,
  update runtime validator tests for removed _validate_format_compatibility /
  _validate_cardinality methods, add x is not None narrowing guards

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 23:04:09 +00:00
Gabriel Torres Ruiz
e68251fa70 feat(mcp): support custom SQL metrics in generate_chart and update_chart (#40448) 2026-05-28 14:52:43 -03:00
Beto Dealmeida
cb53745d43 feat: semantic layer extension (#37815) 2026-05-05 12:07:46 -04:00
Amin Ghadersohi
4b42f82f13 fix(mcp): restore typed ChartConfig in tool schemas for LLM visibility (#39732) 2026-04-28 19:46:57 -04:00
Amin Ghadersohi
ad20285dd6 fix(mcp): sanitize chart config errors and accept field name aliases (#39606) 2026-04-24 21:30:43 -04:00
Enzo Martellucci
dae79a6cba fix(mcp): surface validation errors in generate_chart instead of empty response (#39522)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 21:50:02 +02:00
Kamil Gabryjelski
15bab227bb feat(mcp): support saved metrics from datasets in chart generation (#38955)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 16:38:31 +02:00
Kamil Gabryjelski
14b1b456e1 fix: Add aliases and groupby list to chart schemas (#38740) 2026-03-19 16:15:58 +01:00
Amin Ghadersohi
a1312a86e8 fix(mcp): normalize column names to fix time series filter prompt issue (#37187)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 15:27:53 +01:00
Amin Ghadersohi
a9dca529c1 fix(mcp): treat runtime validation warnings as informational, not errors (#37214)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 09:23:51 -08:00
Amin Ghadersohi
d0783da3e5 fix(mcp): Handle big_number charts and make semantic warnings non-blocking (#37142)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 18:19:06 +01:00