Skip to content

feat(mcp): add typed Gantt chart support - #43737

Merged
aminghadersohi merged 6 commits into
apache:masterfrom
aminghadersohi:sc-119155-mcp-gantt
Sep 16, 2026
Merged

aminghadersohi merged 6 commits into
apache:masterfrom
aminghadersohi:sc-119155-mcp-gantt

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Adds production-quality typed MCP creation and iteration support for Superset's existing ECharts Gantt visualization.

  • Introduces a discriminated gantt config grounded in the frontend controlPanel, buildQuery, and transformProps contracts, including temporal start/end fields, category, series/subcategories, tooltips, ordering, filters/time range, row limits, and presentation controls.
  • Adds dataset-aware validation/normalization, bounded native gantt_chart form-data adaptation, exact typed-to-native mapping, registry/schema/resource/tool exposure, and shared chart-aware query construction for generate/update/query/compile/cached-preview paths.
  • Preserves native Gantt presentation state during saved and cached preview updates.
  • Adds faithful saved and unsaved Vega-Lite interval-bar previews with conservative malformed/missing-result errors and valid empty-result handling.
  • Adds focused coverage based on the repository's saved Gantt example, including schema/discriminator exposure, mapping/query shape, native round trips, validation, preview behavior, aliases, and regression wiring.

Existing Gantt layout-fix PRs #43189, #43299, and #39137 are unrelated to this MCP typed-creation work and are not modified or duplicated here.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshot 2026-09-15 at 9 02 57 PM

TESTING INSTRUCTIONS

Current head: 374ba98259e6f842166b7ab98f429abe41e275f2, rebased onto master 4c27cbd007 with explicit authorization following the duplicate-migration blocker.

  • Removed the branch's duplicate merge revision; upstream e2f3a1b9c640 already joins the same two parents. No remaining tracked references or dependent migrations required rewiring. This PR has no net migration-file changes against master; the single-head regression is retained.
  • Locally confirmed exactly one Alembic head: e2f3a1b9c640, using the repository's superset db heads head-count check, Alembic's heads command, and test_migrations_have_one_head.
  • Migration/MCP-chart/common-query suites: 2,021 passed; full PR-delta pre-commit/static checks passed.
  • Rebase drop-check: all three replayed commits are patch-equivalent; the entire tree matches old head plus current master except the intentionally deleted duplicate migration. All 13 required CI checks passed, with every associated workflow SHA verified against this new head; no failed or pending checks remain.
  • Pushed to the fork only with an exact-old-head lease: 55a5313294394be0169c7e7ca8aef8b2421f26d2 → 374ba98259e6f842166b7ab98f429abe41e275f2. Draft state is unchanged; the PR is not merged.

September 14 history-audit head: eb90008774828be54dacc894a7da5de74564265f, one commit atop master 774a51124ed30e7095636bebcb32e95e388867ff.

History correction: On September 11 the branch was squashed/rebased and force-pushed from 072bdea74eb0 with an explicit lease. Earlier normal-push/no-force-push statements apply only to their original updates, not the later rewrite. Approvals at 1614ed40238e, 924100c73c46, and 072bdea74eb0 are not approvals of this replacement head. Fresh human review has been requested from all three prior approvers; none of their reviews was dismissed.

  • September 14 audit reconstructed the last approved tree plus upstream master: the entire resulting tree matches this head after only two docstring conflict resolutions retaining both Gantt and Treemap. Reviewed Gantt fixes are preserved; no regression or code change was found.
  • Fresh chart suite: 1,824 passed. Broad MCP/common-query suite: 4,271 passed, 1 skipped, including the optional Gauge renderer regression.
  • Full PR-delta pre-commit passed, including MyPy, Ruff, Pylint, and workflow security checks. Changed-Python compilation and diff checks passed.
  • All 13 required CI checks SUCCESS, each workflow SHA verified against the full head above. CI evidence.
  • The 45-minute unit-job limit and scoped Chrome apt-source workaround remain unchanged; test selection and coverage requirements are unchanged.
  • Local app health endpoint is unavailable; no new manual browser verification is claimed.
NODE_PATH=/path/to/vega5/node_modules .venv/bin/python -m pytest -q tests/unit_tests/mcp_service/chart/
NODE_PATH=/path/to/vega5/node_modules .venv/bin/python -m pytest -q tests/unit_tests/mcp_service/ tests/unit_tests/common/test_form_data_query_context.py
PATH="$PWD/.venv/bin:$PATH" .venv/bin/python -m pre_commit run --from-ref HEAD^ --to-ref HEAD
git diff HEAD^ HEAD --check

COORDINATION / SHARED-PATH CHANGES

  • Same-dataset Gantt updates preserve omitted tooltip dimensions/metrics, ordering, and row limit. Explicit empty/default values replace saved values. Gantt dataset rebinds retain the strict no-old-query-reference contract alongside upstream's selective rebind behavior for other chart types.
  • A single Explore-authored time predicate survives omitted temporal settings without a second generated binding. Its user-owned provenance is retained across repeated edits. Explicit temporal settings replace it; explicit filters retain replacement semantics. Unsupported multiple temporal predicates remain errors.
  • Empty native time-bound strings are unset; malformed nonempty times remain errors.
  • Upstream's generic filter-merging behavior is preserved; Gantt's marker/reconciliation behavior is scoped to Gantt. Gauge and other shared MCP behavior remain covered.
  • The default named-preview validation fix, mixed-timeseries per-query ordering, Big Number temporal queries, SQL adhoc filter validation, bounded Gantt previews, and CI apt-source setup fix are retained.
  • Each of the four open reviewer threads has an evidence-backed reply and is resolved. Prior accepted deferrals (strict malformed-sort handling and shared dataset-validation exception policy) are unchanged.
  • Fresh human reviews were requested after the history audit. The PR remains open and non-draft; existing reviews are not dismissed.

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

@bito-code-review

bito-code-review Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #310857

