From d8335c0e1bde880cce4f057851af6bbfebffa01e Mon Sep 17 00:00:00 2001 From: Joe Li Date: Thu, 14 May 2026 20:23:07 -0700 Subject: [PATCH] fix(subdirectory): unblock CI after Superset.route_base="" collisions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three CI failures rooted in the route_base="" migration: * Backend `test_explore_redirect`: `Superset.explore` and `ExploreView.root` both register at `/explore/`; ExploreView wins, leaving the form_data → form_data_key cache-and-redirect contract dead. Move that early-return into `ExploreView.root` (delegates to `Superset.get_redirect_url()`). * Cypress `actions.test.js` / `editmode.test.ts`: `cypress/utils/urls.ts` still hardcoded `/superset/dashboard/...` for 4 dashboard constants; drop the prefix. * Playwright `auth/login.spec.ts`: `playwright/utils/urls.ts` `WELCOME` was `'superset/welcome/'`; login redirects to `/welcome/` now. Co-Authored-By: Claude Opus 4.7 (1M context) --- superset-frontend/cypress-base/cypress/utils/urls.ts | 9 ++++----- superset-frontend/playwright/utils/urls.ts | 2 +- superset/views/explore.py | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/utils/urls.ts b/superset-frontend/cypress-base/cypress/utils/urls.ts index 66110bcc64b..ce8eecaa992 100644 --- a/superset-frontend/cypress-base/cypress/utils/urls.ts +++ b/superset-frontend/cypress-base/cypress/utils/urls.ts @@ -19,9 +19,8 @@ export const DASHBOARD_LIST = '/dashboard/list/'; export const CHART_LIST = '/chart/list/'; -export const WORLD_HEALTH_DASHBOARD = '/superset/dashboard/world_health/'; -export const SAMPLE_DASHBOARD_1 = '/superset/dashboard/1-sample-dashboard/'; -export const SUPPORTED_CHARTS_DASHBOARD = - '/superset/dashboard/supported_charts_dash/'; -export const TABBED_DASHBOARD = '/superset/dashboard/tabbed_dash/'; +export const WORLD_HEALTH_DASHBOARD = '/dashboard/world_health/'; +export const SAMPLE_DASHBOARD_1 = '/dashboard/1-sample-dashboard/'; +export const SUPPORTED_CHARTS_DASHBOARD = '/dashboard/supported_charts_dash/'; +export const TABBED_DASHBOARD = '/dashboard/tabbed_dash/'; export const DATABASE_LIST = '/databaseview/list'; diff --git a/superset-frontend/playwright/utils/urls.ts b/superset-frontend/playwright/utils/urls.ts index ed78c0b1c53..e35eddd2249 100644 --- a/superset-frontend/playwright/utils/urls.ts +++ b/superset-frontend/playwright/utils/urls.ts @@ -35,5 +35,5 @@ export const URL = { LOGIN: 'login/', SAVED_QUERIES_LIST: 'savedqueryview/list/', SQLLAB: 'sqllab', - WELCOME: 'superset/welcome/', + WELCOME: 'welcome/', } as const; diff --git a/superset/views/explore.py b/superset/views/explore.py index a41dcd7f3ff..f8b41bd53d6 100644 --- a/superset/views/explore.py +++ b/superset/views/explore.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +from flask import redirect, request from flask_appbuilder import permission_name from flask_appbuilder.api import expose from flask_appbuilder.security.decorators import has_access @@ -33,6 +34,14 @@ class ExploreView(BaseSupersetView): @permission_name("read") @event_logger.log_this def root(self) -> FlaskResponse: + # After `Superset.route_base = ""`, both `Superset.explore` and this + # view register at `/explore/`; this view wins. Preserve the legacy + # form_data → form_data_key cache-and-redirect contract here so + # callers passing `?form_data=...` still get the short cache-key URL. + if request.args.get("form_data"): + from superset.views.core import Superset # avoid circular import + + return redirect(Superset.get_redirect_url()) return super().render_app_template()