Commit Graph

1005 Commits

Author SHA1 Message Date
Joe Li
47d3425064 test(subdirectory): align test expectations with Superset.route_base=""
After Superset.route_base="" (c531185d0a) and the FAB-link migration
(28b845ead4), `url_for` for the core blueprint emits `/dashboard/...`,
`/explore/...`, `/explore_json/...`, `/welcome/...` etc. (no `/superset/`
segment). Likewise the Tag component renders `/all_entities/?id=<id>`,
and rewritePermalinkOrigin substitutes window.location.origin into
backend permalinks at the frontend boundary.

Update test expectations to match:

  * Python unit: tests/unit_tests/commands/report/execute_test.py drops
    `superset/` from the 12 `dashboard/p/...` expected paths and the
    `superset/dashboard/` membership check (kept assertion meaningful
    via the existing `dashboard/p/` negative check).
  * Python integration: drop `/superset/` from URLs hit by tests and
    from URLs asserted against API payloads in core_tests, dashboard_tests,
    dashboards/api_tests, event_logger_tests, log_api_tests, security_tests,
    strategy_tests, utils_tests, reports/commands_tests,
    reports/commands/execute_dashboard_report_tests. Fixed the regex in
    test_new_dashboard to match the new Location header shape.
  * Jest: ChartList tag-link assertion drops `/superset/`, and
    URLShortLinkButton tests assert the rewritten URL
    (`${window.location.origin}/123`) the component renders after
    rewritePermalinkOrigin, instead of the raw backend `http://fakeurl.com/123`.

These were called out in PROJECT.md as the queued "integration test sweep
for old `/superset/<endpoint>/` shapes" — this commit closes that item.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 19:48:15 -07:00
Joe Li
28b845ead4 fix(subdirectory): close adversarial-review gaps in helpers, backend models, and FAB links
Adversarial review surfaced six classes of subdirectory-deployment gaps not
covered by the existing TDD scaffold. Each is fixed where it lives, with
pinning tests added beside the change:

Helpers
- navigationUtils: drop `//` from the navigation safety regex so
  `openInNewTab('//evil.com')` can no longer open a cross-origin tab
- pathUtils.stripAppRoot: greedy strip so an upstream `/superset/superset/x`
  payload survives one strip + react-router basename re-prepend
- RedirectWarning.isAllowedScheme: explicit `//` guard; the `new URL(...)`
  catch branch was silently allowing protocol-relative URLs through
- SupersetClientClass.getUrl: implement the runtime appRoot dedupe the
  project memory was already documenting. Flips the contract test from
  pinning the doubled shape under a misleading name to asserting single-
  prefix emission with segment-boundary + bare-root coverage

Frontend literals and sinks
- loggerMiddleware: `/superset/log/` -> `/log/` (matches the live route
  after `Superset.route_base = ""`); updated three test fixtures
- DatasetPanel: raw `window.open(explore_url)` -> `openInNewTab` with null guard
- RedirectWarning: raw `window.location.href = targetUrl` -> `redirect()`
  so the helpers' validation applies

Backend literals and sinks
- Slice.explore_json_url: `/superset/explore_json` -> `/explore_json`
- Database.sql_url: `/superset/sql/<id>/` (route no longer exists) ->
  `/sqllab/?dbid=<id>` (the live SQL Lab deep-link)
- tasks/async_queries.result_url: same `/superset/` strip
- initialization Home menu: hardcoded `href="/superset/welcome/"` ->
  `f"{app_root}/welcome/"` so it works under any application_root

FAB list-view raw HTML
- dashboard_link / slice_link render raw `<a href=...>` strings, which do
  not receive SCRIPT_NAME at render time. Migrated both to `url_for`
  (`Superset.dashboard` / `ExploreView.root`) so subdir deployments emit
  single-prefix hrefs. The model properties themselves keep their
  router-relative shape for frontend callers using ensureAppRoot

Tests
- test_subdirectory_url_for.py grew from 7 to 11 cases pinning
  Slice.explore_json_url, Database.sql_url, dashboard_link, and slice_link
  under SCRIPT_NAME=/superset