Actionable Suggestions - 0
Additional Suggestions - 10
  • superset/mcp_service/chart/compile.py - 1
    • orderby dropped in refactor · Line 127-131
      The old code passed `"orderby": form_data.get("orderby", [])` into the query, but the new path via `build_query_context_from_form_data` → `_build_single_query_dict` never sets `orderby` (it only sets columns/metrics/row_limit/order_desc/filters). Charts relying on explicit sort order will silently lose it. Consider threading `orderby` through the helper.
  • superset/mcp_service/chart/tool/get_chart_preview.py - 1
    • Duplicated gantt spec logic · Line 540-617
      `_gantt_chart_spec` duplicates `_generate_gantt_vega_lite_preview` in `preview_utils.py` (both added in this commit). They already diverge: this method raises `ValueError` (surfaced as generic `VegaLiteGenerationError`), while the other returns typed `ChartError` (`InvalidGanttFormData`/`InvalidGanttResult`), and metric-label extraction is inlined instead of reusing `_gantt_metric_label`. Consolidate to avoid divergence.
  • superset/mcp_service/chart/preview_utils.py - 1
    • Big Number trendline regression · Line 85-91
      The removed code explicitly added `granularity_sqla` as the time column for Big Number trendline charts (`if not columns and form_data.get("granularity_sqla")`). The new `build_query_context_from_form_data` path returns empty columns for `big_number`/`big_number_total` via `resolve_metrics_and_groupby`, so the trendline time column is dropped. Verify a Big Number-with-trendline preview still returns the time series.
  • superset/mcp_service/chart/plugins/gantt.py - 1
    • tooltip metric misvalidated · Line 76-76
      `extract_column_refs` appends every `tooltip_metrics` entry as a plain column ref, but `normalize_column_refs` (lines 152-156) treats `saved_metric`/`sql_expression` entries as metrics, not columns. `DatasetValidator._extract_column_references` checks these refs against `available_columns` via `_column_exists`, so a saved metric or SQL-expression tooltip metric would be falsely reported as a missing column. Align the two methods.
  • superset/mcp_service/chart/chart_utils.py - 1
    • Form-key casing mismatch · Line 1225-1225
      The ECharts Gantt controls use camelCase keys: `types.ts` declares `showExtraControls?: boolean` and the legend section uses `showLegend`. Mapping `config.show_legend`/`config.show_extra_controls` to snake_case keys (`show_legend`, `show_extra_controls`) means these values are ignored by the frontend, so the settings never take effect. Use `showLegend` and `showExtraControls` to match the other camelCase legend keys in this dict.
  • superset/mcp_service/chart/chart_helpers.py - 2
    • series array rejected · Line 508-511
      `series_columns` builds `[require_column(raw_series, ...)]`, but the mirrored frontend `Gantt/buildQuery.ts` uses `ensureIsArray(series)`, which accepts an array of series. A saved multi-series `series` value would raise `ValueError` here, rejecting valid form data. Iterate the list through `require_column` to match the contract.
    • single metric rejected · Line 514-514
      `raw_tooltip_metrics` is required to be a list (line 514), but the mirrored frontend `Gantt/buildQuery.ts` passes `metrics: ensureIsArray(tooltip_metrics)`, which accepts a single metric. A saved single-value `tooltip_metrics` would raise ValueError here, rejecting valid form data. Wrap non-list values instead of rejecting.
  • superset/mcp_service/chart/schemas.py - 2
    • Duplicate sort config class · Line 974-1000
      `GanttSortByConfig` (974-1000) duplicates `SortByConfig` (950-971) almost verbatim — same `column`/`ascending` fields and aliases. The only real differences are the `ascending` default and the new `sanitize_column` validator, which `SortByConfig` lacks. This divergence means the table `sort_by` path stays unsanitized while Gantt is sanitized. Consider subclassing `SortByConfig` or sharing a common base to avoid drift.
    • Inconsistent case handling · Line 2646-2655
      The duplicate-column checks in this validator use inconsistent case handling: `start_time`/`end_time` and `series`/`category` compare with case-sensitive `==` (2646-2649), while `order_by` uses `casefold()` (2653). For case-insensitive DBs, `"Start"`/`"start"` would be caught by `order_by` but missed by the start/end check, and vice-versa for case-sensitive DBs. Align them to avoid divergent validation.
  • tests/unit_tests/mcp_service/chart/test_gantt_chart.py - 1
    • Fragile index assumption · Line 350-350
      `context.available_columns[0]` assumes the start_time column is always first in `_dataset_context()`. If column ordering changes, this test silently stops exercising the NON_TEMPORAL path (or fails confusingly). Resolve the column by name to make the intent explicit and robust.
Review Details
  • Files reviewed - 16 · Commit Range: c494cb7..c494cb7
    • superset/mcp_service/app.py
    • superset/mcp_service/chart/chart_helpers.py
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/compile.py
    • superset/mcp_service/chart/plugins/__init__.py
    • superset/mcp_service/chart/plugins/gantt.py
    • superset/mcp_service/chart/preview_utils.py
    • superset/mcp_service/chart/resources/chart_configs.py
    • superset/mcp_service/chart/schemas.py
    • superset/mcp_service/chart/tool/generate_chart.py
    • superset/mcp_service/chart/tool/get_chart_data.py
    • superset/mcp_service/chart/tool/get_chart_preview.py
    • superset/mcp_service/chart/tool/get_chart_type_schema.py
    • superset/mcp_service/chart/tool/update_chart.py
    • superset/mcp_service/chart/tool/update_chart_preview.py
    • tests/unit_tests/mcp_service/chart/test_gantt_chart.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.90698% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.27%. Comparing base (dd60cc2) to head (4c270f8).

