Files
superset2/tests
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
..