- 82 helper Jest tests + 71 touched component tests green; pre-commit clean

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:39:01 -07:00
Joe Li
c531185d0a fix(subdirectory): align SPA + sibling view routes after Superset.route_base=""
Round-4 follow-up to 756458f031. Four user-reported symptoms on /superset/
deployments — blank welcome, blank dashboard edit mode, doubled explore
copy-permalink, JSON 404 on dashboard discard — all trace to round-2
leftovers:

- superset-frontend/src/views/routes.tsx: six SPA routes still hard-coded
  the /superset/ prefix on top of <Router basename={applicationRoot()}>.
  React Router never matched them post-basename. Drop the prefix on
  welcome, file-handler, dashboard/:idOrSlug, explore/p, all_entities,
  and tags. isFrontendRoute stripAppRoots its input so menu URLs that
  carry the appRoot still resolve.
- Menu.tsx + RightMenu.tsx: SPA-route menu branches handed already-rooted
  URLs to <NavLink>/<Link>, doubling them via basename. Mirror the
  round-3 brand-link stripAppRoot pattern.
- superset/views/{explore,tags,all_entities}.py: three sibling view
  classes still declared route_base = "/superset/...". Mirror
  Superset.route_base="".
- superset/models/dashboard.py: Dashboard.url / get_url returned
  "/superset/dashboard/<id>/", producing doubled DashboardList row hrefs
  that caused the discard-edit 404. Return "/dashboard/<id>/" so
  downstream ensureAppRoot-aware consumers prepend exactly once.
- superset/mcp_service/dashboard/{schemas,tool/*}.py: seven sibling
  hard-codes of "/superset/dashboard/<id>/" updated identically.

Tests pin shapes for ExplorePermalinkView.permalink, TagModelView.list,
TaggedObjectsModelView.list, Dashboard.get_url, and the MCP dashboard
url emission. routes.test.tsx adds appRoot-prefixed lookup coverage and
documents the dict-lookup-no-pattern-match limitation.

UPDATING.md notes the new sibling route_base moves and the model URL
change alongside the round-2 Superset.route_base entry.

Live Playwright re-validation confirmed all four bugs fixed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:18:07 -07:00
Joe Li
d26802bcb3 fix(subdirectory): create-chart link, permalink doubling, and dead Superset.* routes
Round-2 follow-up to the TDD scaffold. Two user-visible bugs in QA on
the local /superset deployment:

- Empty dashboard-tab "create a new chart" link opened a 404 tab under
  /superset: raw <Typography.Link href="/chart/add?..."> with
  target="_blank" bypasses React Router's basename, so the new tab
  resolves the absolute path against the document origin without the
  application root.
- "Copy permalink" produced /superset/superset/dashboard/p/<key>/ on
  the clipboard. The same backend mechanism made the 18 routes on the
  `Superset` view class unreachable at request time under subdirectory
  deployment (404 for /superset/welcome/, /superset/dashboard/<id>/,
  /superset/explore/, etc.).

Frontend:
- Tab.tsx — wrap the create-chart href with `ensureAppRoot()` from
  navigationUtils so the application root is applied exactly once and
  the new tab lands at the right path.
- New L2 invariant `RAW_HREF_ABSOLUTE_PATH_PATTERN` flags raw
  absolute-from-root anchors (`href="/..."`, `href={`/...`}`, etc.) —
  the bug class that bypasses both helpers and React Router basename.
  Seeded with 7 remaining violator files paired with a
  `toEqual([])` stale-allow-list check so each migration commit
  shrinks the list in lockstep.
- Tab.subdirectory.test.tsx — empty / /superset / nested-root
  regression pins via a jest.mock pattern on applicationRoot().

Backend (breaking change documented in UPDATING.md):
- Override `Superset.route_base = ""` so Flask-AppBuilder's
  auto-derived `/superset` prefix no longer compounds with the
  SCRIPT_NAME / basename that AppRootMiddleware sets. url_for now
  emits single-prefix URLs and the routes are reachable under both
  root and subdirectory deployments.
- Pin the new shape with four unit tests covering
  Superset.dashboard_permalink (relative + external) and
  Superset.welcome, with and without SCRIPT_NAME.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:16:36 -07:00
Evan Rusackas
4e09889607 test(datasets): regression coverage for #16141 (export with same table name, different schemas) (#40123)
Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 11:08:23 -07:00
Richard Fogaca Nienkotter
8fa5a75c70 fix(mcp): apply cached adhoc filters to chart retrieval (#40099) 2026-05-14 14:21:54 -03:00
Mafi
144dae7c43 fix(dashboard): use datasetUuid instead of datasetId in display controls export/import (SC-104655) (#40008)
Co-authored-by: Matt Fitzgerald <matt.fitzgerald@preset.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 10:18:57 -07:00
Sandesh Devaraju
823eb905d3 fix(mcp): JSON-serialize order_by_cols and support sort direction (#39952)
Co-authored-by: Amin Ghadersohi <amin.ghadersohi@gmail.com>
2026-05-14 11:19:37 -04:00
Mehmet Salih Yavuz
8b0e63b58c fix(rls): prevent double-apply when converting physical dataset to virtual (#39725)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 18:05:48 +03:00
Mafi
01224007da fix(mixed-timeseries): preserve all-NaN metric columns after pivot when Jinja evaluates to NULL (#40005)
Co-authored-by: Matt Fitzgerald <matt.fitzgerald@preset.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 07:46:34 -03:00
Richard Fogaca Nienkotter
2a1dcb79e3 fix(mcp): expose table chart type labels in chart responses (#40060) 2026-05-13 16:38:31 -03:00
Richard Fogaca Nienkotter
c59ab8bffd feat(mcp): add data boundary instruction to harden against prompt injection (#40080) 2026-05-13 09:40:44 -03:00
Richard Fogaca Nienkotter
fa06989ed7 fix(mcp): return requested update chart previews (#40077) 2026-05-12 21:23:49 -03:00
Igor Khrol
3363b48180 fix(spark): register Spark SQLAlchemy dialect so spark:// URIs resolve to SparkEngineSpec (#38299)
Co-authored-by: Joe Li <joe@preset.io>
2026-05-12 12:33:17 -04:00
Amin Ghadersohi
460992d89b fix(mcp): improve not-found errors to suggest corresponding list_* tools (#39919)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-12 02:38:10 -04:00
Amin Ghadersohi
85935b0b88 fix(mcp): handle SSL connection drop during pre-call session teardown (#39917) 2026-05-12 02:32:14 -04:00
Maxime Beauchemin
d90d3a2dea fix(importexport): honor overwrite flag on /api/v1/assets/import (#39502)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-11 10:24:42 -07:00
Evan Rusackas
26ef4b7ed3 fix(sqla): pass catalog and schema to get_sqla_engine in values_for_column (#38681)
Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
2026-05-11 09:54:48 -07:00
Oleg Ovcharuk
d83b0c5ce3 feat: support creating datasets for schema-less databases (#39433)
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
2026-05-11 08:30:13 -04:00
Maxime Beauchemin
d023fe1703 fix(trino/presto): use equality for boolean filters to support computed columns (#39500) 2026-05-08 16:10:27 -07:00
Amin Ghadersohi
547660dcc4 fix(mcp): ASCII chart crashes with NaN when dataset contains null values (#39916) 2026-05-08 17:35:15 -04:00
Amin Ghadersohi
cfb0b6e811 fix(mcp): clarify request wrapper in list_datasets, list_charts, list_dashboards (#39920) 2026-05-08 16:01:07 -04:00
Amin Ghadersohi
ff7dc53853 fix(mcp): get_chart_sql drops x_axis on echarts_timeseries_* and only renders one query for mixed_timeseries (#39865) 2026-05-08 15:29:28 -04:00
Beto Dealmeida
4311a15eb2 feat(sqlglot): Vertica dialect (#39969) 2026-05-08 14:34:34 -03:00
Vitor Avila
ad5e3170dd fix: OpenSearch dialect identifier delimiters (#39953) 2026-05-07 16:19:27 -03:00
Amin Ghadersohi
9b520312a1 fix(mcp): use tiktoken for response-size-guard token estimation (#39912) 2026-05-07 11:51:31 -04:00
Amin Ghadersohi
9ac4711ac8 fix(mcp): prevent DetachedInstanceError in get_chart_preview (#39921) 2026-05-07 11:44:11 -04:00
Enzo Martellucci
b5186d1c65 fix(reports): keep body sized so standalone screenshots don't time out (#39944) 2026-05-07 12:26:50 +02:00
bdonovan1
5b5dd01028 fix(sqla): parenthesize calculated column expressions in WHERE clause (#39793)
Co-authored-by: Brian Donovan <briand@netflix.com>
Co-authored-by: Vitor Avila <96086495+Vitor-Avila@users.noreply.github.com>
2026-05-06 19:45:27 -03:00
Enzo Martellucci
9aaa12c7d4 fix(reports): preserve urlParams in multi-tab report fan-out (#39884) 2026-05-06 16:29:45 +02:00
Alexandru Soare
adfbbf1433 fix(sql): quote identifiers in transpile_to_dialect to fix case-sensitive column filters (#39521) 2026-05-06 10:53:09 +03:00
Vitor Avila
3745e37182 fix(OAuth2): Support OAuth2 exception with legacy endpoint (#39897) 2026-05-05 21:21:48 -03:00
Amin Ghadersohi
4a21a5365f fix(mcp): validate column refs in generate_explore_link, update_chart_preview, and update_chart (#39797) 2026-05-05 19:12:31 -04:00
Richard Fogaca Nienkotter
9459bc7bf4 fix(mcp): warn on invalid chart preview form data key (#39891)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-05 16:40:00 -03:00
Beto Dealmeida
cb53745d43 feat: semantic layer extension (#37815) 2026-05-05 12:07:46 -04:00
Beto Dealmeida
5325b87e73 fix(clickhouse): prevent expensive table scan (#39867) 2026-05-04 19:39:10 -04:00
Sam Firke
c2725e86f3 fix(markdown): Allow "target" attribute (#39868) 2026-05-04 18:27:43 -04:00
Amin Ghadersohi
673634f7af fix(mcp): point get_dataset_info url to explore view instead of legacy tablemodelview edit (#39838) 2026-05-04 13:39:05 -04:00
Amin Ghadersohi
28239c18d4 feat(mcp): warn when execute_sql template_params used with templating disabled (#39858) 2026-05-04 12:14:44 -04:00
jesperct
d8dd2d99b3 fix(time-comparison): use chart row_limit instead of instance config in offset queries (#39490) 2026-05-01 16:24:59 -07:00
Elizabeth Thompson
98eaaaa6d6 fix(mcp): clear stale thread-local DB session in sync tool wrapper (#39798)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 09:24:48 -07:00
Amin Ghadersohi
957b298ae1 fix(mcp): add default request parameter to list_charts and list_dashboards (#39730) 2026-04-30 18:04:39 -04:00
Amin Ghadersohi
f29d82b3b1 feat(mcp): add query_dataset tool to query datasets using semantic layer (#39727) 2026-04-30 18:03:41 -04:00
Vitor Avila
3f550f166f fix(GSheets OAuth2): Re-add UnauthenticatedError (#39785) 2026-04-30 18:57:00 -03:00
Vitor Avila
86eb6176d1 fix: Enforce per-user caching on legacy API endpoint (#39789) 2026-04-30 18:04:33 -03:00
Luiz Otavio
df396aa6e9 fix(drill-to-detail): drill to detail by correctly filtering by metric (#39766)
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
2026-04-30 08:40:16 -03:00
Enzo Martellucci
e4fe08ab9e feat(mcp): add generate_bug_report tool with PII sanitization (#39595)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 12:47:14 +02:00
Richard Fogaca Nienkotter
c2b9272f4c fix(mcp): sanitize read path output for LLM context (#39738) 2026-04-29 19:06:19 -03:00
Enzo Martellucci
e3e834bbf7 fix(mcp): fall back to title match when dashboard slug lookup misses (#39567)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 23:03:16 +02:00
Elizabeth Thompson
8d17c34068 feat(mcp): restore self-lookup via created_by_me flag (#39638)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 11:03:28 -07:00