Files with missing lines Patch % Lines
superset/mcp_service/chart/schemas.py 74.23% 42 Missing and 42 partials ⚠️
superset/mcp_service/chart/preview_utils.py 71.42% 23 Missing and 17 partials ⚠️
superset/mcp_service/chart/chart_helpers.py 77.46% 10 Missing and 6 partials ⚠️
superset/mcp_service/chart/plugins/gantt.py 85.85% 11 Missing and 3 partials ⚠️
superset/mcp_service/chart/chart_utils.py 89.88% 5 Missing and 4 partials ⚠️
...perset/mcp_service/chart/tool/get_chart_preview.py 84.21% 1 Missing and 2 partials ⚠️
superset/mcp_service/chart/validation/pipeline.py 62.50% 3 Missing ⚠️
superset/mcp_service/chart/tool/update_chart.py 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43737      +/-   ##
==========================================
+ Coverage   80.25%   80.27%   +0.01%     
==========================================
  Files        2927     2928       +1     
  Lines      173273   174038     +765     
  Branches    40173    40392     +219     
==========================================
+ Hits       139059   139701     +642     
- Misses      31619    31683      +64     
- Partials     2595     2654      +59     
Flag Coverage Δ
hive 37.13% <13.82%> (-0.21%) ⬇️
mysql 56.57% <13.82%> (-0.38%) ⬇️
postgres 56.60% <13.82%> (-0.38%) ⬇️
presto 39.21% <13.82%> (-0.23%) ⬇️
python 84.67% <77.90%> (-0.01%) ⬇️
sqlite 56.30% <13.82%> (-0.38%) ⬇️
unit 76.26% <77.90%> (+0.07%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@bito-code-review

Copy link
Copy Markdown
Contributor

The issue is that the require_column helper in resolve_gantt_query_fields (in superset/mcp_service/chart/chart_helpers.py) only checks for column_name in the dictionary, but the Pydantic GanttChartConfig model and other parts of the system might expect or provide different keys for adhoc columns (like label or expressionType). To resolve this, update require_column to accept the same column reference structure as the Pydantic model, ensuring consistency between the query field extraction and the configuration validation.

Would you like me to implement this fix for you? I can also check the rest of the PR comments if you'd like to address them as well.

superset/mcp_service/chart/chart_helpers.py

if isinstance(value, dict) and 0 < len(value) <= 20:
            # QueryFormColumn objects use column_name for physical columns or
            # expressionType/sqlExpression/label for adhoc columns.
            if value.get("column_name") or value.get("label"):
                return value

@bito-code-review

bito-code-review Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #808fc0

Actionable Suggestions - 0
Additional Suggestions - 3
  • superset/mcp_service/chart/preview_utils.py - 1
    • Casefold check vs case-sensitive access · Line 629-629
      The distinctness check now uses `.casefold()`, but rows are read with case-sensitive keys (`row[start]`, `row[end]`, `row[category]` at lines 710-730). Two genuinely distinct columns differing only by case (e.g. `ID` vs `id`) would now be rejected as duplicates, while the actual lookups remain case-sensitive. Align the check with the access pattern.
  • superset/mcp_service/chart/validation/dataset_validator.py - 1
    • Metric ambiguity hidden · Line 347-351
      The metric path collapses an ambiguous case-collision to `metric_names[0]` and classifies the ref as a `saved_metric_typo`, unlike the column path which appends to `ambiguous_references`. `_build_saved_metric_hint_error` only names the ref, so the colliding metric names are hidden from the caller. Consider surfacing the ambiguity consistently.
  • superset/mcp_service/chart/tool/update_chart.py - 1
    • Inconsistent Gantt error type · Line 678-682
      This handler returns the generic `error_type="ValidationError"` via `_validation_error_response`, but the sibling tool `update_chart_preview.py` (lines 445-468) maps the same `GanttSemanticNormalizationError` to `error_type="gantt_semantic_validation_error"` with `error_code` and `suggestions`. LLM clients that branch on the specific error type won't recognize Gantt failures from `update_chart`. Consider emitting the same specific error type for consistency.
Review Details
  • Files reviewed - 11 · Commit Range: c494cb7..bdda98d
    • superset/mcp_service/chart/preview_utils.py
    • superset/mcp_service/chart/schemas.py
    • superset/mcp_service/chart/tool/get_chart_preview.py
    • superset/mcp_service/chart/tool/update_chart.py
    • tests/unit_tests/mcp_service/chart/test_gantt_chart.py
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/plugins/gantt.py
    • superset/mcp_service/chart/tool/update_chart_preview.py
    • tests/unit_tests/mcp_service/chart/tool/test_update_chart_preview.py
    • superset/mcp_service/chart/validation/dataset_validator.py
    • superset/mcp_service/chart/validation/pipeline.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@aminghadersohi aminghadersohi mentioned this pull request Sep 1, 2026
1 of 9 tasks
@bito-code-review

bito-code-review Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #e1ee22

Actionable Suggestions - 0
Additional Suggestions - 4
  • superset/mcp_service/chart/tool/update_chart_preview.py - 1
    • Eager dataset context build · Line 267-271
      `build_dataset_context_from_orm(dataset)` is evaluated eagerly as a function argument on every chart update, but `validate_gantt_form_data` returns `None` immediately for non-gantt viz types (chart_utils.py:640). The per-column `DatasetContext` build is wasted work on the common non-gantt path. Consider guarding the call with a `viz_type == "gantt_chart"` check.
  • tests/unit_tests/mcp_service/chart/test_compile.py - 1
    • Duplicated test setup · Line 570-577
      The two `@patch` decorators plus `mock_factory.return_value.create.return_value = Mock()` / `run.return_value = payload` are repeated in all three new tests and duplicate the existing tests above. A small `pytest.fixture` producing `(mock_factory, mock_cmd_cls)` would remove ~12 duplicated lines and centralize payload mocking in one place.
  • superset/mcp_service/chart/query_result.py - 1
    • Duplicate error construction · Line 52-54
      The `ChartError(error=f"{label} failed: {message}", error_type="QueryError")` construction is repeated 4× inside `_failure_for_query_payload` (lines 52-54, 65, 68, 75). If the error format or `error_type` changes, one branch can easily be missed. Consider extracting a small `_query_failure(label, message)` helper and calling it from each branch.
  • tests/unit_tests/mcp_service/chart/test_preview_utils.py - 1
    • Test isolation gap · Line 234-246
      This test mocks `QueryContextFactory`/`ChartDataCommand`, but `build_query_context_from_form_data` still calls `resolve_datasource_engine`, which invokes the real `DatasourceDAO.get_datasource` DB lookup (guarded by try/except in `chart_helpers.py`). The test therefore hits the database on every run. Consider patching `DatasourceDAO.get_datasource` to keep this a pure unit test.
Review Details
  • Files reviewed - 14 · Commit Range: bdda98d..6fd8ab5
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/tool/update_chart.py
    • superset/mcp_service/chart/tool/update_chart_preview.py
    • tests/unit_tests/mcp_service/chart/test_gantt_chart.py
    • superset/mcp_service/chart/chart_helpers.py
    • superset/mcp_service/chart/compile.py
    • superset/mcp_service/chart/preview_utils.py
    • superset/mcp_service/chart/query_result.py
    • superset/mcp_service/chart/tool/get_chart_preview.py
    • tests/unit_tests/mcp_service/chart/test_chart_helpers.py
    • tests/unit_tests/mcp_service/chart/test_compile.py
    • tests/unit_tests/mcp_service/chart/test_preview_utils.py
    • tests/unit_tests/mcp_service/chart/test_query_result.py
    • tests/unit_tests/mcp_service/chart/tool/test_update_chart.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes: no security or data-loss blockers, the auth model is intact and the shared refactor is well-tested — but the flagship Gantt preview rejects charts that render fine, plus a few doc/coverage nits.

🟡 Medium — Gantt preview aborts on any null-bound or unlabeled row
In preview_utils._generate_gantt_vega_lite_preview (preview_utils.py:632-679), the per-row loop returns a single ChartError("InvalidGanttResult") for the entire preview the moment one row has a null/unparseable start_time/end_time, a null/blank/boolean category, or end < start. The native ECharts Gantt (plugin-chart-echarts/src/Gantt/transformProps.ts renderItem) tolerates these — it draws nothing for the missing bound and renders the rest. So the read-only get_chart_preview/update_chart_preview return a hard error for a saved chart that displays perfectly in Superset, on the single most common real-world shape (open-ended/in-progress tasks with a null date). The behavior is pinned by test_gantt_preview_rejects_invalid_values_in_every_row, so it's a deliberate choice that bakes in a stricter-than-the-chart contract. Fix: skip invalid rows (optionally track a dropped-row count to surface as a warning) and only error when zero renderable rows remain; invert the pinning test.

🟢 Low — Malformed order_by_cols entry hard-fails preview and compile
chart_helpers.resolve_gantt_query_fields requires every order_by_cols entry to JSON-decode to [column: str, ascending: bool] and raises ValueError otherwise; that propagates to a compile failure and a preview ChartError. A single format-drifted/hand-edited sort entry on saved state makes the whole chart un-previewable rather than dropping the bad sort. Same fail-closed-on-user-state theme as the Medium above; lower risk since the format matches the standard Superset SORT control.

🟢 Low — Preview echoes the full raw result set into the returned spec
_generate_gantt_vega_lite_preview embeds {"data": {"values": data}} — up to the row limit (1000 on the VegaLite path) of raw result rows verbatim — into the Vega-Lite spec returned to the client. It's JSON not HTML, so XSS risk is low, but it's unfiltered data passthrough and a real token-bloat concern for an LLM-facing tool. Consider bounding the row count embedded in the preview spec.

🟢 Low — Dataset-existence validation is fail-open on unexpected exceptions
ValidationPipeline._validate_dataset (validation/pipeline.py:217-220) wraps validate_against_dataset in except Exception: return True, None ("Don't fail on dataset validation errors"). Expected failures (missing column, bad metric, ambiguity) are returned as (False, error) and still caught, but a genuine raise makes Layer 2 report the config as dataset-valid, and gantt Layer-4 normalization only re-raises on case-ambiguity — a plain nonexistent column resolves to None and passes through. So the "reject columns not in the dataset" guarantee is best-effort. This is pre-existing (present on master, shared by all chart types) and not a security gap — the query-time ChartDataCommand.validate() → raise_for_access() gate still holds — so it's fine to defer, but worth narrowing the except so unexpected errors fail closed with the tailored column-not-found error rather than a later generic one.

🟢 Low — Stale docstring in _preserve_previous_adhoc_filters
update_chart_preview.py:116 still reads """Preserve cached filters without dropping mapper-generated bindings.""", but the refactor now unconditionally drops the prior marker-owned TEMPORAL_RANGE binding regardless of comparator before re-adding the regenerated one — the inline comment at ~123-125 says the opposite of the docstring. Purely documentation, no behavior impact. Fix: reword to something like "Merge non-generated cached adhoc filters into new_form_data, replacing the prior mapper-owned temporal binding (matched by marker) with the binding regenerated from the typed config."

🟢 Low — Example configs assert "all valid" but aren't parse-tested
resources/chart_configs.py:233 adds the project_schedule gantt example and its usage_notes claim "All examples are valid ChartConfig objects that pass validation," but no test round-trips get_chart_configs_resource() (or get_chart_type_schema._CHART_EXAMPLES) through ChartConfig. The new example does parse today, so this is a coverage gap, not a live bug — a future typo would ship silently. Fix: add a parametrized test feeding every example dict through TypeAdapter(ChartConfig)/model_validate.

🟢 Low — Existing-path changes ride under a "Gantt" banner; call them out
Two intentional, tested changes to existing charts flow through the shared refactor and deserve explicit mention in the PR description: (1) compile.py now validates free-form SQL adhoc WHERE/HAVING filters that the old inline path silently dropped (a correctness improvement — only genuinely broken filters newly fail), and (2) Big Number (trendline variant) query construction now injects the x_axis/granularity_sqla temporal column via resolve_big_number_columns, where the generic path previously produced columns=[] (big_number_total correctly excluded). Both are covered by new tests and verified as intended; just surface them so reviewers don't have to reverse-engineer that a Gantt PR alters Big Number output and rewires the compile query builder for all types.


Scope checked and cleared: I specifically hunted for an authorization gap and found none — Gantt adds no new entry point (it's a discriminator branch on the existing generate/update/preview tools), and every data-reaching path still flows through the established gates (validate_chart_dataset(check_access=...), ChartDataCommand.validate() → query_context.raise_for_access() before .run(), and security_manager.raise_for_access(dashboard=...) for dashboard filters). The query_result_failure gate that now covers Big Number/other previews was traced against the normal success envelope and does not false-positive. No High/blocking issues.

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Sep 6, 2026
@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Thanks for the full review. This is a finite maintainer pass; no new reviewer run was requested and the human CHANGES_REQUESTED review has not been dismissed.

Disposition of every item in review 5089944651:

  1. Mixed valid/invalid intervals — fixed. The shared saved/unsaved Gantt Vega-Lite builder skips null, unparsable, reversed, and unlabeled intervals while retaining renderable rows. Nonempty all-invalid results still error; empty results remain valid. Missing fields/non-object rows still error, rather than hiding malformed query output. The inverted parametrized regression covers invalid start/end values and categories.
  2. Malformed native ordering — retained deliberately. Native Gantt/buildQuery.ts uses JSON.parse for every sort entry and does not ignore malformed JSON. Dropping a sort silently also changes the rows selected under row_limit. The bounded, strict [column, ascending_boolean] contract and test_saved_query_fallback_rejects_malformed_native_order are retained; this is distinct from omitting non-renderable intervals. The user docs state this limitation.
  3. Raw preview payload size — fixed. The returned specification contains at most 1,000 renderable rows and only the fields used by encodings/tooltips. The cap is applied after skipping invalid intervals; a regression includes >1,000 invalid rows before >1,000 valid rows and an unused payload field.
  4. Shared dataset validation exception policy — deferred as permitted. _validate_dataset's broad exception fallback is pre-existing shared behavior on upstream master. Narrowing it needs a separate cross-chart policy change; this pass does not claim to fix it.
  5. Filter docstring — fixed. The filter merger lives in shared chart_utils.preserve_previous_adhoc_filters and documents replacement of the prior marker-owned temporal binding. Saved updates, their previews, and cached previews reuse it. Inactive native Gantt No filter placeholders are replaced without dropping an active predicate.
  6. Example parse coverage — fixed. test_chart_examples.py parametrizes every _CHART_EXAMPLES example through TypeAdapter(ChartConfig) (including upstream Gauge), and reads the chart-config resource with authentication isolated to validate every published example config, including project_schedule.
  7. Existing-path coordination — documented in the PR body. Shared compile validates SQL WHERE/HAVING filters; Big Number trendline queries keep the temporal column (not big_number_total). Also restored explicit top-level orderby through the shared builder, addressing the earlier issue comment with a regression.

Other issue-comment dispositions:

  • Explicit ordering: fixed in this pass. Shared Gantt preview duplication, Big Number temporal extraction, metric-vs-column validation, and query-result failure handling have existing focused regressions in the branch.
  • The frontend snake_case form controls are intentionally retained: snake-to-camel conversion happens before transformProps; changing persisted keys to camelCase would not match the control contract.
  • Native series arrays/single scalar tooltip metrics are outside the bounded typed adapter contract: the Gantt UI exposes one series dimension and list-valued tooltip metrics. ensureIsArray in query assembly is not evidence that the renderer supports multiple series dimensions.
  • Required-role casefold collision rejection is intentional and covered across request, native merge, and canonical-name paths; metadata lookup still permits exact physical names in case-colliding datasets. This pass does not broaden the supported required-role collision contract.
  • Metric-only ambiguous spellings without saved_metric=true remain rejected with the tailored opt-in hint; no arbitrary metric is executed.
  • Saved-update validation retains its established GenerateChartResponse envelope rather than changing the client-facing error discriminator solely for stylistic consistency.
  • Removed the unnecessary extra Gantt dataset-context build on non-Gantt cached previews, isolated datasource-engine lookup in the Big Number unit regression, and made the temporal-column fixture lookup name-based.
  • Duplicate sort classes, small repeated query-error constructors, and repeated local test setup are style-only; retained to avoid unrelated abstractions and validation/default changes.

Evidence: normal merge f68b095 and fix commit 1614ed4. Exact-head chart suite: 1,598 passed; focused Gantt/Gauge/examples/query-helper/cached-update suite: 321 passed. Staged and full-PR-range pre-commit (MyPy, Ruff, Pylint), changed-file compilation, and diff checks passed. Required CI is being tracked on the pushed exact head; final CI/broad-suite results will be recorded in the PR body.

@netlify

netlify Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4c270f8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aa9eb103ca46b0008fceacf
😎 Deploy Preview https://deploy-preview-43737--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1ea5eb

Actionable Suggestions - 0
Additional Suggestions - 3
  • superset/mcp_service/chart/chart_helpers.py - 1
    • Ordering key mismatch · Line 618-619
      The new branch reads `form_data["orderby"]`, but the MCP schema exposes ordering as `sort_by` (aliases `order_by_cols`/`order_by`, schemas.py:1847/1853). If the intent is to honor MCP-provided ordering, this key won't match, so the branch and the `not qd.get("orderby")` guard at line 631 never trigger. Also `sort_by` accepts bare strings/SortByConfig, which don't match the `[col, bool]` `OrderBy` shape `qd["orderby"]` requires. Please confirm the upstream key/format.
  • superset/mcp_service/chart/preview_utils.py - 1
    • Docstring/contract divergence · Line 499-499
      The docstring says this resolves keys "using the frontend getColumnLabel contract", but `getColumnLabel` (getColumnLabel.ts) returns `label` then `sqlExpression` and never reads `column_name`. The new `column_name` fallback diverges from that documented contract. Consider updating the docstring to reflect the native-column extension, and note the sibling `_gantt_metric_label` also accepts `columnName`.
  • superset/mcp_service/chart/chart_utils.py - 1
    • Use imported filter constants · Line 686-686
      This file consistently uses the imported constants elsewhere (e.g. `FilterOperator.TEMPORAL_RANGE.value` at lines 945/966/987, `NO_TIME_RANGE` at line 37). Using raw literals `"TEMPORAL_RANGE"` and `"No filter"` here creates drift risk if those constant values ever change. Prefer the constants for consistency.
Review Details
  • Files reviewed - 10 · Commit Range: 6fd8ab5..1614ed4
    • docs/docs/using-superset/using-ai-with-superset.mdx
    • superset/mcp_service/chart/chart_helpers.py
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/preview_utils.py
    • superset/mcp_service/chart/tool/update_chart.py
    • superset/mcp_service/chart/tool/update_chart_preview.py
    • tests/unit_tests/mcp_service/chart/test_chart_examples.py
    • tests/unit_tests/mcp_service/chart/test_chart_helpers.py
    • tests/unit_tests/mcp_service/chart/test_gantt_chart.py
    • tests/unit_tests/mcp_service/chart/test_preview_utils.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve: the Medium preview blocker from my prior review is fixed and well-tested. Only Low items remain — one narrow regression introduced by the fix, the rest deferrable. Lifting my earlier "changes requested". Thanks for the thorough follow-up.

Resolved from the prior round:

  • Preview aborting on null/invalid rows (was Medium) — invalid rows are now skipped; an error is returned only when the result is non-empty but zero rows are renderable; empty input still yields a valid empty preview. Confirmed by test_gantt_preview_skips_invalid_values_in_mixed_results and the all-invalid case; the missing = required - row.keys() guard before the projection rules out a KeyError.
  • Raw result echoed into the preview spec (Low) — the spec now emits renderable_rows (hard-capped at 1000, projected to only the fields the viz uses) instead of the full raw data.
  • Misleading docstring (Low) — the function moved to chart_utils.preserve_previous_adhoc_filters with a corrected docstring that matches the behavior.
  • Example configs not parse-tested (Low) — new test_chart_examples.py round-trips every published example through the ChartConfig union.

🟢 Low — NEW: mixed_timeseries secondary query inherits the primary orderby (introduced by this fix)
In _build_single_query_dict (chart_helpers.py:616-618), the new unconditional if form_data.get("orderby"): qd["orderby"] = form_data["orderby"] also runs for the mixed_timeseries secondary query, which _build_mixed_timeseries_secondary (chart_helpers.py:689) builds from the same primary form_data with groupby_b/metrics_b and has no orderby_b handling. So a saved mixed_timeseries chart carrying a top-level orderby (imported/legacy/hand-edited params), read via get_chart_data/get_chart_preview/get_chart_sql, produces a secondary query ordered by a primary-only column it doesn't select → subtly wrong secondary-series ordering (not a crash). Narrow trigger — the typed mapper never emits a top-level orderby, so normal charts are unaffected. Not a merge blocker. Fix: scope the orderby copy so the secondary query doesn't inherit it (translate orderby_b there, or set orderby per-query), and add a mixed_timeseries contract test with a top-level orderby referencing a primary-only metric.

🟢 Low — pre-existing, fine to defer
Two items from the prior round are unchanged and acceptable to leave: a malformed order_by_cols entry still hard-fails the whole preview/compile in resolve_gantt_query_fields rather than dropping the bad sort, and ValidationPipeline._validate_dataset (validation/pipeline.py:217-220) still swallows unexpected exceptions and returns valid (the query-time raise_for_access() gate still holds, so no security impact).

🟢 Low — docs (optional)
The added "Gantt charts through MCP" section is accurate and useful, but it doesn't surface the shared-path behavior changes this PR also makes to existing chart types — Big Number (trendline) queries now include the temporal column, and _build_single_query_dict now honors a top-level orderby for sort_by_metric charts. Consider a line in the PR description or docs so reviewers/agents aren't surprised.

Authorization model remains intact (verified again this round): Gantt adds no new entry point and every data-reaching path still flows through validate_chart_dataset(check_access=...) and ChartDataCommand.validate() → raise_for_access() before .run().

@aminghadersohi

aminghadersohi commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Finite follow-up to the September 7 approval and Bito issue comment #5561902836, pushed normally as 1dfd27f.

  • Mixed-timeseries ordering regression: fixed. The secondary shared query substitutes its own orderby_b rather than inheriting primary orderby. The focused parametrized regression fails on the prior head in both cases (absent secondary ordering and explicit secondary ordering), and passes with the fix. It checks both complete query shapes and preservation of primary form-data ordering.
  • Ordering key contract: clarified, not renamed. Top-level orderby preserves saved query-shaped [expression, ascending_boolean] ordering; it is not the typed MCP sort_by input. Table sort_by maps to JSON-encoded native order_by_cols; typed Gantt order_by also maps to order_by_cols, which resolve_gantt_query_fields decodes into query orderby. Replacing the saved key with raw typed objects/strings would conflate distinct contracts. Existing Gantt mapping/query tests and the explicit saved-ordering regression pass. Added a concise source comment and user documentation.
  • Gantt field docstring: fixed. It documents frontend label/SQL precedence plus the native column_name extension; the metric resolver documents its accepted columnName/column_name objects.
  • Imported filter constants: fixed. Reused FilterOperator.TEMPORAL_RANGE.value and NO_TIME_RANGE; filter-preservation regressions pass.

Prior accepted deferrals remain unchanged: strict malformed-sort rejection and the pre-existing shared dataset-validation exception policy. No new review run was requested; the PR remains open and ready for review, without rebase, force push, or merge.

Validation: focused helper/Gantt/preview/cached-update suite 293 passed; full chart suite 1,600 passed; staged and complete PR-range pre-commit passed, including MyPy, Ruff, and Pylint; Python compilation and diff checks passed. Broad MCP/common-query suite: 3,974 passed. Exact-head required CI: all 13 required checks SUCCESS, with each associated workflow run verified against 1dfd27f629a1d5961795ce3393e905e35c8d93ab. Required-check evidence. No CI retries or follow-up fixes were needed. The worktree is clean; PR is open, non-draft, and APPROVED.

@bito-code-review

bito-code-review Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #8556c4

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: 1614ed4..1dfd27f
    • docs/docs/using-superset/using-ai-with-superset.mdx
    • superset/mcp_service/chart/chart_helpers.py
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/preview_utils.py
    • tests/unit_tests/mcp_service/chart/test_chart_helpers.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@gabotorresruiz gabotorresruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One remaining blocker from my pass, verified live at this head; details inline. The preview strictness and filters preservation from the earlier rounds are confirmed fixed.

Comment thread superset/mcp_service/chart/schemas.py Resolved
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 10, 2026

@gabotorresruiz gabotorresruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Amin, this addresses everything. I re-verified the fix empirically at 072bdea: the same live default-flow update_chart on a saved Gantt chart that failed with the slice_name validation error on the earlier heads now succeeds, the new pinning test runs the preview-first state through validate_gantt_form_data with slice_name present, and the typo guard keeps unknown-control rejection intact. Full MCP chart suite passes locally (1794 passed, 1 skipped) and CI is green. LGTM.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 11, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 11, 2026
@rusackas

Copy link
Copy Markdown
Member

Heads up, the branch got force-pushed yesterday and squashed everything into one commit, so the commit @rebenitez1802, @sadpandajoe, and @gabotorresruiz approved isn't in the PR's history anymore, which contradicts a few replies here claiming no force push happened. CI's green on the new head, but none of those approvals are against it. Might want a fresh pass before we merge this.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@rusackas You're right. On September 11 at 14:08:32 UTC I force-pushed 072bdea74eb0 → eb9000877482, replacing the history with one commit atop master 774a51124ed3. My earlier “no force push” replies described the earlier pushes, but are not true of the branch's subsequent history; I should have updated that record.

I aborted an initial commit-by-commit rebase because reviewed fixes also lived in merge commits. I then chose to snapshot the complete 072bdea74eb0 tree, squash it against its merge-base e5c2a3e4f682, rebase that snapshot onto master, and push with an explicit lease on the old head. Squashing was my choice, not a requirement of rebasing; the lease guarded the remote head, not review validity.

Audit against the actual approved commits (1614ed40238e, 924100c73c46, and 072bdea74eb0):

  • Reconstructing a merge of the last approved tree with 774a51124ed3 reproduces the entire current tree exactly, after resolving only two chart-type-list docstring conflicts to retain both Gantt and Treemap.
  • Gantt implementation/tests, shared query helpers, preview/compile, and both update tools are byte-identical to the last approved head. Named default-preview validation/typo rejection, invalid-row skipping and payload cap, mixed-series ordering, omitted controls, strict rebinds, native temporal filters, and empty time bounds remain covered.
  • Relative to the earlier approvals, two generic cached-filter tests had already been renamed/changed during the September 10 upstream merge to preserve user temporal filters; Gantt-specific reconciliation regressions were added separately. These changes predate the final approval, not the squash. No chart test functions from the last approved head were lost.

Fresh validation: 1,824 chart tests passed; 4,271 broad MCP/common-query tests passed, 1 skipped. Full PR-delta pre-commit (including MyPy/Ruff/Pylint/workflow security), Python compilation, and diff checks passed. All 13 required checks are green with workflow head SHAs verified as eb90008774828be54dacc894a7da5de74564265f (checks). No regression found; no code/history changes in this audit. Local app health is unavailable, so this is not a new live UI verification.

I've requested fresh human reviews from @rebenitez1802, @sadpandajoe, and @gabotorresruiz. Their earlier approvals were against replaced history, not this head; green CI is not a substitute for that review. No approval was dismissed or recreated. The PR remains open and non-draft.

@rusackas

Copy link
Copy Markdown
Member

Thanks for confirming. Since those three approvals are against the pre-squash history, worth pinging @rebenitez1802, @sadpandajoe, and @gabotorresruiz for a fresh look before this merges.

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve — re-approving the squashed head eb90008774. I re-reviewed from scratch (the pre-squash approved commits are GC'd, so equivalence can't be diff-verified) and confirmed the force-push preserved everything; only one Low test-quality nit remains.

Verified survived the squash / rebase:

  • All four resolved reviewer threads' fixes are present and unweakened: physical column_name accepted by the Gantt result-field resolver; omitted adhoc filters preserved via the shared preserve_previous_adhoc_filters path (explicit [] still clears); adapt_native_form_data strips slice_name; omitted tooltip_columns/tooltip_metrics/order_by_cols/row_limit restored from saved state only when the typed field was omitted (guarded by model_fields_set); single-TEMPORAL_RANGE reconciler intact; empty x_axis_time_bounds normalized to None.
  • The Medium preview blocker from round 1 is fixed: invalid rows are skipped, a hard error only when a non-empty result yields zero renderable rows, empty stays a valid empty preview (test_gantt_preview_skips_invalid_values_in_mixed_results).
  • The mixed_timeseries secondary-orderby regression I flagged at approval is fixed and would fail on the old version (test_shared_query_builder_keeps_mixed_timeseries_ordering_per_query).
  • Both gantt and treemap chart-type registrations are intact after the two docstring-conflict resolutions. Authorization model unchanged: no new entry points, every data path still flows through validate_chart_dataset(check_access=…) → ChartDataCommand.validate() → raise_for_access(); preview leaks nothing the caller couldn't already read.

🟢 Low — Six TestPreviewUtilsColumnBuilding tests assert against a re-implemented copy of the algorithm, not production code
In tests/unit_tests/mcp_service/chart/test_preview_utils.py:66-201, all six tests rebuild the x_axis+groupby column logic inline and assert on their own local columns variable — none call _build_query_columns/columns_from_form_data. Since production _build_query_columns now just delegates to columns_from_form_data, these pin dead/duplicated logic: if the shared helper stopped prepending the x_axis column, they'd stay green while an XY-chart preview queried the wrong columns. Real end-to-end coverage does exist (test_unsaved_big_number_preview_uses_temporal_query_contract:216), so this is false coverage, not a live bug. Fix: have the six tests call _build_query_columns(form_data) and assert on its return instead of a locally recomputed list.

🟢 Low — Question (non-blocking): Big Number trendline groups by raw timestamp, not time_grain_sqla
resolve_big_number_columns builds the big_number query with the temporal column as a plain groupby but never sets granularity/extras.time_grain_sqla, so get_chart_data/preview on a saved trendline appears to bucket by raw timestamp rather than the configured grain. This is strictly better than the pre-PR columns=[] (which dropped the temporal column entirely) and matches the builder's existing echarts_timeseries behavior, so it's not a regression — just worth confirming the trendline preview isn't expected to bucket by grain.

🟢 Low — Question (non-blocking): confirm form_data_key ownership scoping is unchanged
_preserve_gantt_adhoc_filters merges adhoc filters from previously-cached form_data resolved via request.form_data_key (GetFormDataCommand). This mirrors existing cross-type form-data-cache behavior and only affects chart configuration (the query still runs against a dataset the caller must pass has_dataset_access on), so I found no boundary crossing — just a one-line confirm that scoping is untouched.

@github-actions github-actions Bot added the risk:db-migration PRs that require a DB migration label Sep 15, 2026

@gabotorresruiz gabotorresruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approving at 55a5313294394be0169c7e7ca8aef8b2421f26d2 after the force push @rusackas flagged. The pre squash commits are still fetchable by SHA, so I verified the rewrite by diff rather than trusting the audit.

Reconstructing the merge of my approved head 072bdea74eb0 with master 774a51124ed3 via git merge-tree reproduces the squashed commit eb90008774 byte for byte, except the two docstring chart type lists in generate_chart.py and get_chart_type_schema.py, where the conflict is correctly resolved to keep both gantt and treemap_v2. The squash is content identical to the history I approved on September 10.

The three commits added since check out as well:

  • a0b245e1 touches tests only, routing the duplicated column building tests through the production _build_query_columns helper.
  • 00b78856 is a clean merge of master dbccb3bc; its tree matches the mechanical auto merge exactly, nothing smuggled in.
  • 55a53132 adds the no-op Alembic merge revision f2d8a6c941be joining c7f53d184ea2 and 88a01c781622. I verified the revision graph: exactly those two heads before the commit, one head after, both lineages preserved, and current master still carries the two head state, so the join is needed and not duplicated. test_migrations_have_one_head fails on the parent commit and passes at this head.

Full run at this head in a fresh venv (tests/unit_tests/migrations/test_single_migration_head.py, tests/unit_tests/mcp_service/chart/, tests/unit_tests/common/test_form_data_query_context.py): 1873 passed, 1 skipped. My earlier blocker fix (slice_name stripped in adapt_native_form_data) is present and covered, and all required CI checks are green on this exact SHA.

One heads up for whoever merges: master itself still has the two Alembic heads, so if another PR lands its own merge revision first, this branch will need a rebase; the Check DB migration conflict job should catch that. LGTM.

@gabotorresruiz

Copy link
Copy Markdown
Contributor

Heads up before merging: master now contains merge migration e2f3a1b9c640 (landed via #44288) joining c7f53d184ea2 and 88a01c781622. This branch still carries f2d8a6c941be with the same down_revision pair, so merging as is would leave master with two alembic heads again, and the test_migrations_have_one_head test this PR adds would then fail on master. The migration checks here last ran before #44288 merged, which is why everything still shows green. A rebase on current master plus deleting f2d8a6c941be should be all it takes; my approval carries over to that rebase.

Include reviewed Gantt creation, native validation, preview, partial-update, and shared-query contracts with regression coverage and CI setup fixes.
Replace six duplicated column algorithms with calls through the production shared helper. Characterize existing Big Number raw temporal grouping with daily/monthly grain inputs and verify cached form-data retrieval retains Explore resource-access checks, including denied access. No runtime contract changes.
Merge both upstream Alembic branches with a no-op revision so database initialization has one head. Add a regression using the production revision graph; it fails with two heads before the merge revision.
Remove the duplicate sibling merge revision now that upstream joins both parents. Keep the production single-head regression.
@github-actions github-actions Bot removed the risk:db-migration PRs that require a DB migration label Sep 15, 2026
@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@gabotorresruiz Thank you for catching the duplicate merge heads. Rebased onto master 4c27cbd007 and deleted f2d8a6c941be; no tracked references or dependent revisions remain to rewire.

Verified locally, not just via CI: the repository's superset db heads count check and Alembic heads both report exactly one head, e2f3a1b9c640. test_migrations_have_one_head passes; the migration/chart/common-query suites passed 2,021 tests, and full PR static checks passed. Rebase comparison preserved all other branch changes.

Fork-only push used a lease pinned to 55a5313294394be0169c7e7ca8aef8b2421f26d2; the verified new head is 374ba98259e6f842166b7ab98f429abe41e275f2. All 13 required checks are green on that exact head. Leaving your comment for you; no thread was resolved, draft state is unchanged, and the PR is not merged.

Only discard inactive temporal placeholders before reconciling omitted fields. A subject marker does not establish ownership of its active comparator. Cover marked and unmarked subjects, repeated saved/cached updates, and both Explore-edited and explicitly set ranges.
@aminghadersohi
aminghadersohi merged commit 0049f81 into apache:master Sep 16, 2026
77 checks passed
villebro added a commit that referenced this pull request Sep 30, 2026
The y-axis metric tests cherry-picked from #44684 use
pytest.mark.parametrize, but on 7.0 test_preview_utils.py never imported
pytest: on master that import arrived with the bubble/Gantt preview tests
(#43572/#43737), which are not on 7.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants