Compare commits

..

38 Commits

Author SHA1 Message Date
Enzo Martellucci
d42da24365 test(extensions): reference chatbots consume the page-context taxonomy
Local testing scaffolding for the chatbot context work — not intended for the
upstream PR (it lives on the test/chatbot-local branch).

- chat (Reference Chatbot): subscribe to entity- and SQL-Lab-context change
  events (onDidChangeChart/Dashboard/Dataset, onDidChangeActiveTab/TabTitle) so
  the panel refreshes after late hydration and on in-surface changes, not only
  on navigation; add chart_list/dashboard_list/dataset_list/query_history/
  saved_queries to the consumer PageType + inference; render the full per-surface
  context vertically.
- chat2 (Alt Chatbot): scaffold real source (previously a prebuilt dist only)
  mirroring chat with its own identity — alt-chatbot id, apacheSuperset_altChatbot
  federation name, "Alt Chatbot" green UI, view-only (no command registration, to
  avoid colliding with Reference's core.chatbot__* ids), open/close via local
  state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 17:28:10 +02:00
Enzo Martellucci
92224ae270 feat(extensions): refine page-context surface taxonomy for chatbot
Extend the navigation PageType taxonomy so context-consuming extensions can
distinguish browse/list and SQL Lab sub-surfaces, and fix two SQL Lab context
bugs surfaced by it.

Navigation:
- Add chart_list, dashboard_list, dataset_list, query_history and saved_queries
  to PageType, and classify the matching routes in derivePageType (list pages
  and /sqllab/history, /savedqueryview/list). List/sub-pages previously
  collapsed into 'other', and /sqllab/history was mislabeled 'sqllab'.

SQL Lab:
- onDidChangeActiveTab now resolves the active tab via getCurrentTab() instead
  of getTab(action.queryEditor.id). The action payload's editor has no merged
  unsaved dbId yet, so the old parser returned undefined and the event was
  silently swallowed, leaving consumers stuck on the first tab.
- getCurrentTab() now guards on navigation.getPageType() === 'sqllab', so the
  SQL Lab tab no longer leaks onto non-editor surfaces (the slice persists
  after navigating away). Mirrors the explore/dashboard getter guards.

Tests cover the new page types, the switch-away tab event, and the off-surface
getCurrentTab guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 17:27:27 +02:00
Enzo Martellucci
87956741ff chore: updates chatbot sip 2026-06-05 16:10:01 +02:00
Enzo Martellucci
8efaf38a2f fix(extensions): repair reference-chatbot build so served bundle isn't stale 2026-06-05 11:48:56 +02:00
Enzo Martellucci
979e01e7fb chore: updates SIP 2026-06-04 22:44:04 +02:00
Enzo Martellucci
e2a971ef69 fix: lint 2026-06-04 11:57:27 +02:00
Enzo Martellucci
23f6133983 fix(extensions): enforce CSRF protection on ExtensionsRestApi
FAB's BaseApi defaults csrf_exempt to True, so ExtensionsRestApi — which uses
cookie/session auth (allow_browser_login) and exposes state-changing routes
(settings PUT, extension upload POST, delete) — was silently exempt from CSRF
protection. Superset's own BaseSupersetApi sets csrf_exempt = False for exactly
this reason; mirror that here. Fixes test_csrf_exempt_blueprints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 11:39:41 +02:00
Enzo Martellucci
be364bb093 test(extensions): register POST/DELETE routes via ENABLE_EXTENSIONS flag
The extension upload/delete endpoints are only mounted when ENABLE_EXTENSIONS
is enabled at app-init time, so the endpoint tests 404'd depending on test
ordering. Parametrize the app fixture on TestPostEndpoint/TestDeleteEndpoint
so the routes are registered deterministically.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 10:36:23 +02:00
Enzo Martellucci
40dcace5d0 test(extensions): register settings route via ENABLE_EXTENSIONS flag
The settings endpoints are only mounted when ENABLE_EXTENSIONS is enabled at
app-init time. The endpoint tests relied on another test enabling the flag
first, so they 404'd in CI's ordering. Parametrize the app fixture on both
endpoint test classes so the route is registered deterministically.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 09:55:34 +02:00
Enzo Martellucci
74f9b72f64 refactor(extensions): route settings persistence through Command + DAO
Addresses review feedback that the settings endpoints bypassed the
Command->DAO pattern used across the codebase.

- superset/daos/extension.py: ExtensionSettingsDAO / ExtensionEnabledDAO
  (BaseDAO subclasses). Upserts use a portable check-then-write path so all
  metadata backends work without dialect-specific SQL or NotImplementedError.
- superset/commands/extension/settings/: Get/Update commands. UpdateCommand
  validates the payload (rejects non-string/oversized active_chatbot_id and
  oversized/non-string enabled keys) before any write, and wraps writes in
  @transaction so DB errors surface as ExtensionSettingsUpdateFailedError.
- api.py now constructs and runs the commands; pre-validates so malformed
  input returns 400 (the FAB @safe wrapper would otherwise yield 500).
- Remove superset/extensions/settings.py; tests rewritten against the
  Command + DAO layer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 09:23:00 +02:00
Enzo Martellucci
579c8d8377 fix(extensions): validate settings payload and harden chatbot resolver
Addresses remaining PR review comments:

- Reject invalid active_chatbot_id types (e.g. ints) and oversized ids with
  a 400 instead of silently coercing to null / failing at the DB layer.
- Reject oversized / non-string enabled-map keys with a 400 before the DB
  enforces the column length.
- Share the id column length via EXTENSION_ID_MAX_LENGTH so validation and
  the schema cannot drift.
- Chatbot resolver now falls through to the next candidate when a view id
  fails to resolve, instead of returning undefined on the first miss.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 09:03:09 +02:00
Enzo Martellucci
369e4adc76 feat(extensions): restore dataset context namespace with a real producer
Re-introduce the `dataset` namespace end-to-end so chatbot extensions can read
which dataset the user is viewing/editing. It was previously removed because the
SDK exported a typed contract with no runtime producer (calls threw); this adds
the producer so the contract is backed.

- SDK: DatasetContext + getCurrentDataset/onDidChangeDataset, barrel export, and
  the "./dataset" package.json subpath.
- Host: src/core/dataset with setCurrentDataset (producer) + getter + change
  event; exported from src/core and registered on window.superset.
- Producer: the dataset edit page (EditPage) fetches the dataset and publishes
  { datasetId, datasetName, schema, catalog, databaseName, isVirtual } via
  setCurrentDataset on load, clearing it on unmount. Fields map per the SIP
  contract; databaseName/schema/catalog are nullable.
- Use a stable module-level error handler for useSingleViewResource so
  fetchResource keeps a fixed identity — an inline handler made the fetch effect
  re-fire every render (Maximum update depth exceeded).
- Add the dataset-entity fetch mock to EditDataset.test, and add useRouter to
  ExtensionsStartup.test renders (it uses useLocation; tests must wrap a Router).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 17:36:05 +02:00
Enzo Martellucci
76466e3845 adds tickets.md 2026-06-02 16:55:59 +02:00
Enzo Martellucci
0249b8c1b3 fix(extensions): track async registrations via activate(context)
Port the activate(context) lifecycle fix (PR #40441 review feedback) to the
integration branch, and align the chatbot SIP.

Previously deactivateExtension only disposed registrations captured by the
synchronous window.superset registrar-wrapping during module evaluation, so
contributions registered from an async continuation leaked on deactivation.
Extensions now export activate(context) and push each Disposable onto
context.subscriptions, whose lifetime is bound to the context object rather
than a synchronous window — async and synchronous registrations are tracked
alike. The registrar-wrapping is retained as a synchronous-only fallback for
legacy side-effect extensions.

- Add ExtensionContext / ExtensionModule to @apache-superset/core
- loadModule awaits module.activate(context), returns context.subscriptions
- deactivateExtension disposes context.subscriptions
- Fix stale subscribeToLocation comment -> subscribeToRegistry
- Tests: legacy synchronous disposal + async-in-activate tracking
- SIP: describe the activate(context) model; resolve the async-registration
  open item (async dispose-await remains pending)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 14:07:43 +02:00
Enzo Martellucci
a583f1859c Merge branch 'master' into test/chatbot-local 2026-06-02 12:53:52 +02:00
Enzo Martellucci
6d174fa71f docs(extensions): fix logic errors and code-doc drift in chatbot SIP
- Fix broken getCurrentDashboard example (syntax error, raw nativeFilters/
  slices exposure contradicting the "normalized only" point, wrong field
  names, missing ChartSummary.isVisible)
- Correct page-type vocabulary: `chart` -> `explore` to match PageType
- Stop claiming `icon` is "proposed" — it already exists on the View
  descriptor and the registration example already passes it
- Remove phantom "UI-control state" and navigation "focused entity"
  promises that no contract actually exposes
- Distinguish implemented namespaces (dashboard/explore/navigation) from
  specified-but-not-implemented ones (dataset, DashboardContext.charts)
- Fix malformed `explore` status marker; align getViews descriptor field
  list to include `icon`

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:51:08 +02:00
Enzo Martellucci
15ad31effd updates the chatbot sip 2026-06-01 23:45:04 +02:00
Enzo Martellucci
32c42076dd adds the admin extension list details 2026-06-01 15:08:53 +02:00
Enzo Martellucci
7f6f805ffa fix(extensions): sync second-round review fixes to chatbot-local branch
- Validate manifest.id segments in POST endpoint before building dest_file path
- Add hostile manifest.id test (../../tmp/evil → 400)
- Add sqlite-backed round-trip tests for settings.py upsert logic
- Add HTTP tests for GET/PUT /api/v1/extensions/settings endpoints
- Wrap handleDelete in useCallback; already in columns useMemo deps
- Fix MySQL comment drift in _upsert_settings_row (read-then-update, not merge)
- Add intentional no-admin-gate comment to get_settings endpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 11:21:30 +02:00
Enzo Martellucci
df6e0095dc fix(extensions): sync PR review fixes to test/chatbot-local
- ExtensionsList.tsx: unique Tooltip ids per row; onKeyDown Enter/Space for
  star and delete role=button spans; data-test attrs; remove stale loading dep
- ExtensionsList.test.tsx: 10 unit tests (import validation, delete confirm,
  star toggle, keyboard a11y, file upload)
- api.py: path-traversal validation, upload size limit, LOCAL_EXTENSIONS 409
- test_api.py: 19 Python unit tests for POST and DELETE endpoints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 10:05:43 +02:00
Enzo Martellucci
c4b9f7b6e5 fix(extensions): fully remove dataset namespace — SDK contract and orphaned host impl
The host removed dataset from window.superset but the SDK still exported
the typed contract. An extension importing dataset from @apache-superset/core
would get a fully typed namespace whose runtime calls throw at access time,
which is worse than not shipping it.

Removes:
- packages/superset-core/src/dataset/index.ts (SDK type declarations)
- export * as dataset from './dataset' in superset-core/src/index.ts
- "./dataset" subpath from superset-core/package.json exports
- src/core/dataset/index.ts (orphaned host implementation)

The namespace will be re-introduced once a producer (DatasetCreation or
equivalent) calls setCurrentDataset to back the contract at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 09:29:41 +02:00
Enzo Martellucci
23d4574caf fix(extensions): address context-sharing PR review — blockers, quality, and tests
- Add CREATE_NEW_SLICE and SLICE_UPDATED to exploreChangePredicate so
  onDidChangeChart fires when a chart is saved for the first time
- Remove dataset namespace: no producer exists yet; ships it once a
  caller is wired in DatasetCreation or equivalent
- Remove ...supersetCore spread from window.superset assignment so
  un-contracted symbols from @apache-superset/core are not leaked onto
  the global object; list namespaces explicitly instead
- Add defensive array copy for filter values in buildDashboardContext
  so extension mutations cannot affect Redux state
- Lazy-initialize currentPageType in navigation to avoid module-load
  window.location access (throws in non-browser test environments)
- Fix /sqllab exact-match missing from derivePageType
- Add unit tests: navigation (7), explore (9), dashboard (11) — 27 tests
  covering page-type gating, dispose semantics, predicate coverage, and
  defensive copy invariant

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 00:16:37 +02:00
Enzo Martellucci
da4d09a006 fix(extensions): complete model move — remove from core.py, fix import, ensure ORM registration
- Create superset/extensions/models.py with ExtensionSettings and ExtensionEnabled.
- Remove both classes from superset/models/core.py.
- Update superset/extensions/settings.py import to the new path.
- ORM registration is guaranteed by the existing import chain:
  api.py → settings.py → extensions/models.py — no additional import needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 23:51:38 +02:00
Enzo Martellucci
1645a9652f fix(extensions): address PR review — rollback, import cleanup, tests, guard
- ExtensionsList: snapshot previous settings before optimistic write;
  rollback setSettings + notifyExtensionSettingsChanged in .catch() so a
  failed PUT leaves the UI consistent with server state. Drop
  setSettings(json.result) from .then() — optimistic write is source of
  truth. Switch onClick → onChange. Consolidate Switch/Select/etc into
  single @superset-ui/core/components import.
- ChatbotMount: revert undefined loading gate (immediate render, fall
  back on fetch error); guard json.result with ?? fallback; merge React
  imports; promote ChatbotRenderer comment to JSDoc.
- Tests: add getActiveChatbot coverage for admin-pin, stale-pin fallback,
  enabled-filter exclusion, all-disabled. Add ChatbotMount test for
  provider function throwing synchronously.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 23:36:05 +02:00
Enzo Martellucci
22d9332794 fix(extensions): push settings payload through pub/sub to eliminate re-fetch delay on toggle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 23:02:36 +02:00
Enzo Martellucci
504826bb24 refactor(extensions): replace per-location pub/sub with registry-wide version counter + useSyncExternalStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 22:52:57 +02:00
Enzo Martellucci
4e8145f14b fix(extensions): match /sqllab path without trailing slash in derivePageType
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 16:26:45 +02:00
Enzo Martellucci
a74684b062 fix(extensions): port CodeAnt fixes — page-type guards, deactivation cleanup, settings race, feature flag gate
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 12:10:16 +02:00
Enzo Martellucci
96f2fb3659 fix(extensions): defer chatbot render until settings load; isolate provider errors
- Don't call getActiveChatbot before settings arrive — start with null
  so no chatbot is rendered until the admin selection is known, avoiding
  a flash of the wrong chatbot when multiple are registered
- On settings fetch failure fall back to first-to-register instead of
  rendering nothing forever
- Wrap provider call in a ChatbotRenderer child component so
  ErrorBoundary actually catches provider-level throws (calling the
  provider inline during render means errors bubble before the boundary
  can mount)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 09:57:05 +02:00
Enzo Martellucci
e3efa0ae71 feat(extensions): consolidate actions column and live settings sync
- Single Actions column: switch (enable/disable), star (default chatbot,
  chatbot-type only, toggleable), trash (hidden for LOCAL_EXTENSIONS)
- Add `deletable` field to build_extension_data so the frontend knows
  which extensions can be removed via the UI
- Add `publisher` field to Extension type for correct delete URL
- Add notifyExtensionSettingsChanged / subscribeToExtensionSettings
  pub/sub in core/extensions so ChatbotMount re-fetches on any settings
  change without a page reload
- Wire ChatbotMount to subscribe to settings changes via fetchSettings
  callback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 22:51:05 +02:00
Enzo Martellucci
97ba65b0cd feat(extensions): port import/delete UI and backend endpoints to test branch
- POST /api/v1/extensions/ — admin upload of .supx bundles
- DELETE /api/v1/extensions/<publisher>/<name> — admin removal
- Import button in ExtensionsList SubMenu (file picker, .supx only)
- Per-row delete action with confirmation dialog
- Keeps existing Select (default chatbot) and Switch (enabled) UI
- Add publisher to build_extension_data response
- Add subscribeToLocation / getRegisteredViewIds / getViewProvider to
  src/core/views/index.ts so ExtensionsList can detect chatbot extensions
- Fix scripts/oxlint.sh set -e / [ -n "" ] false-positive exit
- Fix settings.py MySQL fallback: use read-then-update instead of
  try/except/rollback to satisfy the custom consider-using-transaction rule

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 21:30:32 +02:00
Enzo Martellucci
d7592913ea feat(extensions): reference chatbot extension — docs and example
Ships the full extensions/chat reference implementation that exercises
the chatbot extension platform end-to-end: activation lifecycle and
master disposable (teardown contract), React error boundary (fault
isolation), mock streaming with AbortController cancellation, commands
registration, and the pageContext helper that composes host namespaces.

Local branch only — not intended for upstream merge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:56:28 +02:00
Enzo Martellucci
8f03c5a1ea feat(extensions): context sharing namespaces (navigation, explore, dashboard, dataset)
Adds four stable namespaces to @apache-superset/core that give extensions
host-managed access to page context without coupling to Redux internals:

- navigation: getPageType(), onDidChangePage (routing signal only)
- explore: getCurrentChart(), onDidChangeChart (ChartContext from Redux)
- dashboard: getCurrentDashboard(), onDidChangeDashboard (DashboardContext
  with active native filter values from Redux)
- dataset: getCurrentDataset(), onDidChangeDataset (push model)

All four are wired into window.superset via ExtensionsStartup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:49:22 +02:00
Enzo Martellucci
8b52fff57b feat(extensions): backend settings persistence and admin-only permissions
Adds ExtensionSettings and ExtensionEnabled models with migration.
GET /api/v1/extensions/settings is public; PUT is restricted to Admin
role via security_manager.is_admin(). Uses dialect-aware ON CONFLICT DO
UPDATE upserts and @transaction() for safe concurrent writes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:49:15 +02:00
Enzo Martellucci
197e14de1b feat(extensions): admin configuration UI for extensions
Adds enable/disable toggles per extension and an active-chatbot selector
(shown when multiple chatbot extensions are registered) to the Extensions
list view. Settings are persisted via PUT /api/v1/extensions/settings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:49:07 +02:00
Enzo Martellucci
7c9efd529b feat(extensions): eager-load extensions at app-shell startup
ExtensionsStartup initializes extensions behind the EnableExtensions
feature flag immediately after the user session is confirmed, wires
window.superset, and isolates unhandled rejections from extension code.
ChatbotMount is mounted at the app root via App.tsx.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:49:01 +02:00
Enzo Martellucci
f8e7ee9dc2 feat(extensions): define the chatbot entry point in the frontend API
Adds getActiveChatbot() singleton resolver (first-to-register + admin
active_chatbot_id + enabled-flag enforcement), subscribeToLocation() for
reactive re-resolution, and ChatbotMount — the fixed bottom-right slot
that persists across routes and renders the active chatbot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:48:53 +02:00
Enzo Martellucci
c77c9b29f9 feat(extensions): define the superset.chatbot contribution point
Adds the `superset.chatbot` app-level location to ViewContributions and
exports ChatbotView from the contributions namespace. Introduces
src/views/contributions.ts as the host-side CHATBOT_LOCATION constant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:32:42 +02:00
939 changed files with 30215 additions and 61906 deletions

View File

@@ -77,17 +77,23 @@ github:
# combination here.
contexts:
- lint-check
- cypress-matrix-required
- cypress-matrix (0, chrome)
- cypress-matrix (1, chrome)
- cypress-matrix (2, chrome)
- cypress-matrix (3, chrome)
- cypress-matrix (4, chrome)
- cypress-matrix (5, chrome)
- dependency-review
- frontend-build
- playwright-tests-required
- playwright-tests (chromium)
- pre-commit (current)
- pre-commit (previous)
- test-mysql
- test-postgres-required
- test-postgres (current)
- test-postgres-hive
- test-postgres-presto
- test-sqlite
- unit-tests-required
- unit-tests (current)
required_pull_request_reviews:
dismiss_stale_reviews: false

View File

@@ -41,8 +41,8 @@ body:
label: Superset version
options:
- master / latest-dev
- "6.1.0"
- "6.0.0"
- "5.0.0"
validations:
required: true
- type: dropdown

View File

@@ -3,6 +3,10 @@ enable-beta-ecosystems: true
updates:
- package-ecosystem: "github-actions"
directory: "/"
ignore:
# Ignore temporarily as release schedule is too mentally taxing for dep-handling maintainers
# Additionally, very few PRs are reviewed by this action.
- dependency-name: anthropics/claude-code-action
schedule:
interval: "daily"
cooldown:
@@ -10,6 +14,12 @@ updates:
- package-ecosystem: "npm"
ignore:
# TODO: remove below entries until React >= 18.0.0
- dependency-name: "storybook"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "@storybook*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "eslint-plugin-storybook"
- dependency-name: "react-error-boundary"
- dependency-name: "@rjsf/*"
# remark-gfm v4+ requires react-markdown v9+, which needs React 18
@@ -32,6 +42,14 @@ updates:
# and confirm the issue https://github.com/apache/superset/issues/39600 is fixed
- dependency-name: "react-checkbox-tree"
update-types: ["version-update:semver-major"]
groups:
storybook:
applies-to: version-updates
patterns:
- "@storybook*"
- "storybook"
update-types:
- "patch"
directory: "/superset-frontend/"
schedule:
interval: "daily"
@@ -72,7 +90,21 @@ updates:
- package-ecosystem: "npm"
directory: "/docs/"
ignore:
# TODO: remove below entries until React >= 18.0.0 in superset-frontend
- dependency-name: "storybook"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "@storybook*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "eslint-plugin-storybook"
- dependency-name: "react-error-boundary"
groups:
storybook:
applies-to: version-updates
patterns:
- "@storybook*"
- "storybook"
update-types:
- "patch"
schedule:
interval: "daily"
open-pull-requests-limit: 10

View File

@@ -20,6 +20,10 @@ set -e
GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-.}
ASSETS_MANIFEST="$GITHUB_WORKSPACE/superset/static/assets/manifest.json"
# Rounded job start time, used to create a unique Cypress build id for
# parallelization so we can manually rerun a job after 20 minutes
NONCE=$(echo "$(date "+%Y%m%d%H%M") - ($(date +%M)%20)" | bc)
# Echo only when not in parallel mode
say() {
if [[ $(echo "$INPUT_PARALLEL" | tr '[:lower:]' '[:upper:]') != 'TRUE' ]]; then

View File

@@ -30,8 +30,9 @@ jobs:
pull-requests: write
checks: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: true
ref: master

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -38,19 +38,6 @@ jobs:
if: steps.check.outputs.python
uses: ./.github/actions/setup-backend/
# Authenticate the Docker daemon so the python:slim pull in
# uv-pip-compile.sh uses our (much higher) authenticated rate limit
# instead of the shared-runner anonymous one. Best-effort: on fork PRs the
# secrets are unavailable, so this no-ops and the pull falls back to
# anonymous (covered by the retry loop in the script).
- name: Login to Docker Hub
if: steps.check.outputs.python
continue-on-error: true
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run uv
if: steps.check.outputs.python
run: ./scripts/uv-pip-compile.sh

View File

@@ -25,7 +25,7 @@ jobs:
pull-requests: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check and notify

88
.github/workflows/claude.yml vendored Normal file
View File

@@ -0,0 +1,88 @@
name: Claude PR Assistant
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
permissions:
contents: read
jobs:
check-permissions:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))
runs-on: ubuntu-latest
outputs:
allowed: ${{ steps.check.outputs.allowed }}
steps:
- name: Check if user is allowed
id: check
env:
COMMENTER: ${{ github.event.comment.user.login }}
run: |
# List of allowed users
ALLOWED_USERS="mistercrunch,rusackas"
echo "Checking permissions for user: $COMMENTER"
# Check if user is in allowed list
if [[ ",$ALLOWED_USERS," == *",$COMMENTER,"* ]]; then
echo "allowed=true" >> $GITHUB_OUTPUT
echo "✅ User $COMMENTER is allowed to use Claude"
else
echo "allowed=false" >> $GITHUB_OUTPUT
echo "❌ User $COMMENTER is not allowed to use Claude"
fi
deny-access:
needs: check-permissions
if: needs.check-permissions.outputs.allowed == 'false'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Comment access denied
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
COMMENTER_LOGIN: ${{ github.event.comment.user.login || github.event.review.user.login || github.event.issue.user.login }}
with:
script: |
const commenter = process.env.COMMENTER_LOGIN;
const message = `👋 Hi @${commenter}!
Thanks for trying to use Claude Code, but currently only certain team members have access to this feature.
If you believe you should have access, please contact a project maintainer.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: message
});
claude-code-action:
needs: check-permissions
if: needs.check-permissions.outputs.allowed == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 1
- name: Run Claude PR Action
uses: anthropics/claude-code-action@5fb899572b81d2bb648d4d187173a2f423a9677c # beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "60"

View File

@@ -15,35 +15,9 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
frontend: ${{ steps.check.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
analyze:
name: Analyze
needs: changes
# Skip on PRs that touch neither code group (e.g. docs-only) so the
# analysis runners don't spin up. push/schedule runs always proceed:
# the change-detector returns "all changed" for non-PR events.
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
actions: read
contents: read
@@ -57,13 +31,19 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -74,6 +54,7 @@ jobs:
# queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
with:
category: "/language:${{matrix.language}}"

View File

@@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "Checkout Repository"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: "Dependency Review"
@@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: "Checkout Repository"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

View File

@@ -18,30 +18,9 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
frontend: ${{ steps.check.outputs.frontend }}
docker: ${{ steps.check.outputs.docker }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
setup_matrix:
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
matrix_config: ${{ steps.set_matrix.outputs.matrix_config }}
steps:
@@ -53,13 +32,8 @@ jobs:
docker-build:
name: docker-build
needs: [setup_matrix, changes]
if: >-
needs.changes.outputs.python == 'true' ||
needs.changes.outputs.frontend == 'true' ||
needs.changes.outputs.docker == 'true'
needs: setup_matrix
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
matrix:
build_preset: ${{fromJson(needs.setup_matrix.outputs.matrix_config)}}
@@ -70,12 +44,20 @@ jobs:
IMAGE_TAG: apache/superset:GHA-${{ matrix.build_preset }}-${{ github.run_id }}
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Environment
if: steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker
uses: ./.github/actions/setup-docker
with:
dockerhub-user: ${{ secrets.DOCKERHUB_USER }}
@@ -83,9 +65,11 @@ jobs:
build: "true"
- name: Setup supersetbot
if: steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker
uses: ./.github/actions/setup-supersetbot/
- name: Build Docker Image
if: steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -111,7 +95,7 @@ jobs:
# in the context of push (using multi-platform build), we need to pull the image locally
- name: Docker pull
if: github.event_name == 'push'
if: github.event_name == 'push' && (steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker)
run: |
for i in 1 2 3; do
docker pull $IMAGE_TAG && break
@@ -119,6 +103,7 @@ jobs:
done
- name: Print docker stats
if: steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker
run: |
echo "SHA: ${{ github.sha }}"
echo "IMAGE: $IMAGE_TAG"
@@ -126,7 +111,7 @@ jobs:
docker history $IMAGE_TAG
- name: docker-compose sanity check
if: matrix.build_preset == 'dev'
if: (steps.check.outputs.python || steps.check.outputs.frontend || steps.check.outputs.docker) && matrix.build_preset == 'dev'
shell: bash
env:
BUILD_PRESET: ${{ matrix.build_preset }}
@@ -139,16 +124,20 @@ jobs:
docker-compose-image-tag:
# Run this job only on pushes to master (not for PRs)
# goal is to check that building the latest image works, not required for all PR pushes
needs: changes
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.changes.outputs.docker == 'true'
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Environment
if: steps.check.outputs.docker
uses: ./.github/actions/setup-docker
with:
dockerhub-user: ${{ secrets.DOCKERHUB_USER }}
@@ -156,6 +145,7 @@ jobs:
build: "false"
install-docker-compose: "true"
- name: docker-compose sanity check
if: steps.check.outputs.docker
shell: bash
run: |
docker compose -f docker-compose-image-tag.yml up superset-init --exit-code-from superset-init

View File

@@ -33,13 +33,13 @@ jobs:
run:
working-directory: superset-embedded-sdk
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-embedded-sdk/.nvmrc"
registry-url: "https://registry.npmjs.org"
node-version-file: './superset-embedded-sdk/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run ci:release
env:

View File

@@ -21,13 +21,13 @@ jobs:
run:
working-directory: superset-embedded-sdk
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-embedded-sdk/.nvmrc"
registry-url: "https://registry.npmjs.org"
node-version-file: './superset-embedded-sdk/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm test
- run: npm run build

View File

@@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive

View File

@@ -12,12 +12,8 @@ on:
permissions:
contents: read
# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
validate-all-ghas:
runs-on: ubuntu-24.04
permissions:
@@ -27,14 +23,14 @@ jobs:
security-events: write
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20"
node-version: '20'
- name: Install Dependencies
run: npm install -g @action-validator/core @action-validator/cli --save-dev

View File

@@ -15,8 +15,9 @@ jobs:
pull-requests: write
issues: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

View File

@@ -2,11 +2,6 @@ name: "Pull Request Labeler"
on:
- pull_request_target
# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
labeler:
permissions:

View File

@@ -11,29 +11,29 @@ jobs:
contents: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
submodules: recursive
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for latest tag
id: latest-tag
env:
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
source ./scripts/tag_latest_release.sh "$RELEASE_TAG_NAME" --dry-run
- name: Check for latest tag
id: latest-tag
env:
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
source ./scripts/tag_latest_release.sh "$RELEASE_TAG_NAME" --dry-run
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run latest-tag
uses: ./.github/actions/latest-tag
if: steps.latest-tag.outputs.SKIP_TAG != 'true'
with:
description: Superset latest release
tag-name: latest
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run latest-tag
uses: ./.github/actions/latest-tag
if: steps.latest-tag.outputs.SKIP_TAG != 'true'
with:
description: Superset latest release
tag-name: latest
env:
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -18,14 +18,14 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "temurin"
java-version: "11"
distribution: 'temurin'
java-version: '11'
- name: Run license check
run: ./scripts/check_license.sh

View File

@@ -8,11 +8,6 @@ on:
# Possible values: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
types: [opened, edited, reopened, synchronize]
# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
lint-check:
runs-on: ubuntu-24.04
@@ -21,7 +16,7 @@ jobs:
pull-requests: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -31,5 +26,6 @@ jobs:
on-failed-regex-fail-action: true
on-failed-regex-request-changes: false
on-failed-regex-create-review: false
on-failed-regex-comment: "Please format your PR title to match: `%regex%`!"
on-failed-regex-comment:
"Please format your PR title to match: `%regex%`!"
repo-token: "${{ github.token }}"

View File

@@ -19,16 +19,12 @@ concurrency:
jobs:
pre-commit:
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
matrix:
# Run the full version spread on push (master/release) and nightly,
# but only the current version on PRs — lint/format/type results
# rarely differ across patch versions, so 3x per PR is wasteful.
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "previous", "next"]') }}
python-version: ["current", "previous", "next"]
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -48,9 +44,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "superset-frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "superset-frontend/package-lock.json"
node-version: '20'
- name: Install Frontend Dependencies
run: |
@@ -74,7 +68,7 @@ jobs:
id: changed_files
uses: ./.github/actions/file-changes-action
with:
output: " "
output: ' '
- name: pre-commit
env:

View File

@@ -33,7 +33,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
# pulls all commits (needed for lerna / semantic release to correctly version)
@@ -52,7 +52,7 @@ jobs:
if: env.HAS_TAGS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
node-version-file: './superset-frontend/.nvmrc'
- name: Cache npm
if: env.HAS_TAGS

View File

@@ -10,11 +10,11 @@ on:
workflow_dispatch:
inputs:
pr_number:
description: "PR number to sync"
description: 'PR number to sync'
required: true
type: number
sha:
description: "Specific SHA to deploy (optional, defaults to latest)"
description: 'Specific SHA to deploy (optional, defaults to latest)'
required: false
type: string
@@ -152,7 +152,7 @@ jobs:
- name: Checkout PR code (only if build needed)
if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.build_needed == 'true'
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ steps.check.outputs.target_sha }}
persist-credentials: false

View File

@@ -41,7 +41,7 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive

View File

@@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "Checkout ${{ github.event.workflow_run.head_sha || github.sha }}"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
persist-credentials: false
@@ -68,13 +68,13 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./docs/.nvmrc"
node-version-file: './docs/.nvmrc'
- name: Setup Python
uses: ./.github/actions/setup-backend/
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "zulu"
java-version: "21"
distribution: 'zulu'
java-version: '21'
- name: Install Graphviz
run: sudo apt-get install -y graphviz
- name: Compute Entity Relationship diagram (ERD)

View File

@@ -28,12 +28,12 @@ jobs:
name: Link Checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
# Do not bump this linkinator-action version without opening
# an ASF Infra ticket to allow the new version first!
- uses: JustinBeckwith/linkinator-action@af984b9f30f63e796ae2ea5be5e07cb587f1bbd9 # v2.3
- uses: JustinBeckwith/linkinator-action@af984b9f30f63e796ae2ea5be5e07cb587f1bbd9 # v2.3
continue-on-error: true # This will make the job advisory (non-blocking, no red X)
with:
paths: "**/*.md, **/*.mdx"
@@ -73,14 +73,14 @@ jobs:
working-directory: docs
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./docs/.nvmrc"
node-version-file: './docs/.nvmrc'
- name: yarn install
run: |
yarn install --check-cache
@@ -112,7 +112,7 @@ jobs:
working-directory: docs
steps:
- name: "Checkout PR head: ${{ github.event.workflow_run.head_sha }}"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
persist-credentials: false
@@ -120,7 +120,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./docs/.nvmrc"
node-version-file: './docs/.nvmrc'
- name: yarn install
run: |
yarn install --check-cache
@@ -131,7 +131,7 @@ jobs:
run_id: ${{ github.event.workflow_run.id }}
name: database-diagnostics
path: docs/src/data/
if_no_artifact_found: "warning"
if_no_artifact_found: 'warning'
- name: Use fresh diagnostics
run: |
if [ -f "src/data/databases-diagnostics.json" ]; then

View File

@@ -10,49 +10,26 @@ on:
workflow_dispatch:
inputs:
use_dashboard:
description: "Use Cypress Dashboard (true/false) [paid service - trigger manually when needed]. You MUST provide a branch and/or PR number below for this to work."
description: 'Use Cypress Dashboard (true/false) [paid service - trigger manually when needed]. You MUST provide a branch and/or PR number below for this to work.'
required: false
default: "false"
default: 'false'
ref:
description: "The branch or tag to checkout"
description: 'The branch or tag to checkout'
required: false
default: ""
default: ''
pr_id:
description: "The pull request ID to checkout"
description: 'The pull request ID to checkout'
required: false
default: ""
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
frontend: ${{ steps.check.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
cypress-matrix:
needs: changes
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.frontend == 'true'
# Somehow one test flakes on 24.04 for unknown reasons, this is the only GHA left on 22.04
runs-on: ubuntu-22.04
timeout-minutes: 30
permissions:
contents: read
pull-requests: read
@@ -63,14 +40,9 @@ jobs:
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
parallel_id: [0, 1]
parallel_id: [0, 1, 2, 3, 4, 5]
browser: ["chrome"]
app_root: ${{ github.event_name == 'push' && fromJSON('["", "/app/prefix"]') || fromJSON('[""]') }}
# The /app/prefix variant (push events only) is smoke-tested on a single
# shard rather than the full matrix, so exclude it from the other shards.
exclude:
- parallel_id: 1
app_root: "/app/prefix"
env:
SUPERSET_ENV: development
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
@@ -97,60 +69,71 @@ jobs:
# Conditional checkout based on context
- name: Checkout for push or pull_request event
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Checkout using ref (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.ref != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- name: Checkout using PR ID (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_id != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: refs/pull/${{ github.event.inputs.pr_id }}/merge
submodules: recursive
# -------------------------------------------------------
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python || steps.check.outputs.frontend
- name: Setup postgres
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: setup-postgres
- name: Import test data
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "superset-frontend/package-lock.json"
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: npm-install
- name: Build javascript packages
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: build-instrumented-assets
- name: Install cypress
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: cypress-install
- name: Run Cypress
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
env:
CYPRESS_BROWSER: ${{ matrix.browser }}
PARALLEL_ID: ${{ matrix.parallel_id }}
PARALLELISM: 2
PARALLELISM: 6
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
NODE_OPTIONS: "--max-old-space-size=4096"
with:
@@ -171,10 +154,7 @@ jobs:
name: cypress-artifact-${{ github.run_id }}-${{ github.job }}-${{ matrix.browser }}-${{ matrix.parallel_id }}--${{ steps.set-safe-app-root.outputs.safe_app_root }}
playwright-tests:
needs: changes
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 30
permissions:
contents: read
pull-requests: read
@@ -207,59 +187,71 @@ jobs:
# Conditional checkout based on context (same as Cypress workflow)
- name: Checkout for push or pull_request event
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Checkout using ref (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.ref != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- name: Checkout using PR ID (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_id != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: refs/pull/${{ github.event.inputs.pr_id }}/merge
submodules: recursive
# -------------------------------------------------------
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python || steps.check.outputs.frontend
- name: Setup postgres
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: setup-postgres
- name: Import test data
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: playwright_testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "superset-frontend/package-lock.json"
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: npm-install
- name: Build javascript packages
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: build-instrumented-assets
- name: Build embedded SDK
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: build-embedded-sdk
- name: Install Playwright
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: playwright-install
- name: Run Playwright (Required Tests)
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
env:
NODE_OPTIONS: "--max-old-space-size=4096"
@@ -281,63 +273,3 @@ jobs:
${{ github.workspace }}/superset-frontend/playwright-results/
${{ github.workspace }}/superset-frontend/test-results/
name: playwright-artifact-${{ github.run_id }}-${{ github.job }}-${{ matrix.browser }}--${{ steps.set-safe-app-root.outputs.safe_app_root }}
# Stable required-status-check anchors. cypress-matrix and playwright-tests
# are matrix jobs gated on change detection (python || frontend). On a PR
# that touches neither — e.g. a docs-only PR — they are skipped at the job
# level, which happens before matrix expansion, so the per-combination
# contexts (`cypress-matrix (0, chrome)`, `playwright-tests (chromium)`) are
# never produced and branch protection waits on them forever. These
# always-running jobs report a single stable context that passes when the
# underlying matrix job succeeded or was skipped, and fails only on a real
# failure. Require these in .asf.yaml instead of the matrix-expanded names.
#
# A matrix job reads as "skipped" in two distinct cases, and only the first
# is a legitimate pass: (a) change detection succeeded and gated the job off
# (docs-only PR); (b) the `changes` job itself failed or was cancelled, in
# which case GHA skips its dependents too. Accepting (b) would let a broken
# change-detector report a false green, so each anchor first requires
# `changes` to have succeeded before honouring a skip.
cypress-matrix-required:
needs: [changes, cypress-matrix]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions: {}
steps:
- name: Check cypress-matrix result
env:
CHANGES: ${{ needs.changes.result }}
RESULT: ${{ needs.cypress-matrix.result }}
run: |
if [ "$CHANGES" != "success" ]; then
echo "change detection did not succeed (result: $CHANGES); refusing to pass on a skipped matrix"
exit 1
fi
if [ "$RESULT" != "success" ] && [ "$RESULT" != "skipped" ]; then
echo "cypress-matrix did not pass (result: $RESULT)"
exit 1
fi
echo "cypress-matrix result: $RESULT (changes: $CHANGES)"
playwright-tests-required:
needs: [changes, playwright-tests]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions: {}
steps:
- name: Check playwright-tests result
env:
CHANGES: ${{ needs.changes.result }}
RESULT: ${{ needs.playwright-tests.result }}
run: |
if [ "$CHANGES" != "success" ]; then
echo "change detection did not succeed (result: $CHANGES); refusing to pass on a skipped matrix"
exit 1
fi
if [ "$RESULT" != "success" ] && [ "$RESULT" != "skipped" ]; then
echo "playwright-tests did not pass (result: $RESULT)"
exit 1
fi
echo "playwright-tests result: $RESULT (changes: $CHANGES)"

View File

@@ -20,18 +20,15 @@ concurrency:
jobs:
test-superset-extensions-cli-package:
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["previous", "current", "next"]') }}
python-version: ["previous", "current", "next"]
defaults:
run:
working-directory: superset-extensions-cli
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -56,7 +53,7 @@ jobs:
- name: Upload coverage reports to Codecov
if: steps.check.outputs.superset-extensions-cli
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
file: ./coverage.xml
flags: superset-extensions-cli

View File

@@ -22,12 +22,11 @@ permissions:
jobs:
frontend-build:
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
should-run: ${{ steps.check.outputs.frontend }}
steps:
- name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0
@@ -75,7 +74,6 @@ jobs:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
fail-fast: false
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Download Docker Image Artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
@@ -105,12 +103,11 @@ jobs:
needs: [sharded-jest-tests]
if: needs.frontend-build.outputs.should-run == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
id-token: write
steps:
- name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0
@@ -134,7 +131,7 @@ jobs:
run: npx nyc merge coverage/ merged-output/coverage-summary.json
- name: Upload Code Coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: javascript
use_oidc: true
@@ -147,7 +144,6 @@ jobs:
needs: frontend-build
if: needs.frontend-build.outputs.should-run == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Download Docker Image Artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
@@ -172,7 +168,6 @@ jobs:
needs: frontend-build
if: needs.frontend-build.outputs.should-run == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Download Docker Image Artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
@@ -192,7 +187,6 @@ jobs:
needs: frontend-build
if: needs.frontend-build.outputs.should-run == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- name: Download Docker Image Artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -33,7 +33,7 @@ jobs:
- name: Setup Python
uses: ./.github/actions/setup-backend/
with:
install-superset: "false"
install-superset: 'false'
- name: Set up chart-testing
uses: ./.github/actions/chart-testing-action

View File

@@ -29,7 +29,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ inputs.ref || github.ref_name }}
persist-credentials: true

View File

@@ -10,46 +10,23 @@ on:
workflow_dispatch:
inputs:
ref:
description: "The branch or tag to checkout"
description: 'The branch or tag to checkout'
required: false
default: ""
default: ''
pr_id:
description: "The pull request ID to checkout"
description: 'The pull request ID to checkout'
required: false
default: ""
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
frontend: ${{ steps.check.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
# NOTE: Required Playwright tests are in superset-e2e.yml (E2E / playwright-tests)
# This workflow contains only experimental tests that run in shadow mode
playwright-tests-experimental:
needs: changes
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 30
continue-on-error: true
permissions:
contents: read
@@ -83,65 +60,78 @@ jobs:
# Conditional checkout based on context (same as Cypress workflow)
- name: Checkout for push or pull_request event
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Checkout using ref (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.ref != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- name: Checkout using PR ID (workflow_dispatch)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_id != ''
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
ref: refs/pull/${{ github.event.inputs.pr_id }}/merge
submodules: recursive
# -------------------------------------------------------
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python || steps.check.outputs.frontend
- name: Setup postgres
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: setup-postgres
- name: Import test data
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: playwright_testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "superset-frontend/package-lock.json"
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: npm-install
- name: Build javascript packages
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: build-instrumented-assets
- name: Build embedded SDK
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: build-embedded-sdk
- name: Install Playwright
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
with:
run: playwright-install
- name: Run Playwright (Experimental Tests)
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
env:
NODE_OPTIONS: "--max-old-space-size=4096"
with:
run: playwright-run "${{ matrix.app_root }}" experimental/
- name: Run Playwright (Embedded Tests)
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
env:
NODE_OPTIONS: "--max-old-space-size=4096"

View File

@@ -14,30 +14,8 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
test-mysql:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
id-token: write
env:
@@ -49,8 +27,6 @@ jobs:
services:
mysql:
image: mysql:8.0
# Authenticated pulls use our higher Docker Hub rate limit. Empty on
# fork PRs (secrets unavailable) -> runner falls back to anonymous.
env:
MYSQL_ROOT_PASSWORD: root
ports:
@@ -67,31 +43,41 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
- name: Setup MySQL
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: setup-mysql
- name: Start Celery worker
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: celery-worker
- name: Python integration tests (MySQL)
if: steps.check.outputs.python
run: |
./scripts/python_tests.sh
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,mysql
verbose: true
use_oidc: true
slug: apache/superset
- name: Generate database diagnostics for docs
if: steps.check.outputs.python
env:
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
SUPERSET__SQLALCHEMY_DATABASE_URI: |
@@ -114,23 +100,19 @@ jobs:
print(f'Generated diagnostics for {len(docs)} databases')
"
- name: Upload database diagnostics artifact
if: steps.check.outputs.python
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: database-diagnostics
path: databases-diagnostics.json
retention-days: 7
test-postgres:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
id-token: write
strategy:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "previous", "next"]') }}
python-version: ["current", "previous", "next"]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
@@ -152,28 +134,37 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
with:
python-version: ${{ matrix.python-version }}
- name: Setup Postgres
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: |
setup-postgres
- name: Start Celery worker
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: celery-worker
- name: Python integration tests (PostgreSQL)
if: steps.check.outputs.python
run: |
./scripts/python_tests.sh
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,postgres
verbose: true
@@ -181,10 +172,7 @@ jobs:
slug: apache/superset
test-sqlite:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
id-token: write
env:
@@ -202,51 +190,38 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
- name: Install dependencies
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: |
# sqlite needs this working directory
mkdir ${{ github.workspace }}/.temp
- name: Start Celery worker
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: celery-worker
- name: Python integration tests (SQLite)
if: steps.check.outputs.python
run: |
./scripts/python_tests.sh
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,sqlite
verbose: true
use_oidc: true
slug: apache/superset
# Stable required-status-check anchor for the matrix-based test-postgres job.
# It is gated on change detection, so on non-Python PRs it is skipped and
# never produces its `test-postgres (current)` context (a job-level skip
# happens before matrix expansion). This always-running job reports a single
# context branch protection can require: it passes when test-postgres
# succeeded or was skipped, and fails only on a real failure.
test-postgres-required:
needs: [changes, test-postgres]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check test-postgres result
env:
RESULT: ${{ needs.test-postgres.result }}
run: |
if [ "$RESULT" != "success" ] && [ "$RESULT" != "skipped" ]; then
echo "test-postgres did not pass (result: $RESULT)"
exit 1
fi
echo "test-postgres result: $RESULT"

View File

@@ -15,30 +15,8 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
test-postgres-presto:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
id-token: write
env:
@@ -72,25 +50,36 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python == 'true'
- name: Setup Postgres
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: setup-postgres
run: |
echo "${{ steps.check.outputs.python }}"
setup-postgres
- name: Start Celery worker
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: celery-worker
- name: Python unit tests (PostgreSQL)
if: steps.check.outputs.python
run: |
./scripts/python_tests.sh -m 'chart_data_flow or sql_json_flow'
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,presto
verbose: true
@@ -98,10 +87,7 @@ jobs:
slug: apache/superset
test-postgres-hive:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
id-token: write
env:
@@ -127,32 +113,44 @@ jobs:
- 16379:6379
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create csv upload directory
if: steps.check.outputs.python
run: sudo mkdir -p /tmp/.superset/uploads
- name: Give write access to the csv upload directory
if: steps.check.outputs.python
run: sudo chown -R $USER:$USER /tmp/.superset
- name: Start hadoop and hive
if: steps.check.outputs.python
run: docker compose -f scripts/databases/hive/docker-compose.yml up -d
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
- name: Setup Postgres
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: setup-postgres
- name: Start Celery worker
if: steps.check.outputs.python
uses: ./.github/actions/cached-dependencies
with:
run: celery-worker
- name: Python unit tests (PostgreSQL)
if: steps.check.outputs.python
run: |
pip install -e .[hive]
./scripts/python_tests.sh -m 'chart_data_flow or sql_json_flow'
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,hive
verbose: true

View File

@@ -15,56 +15,40 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
unit-tests:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
outputs:
python: ${{ steps.check.outputs.python }}
id-token: write
strategy:
matrix:
python-version: ["previous", "current", "next"]
env:
PYTHONPATH: ${{ github.workspace }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
unit-tests:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
id-token: write
strategy:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["previous", "current", "next"]') }}
env:
PYTHONPATH: ${{ github.workspace }}
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
submodules: recursive
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
with:
python-version: ${{ matrix.python-version }}
- name: Python unit tests
if: steps.check.outputs.python
env:
SUPERSET_TESTENV: true
SUPERSET_SECRET_KEY: not-a-secret
run: |
pytest --durations-min=0.5 --cov-report= --cov=superset ./tests/common ./tests/unit_tests --cache-clear --maxfail=50
- name: Python 100% coverage unit tests
if: steps.check.outputs.python
env:
SUPERSET_TESTENV: true
SUPERSET_SECRET_KEY: not-a-secret
@@ -72,31 +56,9 @@ jobs:
pytest --durations-min=0.5 --cov=superset/sql/ ./tests/unit_tests/sql/ --cache-clear --cov-fail-under=100
pytest --durations-min=0.5 --cov=superset/semantic_layers/ ./tests/unit_tests/semantic_layers/ --cache-clear --cov-fail-under=100
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
flags: python,unit
verbose: true
use_oidc: true
slug: apache/superset
# Stable required-status-check anchor. `unit-tests` is a matrix job gated on
# change detection, so on non-Python PRs it is skipped and never produces its
# `unit-tests (current)` context (a job-level skip happens before matrix
# expansion). This always-running job reports a single context that branch
# protection can require: it passes when unit-tests succeeded or was skipped,
# and fails only on a real failure.
unit-tests-required:
needs: [changes, unit-tests]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check unit-tests result
env:
RESULT: ${{ needs.unit-tests.result }}
run: |
if [ "$RESULT" != "success" ] && [ "$RESULT" != "skipped" ]; then
echo "unit-tests did not pass (result: $RESULT)"
exit 1
fi
echo "unit-tests result: $RESULT"

View File

@@ -25,7 +25,7 @@ jobs:
pull-requests: read
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive
@@ -40,9 +40,7 @@ jobs:
if: steps.check.outputs.frontend
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "superset-frontend/package-lock.json"
node-version-file: './superset-frontend/.nvmrc'
- name: Install dependencies
if: steps.check.outputs.frontend
uses: ./.github/actions/cached-dependencies
@@ -61,7 +59,7 @@ jobs:
pull-requests: read
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: recursive

View File

@@ -22,10 +22,9 @@ concurrency:
jobs:
app-checks:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install dependencies

View File

@@ -9,7 +9,7 @@ on:
workflow_dispatch:
inputs:
comment_body:
description: "Comment Body"
description: 'Comment Body'
required: true
type: string
@@ -38,7 +38,7 @@ jobs:
});
- name: "Checkout ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

View File

@@ -16,11 +16,11 @@ on:
force-latest:
required: true
type: choice
default: "false"
default: 'false'
description: Whether to force a latest tag on the release
options:
- "true"
- "false"
- 'true'
- 'false'
permissions:
contents: read
@@ -49,12 +49,12 @@ jobs:
contents: write
strategy:
matrix:
build_preset:
["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]
build_preset: ["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]
fail-fast: false
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0
@@ -119,8 +119,9 @@ jobs:
contents: read
pull-requests: write
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0

View File

@@ -32,14 +32,14 @@ jobs:
name: Generate Reports
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: "./superset-frontend/.nvmrc"
node-version-file: './superset-frontend/.nvmrc'
- name: Install Dependencies
run: npm ci

895
CHATBOT_SIP.md Normal file
View File

@@ -0,0 +1,895 @@
Chatbot extensions
Author: Enzo Martellucci
Team: Preset
Status: Draft | Under Review | Completed
Day: May, 2026
1. Introduction
This SIP proposes a new extension point that enables third-party chatbot integrations to be embedded directly into the Superset user interface through the existing extension framework.
The goal is to provide a stable, supported mechanism for chatbot providers to integrate with Superset without requiring direct access to internal application state, Redux stores, or implementation-specific frontend modules. Chatbot extensions should interact with Superset through the same extension-oriented principles already established for other extension surfaces, such as SQL Lab.
The proposal focuses on three core concerns:
• Defining how chatbot extensions are registered and rendered.
• Defining how chatbot extensions receive contextual information about the currently active application surface.
• Defining how administrators manage chatbot availability and select the active chatbot when multiple chatbot extensions are installed.
This SIP intentionally does not prescribe any specific chatbot implementation, user experience, LLM provider, or backend architecture.
1.1 Motivation
AI-powered assistants are becoming a common way for users to interact with analytical applications. Superset should provide a standardized extension mechanism that allows community-built chatbot integrations to participate in the platform without depending on internal frontend implementation details.
Today, chatbot integrations must either be embedded through custom application modifications or rely on unsupported access to internal application state. Both approaches create maintenance challenges and make integrations fragile when frontend architecture evolves.
This SIP introduces a stable extension contract that:
• Enables chatbot integrations to be distributed as standard Superset extensions.
• Preserves separation between host and extension responsibilities.
• Allows chatbot implementations to access contextual information about the current page and entity being viewed.
• Keeps authorization and permission enforcement aligned with existing Superset APIs.
• Remains compatible with future frontend architecture changes.
1.2 Goals
The goals of this SIP are:
Introduce a dedicated chatbot extension point within the Superset application shell.
Provide chatbot extensions with host-managed, permission-aligned page context.
Establish stable extension-facing APIs for dashboard, explore, dataset, and navigation context.
Support deployment-wide administration of chatbot availability and selection.
Maintain isolation between chatbot implementations and Superset internals.
Preserve compatibility with future extension capabilities and AI-related initiatives.
1.3 Out of Scope
The following capabilities are explicitly out of scope for this SIP.
Client Actions and Agentic UI Manipulation
This SIP defines how chatbot extensions are mounted and how they receive context from the host application.
It does not define how a chatbot performs actions within the user interface, such as:
• Modifying chart configuration.
• Updating dashboard layouts.
• Editing SQL queries.
• Triggering frontend workflows.
These capabilities are deferred to the proposed Client Actions SIP.
Chatbot User Experience
The chatbot user interface remains entirely owned by the extension.
This SIP does not prescribe:
• Visual design.
• Conversation experience.
• Streaming behavior.
• Message persistence.
• Prompting strategy.
• Accessibility implementation details.
• Branding or styling.
LLM and Backend Infrastructure
The following concerns remain extension-specific:
• Model providers.
• MCP implementations.
• Agent frameworks.
• Tool execution systems.
• Prompt orchestration.
• Backend services.
Superset acts only as the host application and context provider.
2. Requirements
2.1 Functional Requirements
Registration and Rendering
The platform must allow extensions to register chatbot providers through the standard extension system.
The host must:
• Support registration of chatbot extensions.
• Render a chatbot UI contributed by an extension.
• Maintain a single active chatbot instance at any given time.
• Make the chatbot available across supported application surfaces.
• Support fully custom chatbot user interfaces.
Context Sharing
The platform must provide chatbot extensions with contextual information about the user's current application state.
At minimum, the host must expose:
• Current page type (`home`, `dashboard`, `explore`, `sqllab`, `dataset`, `other`).
• Dashboard context.
• Explore/chart context.
• Dataset identity context.
• SQL Lab context.
• Navigation events.
The chatbot must be notified of relevant context changes without polling.
Examples include:
• Route changes.
• Dashboard changes.
• Chart changes.
• Dataset changes.
• Title changes.
• Filter changes.
Host-Owned Context
Context exposed to extensions must be computed by the host application.
Extensions must not be required to:
• Read Redux state.
• Access internal application modules.
• Depend on component-level implementation details.
• Reconstruct semantic context from frontend internals.
Instead, extensions consume stable namespace APIs provided by the host.
Conversation State
The conversation state remains entirely owned by the chatbot extension.
This includes:
• Message history.
• Tool execution state.
• Streaming buffers.
• Conversation persistence.
• Session management.
The host is responsible only for exposing contextual information.
2.2 Non-Functional Requirements
Security and Authorization
Context shared with chatbot extensions must remain aligned with Superset's existing authorization model.
The host must not expose:
• Entities the current user cannot access.
• Metadata outside the user's permission scope.
• Datasource-derived information unavailable through existing APIs.
Authorization remains enforced by backend APIs. The extension-facing APIs defined by this SIP operate on data that has already been scoped to the current user.
Stable Extension Contracts
Extension-facing APIs must remain independent of frontend implementation details.
Extensions should rely on documented namespace contracts rather than:
• Redux slices.
• Internal selectors.
• Component state.
• Routing implementation details.
This allows frontend architecture to evolve without breaking extensions.
Performance
The architecture must minimize impact on existing application performance.
In particular:
• Context APIs must avoid unnecessary application re-renders.
• Context change notifications must not rely on polling.
• Chatbot integrations should not introduce additional work for unrelated surfaces.
Fault Isolation
Failures within chatbot extensions must not affect the stability of the host application.
Errors originating from third-party chatbot implementations should be isolated to the chatbot mount boundary.
Extensibility
The architecture should support future:
• Application surfaces.
• AI-related capabilities.
• Extension APIs.
• Context providers.
without requiring redesign of the chatbot extension model.
Vendor Neutrality
The architecture must remain independent of any specific:
• LLM provider.
• AI platform.
• Agent framework.
• Backend implementation.
3. Administration
3.1 Overview
Administrators can manage chatbot availability and select the active chatbot when multiple chatbot extensions are installed.
Administration is exposed through the existing Extensions management interface.
For chatbot extensions, administrators can:
• Enable or disable individual chatbot extensions.
• Select the default chatbot when multiple chatbot providers are available.
Only one chatbot may be active at a time.
3.2 Default Chatbot Selection
Extensions that contribute a chatbot view participate in a deployment-wide chatbot selection process.
The host discovers available chatbot candidates from the chatbot contribution location and allows administrators to designate a single active chatbot.
When multiple chatbot extensions are installed:
Administrators select the preferred chatbot.
The host resolves the active chatbot using the configured selection.
Only the selected chatbot is rendered.
Changes are applied dynamically without requiring a page reload.
3.3 Scope of Administration
The administration model introduced by this SIP is deployment-wide.
Administrative settings answer the question:
"Which chatbot integrations are available within this Superset deployment?"
They do not answer:
"Which chatbot integrations does a specific user prefer to use?"
This distinction is intentional.
Deployment administrators determine which integrations are available across the environment, while user-specific preferences remain a separate concern.
3.4 Future User Preferences
Per-user chatbot preferences are considered an important future capability but are intentionally out of scope for this SIP.
This proposal does not introduce user-scoped extension availability.
Instead, future user preferences should be layered on top of deployment availability using the following model:
Effective Availability = Deployment Availability AND User Preference
The recommended persistence layer for future user preferences is the Extension Storage API, which provides user-scoped extension storage and aligns with the architecture established by SIP-127 (User Preferences).
This separation preserves a clear distinction between:
• Deployment configuration.
• User customization.
and avoids introducing multiple ownership models for extension availability.
Consequently, this SIP focuses exclusively on deployment-wide administration and active chatbot selection. 4. Proposed Extension Point
4.1 Overview
This SIP introduces a single extension point that allows chatbot providers to integrate directly into the Superset application shell.
Extension Point
Contribution Location
Registration API
Cardinality
Chatbot Bubble
superset.chatbot
views.registerView()
Singleton
The chatbot contribution point is application-wide and persists across supported Superset surfaces, including dashboards, Explore, SQL Lab, and dataset-related pages.
Unlike most contribution locations, which allow multiple contributions to be rendered simultaneously, the chatbot location is intentionally exclusive and renders a single active provider.
4.2 Chatbot Contribution Location
Contribution Area
The contribution location introduced by this SIP is:
superset.chatbot
The host provides a fixed mount point within the application shell and renders the active chatbot provider at that location.
The mount point persists across route changes, allowing chatbot conversations and UI state to remain available while users navigate between application surfaces.
The chatbot extension contributes a single React component representing the entire chatbot experience.
Manifest Support
The current contribution manifest schema is focused on SQL Lab contribution locations and does not provide an application-shell-level contribution scope.
To support chatbot integrations, the manifest schema must be extended with an application-level contribution scope capable of declaring:
{
"views": {
"app": [
{
"location": "superset.chatbot"
}
]
}
}
This is a schema-level change and requires updates to both:
• Manifest validation.
• Runtime registration infrastructure.
The runtime registration API alone is not sufficient because chatbot contributions must also be discoverable through extension manifests.
4.3 Singleton Rendering Model
The chatbot location is intentionally exclusive.
Only one chatbot may be active at a time.
This differs from other contribution locations that allow multiple views to be rendered simultaneously.
Motivation
Chatbot interactions are inherently conversational and user-focused.
Rendering multiple chatbot providers simultaneously would:
• Create competing user experiences.
• Introduce ambiguity regarding which chatbot should respond.
• Increase UI complexity.
• Reduce discoverability.
For these reasons, chatbot rendering is treated as a deployment-level selection rather than a multi-provider composition model.
Resolution Rules
The host applies the following behavior:
Installed Chatbots
Behavior
None
No chatbot is rendered
One
The chatbot is rendered automatically
Multiple
The administrator-selected chatbot is rendered
The singleton policy is implemented entirely by the host.
Extensions continue to register normally through the existing view registry.
4.4 Provider Isolation
A key architectural principle of this SIP is that extensions may discover registrations but may not invoke another extension's rendering logic.
Public View Discovery
The existing registry exposes:
getViews(location);
This API returns metadata describing registered views:
interface View {
id: string;
name: string;
description?: string;
icon?: string;
}
The returned descriptors are intentionally passive metadata.
They allow extensions and host components to:
• Discover available contributions.
• Display contribution information.
• Populate administration interfaces.
They do not allow rendering.
Why Providers Are Not Exposed
The view provider is executable rendering logic.
If providers were exposed through the public registry:
• Extensions could render another extension's UI.
• Extensions could bypass host lifecycle management.
• Extensions could circumvent fault-isolation boundaries.
• Rendering ownership would become ambiguous.
This would violate the separation between extension discovery and extension execution.
For this reason:
"Extensions may discover registered views, but only the host may render registered views."
Host-Managed Resolution
The host uses internal APIs to resolve the active chatbot provider.
These APIs are not exposed through the public extension surface.
Conceptually:
const provider = getViewProvider("superset.chatbot", selectedId);
The active chatbot is determined through a host-managed resolution policy:
const chatbot = getActiveChatbot(adminSelectedId, enabledMap);
This policy considers:
• Enabled state.
• Administrative selection.
• Runtime settings.
• Registration state.
before rendering any provider.
As a result, chatbot selection is implemented as a host-side rendering policy rather than a new registration primitive.
4.5 Chatbot Lifecycle
Host Responsibilities
The host is responsible for:
• Providing the chatbot mount point.
• Resolving the active chatbot provider.
• Loading chatbot extensions.
• Managing chatbot lifecycle integration.
• Handling activation and deactivation.
• Maintaining fault isolation boundaries.
• Preserving chatbot availability across route changes.
• Providing context APIs defined by this SIP.
The host also provides fixed positioning and layering behavior to ensure chatbot visibility remains consistent throughout the application.
Fault Isolation
Chatbot providers execute within a host-managed boundary.
Failures originating from a chatbot extension must not affect the rest of the application.
Examples include:
• Module Federation loading failures.
• Runtime exceptions.
• Provider initialization errors.
If a chatbot fails to load, the host logs the failure, surfaces an appropriate notification, and continues operating normally.
The application shell remains functional even when the chatbot provider is unavailable.
4.6 Extension Responsibilities
The registered chatbot component owns the complete chatbot experience.
The extension is responsible for:
User Interface
• Collapsed bubble UI.
• Expanded panel UI.
• Branding.
• Icons and badges.
• Layout.
• Responsiveness.
Interaction Model
• Open and close behavior.
• Keyboard shortcuts.
• Focus management.
• Accessibility behavior.
• Conversation navigation.
Conversation Runtime
• Message history.
• Streaming state.
• Tool execution.
• Persistence.
• Session management.
Backend Integration
• LLM communication.
• MCP integration.
• Agent orchestration.
• Tool invocation.
The host does not manage any chatbot-specific runtime state.
4.7 Registration Example
Chatbot extensions register a single provider through the existing view registration API.
import { views, type ExtensionContext } from '@apache-superset/core';
import { ChatbotApp } from './ChatbotApp';
export function activate(context: ExtensionContext) {
const disposable = views.registerView(
{
id: 'acme.chatbot',
name: 'Acme Chatbot',
icon: 'Bubble',
},
'superset.chatbot',
() => <ChatbotApp />,
);
context.subscriptions.push(disposable);
}
The registration process remains consistent with existing extension contribution patterns.
The only difference is that the host applies singleton resolution before selecting the provider to render.
4.8 Chatbot Descriptor Metadata
Chatbot registrations may include an optional icon descriptor.
{
id: 'acme.chatbot',
name: 'Acme Chatbot',
icon: 'Bubble',
}
This metadata is used by:
• Extension administration interfaces.
• Chatbot selection interfaces.
• Extension discovery surfaces.
Design Decision
The icon descriptor is treated as static registration metadata.
Runtime UI state such as:
• Notification indicators.
• Unread counts.
• Loading states.
• Thinking indicators.
belongs to the chatbot component itself rather than the registration descriptor.
This keeps the registry simple while allowing chatbot implementations complete control over their user experience.
If future requirements emerge for host-visible dynamic icon updates, that capability can be introduced independently without expanding the registration model defined by this SIP. 5. Context and Namespace Model
5.1 Overview
Chatbot extensions require access to contextual information about the user's current activity within Superset. This SIP introduces a namespace-based context model that allows extensions to consume stable, host-managed APIs rather than depending on internal frontend implementation details.
The host exposes context through a set of surface-specific namespaces. Each namespace owns the context for a particular application surface and provides:
• Synchronous state getters.
• Event-based change notifications.
• Stable extension-facing contracts.
• Context aligned with the current user's authorized application view.
Extensions consume these namespaces and compose them into higher-level context models tailored to their own use cases.
5.2 Design Principles
The namespace model is guided by the following principles.
Stable Extension Contracts
Extensions must depend on documented APIs rather than frontend implementation details.
In particular, extensions must not depend on:
• Redux slices.
• Store shape.
• Selectors.
• Component-local state.
• Routing implementation details.
This allows Superset to evolve its frontend architecture without breaking extension integrations.
Host-Owned Context Normalization
The host is responsible for transforming application state into semantic extension-facing contracts.
Extensions consume normalized context rather than deriving it from raw frontend state.
Backend-Authorized Context
Authorization remains a backend responsibility.
Namespaces expose context that has already been scoped by backend APIs according to the current user's permissions.
Namespaces do not implement authorization logic themselves and should not be considered security boundaries.
Event-Driven Updates
Context changes are propagated through events rather than polling.
Extensions can subscribe to context updates and react immediately when relevant application state changes.
5.3 Available Namespaces
The following namespaces are available to chatbot extensions.
Namespace
Status
Purpose
sqlLab
Existing
SQL Lab context and events
authentication
Existing
Current user and session context
commands
Existing
Host actions and commands
dashboard
New
Dashboard context
explore
New
Explore/chart context
dataset
New
Dataset identity context
navigation
New
Routing and page context
The new namespaces introduced by this SIP follow the same high-level contract pattern established by the existing sqlLab namespace.
5.4 Namespace API Shape
Each namespace follows a common structure:
const current = namespace.getCurrent();
const disposable = namespace.onDidChange((next) => {
// react to updates
});
The exact contracts differ by surface, but every namespace provides:
• One or more synchronous getters.
• Event-based change notifications.
• Stable semantic contracts.
This pattern allows extensions to remain synchronized with application state without polling.
5.5 Dashboard Namespace
The dashboard namespace provides contextual information about the currently active dashboard.
API
dashboard.getCurrentDashboard();
Contract
interface DashboardContext {
dashboardId: number;
title: string;
filters: FilterValue[];
charts: ChartSummary[];
}
interface ChartSummary {
chartId: number;
chartName: string;
vizType: string;
datasourceId: number | null;
datasourceName: string | null;
isVisible: boolean;}
The context includes:
• Dashboard identity.
• Active filter state.
• Dashboard charts.
• Per-chart visibility information.
Returning all charts while exposing visibility allows chatbot implementations to answer both:
• "Which charts are currently visible?"
• "Find the chart named Revenue by Region."
without requiring additional lookups.
Normalization Requirements
The namespace must expose semantic dashboard context rather than raw application state.
For example:
dashboard.getCurrentDashboard();
returns a normalized contract rather than Redux slices or internal entities.
This abstraction layer preserves compatibility as frontend implementation details evolve.
Page-Type Guarding
The getter returns undefined when the current page is not a dashboard.
Conceptually:
if (navigation.getPageType() !== "dashboard") {
return undefined;
}
This prevents stale dashboard state from leaking across application surfaces.
5.6 Explore Namespace
The explore namespace provides context for the currently active Explore session.
API
explore.getCurrentChart();
Contract
interface ChartContext {
chartId: number | null;
chartName: string | null;
datasourceId: number | null;
datasourceName: string | null;
vizType: string;
}
The namespace exposes:
• Chart identity. `chartId` and `chartName` are null for a new, unsaved chart that has not yet been persisted.
• Saved chart metadata (name, datasource, viz type)
• Current Explore context: `vizType` reflects the type currently selected in the editor, so the value tracks the live session rather than only the last saved state.
The contract is intentionally focused on chart-specific information relevant to chatbot integrations.
Reflecting the live editing session — rather than reconstructing chart state from
the route alone — is the primary reason this SIP exposes frontend context
directly (see §6.2, Option C).
Page-Type Guarding
The getter returns undefined when the current page is not an Explore surface.
Conceptually:
if (navigation.getPageType() !== "explore") {
return undefined;
}
This ensures the namespace reflects only active Explore context.
5.7 Dataset Namespace
The dataset namespace exposes the dataset currently being viewed or edited.
API
dataset.getCurrentDataset();
Contract
interface DatasetContext {
datasetId: number;
datasetName: string;
schema: string | null;
catalog: string | null;
databaseName: string | null;
isVirtual: boolean;}
This contract is intentionally identity-focused.
It answers:
• Which dataset is currently in focus?
• Is the dataset virtual or physical?
• Which database and schema does it belong to?
It does not expose:
• Column definitions.
• Lineage information.
• Dataset dependencies.
Those concerns are expected to be resolved by backend services using the dataset identifier.
Producer-Backed Context
Unlike dashboard and explore namespaces, dataset pages do not currently expose a shared source of truth suitable for namespace consumption.
For this reason, dataset context is published by dataset pages through a host-managed producer mechanism.
Dataset pages publish the active dataset as it loads, and:
dataset.getCurrentDataset();
returns the most recently published value.
Until dataset information has been published, the getter returns:
undefined;
This design keeps the public contract stable without requiring the introduction of a dedicated Redux slice.
Example Use Cases
The dataset namespace enables chatbot workflows such as:
• Explain this dataset.
• Summarize this dataset's purpose.
• Show lineage for this dataset.
• Which charts depend on this dataset?
The namespace provides the identity required to perform those lookups while avoiding duplication of backend metadata.
5.8 Navigation Namespace
The navigation namespace provides routing-related context.
API
navigation.getPageType();
Events
navigation.onDidChangePage(...)
Contract
type PageType =
| "home"
| "dashboard"
| "explore"
| "sqllab"
| "dataset"
| "other";
The namespace answers a single question:
"Which application surface is currently active?"
It intentionally does not expose entity-specific information.
Entity context remains owned by the corresponding surface namespace.
Examples:
dashboard.getCurrentDashboard();
explore.getCurrentChart();
dataset.getCurrentDataset();
This separation preserves clear ownership boundaries and prevents duplication across namespaces.
5.9 Context Composition
This SIP intentionally does not introduce a host-owned aggregate context object.
Instead, extensions compose the context they require from individual namespaces.
For example:
const pageContext = {
pageType: navigation.getPageType(),
dashboard: dashboard.getCurrentDashboard(),
chart: explore.getCurrentChart(),
dataset: dataset.getCurrentDataset(),
sqlLab: sqlLab.getCurrentTab(),
};
The extension assembles a higher-level context tailored to its own requirements.
The host remains responsible for:
• Context ownership.
• Context normalization.
• Authorization alignment.
The extension remains responsible for:
• Context composition.
• Prompt construction.
• Application-specific interpretation.
This separation avoids introducing a centralized context abstraction while allowing new surfaces to be added incrementally over time.
5.10 Compatibility and Evolution
Namespace contracts are part of the public Superset extension API surface.
Breaking changes require standard compatibility and deprecation processes.
Extensions should depend only on documented namespace contracts and must not rely on implementation details behind those contracts.
As new application surfaces become extension-aware, additional namespaces may be introduced without affecting existing integrations.
This additive model allows the extension ecosystem to evolve while preserving backward compatibility.
6. Design Decisions
This section consolidates the key architectural decisions made by this SIP and summarizes the alternatives that were evaluated.
The goal is to capture the rationale behind the extension model so that future contributors can understand not only what was selected, but why alternative approaches were rejected.
6.1 Decision Summary
Decision
Topic
Selected Approach
D1
Page Context Model
Extension-composed context from host-provided namespaces
D2
Chatbot Resolution
Host-managed singleton resolution
D3
Descriptor Metadata
Static icon metadata
D4
Administration Scope
Deployment-wide administration
D5
Per-Page Visibility
Deferred - open question, see §8
D6
Generalized Floating Slots
Deferred - open question, see §8
6.2 D1 — Page Context Model
A central design question is how chatbot extensions obtain contextual information about the currently active application surface.
Three approaches were considered.
Option A — Host-Owned Aggregate Context
The host exposes a single API:
context.getPageContext();
which returns a fully assembled context object containing dashboard, chart, dataset, navigation, and SQL Lab information.
Rejected Because
• The host becomes responsible for understanding every application surface.
• The aggregate contract grows whenever a new surface is introduced.
• Changes in any surface can trigger unnecessary recomputation.
• The host becomes coupled to a single canonical context model.
• Ownership boundaries become unclear over time.
Option B — Surface Namespaces Composed by Extensions (Selected)
The host exposes independent namespaces:
• dashboard
• explore
• dataset
• navigation
• sqlLab
Extensions compose these primitives into their own application-specific context.
Advantages
• Clear ownership boundaries.
• Independent evolution of namespaces.
• Additive extensibility.
• Reduced coupling between surfaces.
• Extensions subscribe only to the context they require.
Option C — Route-Only Context
The host exposes only routing information.
Chatbot providers independently reconstruct context through APIs or backend services.
Rejected Because
This approach cannot reliably represent transient frontend state.
Examples include:
• Unsaved chart edits.
• Temporary dashboard filters.
• Active dashboard tabs.
• SQL editor state.
• Draft configuration changes.
As a result, chatbot context would frequently drift from what the user is actually viewing.
Decision
Option B is selected.
The host owns context normalization while extensions own context composition.
This preserves separation of concerns, minimizes coupling, and provides a stable foundation for future extension capabilities.
6.3 D2 — Singleton Chatbot Resolution
When multiple chatbot extensions are installed, the host must determine which chatbot is rendered.
This decision shapes both the rendering model and the extension isolation model.
Option A — Expose Providers Through getViews()
Allow:
getViews(location);
to return both metadata and rendering providers.
Rejected Because
Rendering providers are executable logic.
Exposing providers would allow one extension to:
• Render another extension.
• Bypass host lifecycle management.
• Circumvent fault isolation.
• Assume ownership of another extension's UI.
This violates a deliberate separation between extension discovery and extension execution.
Option B — Host-Managed Provider Resolution (Selected)
The host exposes only metadata publicly while retaining provider resolution internally.
Conceptually:
const provider = getViewProvider("superset.chatbot", selectedId);
Chatbot selection is handled through a host-managed policy:
const chatbot = getActiveChatbot(adminSelectedId, enabledMap);
Advantages
• Preserves extension isolation.
• Preserves host ownership of rendering.
• Supports administrative selection.
• Supports enablement checks.
• Supports future policy evolution.
Option C — Reuse resolveView()
Use the existing rendering helper:
resolveView(id);
to render chatbot providers.
Rejected Because
resolveView() assumes the caller already knows which view should be rendered.
It does not account for:
• Administrative selection.
• Enablement state.
• Settings synchronization.
• Chatbot-specific resolution policy.
Decision
Option B is selected.
The host owns chatbot selection and rendering.
The registry remains a discovery mechanism rather than a rendering mechanism.
Architectural Principle
A core principle established by this SIP is:
"Extensions may discover registered views, but only the host may render registered views."
This preserves extension isolation and prevents cross-extension rendering dependencies.
6.4 D3 — Descriptor Metadata Ownership
Chatbot registrations may include metadata used by administrative and discovery interfaces.
A key question is whether descriptor metadata should be static or runtime-updatable.
Option A — Static Descriptor Metadata (Selected)
Metadata is defined at registration time and remains unchanged for the lifetime of the registration.
Example:
{
id: 'acme.chatbot',
name: 'Acme Chatbot',
icon: 'Bubble',
}
Advantages
• Simpler registry implementation.
• Clear ownership model.
• Consistent administration UI.
• No registry update lifecycle.
Option B — Runtime-Updatable Metadata
Extensions can update descriptor metadata after registration.
Examples:
• Notification badges.
• Thinking indicators.
• Dynamic branding.
Rejected Because
These states belong to the chatbot user interface rather than the registration descriptor.
Supporting dynamic metadata would:
• Increase registry complexity.
• Introduce update synchronization concerns.
• Provide limited benefit for current consumers.
Decision
Option A is selected.
Descriptor metadata remains static.
Dynamic UI state remains the responsibility of the chatbot component.
Future requirements for dynamic metadata can be addressed independently if needed.
6.5 D4 — Administration Scope
This SIP introduces deployment-wide chatbot administration.
A key question is whether availability should be deployment-scoped or user-scoped.
Option A — Deployment-Wide Administration (Selected)
Administrators manage:
• Extension availability.
• Default chatbot selection.
These settings apply to the entire deployment.
Advantages
• Clear administrative ownership.
• Simple operational model.
• Consistent with existing extension administration patterns.
• Avoids introducing multiple configuration layers.
Option B — User-Scoped Availability
Availability and chatbot selection become user-specific settings.
Rejected Because
Administrative availability and user preference represent different concerns.
Administrators answer:
"Which integrations are available in this deployment?"
Users answer:
"Which available integrations do I prefer?"
Combining these concerns into a single model creates unclear ownership and duplicated configuration responsibilities.
Decision
Option A is selected.
This SIP introduces only deployment-wide administration.
Future user preferences should be layered on top using the following model:
Effective Availability = Deployment Availability AND User Preference
The recommended persistence mechanism for user-specific preferences is the Extension Storage API.
This approach aligns with SIP-127 and preserves a clear separation between administrative configuration and user customization.
7. Risks and Future Considerations
The selected architecture introduces several tradeoffs.
Namespace Maintenance
As additional application surfaces become extension-aware, new namespaces may be required.
This increases the maintenance burden of the extension API surface.
Contract Evolution
Namespace contracts are intended to be stable.
Over time, extensions may require additional context that is not initially exposed.
Future additions must preserve compatibility and avoid leaking implementation details.
Context Growth
Dashboard and chart context may become increasingly rich over time.
Care must be taken to ensure context APIs remain focused and do not evolve into large aggregate objects.
Extension Expectations
Chatbot vendors may request direct access to internal application state for convenience.
This SIP intentionally rejects that approach in favor of stable semantic contracts.
Maintaining that boundary may require additional namespace evolution over time. 8. Open Questions
D5 — Per-Page Visibility
Should chatbot extensions be able to declare page visibility constraints?
Two approaches remain possible.
Extension-Controlled Visibility
Extensions observe:
navigation.onDidChangePage(...)
and decide whether to render themselves.
Host-Enforced Visibility
Extensions declare supported page types through manifest metadata and the host enforces visibility.
Recommendation
Defer this decision.
The current architecture already supports extension-controlled visibility without requiring additional platform capabilities.
D6 — Generalized Floating Contribution Areas
The current proposal introduces a chatbot-specific contribution location:
superset.chatbot
A future question is whether this should evolve into a more generic floating-widget framework.
Examples might include:
• Chatbots.
• Guided tours.
• Notification centers.
• Productivity assistants.
Recommendation
Keep the contribution area chatbot-specific.
If broader floating-widget requirements emerge, introduce a dedicated abstraction rather than expanding the scope of this SIP.
9. Related Documents
Contribution types
Client actions
The following proposals are related to this SIP.
Extension Storage API
Add storage API for extensions (#39171)
Introduces namespace-isolated storage for extensions with support for:
• Local storage.
• Session storage.
• Ephemeral server storage.
• Persistent database-backed storage.
This proposal is complementary to the administration model defined by this SIP and is the recommended foundation for future user-specific extension preferences.
SIP-127 — User Preferences
[SIP-127] User Preferences (#28047)
Establishes the per-user preference model used by Superset core.
The Extension Storage API serves as the extension-scoped equivalent of this pattern and provides the recommended approach for future user-specific chatbot preferences. 10. Migration Plan
Base branch enxdev/chat-prototype
Branch for testing test/chatbot-local
The following capabilities are required to fully realize this SIP.
Core Platform Changes
Implemented
• superset.chatbot contribution location.
• Host-side chatbot resolution.
• Administration UI for chatbot selection.
• Dashboard namespace.
• Explore namespace.
• Navigation namespace.
• Runtime settings synchronization.
Pending
• Dataset namespace implementation.
• Dashboard chart visibility context.
• Permission-scoped dashboard context endpoint.
• Manifest support for application-level contribution scopes.
• Optional descriptor icon support.
11. Implementation Phases
Phase 1 — Chatbot Mount Point
• Chatbot contribution location.
• Host-side rendering.
• Lifecycle management.
• Fault isolation.
Status: Complete
Phase 2 — Administration
• Enable/disable support.
• Default chatbot selection.
• Runtime synchronization.
Status: Complete
Phase 3 — Context APIs
• Dashboard namespace.
• Explore namespace.
• Navigation namespace.
• Dataset namespace.
Status: Partially Complete
Remaining work:
• Dataset namespace.
• Dashboard chart visibility context.
• Dashboard context endpoint.
Phase 4 — Client Actions
Client actions and agentic UI interactions remain outside the scope of this SIP and are expected to be addressed through a separate proposal.

View File

@@ -29,7 +29,7 @@ ARG BUILD_TRANSLATIONS="false"
######################################################################
# superset-node-ci used as a base for building frontend assets and CI
######################################################################
FROM --platform=${BUILDPLATFORM} node:24-trixie-slim AS superset-node-ci
FROM --platform=${BUILDPLATFORM} node:22-trixie-slim AS superset-node-ci
ARG BUILD_TRANSLATIONS
ENV BUILD_TRANSLATIONS=${BUILD_TRANSLATIONS}
ARG DEV_MODE="false" # Skip frontend build in dev mode
@@ -55,13 +55,6 @@ WORKDIR /app/superset-frontend
RUN mkdir -p /app/superset/static/assets \
/app/superset/translations
# Harden `npm ci` against transient npm-registry network blips (e.g. ECONNRESET),
# which otherwise fail the entire multi-platform image build with no retry.
ENV npm_config_fetch_retries=5 \
npm_config_fetch_retry_mintimeout=20000 \
npm_config_fetch_retry_maxtimeout=120000 \
npm_config_fetch_timeout=600000
# Mount package files and install dependencies if not in dev mode
# NOTE: we mount packages and plugins as they are referenced in package.json as workspaces
# ideally we'd COPY only their package.json. Here npm ci will be cached as long

View File

@@ -189,11 +189,6 @@ Try out Superset's [quickstart](https://superset.apache.org/docs/quickstart/) gu
- [Join our community's Slack](http://bit.ly/join-superset-slack)
and please read our [Slack Community Guidelines](https://github.com/apache/superset/blob/master/CODE_OF_CONDUCT.md#slack-community-guidelines)
- [Join our dev@superset.apache.org Mailing list](https://lists.apache.org/list.html?dev@superset.apache.org). To join, simply send an email to [dev-subscribe@superset.apache.org](mailto:dev-subscribe@superset.apache.org)
- Follow us on social media:
[X](https://x.com/apachesuperset) |
[LinkedIn](https://www.linkedin.com/company/apache-superset) |
[Bluesky](https://bsky.app/profile/apachesuperset.bsky.social) |
[Reddit](https://reddit.com/r/apache-superset)
- If you want to help troubleshoot GitHub Issues involving the numerous database drivers that Superset supports, please consider adding your name and the databases you have access to on the [Superset Database Familiarity Rolodex](https://docs.google.com/spreadsheets/d/1U1qxiLvOX0kBTUGME1AHHi6Ywel6ECF8xk_Qy-V9R8c/edit#gid=0)
- Join Superset's Town Hall and [Operational Model](https://preset.io/blog/the-superset-operational-model-wants-you/) recurring meetings. Meeting info is available on the [Superset Community Calendar](https://superset.apache.org/community)

View File

@@ -109,7 +109,7 @@ If yes, it is in scope. If no, it is out of scope. The lists below apply that te
- Any action an Admin role can perform through documented configuration, API, or UI. The Admin role is a trusted operational principal by policy. Per MITRE CNA Operational Rules 4.1, a qualifying vulnerability must violate a security policy; behavior within a documented trust boundary does not.
- Deployment or operator decisions: the values of secrets and tokens, whether internal networks are reachable from the server, which database connectors or cache backends are enabled, which feature flags are set, where notifications are delivered, and which third-party plugins are loaded.
- Compromise, modification, or malicious control of trusted backend infrastructure. Apache Superset assumes the integrity of its metastore, cache backends (for example Redis or Memcached), message brokers, secret stores, and other operator-managed infrastructure. Findings that require an attacker to read from, write to, or otherwise tamper with these systems, including injecting malicious state, serialized objects, cache entries, task metadata, configuration, or database records, are post-compromise scenarios and do not constitute vulnerabilities in Apache Superset itself. A finding remains in scope only if an unprivileged user can cause such modification through a vulnerability in Apache Superset.
- The continued presence of expired key-value or metastore-cache entries that have not yet been deleted from the metadata database. Such entries are excluded from reads once expired, are purged opportunistically on write, and are removed in bulk by the scheduled `prune_key_value` maintenance task; their lingering until purged is an eventual-cleanup property, not a security boundary, and does not constitute a vulnerability.
- Code paths whose intended purpose is example data, demos, fixtures, local development, or documentation, rather than the production runtime.
- How a downstream application (spreadsheet program, email client, browser handling user-downloaded files) interprets output Apache Superset produced for it.
- Findings without a reproducible proof of concept against a supported release. The burden of demonstrating exploitability rests with the reporter; findings closed for lack of a proof of concept may be refiled if one is later produced.
- Brute force, rate limiting, denial of service, or resource exhaustion that does not bypass a documented control.

322
TICKETS.md Normal file
View File

@@ -0,0 +1,322 @@
# Chatbot Extensions — Tickets
Lightweight, pre-implementation tickets. Each says what to build and where the
boundaries are; it does not prescribe the final code. Stack order (bottom → top):
contribution point → frontend API mount → eager loading → admin UI → backend
settings/permissions → context sharing → import/delete.
---
## 1. Define the contribution point
**Goal:** Introduce the `superset.chatbot` contribution area and the host plumbing
needed to mount a single chatbot at the application-shell level, persistent across
routes. This is the keystone everything else builds on.
**Build:**
- Register `superset.chatbot` as a recognized contribution location in the view
registry.
- Add an app-shell / app-root contribution scope to the extension manifest schema
so the location can be declared in `extension.json` (the current schema is
SQL-Lab-only). Teach both manifest validation and runtime registration about it.
- Provide an exclusive-location resolver that selects exactly one renderable
chatbot for the slot, with a deterministic first-to-register fallback and a seam
for an externally supplied "active chatbot id" (so admin/runtime policy can plug
in later without touching the resolver).
- Host-managed mount layout: fixed bottom-right, 24px margin, z-index above content
and toasts, below modals.
**Out of scope:** fault isolation, admin selection UI, the lifecycle/teardown
contract, eager loading, streaming, context namespaces, authoring docs.
**Depends on:** nothing — this unblocks the rest.
**Done when:** an extension can register at `superset.chatbot` and render at the
app shell across routes; the resolver returns one provider (admin-id seam +
first-to-register fallback); unregistering removes the mount cleanly with no
duplicate bubbles.
Base branch: `enxdev/chat-prototype`
**External Links:** https://github.com/apache/superset/pull/40439
---
## 2. Host resolution & mount (frontend API entry point)
**Goal:** Turn a registered `superset.chatbot` view into a rendered, fault-isolated
bubble — the host-internal provider accessor, the selection policy, and the
fixed-position mount.
**Build:**
- Host-internal accessors on the views registry: `getViewProvider(location, id)`
and `getRegisteredViewIds(location)`. Keep the public `getViews` descriptor-only —
do not expose providers on the public surface.
- A registry change subscription so a mount can re-resolve without polling (fired
on register/unregister).
- The `getActiveChatbot(adminSelectedId?, enabledMap?)` resolver implementing the
selection policy: empty → none; drop disabled ids; admin-selected-and-enabled
wins; else first enabled in registration order.
- A `ChatbotMount` component at the app shell that renders the active provider
inside the host `ErrorBoundary`, re-resolves on registry change, and renders
nothing when no chatbot is active.
**Out of scope:** the contribution location itself (#40439); eager-loading the
bundle (#40441); the settings endpoint (#40443, consumed here with silent
fallback); admin UI; the lifecycle/teardown contract.
**Depends on:** #40439 (imports `CHATBOT_LOCATION`). The settings endpoint is a soft
forward-dependency — the mount falls back to first-registered-enabled if it 404s.
**Done when:** the provider accessor and resolver behave per the policy; the mount
renders/clears correctly and survives a throwing provider via `ErrorBoundary`;
`getViews` stays descriptor-only.
Base branch: `enxdev/feat/chatbot-contribution-point` (on #40439)
**External Links:** https://github.com/apache/superset/pull/40440
---
## 3. Eager loading & extension lifecycle/teardown
> Merged: this ticket also covers the **lifecycle & teardown contract** — both are
> implemented in the same PR (#40441), so they are tracked together.
**Goal:** Boot extension bundles at app-shell startup so contributions register
before the first route, and define the host contract for tearing those
contributions down on uninstall.
**Build — eager loading:**
- An `ExtensionsStartup` component that, once the session is confirmed and behind
`FeatureFlag.EnableExtensions`, kicks off `initializeExtensions()` in the
background. The host renders immediately; the mount re-resolves reactively when
registrations land.
- Wire `window.superset` so Module-Federation remotes can consume host namespaces.
- Mount `<ChatbotMount />` as a sibling of the route switch, inside
`ExtensionsStartup`.
- On bundle-load failure: a danger toast, host stays interactive, corner stays
empty. Add a global `unhandledrejection` logger (log only; do not suppress the
browser default).
**Build — lifecycle/teardown contract (Model A1, per-contribution dispose):**
- During the `./index` factory call, intercept the public registrars and collect
the returned `Disposable`s keyed by extension id.
- `deactivateExtension(id)` is the single teardown entrypoint: it fires every
collected `Disposable` and removes the extension from the index. A throwing
`Disposable` must not block the others (catch per-disposable). Idempotent;
unknown id is a no-op.
- Trigger semantics to document: **uninstall**`deactivateExtension(id)`;
**disable** → mount filters by `enabledMap`, does NOT fire disposables, re-enable
needs no reload; **replace** (singleton) → resolver re-selects, the losing
extension is not deactivated. Disposal order is best-effort (registration order),
not a contract — consumers must be order-independent.
**Out of scope:** selective per-type eager loading (not feasible without running the
factory); the mount-boundary `ErrorBoundary` (#40440); the settings endpoint and
its subscription primitive (#40443); context namespaces (#40444); an async-aware
`deactivate(): Promise<void>` — file separately only if a graceful-flush
requirement appears.
**Depends on:** #40440 (`ChatbotMount`, resolver, registry-subscription hook). Soft
build-time deps on #40443 (settings subscription) and #40444 (namespaces) — land
those first or stub the imports.
**Done when:** enabled extensions init once at startup behind the flag without
gating initial render; the bubble appears reactively on registration;
`deactivateExtension(id)` disposes all of an extension's contributions (per-disposable
catch, idempotent); load failure toasts without throwing; teardown is verified
end-to-end on the reference chatbot (including an abort-registry controller that must
still abort on deactivate).
Base branch: `enxdev/feat/chatbot-frontend-api` (on #40440)
**External Links:** https://github.com/apache/superset/pull/40441
---
## 4. Admin configuration UI
**Goal:** Let an admin enable/disable the chatbot and, when more than one chatbot is
installed, choose which is active.
**Resolve before building:**
- Is "disable the chatbot" the existing generic extension-disable, or a
chatbot-specific toggle? (Determines the ticket's size — prefer reusing the
existing flag.)
- Where does the UI live? Default: the existing extensions management surface, not a
new page.
- How does the "default chatbot" selection persist? Reuse existing extension-state
storage or a config value — do not invent a table.
- Which permission gates it? Default: the existing Extensions-API write permission.
**Build:**
- Enable/disable control that empties the `superset.chatbot` slot when off (no broken
placeholder).
- (Gated on the singleton-policy decision) A selection control listing candidates via
`getViews('superset.chatbot')`, activating the choice through the resolver, falling
back to first-to-register when unset.
- Switching the active chatbot or disabling it at runtime must dispose the previously
active chatbot via its `Disposable` and release its in-flight stream readers (via
`AbortController`) — no two bubbles, no leaked readers.
**Out of scope:** the singleton-policy decision itself; per-page visibility; the
resolver implementation (consumed here).
**Depends on:** #40440 (resolver) for selection; enable/disable does not wait on the
policy decision.
**Done when:** admin can enable/disable (gated by the chosen permission) and the slot
empties when off; selection picks the active chatbot with first-to-register fallback;
the persistence-mechanism and permission decisions are recorded in the ticket.
Base branch: `enxdev/chat-prototype`
**External Links:** https://github.com/apache/superset/pull/40442
---
## 5. Permissions
**Goal:** Guarantee the new page-context surface cannot expose anything the current
user can't already access through Superset's standard security model. Chatbot
extensions fetch data as any other frontend surface and inherit only the current
user's privileges; this ticket covers only the new host → extension context-sharing
path.
**Build:**
- The page-context namespaces (#40444) must derive entity metadata from the same
permission checks that gate the underlying page — not a raw Redux pass-through.
- Canonical threat (SIP §2.1): a dashboard the user can view that contains a chart
whose dataset they cannot query — that chart's metadata (id, name, datasource,
viz type, form_data) must be dropped from the context payload.
- Context carries only lightweight semantic data + identifiers that resolve through
already-protected APIs; never inline dataset rows or query results.
- Filtering applies equally to the initial read and every change-notification
payload. A chatbot an admin has disabled receives no context at all.
**Out of scope:** REST API authorization, RBAC, RLS (already enforced by Superset);
LLM/backend auth; the singleton selection policy. The chatbot authenticates via the
user's existing session (cookie + CSRF) — no separate credential is issued.
**Depends on:** the Spike sizing the new namespaces (the per-getter filtering lands
with those getters); the Context-sharing ticket consumes the filtered getters this
one specifies.
**Done when:** context never exposes entities/ids/metadata the user can't access
(even via a manually-entered URL); the dashboard payload omits charts whose dataset
the user can't query; no inline privileged payloads; filtering covers change events
as well as the initial read; a disabled chatbot gets nothing.
Base branch: `enxdev/chat-prototype`
**External Links:** https://github.com/apache/superset/pull/40443
---
## 6. Context sharing
**Goal:** Let the chatbot read semantic page context and subscribe to changes through
public per-surface core namespaces only — never the host Redux store.
**Approach:** Deliver context through per-surface namespaces — the existing `sqlLab`
namespace plus new `dashboard` / `explore` / `navigation` namespaces that mirror its
shape (a state getter + an `Event<T>` change subscription). No new aggregate context
API. The new namespaces copy `sqlLab`'s shape but must filter the Redux state they
read (the permission filtering itself is specified by #40443).
**Build:**
- Route all chatbot page-context reads through one narrow adapter module with a fixed
interface — the adapter is the deliverable, not scattered call sites — so swapping
to core namespaces is a one-line change.
- Back the adapter with `sqlLab` immediately; back the dashboard/explore/navigation
portions and wire change notifications through `navigation`'s page-change event once
those namespaces ship.
**Out of scope:** the permission-filtering logic (#40443 + upstream namespace work);
designing the namespace API surface (upstream OSS work, sized by the Spike).
**Depends on:** a Spike to size the new namespaces (state getters + events + the
per-getter permission filtering). The namespace _shape_ is settled by the `sqlLab`
precedent; the filtering is real design work.
**Done when:** all context reads go through the single adapter (zero direct Redux
imports, greppable); SQL Lab context works today; dashboard/explore context is either
delivered or explicitly tracked as OSS-blocked (not faked); change notifications need
no polling; no extra host re-renders.
Base branch: `enxdev/chat-prototype`
**External Links:** https://github.com/apache/superset/pull/40444
---
## 7. Import / delete UI
**Goal:** Add an actions column to the extensions list with buttons to delete an
extension, set-as-default (chatbot extensions only), and import a new extension.
**Build:**
- Import an extension bundle, refreshing the list on success.
- Delete an installed extension.
- A "set as default chatbot" control, shown only for chatbot extensions.
**Out of scope:** the settings endpoint itself (#40443); the resolver (#40440).
**Depends on:** #40442/#40443 for the settings + chatbot-selection plumbing.
**Done when:** an admin can import, delete, and set a default chatbot from the
actions column, with the list reflecting changes.
Base branch: `enxdev/chat-prototype`
**External Links:** https://github.com/apache/superset/pull/40450
---
## ~~8. Fault isolation & error boundaries~~ — CLOSED (no ticket needed)
The protective fault-isolation mechanisms are **already implemented** across the
mount and eager-loading PRs, so no standalone ticket is required:
- Render/lifecycle throw → host `ErrorBoundary` around the `superset.chatbot` slot
(#40440, reinforced by the `ChatbotRenderer` wrapper in #40441).
- Bundle-load failure → `.catch()` + danger toast in `ExtensionsLoader` (#40441).
- `activate()` throw → host try/catch in `ExtensionsLoader` (#40441).
- Escaped async rejection → `unhandledrejection` hook in `ExtensionsStartup` (#40441).
- Failed-activation cleanup → driven by `deactivateExtension` (ticket 3 / #40441).
The host stays safe under every failure class today. The only unbuilt pieces were the
**optional** "chatbot failed — Reload page" notification and structured
failure-class/telemetry logging — both judged not worth a ticket (the original spec
itself marked the reload notification "optional"). File a fresh ticket only if that
UX is later wanted.
(Original link, for reference only: PR #40433 `feat(extensions): adds chatbot P1-P2`
closed/superseded; never a dedicated fault-isolation PR.)
---
## Notes on consolidation
- **Lifecycle/teardown** was a separate ticket pointing at the same PR as **Eager
loading** (#40441) — merged into ticket 3 above. (This is the only true duplicate.)
- The **Permissions** ticket (#40443) is kept as-is. Note its PR also contains
backend settings-persistence code, but the original ticket only ever scoped the
permission-safe context surface — so the ticket stays "Permissions" and no
persistence ticket is invented.
- The **Permissions** ticket previously had a truncated base branch
(`enxdev/chat-protot`) — corrected to `enxdev/chat-prototype`.
- **Fault isolation** was **closed without a ticket** (see the struck-through section
above): its protective mechanisms already shipped in #40440/#40441, and the only
unbuilt pieces (the optional "Reload page" notification + structured telemetry
logging) were judged not worth a ticket.

View File

@@ -24,166 +24,12 @@ assists people when migrating to a new version.
## Next
### Webhook alerts/reports block private/internal hosts by default
Webhook alert/report dispatch (`WebhookNotification.send`) now validates the target URL's host against the same private/internal-IP block applied to dataset import URLs. If the resolved host is in a loopback, link-local, private (RFC-1918), shared-CGNAT, or multicast range, the webhook is rejected with `NotificationParamException`.
Deployments that intentionally point webhooks at internal targets (chatops bridges, internal automation servers, on-premises Mattermost/Rocket.Chat, etc.) can opt out by setting `ALERT_REPORTS_WEBHOOK_ALLOW_INTERNAL_HOSTS = True` in `superset_config.py`. This mirrors the existing `DATASET_IMPORT_ALLOW_INTERNAL_DATA_URLS` opt-out for dataset imports.
### Impala cancel_query blocks private/internal hosts by default
The Impala engine spec's `cancel_query` issues an HTTP request from the Superset backend to the host configured on the Impala database connection. That host is now validated before the request: if it resolves to a private/internal IP range, the cancel call is refused and a warning is logged. Operators whose Impala cluster runs on an internal network can opt out by setting `IMPALA_CANCEL_QUERY_ALLOW_INTERNAL_HOSTS = True` in `superset_config.py`. This mirrors the dataset-import and webhook opt-out flags.
### Map chart renderer and OpenStreetMap migration behavior
The MapLibre migration for deck.gl charts preserves saved non-Mapbox styles on
the MapLibre-compatible path. Saved styles such as OpenStreetMap, `tile://`
tile templates, generic HTTPS style URLs, and charts without a saved style are
not reclassified as Mapbox during migration and do not require
`MAPBOX_API_KEY` only because of the migration.
Saved true Mapbox styles whose value starts with `mapbox://` remain
Mapbox-backed. If a Superset deployment does not configure `MAPBOX_API_KEY`,
those saved Mapbox charts keep the existing missing-key message instead of
silently falling back to MapLibre or another provider. In Explore, deck.gl and
point-cluster renderer controls preserve saved Mapbox state, but the Mapbox
choice is not available as a new working renderer without a configured key.
The MapLibre style choices include `Streets (OSM)`, backed by
`https://tile.openstreetmap.org/{z}/{x}/{y}.png`. This OpenStreetMap tile
service requires visible `© OpenStreetMap contributors` attribution and should
be used through normal browser map tile requests and caching; it is not intended
for bulk prefetch or offline tile downloads.
### Password complexity policy enabled by default
Superset now ships a default password-complexity policy, enforced (via Flask-AppBuilder) across self-registration, the user create/edit/reset forms, and the User REST API. The policy requires a minimum password length of 8 characters and rejects a built-in blocklist of common/guessable passwords.
This is enabled by default (`FAB_PASSWORD_COMPLEXITY_ENABLED = True`), so new or reset passwords that are too short or appear in the blocklist will be rejected where they were previously accepted. Existing stored passwords are unaffected until they are next changed.
Operators can tune or disable the policy via config:
- `AUTH_PASSWORD_MIN_LENGTH` — minimum length (default `8`).
- `AUTH_PASSWORD_COMMON_BLOCKLIST` — extra passwords to reject, in addition to the built-in list.
- `FAB_PASSWORD_COMPLEXITY_VALIDATOR` — replace with your own callable for custom rules.
- `FAB_PASSWORD_COMPLEXITY_ENABLED = False` — disable enforcement entirely.
### Data uploads bounded by UPLOAD_MAX_FILE_SIZE_BYTES
Single data-file uploads (CSV, Excel, columnar) are now bounded by the `UPLOAD_MAX_FILE_SIZE_BYTES` config option, which defaults to `100 * 1024 * 1024` (100 MB). Files larger than this are rejected with a `413` before their contents are buffered into memory. Set `UPLOAD_MAX_FILE_SIZE_BYTES = None` to disable the check and restore unbounded uploads.
### Duration formatter precision
The `DURATION` number formatter now uses `Intl.DurationFormat` for locale-aware output. By default, sub-second fields are omitted, so values that previously displayed fractional seconds with `pretty-ms`, such as `10500` milliseconds rendering as `10.5s`, now render as `10s`.
To preserve sub-second precision in custom duration formatters, enable `formatSubMilliseconds`.
### Cache warmup authenticates via SUPERSET_CACHE_WARMUP_USER
The `cache-warmup` Celery task now drives a real WebDriver session for reliable authentication and reads the user to authenticate as from the new `SUPERSET_CACHE_WARMUP_USER` config option. It no longer consults `CACHE_WARMUP_EXECUTORS` for the warmup path. `SUPERSET_CACHE_WARMUP_USER` defaults to `None`, so the task fails fast with a clear message until you set it. Operators who previously relied on `CACHE_WARMUP_EXECUTORS` for cache warmup must set `SUPERSET_CACHE_WARMUP_USER` to a dedicated least-privilege user with access to the dashboards they want warmed up before the next warmup run.
### YDB now uses a native sqlglot dialect
YDB SQL parsing now relies on the dedicated [`ydb-sqlglot-plugin`](https://pypi.org/project/ydb-sqlglot-plugin/) dialect, which registers itself with sqlglot automatically. YDB users must install this plugin (e.g., via `pip install "apache-superset[ydb]"`) to avoid a `ValueError` when Superset parses YDB queries.
### Embedded dashboards enforce configured Allowed Domains for postMessage
The embedded dashboard page now validates the origin of incoming `postMessage` events against the dashboard's configured **Allowed Domains**. The server-rendered embedded page exposes the configured domains in its bootstrap payload, and the frontend rejects message events whose origin is not in that list.
Enforcement only applies when the Allowed Domains list is non-empty. If the list is empty (the default), any origin is accepted, so there is no behavior change for embeds that did not configure Allowed Domains.
### Default guest/async JWT secrets are rejected at startup
Superset already refuses to start in production (non-debug, non-testing) when `SECRET_KEY` is left at its built-in default, and when `GUEST_TOKEN_JWT_SECRET` is left at its default while `EMBEDDED_SUPERSET` is enabled. This behavior is extended to `GLOBAL_ASYNC_QUERIES_JWT_SECRET`: if the `GLOBAL_ASYNC_QUERIES` feature flag is enabled and the secret is still the publicly known default (`test-secret-change-me`), Superset logs a clear error and refuses to start.
As with the existing `SECRET_KEY` check, this only fails in production. In debug mode, testing mode, or under the test runner, a warning is logged instead of exiting, so local development is unaffected.
To resolve the error, set a strong random value in `superset_config.py`:
```python
GLOBAL_ASYNC_QUERIES_JWT_SECRET = "<output of: openssl rand -base64 42>"
```
The check is only active when the relevant feature is enabled, so deployments that do not use global async queries (or embedding) are not affected.
### Guest token revocation (opt-in)
Embedded guest tokens can be coarsely revoked at runtime via a new opt-in mechanism. A new config flag `GUEST_TOKEN_REVOCATION_ENABLED` (default `False`) gates the feature. When enabled, every minted guest token carries a revocation version, and tokens whose version is below the current expected version (stored in the metadata database) are rejected at validation time.
Bump the expected version with the new CLI command to invalidate all outstanding guest tokens:
```bash
superset revoke-guest-tokens
```
This change is backward compatible. The feature is off by default, and even when enabled nothing is revoked until an admin explicitly bumps the version: the expected version starts at `0`, and tokens minted before this change (which carry no version claim) are treated as version `0`. No database migration is required.
### Sessions are terminated when an account is disabled
Disabling a user account (setting `active` to `False`, via the admin UI, REST API, or CLI) now terminates that user's outstanding sessions on their next request, instead of relying on a passive check. This works for both client-side cookie sessions and server-side session stores via a per-user invalidation epoch (`user_attribute.sessions_invalidated_at`, added by a migration). The mechanism is inert for users that were never disabled (NULL epoch), so there is no behavior change for active users. Re-enabling an account and logging in again starts a fresh, valid session. The migration backfills the epoch for accounts that are already disabled at upgrade time, so re-enabling such an account does not revive a session that predates this feature.
### Opt-in SSH tunnel server host key verification
SSH tunnels can now optionally pin the expected SSH server host key as a defense-in-depth measure against man-in-the-middle attacks. paramiko's transport performs no known-hosts checking by default, so previously the SSH server's identity was not verified. This feature is opt-in and off by default; existing tunnels are unaffected.
- A new nullable `server_host_key` column on the `ssh_tunnels` table stores the expected host key in authorized-key form (e.g. `ssh-ed25519 AAAA...`). It is a public key and is stored in plaintext. It can be set via the SSH tunnel POST/PUT payloads (`ssh_tunnel.server_host_key`).
- When a tunnel has `server_host_key` set, Superset connects to the SSH server, reads the host key it presents, and rejects the tunnel if it does not match.
- A new config flag `SSH_TUNNEL_STRICT_HOST_KEY_CHECKING` (default `False`) controls fail-closed behavior. When `True`, every tunnel must declare a `server_host_key`; a tunnel without one is rejected.
Runbook to adopt:
1. Capture the SSH server's host key, e.g. `ssh-keyscan -t ed25519 ssh.example.com` (verify it out-of-band).
2. Set that value on the tunnel's `server_host_key` (via the database/SSH tunnel API or UI payload).
3. Optionally set `SSH_TUNNEL_STRICT_HOST_KEY_CHECKING = True` in `superset_config.py` to require host-key verification on all tunnels.
### Dataset import validates catalog against the target connection
Importing a dataset now validates the `catalog` field against the target database connection. When the connection has multi-catalog disabled (`allow_multi_catalog` off) and the dataset's catalog is not the connection's default catalog, the import fails instead of silently persisting the non-default catalog. This matches the validation already enforced on the dataset update path and prevents imported datasets from querying an unintended database.
If you relied on importing datasets with a non-default catalog, enable "Allow changing catalogs" on the target connection, or set the dataset's catalog to the connection's default before importing.
### Extension supply-chain controls (denylist + version policy)
Two opt-in static gates control which extensions are allowed to load:
- `EXTENSION_DENYLIST` refuses extensions matching an id (every version) or `id@version` (a single version), e.g. `["compromised-extension", "other-ext@1.2.3"]`.
- `EXTENSION_VERSION_POLICY` enforces a minimum version per extension id, e.g. `{"acme.widget": "1.2.0"}` (PEP 440 comparison); a release below the minimum is refused.
Both default to empty (no behavior change). They apply to both the `LOCAL_EXTENSIONS` and `EXTENSIONS_PATH` load paths.
### Dynamic Group By respects the sort toggle for display values
The Dynamic Group By chart customization now orders its display values according to the "Sort display control values" toggle: ascending (AZ), descending (ZA), or the dataset's source order when the toggle is unset. Previously the dropdown always sorted alphabetically. Existing dashboards where the toggle was never set will show options in source order instead of AZ; open the customization and enable the toggle to restore alphabetical ordering.
### Selectable encryption engine for app-encrypted fields (AES-GCM)
App-encrypted fields (database passwords, SSH tunnel credentials, OAuth tokens, etc.) can now use authenticated **AES-GCM** encryption instead of the historical unauthenticated **AES-CBC**. A new config selects the engine for the default adapter:
```python
# "aes" (AES-CBC, historical default) | "aes-gcm" (authenticated, recommended for new installs)
SQLALCHEMY_ENCRYPTED_FIELD_ENGINE = "aes"
```
**No action required / no behavior change:** the default remains `"aes"`, so existing installs are unaffected.
**Opting in on an existing install:** flipping the engine on a populated database without re-encrypting first will make stored secrets undecryptable, because the two ciphertext formats are not compatible. A migrator is provided. Recommended runbook:
1. Take a metadata-DB backup.
2. Re-encrypt existing secrets into the new engine (the `SECRET_KEY` is unchanged):
```bash
superset re-encrypt-secrets --engine aes-gcm
```
3. Set `SQLALCHEMY_ENCRYPTED_FIELD_ENGINE = "aes-gcm"` in your config.
4. Restart Superset.
5. Re-run the migrator once more after the restart:
```bash
superset re-encrypt-secrets --engine aes-gcm
```
A live instance keeps writing *new* secrets as AES-CBC during the window between step 2 and the restart in step 4; this second pass sweeps those up (it is idempotent, so already-migrated values are skipped).
Schedule the cutover in a quiet window. Runtime reads use only the single configured engine, so in a multi-worker deployment there is an unavoidable brief decrypt-outage between the migration commit and the last worker restarting with the new config — each migrator run is transactional, but the fleet-wide cutover is not zero-downtime.
The migration is transactional (all-or-nothing) and idempotent — it can be safely re-run or resumed. Note that AES-GCM, unlike AES-CBC, does not support querying directly over encrypted columns; audit any code that filters on an encrypted column before switching. See the SIP at `docs/sip/authenticated-encryption-at-rest.md` for details.
### Granular Export Controls
A new feature flag `GRANULAR_EXPORT_CONTROLS` introduces three fine-grained permissions that replace the legacy `can_csv` permission:

View File

@@ -61,31 +61,6 @@ services:
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/templates:/etc/nginx/templates:ro
# Wait for the webpack dev server's manifest.json to be served before
# starting nginx. This prevents 404s on static assets at startup. The
# probe targets host.docker.internal so it works regardless of whether
# the dev server runs in the superset-node container
# (BUILD_SUPERSET_FRONTEND_IN_DOCKER=true, the default) or directly on
# the host (BUILD_SUPERSET_FRONTEND_IN_DOCKER=false).
command:
- /bin/bash
- -c
- |
url="http://host.docker.internal:9000/static/assets/manifest.json"
max_attempts=150 # ~5 minutes at 2s intervals
echo "Waiting for webpack dev server at $url..."
attempt=0
until curl -sf --max-time 5 -o /dev/null "$url"; do
attempt=$((attempt + 1))
if [ "$attempt" -ge "$max_attempts" ]; then
echo "ERROR: webpack dev server did not serve $url after $max_attempts attempts (~5 minutes)." >&2
echo "Is the dev server running? With BUILD_SUPERSET_FRONTEND_IN_DOCKER=false you must start it on the host (e.g. 'npm run dev' in superset-frontend)." >&2
exit 1
fi
sleep 2
done
echo "Webpack dev server is ready; starting nginx."
exec nginx -g 'daemon off;'
redis:
image: redis:7

View File

@@ -80,23 +80,7 @@ case "${1}" in
;;
app)
echo "Starting web app (using development server)..."
# Environment-based debugger control for security
# Only enable Werkzeug interactive debugger when explicitly requested
# Modern Werkzeug (3.0+) includes PIN protection, but defense-in-depth approach
# Override FLASK_DEBUG so the effective state matches SUPERSET_DEBUG_ENABLED even
# when FLASK_DEBUG=true is inherited from docker/.env or .flaskenv
if [[ "${SUPERSET_DEBUG_ENABLED:-}" == "true" ]]; then
export FLASK_DEBUG=1
DEBUGGER_FLAG="--debugger"
echo " ⚠️ Werkzeug debugger enabled (requires PIN for /console access)"
else
export FLASK_DEBUG=0
DEBUGGER_FLAG="--no-debugger"
echo " 🔒 Werkzeug debugger disabled (set SUPERSET_DEBUG_ENABLED=true to enable)"
fi
flask run -p $PORT --reload $DEBUGGER_FLAG --host=0.0.0.0 --exclude-patterns "*/node_modules/*:*/.venv/*:*/build/*:*/__pycache__/*:*/superset-frontend/*"
flask run -p $PORT --reload --debugger --host=0.0.0.0 --exclude-patterns "*/node_modules/*:*/.venv/*:*/build/*:*/__pycache__/*:*/superset-frontend/*"
;;
app-gunicorn)
echo "Starting web app..."

View File

@@ -1 +1 @@
v24.16.0
v22.22.0

View File

@@ -86,39 +86,6 @@ instead requires a cachelib object.
See [Async Queries via Celery](/admin-docs/configuration/async-queries-celery) for details.
## Celery beat
Superset has a Celery task that will periodically warm up the cache based on different strategies.
To use it, add the following to your `superset_config.py`:
```python
from celery.schedules import crontab
from superset.config import CeleryConfig
# User that will be used to authenticate and render dashboards for cache warmup
SUPERSET_CACHE_WARMUP_USER = "user_with_permission_to_dashboards"
# Extend the default CeleryConfig to add cache warmup schedule
class CustomCeleryConfig(CeleryConfig):
beat_schedule = {
**CeleryConfig.beat_schedule,
'cache-warmup-hourly': {
'task': 'cache-warmup',
'schedule': crontab(minute=0, hour='*'), # hourly
'kwargs': {
'strategy_name': 'top_n_dashboards',
'top_n': 5,
'since': '7 days ago',
},
},
}
CELERY_CONFIG = CustomCeleryConfig
```
This will cache the top 5 most popular dashboards every hour. For other
strategies, check the `superset/tasks/cache.py` file.
## Caching Thumbnails
This is an optional feature that can be turned on by activating its [feature flag](/admin-docs/configuration/configuring-superset#feature-flags) on config:

View File

@@ -157,15 +157,8 @@ superset load_examples
superset init
# To start a development web server on port 8088, use -p to bind to another port
superset run -p 8088 --with-threads --reload
# For debugging with interactive console (⚠️ localhost only)
# superset run -p 8088 --with-threads --reload --debugger
superset run -p 8088 --with-threads --reload --debugger
```
:::warning Security Note
The `--debugger` flag enables Werkzeug's interactive console at `/console`. Only use this for local development and never bind to `0.0.0.0` or expose the server to networks when debugging is enabled.
:::
If everything worked, you should be able to navigate to `hostname:port` in your browser (e.g.
locally by default at `localhost:8088`) and login using the username and password you created.

View File

@@ -157,15 +157,8 @@ superset load_examples
superset init
# To start a development web server on port 8088, use -p to bind to another port
superset run -p 8088 --with-threads --reload
# For debugging with interactive console (⚠️ localhost only)
# superset run -p 8088 --with-threads --reload --debugger
superset run -p 8088 --with-threads --reload --debugger
```
:::warning Security Note
The `--debugger` flag enables Werkzeug's interactive console at `/console`. Only use this for local development and never bind to `0.0.0.0` or expose the server to networks when debugging is enabled.
:::
If everything worked, you should be able to navigate to `hostname:port` in your browser (e.g.
locally by default at `localhost:8088`) and login using the username and password you created.

View File

@@ -102,8 +102,6 @@ Affecting the Docker build process:
save some precious time on startup by `SUPERSET_LOAD_EXAMPLES=no docker compose up`
- **SUPERSET_LOG_LEVEL (default=info)**: Can be set to debug, info, warning, error, critical
for more verbose logging
- **SUPERSET_DEBUG_ENABLED (default=false)**: Enable Werkzeug debugger with interactive console.
Set to `true` for debugging: `SUPERSET_DEBUG_ENABLED=true docker compose up`
For more env vars that affect your configuration, see this
[superset_config.py](https://github.com/apache/superset/blob/master/docker/pythonpath_dev/superset_config.py)

View File

@@ -917,23 +917,6 @@ const config: Config = {
footer: {
links: [],
copyright: `
<div class="footer__social-links">
<a href="https://bit.ly/join-superset-slack" target="_blank" rel="noopener noreferrer" title="Join us on Slack" aria-label="Slack">
<img src="/img/community/slack-symbol.svg" alt="Slack" />
</a>
<a href="https://x.com/apachesuperset" target="_blank" rel="noopener noreferrer" title="Follow us on X" aria-label="X">
<img src="/img/community/x-symbol.svg" alt="X" />
</a>
<a href="https://www.linkedin.com/company/apache-superset" target="_blank" rel="noopener noreferrer" title="Follow us on LinkedIn" aria-label="LinkedIn">
<img src="/img/community/linkedin-symbol.svg" alt="LinkedIn" />
</a>
<a href="https://bsky.app/profile/apachesuperset.bsky.social" target="_blank" rel="noopener noreferrer" title="Follow us on Bluesky" aria-label="Bluesky">
<img src="/img/community/bluesky-symbol.svg" alt="Bluesky" />
</a>
<a href="https://reddit.com/r/apache-superset" target="_blank" rel="noopener noreferrer" title="Follow us on Reddit" aria-label="Reddit">
<img src="/img/community/reddit-symbol.svg" alt="Reddit" />
</a>
</div>
<div class="footer__ci-services">
<span>CI powered by</span>
<a href="https://www.netlify.com/" target="_blank" rel="nofollow noopener noreferrer"><img src="/img/netlify.png" alt="Netlify" title="Netlify - Deploy Previews" /></a>

View File

@@ -1,6 +1,6 @@
{
"copyright": {
"message": "\n <div class=\"footer__social-links\">\n <a href=\"https://bit.ly/join-superset-slack\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Join us on Slack\" aria-label=\"Slack\">\n <img src=\"/img/community/slack-symbol.svg\" alt=\"Slack\" />\n </a>\n <a href=\"https://x.com/apachesuperset\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow us on X\" aria-label=\"X\">\n <img src=\"/img/community/x-symbol.svg\" alt=\"X\" />\n </a>\n <a href=\"https://www.linkedin.com/company/apache-superset\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow us on LinkedIn\" aria-label=\"LinkedIn\">\n <img src=\"/img/community/linkedin-symbol.svg\" alt=\"LinkedIn\" />\n </a>\n <a href=\"https://bsky.app/profile/apachesuperset.bsky.social\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow us on Bluesky\" aria-label=\"Bluesky\">\n <img src=\"/img/community/bluesky-symbol.svg\" alt=\"Bluesky\" />\n </a>\n <a href=\"https://reddit.com/r/apache-superset\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"Follow us on Reddit\" aria-label=\"Reddit\">\n <img src=\"/img/community/reddit-symbol.svg\" alt=\"Reddit\" />\n </a>\n </div>\n <div class=\"footer__ci-services\">\n <span>CI powered by</span>\n <a href=\"https://www.netlify.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img src=\"/img/netlify.png\" alt=\"Netlify\" title=\"Netlify - Deploy Previews\" /></a>\n </div>\n <p>Copyright © 2026,\n The <a href=\"https://www.apache.org/\" target=\"_blank\" rel=\"noreferrer\">Apache Software Foundation</a>,\n Licensed under the Apache <a href=\"https://apache.org/licenses/LICENSE-2.0\" target=\"_blank\" rel=\"noreferrer\">License</a>.</p>\n <p><small>Apache Superset, Apache, Superset, the Superset logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation. All other products or name brands are trademarks of their respective holders, including The Apache Software Foundation.\n <a href=\"https://www.apache.org/\" target=\"_blank\">Apache Software Foundation</a> resources</small></p>\n <img class=\"footer__divider\" src=\"/img/community/line.png\" alt=\"Divider\" />\n <p>\n <small>\n <a href=\"/admin-docs/security/\" target=\"_blank\" rel=\"noreferrer\">Security</a>&nbsp;|&nbsp;\n <a href=\"https://www.apache.org/foundation/sponsorship.html\" target=\"_blank\" rel=\"noreferrer\">Donate</a>&nbsp;|&nbsp;\n <a href=\"https://www.apache.org/foundation/thanks.html\" target=\"_blank\" rel=\"noreferrer\">Thanks</a>&nbsp;|&nbsp;\n <a href=\"https://apache.org/events/current-event\" target=\"_blank\" rel=\"noreferrer\">Events</a>&nbsp;|&nbsp;\n <a href=\"https://apache.org/licenses/\" target=\"_blank\" rel=\"noreferrer\">License</a>&nbsp;|&nbsp;\n <a href=\"https://privacy.apache.org/policies/privacy-policy-public.html\" target=\"_blank\" rel=\"noreferrer\">Privacy</a>\n </small>\n </p>\n <!-- telemetry/analytics pixel: -->\n <img referrerPolicy=\"no-referrer-when-downgrade\" src=\"https://static.scarf.sh/a.png?x-pxid=39ae6855-95fc-4566-86e5-360d542b0a68\" />\n ",
"message": "\n <div class=\"footer__ci-services\">\n <span>CI powered by</span>\n <a href=\"https://www.netlify.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img src=\"/img/netlify.png\" alt=\"Netlify\" title=\"Netlify - Deploy Previews\" /></a>\n </div>\n <p>Copyright © 2026,\n The <a href=\"https://www.apache.org/\" target=\"_blank\" rel=\"noreferrer\">Apache Software Foundation</a>,\n Licensed under the Apache <a href=\"https://apache.org/licenses/LICENSE-2.0\" target=\"_blank\" rel=\"noreferrer\">License</a>.</p>\n <p><small>Apache Superset, Apache, Superset, the Superset logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation. All other products or name brands are trademarks of their respective holders, including The Apache Software Foundation.\n <a href=\"https://www.apache.org/\" target=\"_blank\">Apache Software Foundation</a> resources</small></p>\n <img class=\"footer__divider\" src=\"/img/community/line.png\" alt=\"Divider\" />\n <p>\n <small>\n <a href=\"/docs/security/\" target=\"_blank\" rel=\"noreferrer\">Security</a>&nbsp;|&nbsp;\n <a href=\"https://www.apache.org/foundation/sponsorship.html\" target=\"_blank\" rel=\"noreferrer\">Donate</a>&nbsp;|&nbsp;\n <a href=\"https://www.apache.org/foundation/thanks.html\" target=\"_blank\" rel=\"noreferrer\">Thanks</a>&nbsp;|&nbsp;\n <a href=\"https://apache.org/events/current-event\" target=\"_blank\" rel=\"noreferrer\">Events</a>&nbsp;|&nbsp;\n <a href=\"https://apache.org/licenses/\" target=\"_blank\" rel=\"noreferrer\">License</a>&nbsp;|&nbsp;\n <a href=\"https://privacy.apache.org/policies/privacy-policy-public.html\" target=\"_blank\" rel=\"noreferrer\">Privacy</a>\n </small>\n </p>\n <!-- telemetry/analytics pixel: -->\n <img referrerPolicy=\"no-referrer-when-downgrade\" src=\"https://static.scarf.sh/a.png?x-pxid=39ae6855-95fc-4566-86e5-360d542b0a68\" />\n ",
"description": "The footer copyright"
}
}

View File

@@ -43,7 +43,7 @@
"version:remove:components": "node scripts/manage-versions.mjs remove components"
},
"dependencies": {
"@ant-design/icons": "^6.2.5",
"@ant-design/icons": "^6.2.3",
"@docusaurus/core": "^3.10.1",
"@docusaurus/faster": "^3.10.1",
"@docusaurus/plugin-client-redirects": "^3.10.1",
@@ -72,11 +72,11 @@
"@superset-ui/core": "^0.20.4",
"@swc/core": "^1.15.40",
"antd": "^6.4.3",
"baseline-browser-mapping": "^2.10.34",
"caniuse-lite": "^1.0.30001797",
"baseline-browser-mapping": "^2.10.32",
"caniuse-lite": "^1.0.30001793",
"docusaurus-plugin-openapi-docs": "^5.0.2",
"docusaurus-theme-openapi-docs": "^5.0.2",
"js-yaml": "^4.2.0",
"js-yaml": "^4.1.1",
"js-yaml-loader": "^1.2.2",
"json-bigint": "^1.0.0",
"prism-react-renderer": "^2.4.1",
@@ -101,15 +101,15 @@
"@types/js-yaml": "^4.0.9",
"@types/react": "^19.1.8",
"@typescript-eslint/eslint-plugin": "^8.59.3",
"@typescript-eslint/parser": "^8.60.1",
"@typescript-eslint/parser": "^8.60.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-react": "^7.37.5",
"globals": "^17.6.0",
"prettier": "^3.8.3",
"typescript": "~6.0.3",
"typescript-eslint": "^8.60.1",
"typescript-eslint": "^8.60.0",
"webpack": "^5.107.2"
},
"browserslist": {

View File

@@ -1,136 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# SIP: Authenticated encryption (AES-GCM) for app-encrypted fields
## [DRAFT — proposal for discussion]
This document is a draft proposal accompanying the code in this PR. It is
intended to seed the formal SIP discussion. The code here ships the
backward-compatible engine selection **and** the re-encryption migrator
(Phases 12 below); both are opt-in and change nothing for existing installs by
default. Flipping the default for fresh installs (Phase 3) remains future work.
## Motivation
Superset app-encrypts a number of sensitive fields before persisting them to
the metadata database, including:
- database connection passwords and `encrypted_extra` (`superset/models/core.py`),
- SSH tunnel credentials — password, private key, private-key password
(`superset/databases/ssh_tunnel/models.py`),
- OAuth2 tokens and other secrets stored via `EncryptedType`.
These fields are encrypted with `sqlalchemy_utils.EncryptedType`, which
**defaults to `AesEngine` (AES-CBC)**. AES-CBC provides confidentiality but is
**unauthenticated**: it has no integrity tag. An attacker with write access to
the ciphertext (e.g. direct metadata-DB access, a backup, or a compromised
replica) can perform **bit-flipping / chosen-ciphertext manipulation** to
silently alter the decrypted plaintext of a secret without detection.
`AesGcmEngine` (AES-GCM) is authenticated encryption: tampering causes
decryption to fail loudly rather than yielding attacker-influenced plaintext.
Using authenticated encryption for secrets at rest is an ASVS L1 expectation
(11.3.2 / cryptography best practice).
`config.py` already documents that operators *can* switch to GCM by writing a
custom `AbstractEncryptedFieldAdapter`, but:
1. it is opt-in, undocumented as a security recommendation, and easy to miss;
2. there is **no migration path** — flipping the engine on a populated database
makes every existing secret undecryptable, because GCM ciphertext is not
format-compatible with CBC.
## Proposed change
A three-part change, delivered incrementally so existing deployments are never
broken:
### Phase 1 — engine selection (this PR)
- Add a `SQLALCHEMY_ENCRYPTED_FIELD_ENGINE` config (`"aes"` | `"aes-gcm"`),
**defaulting to `"aes"`** (no behavior change for existing installs).
- Teach the default `SQLAlchemyUtilsAdapter` to honor it (an explicit `engine`
kwarg still wins, so the migrator can pin an engine).
- This lets **new** deployments choose AES-GCM from day one with a one-line
config, instead of writing a custom adapter.
### Phase 2 — CBC→GCM re-encryption migrator (this PR)
The existing `SecretsMigrator` (previously only used for `SECRET_KEY` rotation)
gains an **engine migration** mode that:
1. discovers every `EncryptedType` column (via `discover_encrypted_fields()`),
2. decrypts each value with the **source** engine (AES-CBC) under the current
`SECRET_KEY`,
3. re-encrypts with the **target** engine (AES-GCM),
4. runs transactionally per the existing all-or-nothing semantics, and is
idempotent per column (already-migrated values are skipped), so a run can be
safely repeated or resumed.
Exposed via a new `--engine` option on the existing CLI command:
`superset re-encrypt-secrets --engine aes-gcm`, runnable by operators with a DB
backup in hand. The `SECRET_KEY` is unchanged; an engine change and a key
rotation can also be combined (pass `--previous_secret_key` as well).
### Phase 3 — flip the default for new installs
Once the migrator and docs are in place, change the default to `"aes-gcm"` for
**fresh** installs only (e.g. keyed off an empty metadata DB / documented in
`UPDATING.md`), keeping existing installs on `"aes"` until they run Phase 2.
## New or changed public interfaces
- New config: `SQLALCHEMY_ENCRYPTED_FIELD_ENGINE: Literal["aes", "aes-gcm"]`.
- New (Phase 2) CLI: `superset re-encrypt-secrets --engine <name>`.
- No schema changes; ciphertext format changes per migrated column.
## Migration plan and compatibility
- **Backward compatible by default.** Phase 1 changes nothing unless the
operator opts in.
- Switching an existing deployment to `"aes-gcm"` **without** running the Phase
2 migrator will make existing secrets undecryptable — this is called out in
the config comment and must be in `UPDATING.md`.
- Recommended operator runbook: take a metadata-DB backup → run
`re-encrypt-secrets --engine aes-gcm` → set
`SQLALCHEMY_ENCRYPTED_FIELD_ENGINE = "aes-gcm"` → restart → re-run
`re-encrypt-secrets --engine aes-gcm` once more to sweep up any secrets a live
instance wrote as AES-CBC during the cutover window. The canonical, more
detailed version of this runbook lives in `UPDATING.md`; this is a summary.
- `AesEngine` allows queryability over encrypted fields; AES-GCM does not.
Any code that filters/queries on an encrypted column directly must be audited
before Phase 3 (none is expected, but it must be verified).
## Rejected alternatives
- **Flip the default immediately.** Rejected: bricks every existing
deployment's secrets with no migration path.
- **Document-only (custom adapter).** Status quo; high friction and no
migration tooling — most operators will never do it.
## Open questions
- GCM→CBC rollback (for operators who need queryability) already works via the
same command (`re-encrypt-secrets --engine aes`), since the migrator is
engine-symmetric. Should rollback be documented as a supported path or
discouraged?
- The migrator already supports a concurrent `SECRET_KEY` rotation + engine
change in a single pass (pass `--previous_secret_key` alongside `--engine`).
Is that combination worth calling out in the operator docs, or kept advanced?

View File

@@ -260,45 +260,10 @@ a > span > svg {
.footer {
position: relative;
padding-top: 130px;
padding-top: 90px;
font-size: 15px;
}
.footer__social-links {
background-color: #173036;
position: absolute;
top: 52px;
left: 0;
width: 100%;
padding: 10px 0;
display: flex;
align-items: center;
justify-content: center;
gap: 24px;
}
.footer__social-links a {
display: inline-flex;
align-items: center;
transition: opacity 0.2s, transform 0.2s;
}
.footer__social-links a:hover {
opacity: 0.8;
transform: scale(1.1);
}
.footer__social-links img {
height: 24px;
width: 24px;
/* The brand SVGs ship in their native colors (e.g. Slack's dark aubergine,
X's near-black), which disappear on the dark footer. Render them all as
uniform white silhouettes. The icons are single-path glyphs whose
counters (the LinkedIn "in", Slack gaps, Reddit face) are transparent
cut-outs, so they stay legible against the footer background. */
filter: brightness(0) invert(1);
}
.footer__ci-services {
background-color: #0d3e49;
color: #e1e1e1;
@@ -344,21 +309,6 @@ a > span > svg {
}
@media only screen and (max-width: 996px) {
.footer {
padding-top: 120px;
}
.footer__social-links {
top: 44px;
gap: 20px;
padding: 8px 16px;
}
.footer__social-links img {
height: 20px;
width: 20px;
}
.footer__ci-services {
gap: 12px;
padding: 10px 16px;

View File

@@ -1,21 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" fill="#FF4500">
<path d="M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12c-.688 0-1.25.561-1.25 1.25 0 .687.562 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,21 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" fill="#4A154B">
<path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.124 2.521a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.52 2.521h-2.522V8.834zm-1.271 0a2.528 2.528 0 0 1-2.521 2.521 2.528 2.528 0 0 1-2.521-2.521V2.522A2.528 2.528 0 0 1 15.166 0a2.528 2.528 0 0 1 2.521 2.522v6.312zm-2.521 10.124a2.528 2.528 0 0 1 2.521 2.522A2.528 2.528 0 0 1 15.166 24a2.528 2.528 0 0 1-2.521-2.52v-2.522h2.521zm0-1.271a2.528 2.528 0 0 1-2.521-2.521 2.528 2.528 0 0 1 2.521-2.521h6.312A2.528 2.528 0 0 1 24 15.165a2.528 2.528 0 0 1-2.52 2.521h-6.313z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -212,14 +212,14 @@
resolved "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz"
integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==
"@ant-design/icons@^6.2.3", "@ant-design/icons@^6.2.5":
version "6.2.5"
resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-6.2.5.tgz#31c142aa6ce5eaf99598aaead222f4c459693512"
integrity sha512-0hKtoKqTjGFOndUyJLJmC9Cg6k4rEO7rLo6xmgbNJH+/ZX1C57RVals2v1j1knHl9n7Q+sBOveTvn931wLOCKw==
"@ant-design/icons@^6.2.3":
version "6.2.3"
resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-6.2.3.tgz#66e1c7fdea009b9c3fab6964062bedc76f308ad8"
integrity sha512-Pl3aoAtxQeKryYnt6VvDJtOxMOtA8wrRSACe/pTjOAIG3fdHrWm6Ivb4ku9tsFjYroSXBKirvuxG4QkwBXD9gg==
dependencies:
"@ant-design/colors" "^8.0.1"
"@ant-design/icons-svg" "^4.4.2"
"@rc-component/util" "^1.11.0"
"@rc-component/util" "^1.10.1"
clsx "^2.1.1"
"@ant-design/react-slick@~2.0.0":
@@ -265,15 +265,6 @@
js-tokens "^4.0.0"
picocolors "^1.1.1"
"@babel/code-frame@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7"
integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==
dependencies:
"@babel/helper-validator-identifier" "^7.29.7"
js-tokens "^4.0.0"
picocolors "^1.1.1"
"@babel/compat-data@^7.27.7", "@babel/compat-data@^7.28.0":
version "7.28.0"
resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz"
@@ -284,25 +275,20 @@
resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.6.tgz"
integrity sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==
"@babel/compat-data@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.7.tgz#6f0237f0f36d2e51c0570a636faed9d2d0efe629"
integrity sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==
"@babel/core@^7.21.3", "@babel/core@^7.25.9":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.7.tgz#80c10b17248082968b57a857b91640971f2070f7"
integrity sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/core/-/core-7.28.6.tgz"
integrity sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==
dependencies:
"@babel/code-frame" "^7.29.7"
"@babel/generator" "^7.29.7"
"@babel/helper-compilation-targets" "^7.29.7"
"@babel/helper-module-transforms" "^7.29.7"
"@babel/helpers" "^7.29.7"
"@babel/parser" "^7.29.7"
"@babel/template" "^7.29.7"
"@babel/traverse" "^7.29.7"
"@babel/types" "^7.29.7"
"@babel/code-frame" "^7.28.6"
"@babel/generator" "^7.28.6"
"@babel/helper-compilation-targets" "^7.28.6"
"@babel/helper-module-transforms" "^7.28.6"
"@babel/helpers" "^7.28.6"
"@babel/parser" "^7.28.6"
"@babel/template" "^7.28.6"
"@babel/traverse" "^7.28.6"
"@babel/types" "^7.28.6"
"@jridgewell/remapping" "^2.3.5"
convert-source-map "^2.0.0"
debug "^4.1.0"
@@ -332,17 +318,6 @@
"@jridgewell/trace-mapping" "^0.3.28"
jsesc "^3.0.2"
"@babel/generator@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.7.tgz#cca0b8827e6bcf3ba176788e7f3b180ad6db2fa3"
integrity sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==
dependencies:
"@babel/parser" "^7.29.7"
"@babel/types" "^7.29.7"
"@jridgewell/gen-mapping" "^0.3.12"
"@jridgewell/trace-mapping" "^0.3.28"
jsesc "^3.0.2"
"@babel/helper-annotate-as-pure@^7.27.1", "@babel/helper-annotate-as-pure@^7.27.3":
version "7.27.3"
resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz"
@@ -350,7 +325,7 @@
dependencies:
"@babel/types" "^7.27.3"
"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2":
"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2", "@babel/helper-compilation-targets@^7.28.6":
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz"
integrity sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==
@@ -361,17 +336,6 @@
lru-cache "^5.1.1"
semver "^6.3.1"
"@babel/helper-compilation-targets@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz#7a1def704302401c47f64fa85589e974ae217042"
integrity sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==
dependencies:
"@babel/compat-data" "^7.29.7"
"@babel/helper-validator-option" "^7.29.7"
browserslist "^4.24.0"
lru-cache "^5.1.1"
semver "^6.3.1"
"@babel/helper-create-class-features-plugin@^7.27.1", "@babel/helper-create-class-features-plugin@^7.28.3":
version "7.28.3"
resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.28.3.tgz"
@@ -410,11 +374,6 @@
resolved "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz"
integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==
"@babel/helper-globals@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b"
integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==
"@babel/helper-member-expression-to-functions@^7.27.1":
version "7.27.1"
resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz"
@@ -439,14 +398,6 @@
"@babel/traverse" "^7.28.6"
"@babel/types" "^7.28.6"
"@babel/helper-module-imports@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz#ef25048a518e828d7393fac5882ddd73921d7396"
integrity sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==
dependencies:
"@babel/traverse" "^7.29.7"
"@babel/types" "^7.29.7"
"@babel/helper-module-transforms@^7.27.1", "@babel/helper-module-transforms@^7.28.6":
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz"
@@ -456,15 +407,6 @@
"@babel/helper-validator-identifier" "^7.28.5"
"@babel/traverse" "^7.28.6"
"@babel/helper-module-transforms@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz#b062747a5997ba138637201328bbff77960574ae"
integrity sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==
dependencies:
"@babel/helper-module-imports" "^7.29.7"
"@babel/helper-validator-identifier" "^7.29.7"
"@babel/traverse" "^7.29.7"
"@babel/helper-optimise-call-expression@^7.27.1":
version "7.27.1"
resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz"
@@ -513,31 +455,16 @@
resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz"
integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==
"@babel/helper-string-parser@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f"
integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==
"@babel/helper-validator-identifier@^7.28.5":
version "7.28.5"
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz"
integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==
"@babel/helper-validator-identifier@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2"
integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==
"@babel/helper-validator-option@^7.27.1":
version "7.27.1"
resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz"
integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==
"@babel/helper-validator-option@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz#cf315be940213b354eb4abcc0bd01ebe3f73bc2a"
integrity sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==
"@babel/helper-wrap-function@^7.27.1":
version "7.28.3"
resolved "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.28.3.tgz"
@@ -547,13 +474,13 @@
"@babel/traverse" "^7.28.3"
"@babel/types" "^7.28.2"
"@babel/helpers@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.29.7.tgz#45abfde7548997e34376c3e69feb475cffb4a607"
integrity sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==
"@babel/helpers@^7.28.6":
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz"
integrity sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==
dependencies:
"@babel/template" "^7.29.7"
"@babel/types" "^7.29.7"
"@babel/template" "^7.28.6"
"@babel/types" "^7.28.6"
"@babel/parser@^7.28.6":
version "7.28.6"
@@ -569,13 +496,6 @@
dependencies:
"@babel/types" "^7.29.0"
"@babel/parser@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.7.tgz#837b87387cbf5ec5530cb634b3c622f68edb9334"
integrity sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==
dependencies:
"@babel/types" "^7.29.7"
"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.27.1":
version "7.27.1"
resolved "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz"
@@ -1252,15 +1172,6 @@
"@babel/parser" "^7.28.6"
"@babel/types" "^7.28.6"
"@babel/template@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700"
integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==
dependencies:
"@babel/code-frame" "^7.29.7"
"@babel/parser" "^7.29.7"
"@babel/types" "^7.29.7"
"@babel/traverse@^7.25.9", "@babel/traverse@^7.27.1", "@babel/traverse@^7.28.0", "@babel/traverse@^7.28.3", "@babel/traverse@^7.28.6":
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.6.tgz"
@@ -1287,19 +1198,6 @@
"@babel/types" "^7.29.0"
debug "^4.3.1"
"@babel/traverse@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.7.tgz#c47b07a41b95da0907d026b5dd894d98de7d2f2d"
integrity sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==
dependencies:
"@babel/code-frame" "^7.29.7"
"@babel/generator" "^7.29.7"
"@babel/helper-globals" "^7.29.7"
"@babel/parser" "^7.29.7"
"@babel/template" "^7.29.7"
"@babel/types" "^7.29.7"
debug "^4.3.1"
"@babel/types@^7.21.3", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.6", "@babel/types@^7.4.4":
version "7.28.6"
resolved "https://registry.npmjs.org/@babel/types/-/types-7.28.6.tgz"
@@ -1316,14 +1214,6 @@
"@babel/helper-string-parser" "^7.27.1"
"@babel/helper-validator-identifier" "^7.28.5"
"@babel/types@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.7.tgz#8005e31d82712ee7adaef6e23c63b71a62770a92"
integrity sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==
dependencies:
"@babel/helper-string-parser" "^7.29.7"
"@babel/helper-validator-identifier" "^7.29.7"
"@braintree/sanitize-url@^7.1.1":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-7.1.2.tgz#ca2035b0fefe956a8676ff0c69af73e605fcd81f"
@@ -3131,10 +3021,10 @@
os-homedir "^1.0.1"
regexpu-core "^4.5.4"
"@pkgr/core@^0.3.6":
version "0.3.6"
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.3.6.tgz#3569708bd4be4d8870ba32bf1c456dac81600d97"
integrity sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==
"@pkgr/core@^0.2.9":
version "0.2.9"
resolved "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz"
integrity sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==
"@pnpm/config.env-replace@^1.1.0":
version "1.1.0"
@@ -4922,110 +4812,110 @@
dependencies:
"@types/yargs-parser" "*"
"@typescript-eslint/eslint-plugin@8.60.1", "@typescript-eslint/eslint-plugin@^8.59.3":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.60.1.tgz#c1060bb8fa4be80624d3f3dec8dd9caca373af76"
integrity sha512-JQ4S5GB0tfjO8BuJ4fcX+HodkzJjYBV+7OJ+wLygaX7OGQ7FudyHL4NSCA6ob+w3Yn+5MkKIozOwQhXeM7opVg==
"@typescript-eslint/eslint-plugin@8.60.0", "@typescript-eslint/eslint-plugin@^8.59.3":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.60.0.tgz#8fc1e0a950c43270eaf0212dc060f7edaa42f9cf"
integrity sha512-QYb/sa74/s7OKMbACMjrYnGspj9Hs5YI5aaffSL65UfeBUzVzBJfVo3oWSpbzPurvm7yaCCo2Lk7lVj610HqKw==
dependencies:
"@eslint-community/regexpp" "^4.12.2"
"@typescript-eslint/scope-manager" "8.60.1"
"@typescript-eslint/type-utils" "8.60.1"
"@typescript-eslint/utils" "8.60.1"
"@typescript-eslint/visitor-keys" "8.60.1"
"@typescript-eslint/scope-manager" "8.60.0"
"@typescript-eslint/type-utils" "8.60.0"
"@typescript-eslint/utils" "8.60.0"
"@typescript-eslint/visitor-keys" "8.60.0"
ignore "^7.0.5"
natural-compare "^1.4.0"
ts-api-utils "^2.5.0"
"@typescript-eslint/parser@8.60.1", "@typescript-eslint/parser@^8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.60.1.tgz#a9d7f30850384d34b41f4687dd8944823c09e289"
integrity sha512-A0M6ua6H252bVjPvvtSgl2QA4+ET9S5Mtkb2GDyTxIhH/C4qDItT7RQNO5PhMC6NXGYXOR9dIalcDDgBKT7oFA==
"@typescript-eslint/parser@8.60.0", "@typescript-eslint/parser@^8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.60.0.tgz#38d611b8e658cb10850d4975e8a175a222fbcd6a"
integrity sha512-fcqpj/MyK4sxDPcbe7STNPbpQL4RLZOPWuaTmwZYuc+hJKzRf58yRxfhqGpc6PIq9ZyfSBpfHgmUHmHs0KwHwg==
dependencies:
"@typescript-eslint/scope-manager" "8.60.1"
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/typescript-estree" "8.60.1"
"@typescript-eslint/visitor-keys" "8.60.1"
"@typescript-eslint/scope-manager" "8.60.0"
"@typescript-eslint/types" "8.60.0"
"@typescript-eslint/typescript-estree" "8.60.0"
"@typescript-eslint/visitor-keys" "8.60.0"
debug "^4.4.3"
"@typescript-eslint/project-service@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.60.1.tgz#eb29712f58d72c222fc727162e92f2ab4670971b"
integrity sha512-eXkTH2bxmXlqD1RnOPmLZ9ZM9D3VwSx04JOwBnP9RQ+yUA5a2Mu7SfW8uaV2Aon53NJzZlZYuX7tn91Izf+xaw==
"@typescript-eslint/project-service@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.60.0.tgz#b82ab12e64d005d0c7163d1240c432381f1bde0f"
integrity sha512-aZu74NNKJeUWqCjDddzdiKaS82dgYgV/vmf+Ui3ZdZejmgfXR/q+pRumgobnQ2cCJTgGTWp4ypiwsuofFubavg==
dependencies:
"@typescript-eslint/tsconfig-utils" "^8.60.1"
"@typescript-eslint/types" "^8.60.1"
"@typescript-eslint/tsconfig-utils" "^8.60.0"
"@typescript-eslint/types" "^8.60.0"
debug "^4.4.3"
"@typescript-eslint/scope-manager@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.60.1.tgz#2f875962eaad0a0789cc3c36aea9b4ddeb2dd9c8"
integrity sha512-gvI5OQoptnxQnchOirukCuQ55svJSTuD/4k5+pC267xyBtYry748R9/c3tYUzb/iE6RZfllRz2lVulLCHkTm4w==
"@typescript-eslint/scope-manager@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.60.0.tgz#7617a4617c043fe235dcf066f9a40f106cfd2fd5"
integrity sha512-pFzqhllJMs+jghLQWzV00ds39xLzuyqPSev5pd8f4Ir0rtKR3ZLUB4/4dhjOFighWb9larvtfJvqL+4yKDI3Xw==
dependencies:
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/visitor-keys" "8.60.1"
"@typescript-eslint/types" "8.60.0"
"@typescript-eslint/visitor-keys" "8.60.0"
"@typescript-eslint/tsconfig-utils@8.60.1":
"@typescript-eslint/tsconfig-utils@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.60.0.tgz#3af78c48956227a407dea9626b8db8ca53f130d2"
integrity sha512-BZPR3RGYlAXnly6ymAxfkVn5rCbZzQNou0rxv3GfWZ8cTQp+hhVd73khbGLAd8k1TlAPLISH337M+tAgAnaJDQ==
"@typescript-eslint/tsconfig-utils@^8.60.0":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.60.1.tgz#bee8b942a13679a878101c9c74577d732062ed93"
integrity sha512-nh8w4qAteiKuZu3pSSzG/yGKpw0OlkrKnzFmbVRenKaD4qc+7i1GrmZaLVkr8rk4uipiPGMOW4YsM6WmKZ5CvA==
"@typescript-eslint/tsconfig-utils@^8.60.1":
version "8.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.61.0.tgz#05d6e3ff20001674ebcd22d03dac29ee448043ba"
integrity sha512-O5Amvdv9ztMpxpf+vmFULGG78IE6Qwdr3bCGvqwG4nwc9H2qXkOYJJnRbRHyMkQTjv1d03olqwwwzHLMqpFePQ==
"@typescript-eslint/type-utils@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.60.1.tgz#1ae45f0f2a701354beea4a58c2161e40a5e3c379"
integrity sha512-sdwTrpjosW7ANQYJ39ZBF1ZyEMEGVB2UsikrserVM/30a/F1dTLnu9bGxEdosugyu5caigjLrR2qiD11asjI1A==
"@typescript-eslint/type-utils@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.60.0.tgz#6971a61bc4f3a1b2df45dcc14e26a43a88a4cb6a"
integrity sha512-SX46wEUtitCpq7AN38HkUU/+zvUpdKf7ephtWAFgckH8O7PQIyL5gvrhQgBLuEYgLfuKWOVvWVskMbuFHAz5xg==
dependencies:
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/typescript-estree" "8.60.1"
"@typescript-eslint/utils" "8.60.1"
"@typescript-eslint/types" "8.60.0"
"@typescript-eslint/typescript-estree" "8.60.0"
"@typescript-eslint/utils" "8.60.0"
debug "^4.4.3"
ts-api-utils "^2.5.0"
"@typescript-eslint/types@8.60.1":
"@typescript-eslint/types@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.60.0.tgz#e77ad768e933263b1960b2fe79de75fe1cc6e7db"
integrity sha512-AsE7x2XaAK+CVbeih0Fvbn+r1qHxtpLDJ3XUuFcIinT318T90yHMJC+Zgv+jUuDjQQd06HKwxnDu6sz1IcTilA==
"@typescript-eslint/types@^8.60.0":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.60.1.tgz#ccdc482ba9e17f9723a10ce240b5e67dad3046c4"
integrity sha512-4h0tY8ppCkdCzcrl2YM5M3my0xsE1Tf8om3owEu5oPWmXwkKRmk0j0LGDzYBGUcAlesEbxBhazqu/K4cu3Ug7w==
"@typescript-eslint/types@^8.60.1":
version "8.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.61.0.tgz#0ddb46e012a4288292950bdd253db42f278ce64d"
integrity sha512-9QTQpZ5Iin4CdIodfbDQFSeiSJKidgYJYug1P9CC2xWgUTvlmixViqDZNciMjwLBZyJnG4tGmPl97rVAFb1AJg==
"@typescript-eslint/typescript-estree@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.60.1.tgz#016630b119228bf483ddc652703a6a038f3fdd74"
integrity sha512-alpRkfG8hlVE5kdJW2GkfgDgXxold3e8e4l6EnmhRmRLbekgAPCCGDVD++sABy9FcgPFroq+uFcCSM1vR57Cew==
"@typescript-eslint/typescript-estree@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.60.0.tgz#c102196a44414481190041c99eea1d854e66001b"
integrity sha512-3AcZNBGMClm6CXDyo8kYvVGT/sx29sS0oBsIb9oZI2gunA4Vm2M3YHzRLPvsUBBsl+yB5FPtltq7gGH0iTlp9g==
dependencies:
"@typescript-eslint/project-service" "8.60.1"
"@typescript-eslint/tsconfig-utils" "8.60.1"
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/visitor-keys" "8.60.1"
"@typescript-eslint/project-service" "8.60.0"
"@typescript-eslint/tsconfig-utils" "8.60.0"
"@typescript-eslint/types" "8.60.0"
"@typescript-eslint/visitor-keys" "8.60.0"
debug "^4.4.3"
minimatch "^10.2.2"
semver "^7.7.3"
tinyglobby "^0.2.15"
ts-api-utils "^2.5.0"
"@typescript-eslint/utils@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.60.1.tgz#31cf566095602d9fe8ad91837d2eb520b8de762b"
integrity sha512-h2MPBLoNtjc3qZWfY3Tl51yPorQ2McHn8pJfcMNTcIvrrZrr90Ykffit0yjrPFWQcRcUxzH20+6OcVdW4yHtUg==
"@typescript-eslint/utils@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.60.0.tgz#6110cddaef87606ae4ca6f8bf81bb5949fc8e098"
integrity sha512-HtXuPfrHTyBDkameWpl+vJb1Uevu2tznAyahM1Oc4AENidCLTPiZDWIo4GfcxNdC/RcfGcadzzkqbRG87dUrQA==
dependencies:
"@eslint-community/eslint-utils" "^4.9.1"
"@typescript-eslint/scope-manager" "8.60.1"
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/typescript-estree" "8.60.1"
"@typescript-eslint/scope-manager" "8.60.0"
"@typescript-eslint/types" "8.60.0"
"@typescript-eslint/typescript-estree" "8.60.0"
"@typescript-eslint/visitor-keys@8.60.1":
version "8.60.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.60.1.tgz#165d1d8901137b944efaf18f00ab5ecb57f06995"
integrity sha512-EbGRQg4FhrmwLodl+t3JNAnXHWVr9Vp+Zl1QBZVPY4ByfkzIT8cX3K6QWODHtkIZqqJVEWvhHSx3v5PDHsaQag==
"@typescript-eslint/visitor-keys@8.60.0":
version "8.60.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.60.0.tgz#f2c41eedd3d7b03b808369fb2e3fb40a93783ec2"
integrity sha512-9WI52t8ZGLVGrPMBet25yAftqY/n95+zmoUUtJBBQTKDSKUu7OsPTroT2op7U9JatkoRccL0YkWDNMFfC4Sjxg==
dependencies:
"@typescript-eslint/types" "8.60.1"
"@typescript-eslint/types" "8.60.0"
eslint-visitor-keys "^5.0.0"
"@ungap/structured-clone@^1.0.0":
@@ -5688,10 +5578,10 @@ base64-js@^1.3.1, base64-js@^1.5.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
baseline-browser-mapping@^2.10.34, baseline-browser-mapping@^2.9.0, baseline-browser-mapping@^2.9.19:
version "2.10.34"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.34.tgz#dedb606362446777cfe328d30d4ee15056d06303"
integrity sha512-IMDedajPifLnHNY0X9n8hKxRTQ6/eTHwr5bDo04WnuqxyKw6LYtQywCuuqPZwhl3aBXMvQpJov42GLCwRRdQzw==
baseline-browser-mapping@^2.10.32, baseline-browser-mapping@^2.9.0, baseline-browser-mapping@^2.9.19:
version "2.10.32"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.32.tgz#b6b553a4285fdd606327a617de36a5351e3aaa64"
integrity sha512-wbPvpyjJPC0zdfdKXxqEL3Ea+bOMD/87X4lftiJkkaBiuG6ALQy1SLmEd7BSmVCuwCQsBrCamgBoLyfFDD1EPg==
batch@0.6.1:
version "0.6.1"
@@ -5934,10 +5824,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001759, caniuse-lite@^1.0.30001797:
version "1.0.30001797"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001797.tgz#1332709e1439f01ff92085dd17001e0a45897ec0"
integrity sha512-l8xKG+gwAIExZGl9FrF7KUwuOmk6wbEPC9Xoy/RtnWv1XG0Q4LFlagaLpUv3Kiza3W/wm27zy0yWJEieYKAP6w==
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001759, caniuse-lite@^1.0.30001793:
version "1.0.30001793"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz#238887ddf5fcfc8c36d872394d0a78a517312a72"
integrity sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==
ccount@^2.0.0:
version "2.0.1"
@@ -7632,13 +7522,13 @@ eslint-config-prettier@^10.1.8:
resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz"
integrity sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==
eslint-plugin-prettier@^5.5.6:
version "5.5.6"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.6.tgz#363ebe4d769bce157ccdd8129ce3efd91dc62564"
integrity sha512-ifetmTcxWfz+4qRW3pH/ujdTq2jQIj59AxJMIN26K5avYgU8dxycUETQonWiW+wPrYXA0j3Try0l1CnwVQtDqQ==
eslint-plugin-prettier@^5.5.5:
version "5.5.5"
resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.5.tgz"
integrity sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==
dependencies:
prettier-linter-helpers "^1.0.1"
synckit "^0.11.13"
synckit "^0.11.12"
eslint-plugin-react@^7.37.5:
version "7.37.5"
@@ -9410,9 +9300,9 @@ jiti@^1.20.0:
integrity sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==
joi@^17.9.2:
version "17.13.4"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.4.tgz#ad6153d97ce558eb3a3b593e0d43eab51df1c474"
integrity sha512-1RuuER6kmt8K8I3nIWvPZKi5RQCb568ZPyY4Pwjlua+yo+63ZTmIwxLZH0heBmiKN4uxjvCiarDrjaeH84xicQ==
version "17.13.3"
resolved "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz"
integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==
dependencies:
"@hapi/hoek" "^9.3.0"
"@hapi/topo" "^5.1.0"
@@ -9451,7 +9341,7 @@ js-yaml@4.1.0:
dependencies:
argparse "^2.0.1"
js-yaml@=4.1.1:
js-yaml@=4.1.1, js-yaml@^4.1.0, js-yaml@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b"
integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==
@@ -9466,13 +9356,6 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"
js-yaml@^4.1.0, js-yaml@^4.1.1, js-yaml@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.2.0.tgz#2bd9e85682dd91bd469afb809d816043b3d49524"
integrity sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==
dependencies:
argparse "^2.0.1"
jsdoc-type-pratt-parser@^4.0.0:
version "4.8.0"
resolved "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.8.0.tgz"
@@ -9642,12 +9525,12 @@ latest-version@^7.0.0:
package-json "^8.1.0"
launch-editor@^2.6.1:
version "2.14.1"
resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.14.1.tgz#f7e0da3f58aaea03fea01074d840b5f739ed7ddc"
integrity sha512-QWBrQsMpH7gPr965dsKD/3cKWiNoTjpATQf++Xq63N6sKRGMwlVXz41O1IZTMfZQgBctD/K5Zt06+/I6pP6+HA==
version "2.11.1"
resolved "https://registry.npmjs.org/launch-editor/-/launch-editor-2.11.1.tgz"
integrity sha512-SEET7oNfgSaB6Ym0jufAdCeo3meJVeCaaDyzRygy0xsp2BFKCprcfHljTq4QkzTLUxEKkFK6OK4811YM2oSrRg==
dependencies:
picocolors "^1.1.1"
shell-quote "^1.8.4"
shell-quote "^1.8.3"
layout-base@^1.0.0:
version "1.0.2"
@@ -13599,10 +13482,10 @@ shebang-regex@^3.0.0:
resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
shell-quote@^1.8.4:
version "1.8.4"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.4.tgz#2edd9a4dcefc96649e2e2cb12f637b1f1d92a190"
integrity sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ==
shell-quote@^1.8.3:
version "1.8.3"
resolved "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz"
integrity sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==
shelljs@0.8.5:
version "0.8.5"
@@ -14213,12 +14096,12 @@ swc-loader@^0.2.6, swc-loader@^0.2.7:
dependencies:
"@swc/counter" "^0.1.3"
synckit@^0.11.13:
version "0.11.13"
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.13.tgz#062a5ea57d81befc35892f8254de5c567e97c80a"
integrity sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==
synckit@^0.11.12:
version "0.11.12"
resolved "https://registry.npmjs.org/synckit/-/synckit-0.11.12.tgz"
integrity sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==
dependencies:
"@pkgr/core" "^0.3.6"
"@pkgr/core" "^0.2.9"
tapable@^2.0.0, tapable@^2.2.1, tapable@^2.3.0, tapable@^2.3.3:
version "2.3.3"
@@ -14499,15 +14382,15 @@ types-ramda@^0.30.1:
dependencies:
ts-toolbelt "^9.6.0"
typescript-eslint@^8.60.1:
version "8.60.1"
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.60.1.tgz#13db05c6eabb89669deec44545b788a0e9aee640"
integrity sha512-6m5hkkRAp8lKvhVpcprAIn5KkehQEh+47oHH2VGnExEh7dhNxXlg6GPAOIu6TxbVQxhebrJDvjl3020ooiWCMA==
typescript-eslint@^8.60.0:
version "8.60.0"
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.60.0.tgz#6686fecb1f4f367c0bf0075828e93b7ecacbc62b"
integrity sha512-9f65qWLZdAW9m1JaxBDUHcqRUfL8bkxxXL7XxEfI+F09q56PkBvIfCjLF3yInsDM/BBmwkqmCQdCZe/RYlIWEw==
dependencies:
"@typescript-eslint/eslint-plugin" "8.60.1"
"@typescript-eslint/parser" "8.60.1"
"@typescript-eslint/typescript-estree" "8.60.1"
"@typescript-eslint/utils" "8.60.1"
"@typescript-eslint/eslint-plugin" "8.60.0"
"@typescript-eslint/parser" "8.60.0"
"@typescript-eslint/typescript-estree" "8.60.0"
"@typescript-eslint/utils" "8.60.0"
typescript@~6.0.3:
version "6.0.3"

138
extensions/chat/README.md Normal file
View File

@@ -0,0 +1,138 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Reference Chatbot Extension
Canonical environment-validation extension for the `superset.chatbot`
contribution area. **Not** a product chatbot — there is no LLM, no backend,
no persistence. Its purpose is to exercise the extension platform end-to-end:
- `views.registerView` at `superset.chatbot` (singleton resolution)
- Lifecycle activation + a master disposable that tears down everything
- `commands.registerCommand` for `core.chatbot__open|close|toggle`
- Mock streaming with `AbortController` cancellation on dispose
- Defense-in-depth React error boundary inside the panel
- A single P3 page-context seam that lights up automatically as the
`dashboard` / `explore` / `dataset` / `navigation` namespaces become
available at runtime on the host
It is intended as the reference implementation third-party chatbot extension
authors copy. Anything that ships as host-internal (the mount point, the
admin picker, the `getActiveChatbot` resolver) is **not** here — see the
host side at `superset-frontend/src/components/ChatbotMount/` and
`superset-frontend/src/core/chatbot/`.
## Layout
```
extensions/chat/
├── extension.json Manifest (app.chatbot view + commands)
├── package.json
├── tsconfig.json
├── webpack.config.js ModuleFederation → window.superset
├── jest.config.js Self-contained unit tests
└── src/
├── index.tsx MF entry — calls activate() once
├── activate.ts Returns master disposable
├── commands.ts core.chatbot__open|close|toggle
├── state.ts Module-scoped open/closed + emitter
├── ReferenceChatbot.tsx Root component (bubble ↔ panel)
├── components/
│ ├── Bubble.tsx
│ ├── Panel.tsx
│ └── ErrorBoundary.tsx
├── streaming/
│ ├── mockStream.ts AsyncIterable<string> + AbortSignal
│ └── registry.ts Cross-component abort tracking
├── context/
│ └── pageContext.ts P3 namespace seam (defensive)
└── __tests__/
├── sdkMock.ts In-memory @apache-superset/core mock
└── activate.test.tsx
```
## Run the unit tests
```bash
cd extensions/chat
npm install # first time only
npx jest
```
The tests mock `@apache-superset/core` via `src/__tests__/sdkMock.ts` so they
do not depend on host runtime wiring.
## Build / bundle for deployment
```bash
# from the extension folder
npm install
npm run build
# packaging into a .supx is handled by the Superset extensions CLI
pip install apache-superset-extensions-cli
superset-extensions bundle # produces apache-superset.reference-chatbot-0.1.0.supx
```
Drop the `.supx` into the `EXTENSIONS_PATH` of a Superset instance that has
`FEATURE_FLAGS = { "ENABLE_EXTENSIONS": True }`.
## Selecting it as the active chatbot
The host's singleton picker reads `active_chatbot_id` from the admin
settings endpoint (`/api/v1/extensions/settings`). Set it to:
```
apache-superset.reference-chatbot
```
If no admin selection exists, the host falls back to the first-to-register
chatbot — installing this extension alone is enough for the bubble to appear.
## P3 integration seams
All page-context derivation lives in [`src/context/pageContext.ts`](src/context/pageContext.ts).
Each namespace branch (`dashboard`, `explore`, `dataset`, `navigation`) is
called defensively — when the host implementation lands, the returned value
becomes non-undefined automatically with no other change in the extension.
The panel re-reads context on `popstate`. Once `navigation.onDidChangePage`
is live on the host, the panel's `useEffect` should subscribe to it instead;
that is the only file in the extension that needs to change for full P3
context sync.
## Known intentional non-features
- No conversation persistence — by design (extension scope per SIP §2).
- No real network. The mock stream is a `setTimeout` token emitter so the
cancellation contract is exercised without external dependencies.
- No keyboard shortcut binding (Cmd+K). Extensions own that, but it adds
surface area not needed for platform validation.
- No notification badge / icon mutation. SIP §3.2 recommends static icons;
the bubble re-renders freely already.
## TODOs
- **P1**: if/when the host gains `deactivate(): Promise<void>`, wrap the
master disposer in `activate.ts` to flush async work before returning.
- **P3**: replace the `popstate` listener in `Panel.tsx` with
`navigation.onDidChangePage` once that event is wired up host-side.
- **P4**: if the host pre-registers `core.chatbot__*` as host-owned intents,
swap `commands.registerCommand` for the implementation hook in
`commands.ts`. Command IDs do not change.

View File

@@ -0,0 +1,40 @@
{
"publisher": "apache-superset",
"name": "reference-chatbot",
"displayName": "Reference Chatbot",
"description": "Canonical environment-validation chatbot extension for the superset.chatbot contribution area. Exercises registration, lifecycle, singleton resolution, commands, fault isolation, and streaming teardown. Not a product chatbot.",
"version": "0.1.0",
"license": "Apache-2.0",
"permissions": [],
"contributes": {
"views": {
"app": {
"chatbot": [
{
"id": "apache-superset.reference-chatbot",
"name": "Reference Chatbot",
"description": "Validates the chatbot extension environment end-to-end.",
"icon": "Bubble"
}
]
}
},
"commands": [
{
"id": "core.chatbot__open",
"title": "Open chatbot",
"description": "Opens the reference chatbot panel."
},
{
"id": "core.chatbot__close",
"title": "Close chatbot",
"description": "Closes the reference chatbot panel."
},
{
"id": "core.chatbot__toggle",
"title": "Toggle chatbot",
"description": "Toggles the reference chatbot panel."
}
]
}
}

View File

@@ -0,0 +1,53 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const path = require('path');
// When run as a standalone package (`cd extensions/chat && npm test`), modules
// resolve from this folder's own node_modules. When run from the superset-frontend
// workspace (CI, dev convenience), resolve ts-jest there too.
const tsJest = (() => {
try {
require.resolve('ts-jest');
return 'ts-jest';
} catch {
return path.resolve(
__dirname,
'..',
'..',
'superset-frontend',
'node_modules',
'ts-jest',
);
}
})();
module.exports = {
testEnvironment: 'jsdom',
rootDir: __dirname,
testMatch: ['<rootDir>/src/**/*.test.{ts,tsx}'],
// When running from the extension folder without node_modules installed,
// resolve react / react-dom from the superset-frontend workspace.
modulePaths: [path.resolve(__dirname, '..', '..', 'superset-frontend', 'node_modules')],
moduleNameMapper: {
'^@apache-superset/core$': '<rootDir>/src/__tests__/sdkMock.ts',
},
transform: {
'^.+\\.tsx?$': [tsJest, { tsconfig: '<rootDir>/tsconfig.test.json' }],
},
};

View File

@@ -0,0 +1,26 @@
{
"name": "@apache-superset/reference-chatbot",
"version": "0.1.0",
"private": true,
"license": "Apache-2.0",
"description": "Reference chatbot extension that validates the Superset chatbot extension platform.",
"scripts": {
"start": "webpack serve --mode development",
"build": "webpack --stats-error-details --mode production"
},
"peerDependencies": {
"@apache-superset/core": "^0.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@apache-superset/core": "^0.1.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"ts-loader": "^9.5.0",
"typescript": "^5.0.0",
"webpack": "^5.0.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^5.0.0"
}
}

View File

@@ -0,0 +1,45 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useState } from 'react';
import { commands } from '@apache-superset/core';
import { Bubble } from './components/Bubble';
import { Panel } from './components/Panel';
import { ExtensionErrorBoundary } from './components/ErrorBoundary';
import { isOpen, subscribe } from './state';
/**
* Root extension component. Mirrors module-state into React via `subscribe`
* so the bubble↔panel transition is driven by the same command handlers
* that external callers use (`core.chatbot__open`, `__close`, `__toggle`).
*/
export const ReferenceChatbot: React.FC = () => {
const [open, setOpenState] = useState<boolean>(isOpen());
useEffect(() => subscribe(setOpenState), []);
return (
<ExtensionErrorBoundary>
{open ? (
<Panel onClose={() => commands.executeCommand('core.chatbot__close')} />
) : (
<Bubble onClick={() => commands.executeCommand('core.chatbot__open')} />
)}
</ExtensionErrorBoundary>
);
};

View File

@@ -0,0 +1,144 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { commands } from '@apache-superset/core';
import { registry, reset } from './sdkMock';
import { activate, VIEW_ID, CHATBOT_LOCATION } from '../activate';
import { isOpen } from '../state';
import { streamReply } from '../streaming/mockStream';
import {
registerActiveController,
unregisterActiveController,
abortAllActiveControllers,
} from '../streaming/registry';
beforeEach(() => {
reset();
});
test('registers one view at superset.chatbot and three chatbot commands', () => {
const disposable = activate();
try {
expect(registry.views.size).toBe(1);
const entry = registry.views.get(VIEW_ID);
expect(entry?.location).toBe(CHATBOT_LOCATION);
expect(entry?.view.icon).toBe('Bubble');
expect(Array.from(registry.commands.keys()).sort()).toEqual([
'core.chatbot__close',
'core.chatbot__open',
'core.chatbot__toggle',
]);
} finally {
disposable.dispose();
}
});
test('executeCommand drives open/close/toggle through module state', async () => {
const disposable = activate();
try {
expect(isOpen()).toBe(false);
await commands.executeCommand('core.chatbot__open');
expect(isOpen()).toBe(true);
await commands.executeCommand('core.chatbot__toggle');
expect(isOpen()).toBe(false);
await commands.executeCommand('core.chatbot__toggle');
expect(isOpen()).toBe(true);
await commands.executeCommand('core.chatbot__close');
expect(isOpen()).toBe(false);
} finally {
disposable.dispose();
}
});
test('disposing the master disposable unregisters view + commands', () => {
const disposable = activate();
expect(registry.views.size).toBe(1);
expect(registry.commands.size).toBe(3);
disposable.dispose();
expect(registry.views.size).toBe(0);
expect(registry.commands.size).toBe(0);
});
test('disposal is idempotent', () => {
const disposable = activate();
disposable.dispose();
expect(() => disposable.dispose()).not.toThrow();
expect(registry.views.size).toBe(0);
});
test('re-activate after dispose works (validates replace semantics)', () => {
const first = activate();
first.dispose();
const second = activate();
try {
expect(registry.views.size).toBe(1);
expect(registry.commands.size).toBe(3);
expect(isOpen()).toBe(false); // resetState() cleared open flag
} finally {
second.dispose();
}
});
test('aborting an active controller stops the stream cleanly', async () => {
const controller = new AbortController();
registerActiveController(controller);
const iter = streamReply('hello world', controller.signal);
const received: string[] = [];
const consume = (async () => {
for await (const tok of iter) received.push(tok);
})();
// Abort after a single tick — the iterator must return without throwing.
await new Promise(r => setTimeout(r, 50));
abortAllActiveControllers();
await expect(consume).resolves.toBeUndefined();
unregisterActiveController(controller);
expect(received.length).toBeLessThan(20); // would be ~20+ tokens if uncancelled
});
test('disposing the extension aborts any in-flight controller', async () => {
const disposable = activate();
const controller = new AbortController();
registerActiveController(controller);
const iter = streamReply('a longer prompt to ensure many tokens', controller.signal);
const consume = (async () => {
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
for await (const _tok of iter) {
// drain
}
})();
await new Promise(r => setTimeout(r, 30));
disposable.dispose();
await expect(consume).resolves.toBeUndefined();
expect(controller.signal.aborted).toBe(true);
});

View File

@@ -0,0 +1,119 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* In-memory mock of `@apache-superset/core` for unit-testing the extension.
*
* Mirrors only the surfaces the reference chatbot consumes:
* - views.registerView returns a disposable that removes the view
* - commands.registerCommand / executeCommand round-trip handlers
* - sqlLab.getCurrentTab returns undefined (no SQL Lab in tests)
*
* The mock is intentionally observable: tests can read `registry.views` and
* `registry.commands` to assert contract compliance.
*/
import type { ReactElement } from 'react';
type Provider = () => ReactElement;
interface ViewDescriptor {
id: string;
name: string;
icon?: string;
description?: string;
}
interface DisposableLike {
dispose(): void;
}
interface RegisteredView {
view: ViewDescriptor;
location: string;
provider: Provider;
}
interface RegisteredCommand {
id: string;
title: string;
handler: (...args: any[]) => any;
}
export const registry = {
views: new Map<string, RegisteredView>(),
commands: new Map<string, RegisteredCommand>(),
};
export const reset = (): void => {
registry.views.clear();
registry.commands.clear();
};
export const views = {
registerView(
view: ViewDescriptor,
location: string,
provider: Provider,
): DisposableLike {
registry.views.set(view.id, { view, location, provider });
return {
dispose: () => {
registry.views.delete(view.id);
},
};
},
getViews(location: string) {
return Array.from(registry.views.values())
.filter(v => v.location === location)
.map(v => v.view);
},
};
export const commands = {
registerCommand(
command: { id: string; title: string },
handler: (...args: any[]) => any,
): DisposableLike {
registry.commands.set(command.id, {
id: command.id,
title: command.title,
handler,
});
return {
dispose: () => {
registry.commands.delete(command.id);
},
};
},
async executeCommand(id: string, ...rest: any[]): Promise<unknown> {
const cmd = registry.commands.get(id);
return cmd?.handler(...rest);
},
getCommands() {
return Array.from(registry.commands.values()).map(c => ({
id: c.id,
title: c.title,
}));
},
};
export const sqlLab = {
getCurrentTab: () => undefined,
};

View File

@@ -0,0 +1,88 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { views } from '@apache-superset/core';
import { ReferenceChatbot } from './ReferenceChatbot';
import { registerChatbotCommands } from './commands';
import { abortAllActiveControllers } from './streaming/registry';
import { resetState } from './state';
export const VIEW_ID = 'apache-superset.reference-chatbot';
export const CHATBOT_LOCATION = 'superset.chatbot';
interface DisposableLike {
dispose(): void;
}
/**
* Registers the reference chatbot and returns a single disposable that
* tears down everything it created. Idempotent across activate/dispose cycles.
*
* Cleanup order matters: stop in-flight streams first so listeners do not
* receive late tokens, then unregister commands (so user clicks during teardown
* become no-ops), then unregister the view (so the host's ChatbotMount unmounts
* the React tree), and finally reset module state.
*
* Returns a plain `{ dispose }` object rather than constructing a Disposable
* from the SDK — the SDK class is host-injected and only reliably available
* via window.superset at runtime, while plain disposable-likes work in both
* runtime and unit-test contexts.
*
* TODO(P1): when the host gains an async `deactivate(): Promise<void>` hook,
* wrap the master disposer to flush in-flight async work before returning.
*/
export const activate = (): DisposableLike => {
const commandDisposables = registerChatbotCommands();
const viewDisposable = views.registerView(
{
id: VIEW_ID,
name: 'Reference Chatbot',
icon: 'Bubble',
description: 'Validates the chatbot extension environment end-to-end.',
},
CHATBOT_LOCATION,
() => React.createElement(ReferenceChatbot),
);
let disposed = false;
return {
dispose() {
if (disposed) return;
disposed = true;
try {
abortAllActiveControllers();
} catch {
// streams are best-effort during teardown
}
commandDisposables.forEach(d => {
try {
d.dispose();
} catch {
// a single command failing to unregister must not block the rest
}
});
try {
viewDisposable.dispose();
} catch {
// ignore
}
resetState();
},
};
};

View File

@@ -0,0 +1,47 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { commands } from '@apache-superset/core';
import { isOpen, setOpen } from './state';
interface DisposableLike {
dispose(): void;
}
/**
* Registers the three chatbot intent commands and returns their disposables.
*
* TODO(P4): if/when the host pre-registers `core.chatbot__*` as host-owned
* intents that extensions implement instead of own, swap registerCommand for
* the implementation hook. The command ids stay the same so call sites do not
* change.
*/
export const registerChatbotCommands = (): DisposableLike[] => [
commands.registerCommand(
{ id: 'core.chatbot__open', title: 'Open chatbot' },
() => setOpen(true),
),
commands.registerCommand(
{ id: 'core.chatbot__close', title: 'Close chatbot' },
() => setOpen(false),
),
commands.registerCommand(
{ id: 'core.chatbot__toggle', title: 'Toggle chatbot' },
() => setOpen(!isOpen()),
),
];

View File

@@ -16,13 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
import { useDispatch } from 'react-redux';
import type { AppDispatch } from 'src/views/store';
import React from 'react';
// In Module Federation deployments where the host shell shares src/views/store
// as a singleton, a version skew between the shell and the SQL Lab chunk can
// leave useAppDispatch undefined at runtime even though TypeScript types it as
// always-present. Keep this hook free of runtime imports from src/views/store:
// store initialization imports SqlLab persistence helpers, so importing store
// values here can create an app-startup circular dependency.
export const useAppDispatch: () => AppDispatch = useDispatch;
interface Props {
onClick: () => void;
}
export const Bubble: React.FC<Props> = ({ onClick }) => (
<button
type="button"
onClick={onClick}
data-test="reference-chatbot-bubble"
aria-label="Open reference chatbot"
style={{
width: 56,
height: 56,
borderRadius: '50%',
border: 'none',
background: '#1f6feb',
color: '#fff',
fontSize: 24,
fontWeight: 600,
cursor: 'pointer',
boxShadow: '0 4px 14px rgba(0,0,0,0.18)',
}}
>
?
</button>
);

View File

@@ -0,0 +1,66 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
interface State {
error: Error | null;
}
/**
* Defense-in-depth boundary. The host already wraps the mount in its own
* ErrorBoundary; this one keeps a panel crash from also bringing down the
* bubble next to it.
*/
export class ExtensionErrorBoundary extends React.Component<
React.PropsWithChildren<{}>,
State
> {
state: State = { error: null };
static getDerivedStateFromError(error: Error): State {
return { error };
}
componentDidCatch(error: Error): void {
// eslint-disable-next-line no-console
console.error('[reference-chatbot] render error', error);
}
render() {
if (this.state.error) {
return (
<div
data-test="reference-chatbot-error"
style={{
padding: 12,
border: '1px solid #f5222d',
borderRadius: 6,
background: '#fff1f0',
color: '#a8071a',
fontSize: 12,
maxWidth: 320,
}}
>
Reference chatbot crashed: {this.state.error.message}
</div>
);
}
return <>{this.props.children}</>;
}
}

View File

@@ -0,0 +1,307 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { streamReply } from '../streaming/mockStream';
import { getPageContext, PageContext, subscribeToPageChanges } from '../context/pageContext';
import { registerActiveController, unregisterActiveController } from '../streaming/registry';
interface Props {
onClose: () => void;
}
interface Message {
id: number;
from: 'user' | 'bot';
text: string;
}
let messageSeq = 0;
/**
* Builds the full set of context fields the host exposes for the current
* surface, as ordered [label, value] rows. Whatever the host provides for where
* the user is, the panel shows — nothing is summarized away. Returns an empty
* array for surfaces with no active entity (list/home pages), where the
* `page:` line alone is the context.
*/
const contextRows = (ctx: PageContext): Array<[string, string]> => {
const rows: Array<[string, string]> = [];
const push = (label: string, value: unknown) => {
if (value !== undefined && value !== null && value !== '') {
rows.push([label, String(value)]);
}
};
const chart = ctx.chart as
| {
chartId?: number | null;
chartName?: string | null;
vizType?: string;
datasourceId?: number | null;
datasourceName?: string | null;
}
| undefined;
if (chart) {
push('chart', chart.chartName ?? (chart.chartId == null ? '(unsaved)' : ''));
push('chartId', chart.chartId);
push('viz', chart.vizType);
push('datasource', chart.datasourceName);
push('datasourceId', chart.datasourceId);
}
const dashboard = ctx.dashboard as
| { dashboardId?: number; title?: string; filters?: Array<{ label: string; value: unknown }> }
| undefined;
if (dashboard) {
push('dashboard', dashboard.title);
push('dashboardId', dashboard.dashboardId);
const filters = dashboard.filters ?? [];
if (filters.length) {
push(
'filters',
filters.map(f => `${f.label}=${JSON.stringify(f.value)}`).join(', '),
);
}
}
const dataset = ctx.dataset as
| {
datasetId?: number;
datasetName?: string;
schema?: string | null;
catalog?: string | null;
databaseName?: string | null;
isVirtual?: boolean;
}
| undefined;
if (dataset) {
push('dataset', dataset.datasetName);
push('datasetId', dataset.datasetId);
push('schema', dataset.schema);
push('catalog', dataset.catalog);
push('database', dataset.databaseName);
if (typeof dataset.isVirtual === 'boolean') {
push('virtual', dataset.isVirtual);
}
}
if (ctx.sqlLab) {
push('tab', ctx.sqlLab.title);
}
return rows;
};
export const Panel: React.FC<Props> = ({ onClose }) => {
const [input, setInput] = useState('');
const [messages, setMessages] = useState<Message[]>([]);
const [streaming, setStreaming] = useState(false);
const [pageContext, setPageContext] = useState<PageContext>(() => getPageContext());
const controllerRef = useRef<AbortController | null>(null);
useEffect(
() => subscribeToPageChanges(() => setPageContext(getPageContext())),
[],
);
useEffect(
() => () => {
// Component unmount cancels any in-flight stream.
controllerRef.current?.abort();
},
[],
);
const send = useCallback(async () => {
const prompt = input.trim();
if (!prompt || streaming) return;
setInput('');
const userMsg: Message = { id: ++messageSeq, from: 'user', text: prompt };
const botMsg: Message = { id: ++messageSeq, from: 'bot', text: '' };
setMessages(prev => [...prev, userMsg, botMsg]);
setStreaming(true);
const controller = new AbortController();
controllerRef.current = controller;
registerActiveController(controller);
try {
for await (const token of streamReply(prompt, controller.signal)) {
setMessages(prev =>
prev.map(m => (m.id === botMsg.id ? { ...m, text: m.text + token } : m)),
);
}
} finally {
unregisterActiveController(controller);
controllerRef.current = null;
setStreaming(false);
}
}, [input, streaming]);
const cancel = useCallback(() => {
controllerRef.current?.abort();
}, []);
return (
<div
data-test="reference-chatbot-panel"
style={{
width: 360,
maxHeight: 480,
display: 'flex',
flexDirection: 'column',
background: '#fff',
border: '1px solid #d9d9d9',
borderRadius: 8,
boxShadow: '0 8px 24px rgba(0,0,0,0.18)',
overflow: 'hidden',
fontSize: 13,
}}
>
<header
style={{
padding: '8px 12px',
background: '#1f6feb',
color: '#fff',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<span>Reference Chatbot</span>
<button
type="button"
onClick={onClose}
aria-label="Close chatbot"
data-test="reference-chatbot-close"
style={{
background: 'transparent',
border: 'none',
color: '#fff',
fontSize: 16,
cursor: 'pointer',
}}
>
×
</button>
</header>
<div
data-test="reference-chatbot-context"
style={{
padding: '6px 12px',
background: '#f6f8fa',
borderBottom: '1px solid #eaecef',
fontFamily: 'monospace',
fontSize: 11,
color: '#57606a',
wordBreak: 'break-all',
}}
>
<div>page: {pageContext.pageType}</div>
{contextRows(pageContext).map(([label, value]) => (
<div key={label}>
{label}: {value}
</div>
))}
</div>
<div style={{ flex: 1, overflowY: 'auto', padding: 12 }}>
{messages.length === 0 && (
<p style={{ color: '#8c8c8c' }}>
Ask anything replies are canned tokens streamed by the reference extension.
</p>
)}
{messages.map(m => (
<div
key={m.id}
data-test={`reference-chatbot-msg-${m.from}`}
style={{
margin: '6px 0',
textAlign: m.from === 'user' ? 'right' : 'left',
}}
>
<span
style={{
display: 'inline-block',
padding: '4px 8px',
borderRadius: 6,
background: m.from === 'user' ? '#1f6feb' : '#eef0f3',
color: m.from === 'user' ? '#fff' : '#1f2328',
maxWidth: '85%',
whiteSpace: 'pre-wrap',
}}
>
{m.text || '…'}
</span>
</div>
))}
</div>
<footer
style={{
padding: 8,
borderTop: '1px solid #eaecef',
display: 'flex',
gap: 6,
}}
>
<input
aria-label="Chat input"
data-test="reference-chatbot-input"
value={input}
onChange={e => setInput(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
send();
}
}}
placeholder="Type a message"
style={{
flex: 1,
padding: '4px 8px',
border: '1px solid #d9d9d9',
borderRadius: 4,
}}
/>
{streaming ? (
<button
type="button"
onClick={cancel}
data-test="reference-chatbot-cancel"
style={{ padding: '4px 10px' }}
>
Stop
</button>
) : (
<button
type="button"
onClick={send}
data-test="reference-chatbot-send"
disabled={!input.trim()}
style={{ padding: '4px 10px' }}
>
Send
</button>
)}
</footer>
</div>
);
};

View File

@@ -0,0 +1,159 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Single integration seam for the P3 namespaces.
*
* Each surface namespace is consumed via a try/catch — the host may ship a
* version where a namespace function is declared but not yet implemented at
* runtime, and the reference extension must keep working in that case. As
* each namespace lights up on the host, that branch starts returning real
* data without any change here.
*
* Route inference is the fallback when navigation.getPageType() is absent.
*/
import * as core from '@apache-superset/core';
export type PageType =
| 'home'
| 'dashboard'
| 'dashboard_list'
| 'chart'
| 'chart_list'
| 'sqllab'
| 'query_history'
| 'saved_queries'
| 'dataset'
| 'dataset_list'
| 'unknown';
export interface PageContext {
pageType: PageType;
dashboard?: unknown;
chart?: unknown;
dataset?: unknown;
sqlLab?: { tabId: string; title: string };
href: string;
}
const tryCall = <T>(fn: () => T | undefined): T | undefined => {
try {
return fn();
} catch {
return undefined;
}
};
const inferPageType = (pathname: string): PageType => {
if (pathname.startsWith('/sqllab/history')) return 'query_history';
if (pathname.startsWith('/savedqueryview/list')) return 'saved_queries';
if (pathname.startsWith('/sqllab')) return 'sqllab';
if (pathname.startsWith('/dashboard/list')) return 'dashboard_list';
if (
pathname.startsWith('/superset/dashboard') ||
pathname.startsWith('/dashboard')
)
return 'dashboard';
if (pathname.startsWith('/chart/list')) return 'chart_list';
if (pathname.startsWith('/explore') || pathname.startsWith('/chart'))
return 'chart';
if (pathname.startsWith('/tablemodelview/list')) return 'dataset_list';
if (pathname.startsWith('/tablemodelview') || pathname.startsWith('/dataset'))
return 'dataset';
if (pathname === '/' || pathname.startsWith('/superset/welcome'))
return 'home';
return 'unknown';
};
const readSqlLabTab = (): PageContext['sqlLab'] => {
const tab = tryCall(() => (core as any).sqlLab?.getCurrentTab?.());
return tab ? { tabId: tab.id, title: tab.title } : undefined;
};
const readPageType = (pathname: string): PageType => {
const fromNav = tryCall(() => (core as any).navigation?.getPageType?.());
return (fromNav as PageType | undefined) ?? inferPageType(pathname);
};
/**
* Subscribe to page-context changes and invoke `onChange` whenever any part of
* the context may have changed. Returns a cleanup function.
*
* Three classes of change are watched:
* - Navigation (`navigation.onDidChangePage`, or `popstate` as a fallback for
* hosts without the namespace) — the user moved to a different surface.
* - Entity hydration (`explore.onDidChangeChart`, `dashboard.onDidChangeDashboard`,
* `dataset.onDidChangeDataset`) — the surface's entity loaded or changed
* *after* navigation settled. This matters because a surface (notably Explore)
* can finish hydrating several seconds after the route change fires, so a
* navigation-only subscription would read empty entity context and never
* refresh once the real data arrives.
* - In-surface SQL Lab changes (`sqlLab.onDidChangeActiveTab`,
* `sqlLab.onDidChangeTabTitle`) — switching or renaming a tab does not change
* the route, so without these the panel would keep showing the first tab.
*/
export const subscribeToPageChanges = (onChange: () => void): (() => void) => {
const disposers: Array<() => void> = [];
const nav = tryCall(() => (core as any).navigation);
if (nav?.onDidChangePage) {
const sub = nav.onDidChangePage(onChange);
disposers.push(() => sub.dispose());
} else {
window.addEventListener('popstate', onChange);
disposers.push(() => window.removeEventListener('popstate', onChange));
}
// Entity-context change events. Each is optional — a host may not implement a
// given namespace yet — so subscribe defensively and collect any disposer.
const subscribeEntity = (
getNamespace: () => any,
method: string,
): void => {
const sub = tryCall(() => getNamespace()?.[method]?.(onChange));
if (sub?.dispose) {
disposers.push(() => sub.dispose());
}
};
subscribeEntity(() => (core as any).explore, 'onDidChangeChart');
subscribeEntity(() => (core as any).dashboard, 'onDidChangeDashboard');
subscribeEntity(() => (core as any).dataset, 'onDidChangeDataset');
// SQL Lab tab switches/renames happen without a route change.
subscribeEntity(() => (core as any).sqlLab, 'onDidChangeActiveTab');
subscribeEntity(() => (core as any).sqlLab, 'onDidChangeTabTitle');
return () => disposers.forEach(dispose => dispose());
};
export const getPageContext = (): PageContext => {
const { pathname, href } =
typeof window !== 'undefined'
? window.location
: { pathname: '', href: '' };
return {
pageType: readPageType(pathname),
dashboard: tryCall(() => (core as any).dashboard?.getCurrentDashboard?.()),
chart: tryCall(() => (core as any).explore?.getCurrentChart?.()),
dataset: tryCall(() => (core as any).dataset?.getCurrentDataset?.()),
sqlLab: readSqlLabTab(),
href,
};
};

View File

@@ -0,0 +1,30 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Module Federation entry. The host loads `./index` and invokes the factory;
* the side effect below registers the view + commands. The host's loader
* intercepts registerView calls to collect disposables for deactivation, so
* returning the master Disposable here is also captured by the test harness
* for direct assertion.
*/
import { activate } from './activate';
export const disposable = activate();

View File

@@ -0,0 +1,57 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Module-scoped open/closed state plus a tiny emitter the UI subscribes to.
*
* Lives entirely inside the extension — never reaches into the host store.
* Reset on dispose so re-activation starts cleanly.
*/
export type OpenStateListener = (open: boolean) => void;
let open = false;
const listeners = new Set<OpenStateListener>();
export const isOpen = (): boolean => open;
export const setOpen = (next: boolean): void => {
if (next === open) return;
open = next;
listeners.forEach(fn => {
try {
fn(open);
} catch {
// A listener throwing must not block other listeners or flip our state back.
}
});
};
export const subscribe = (fn: OpenStateListener): (() => void) => {
listeners.add(fn);
return () => {
listeners.delete(fn);
};
};
/** Drains listeners and resets state. Called from the master Disposable. */
export const resetState = (): void => {
open = false;
listeners.clear();
};

View File

@@ -0,0 +1,73 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Mock streaming reply used to validate stream teardown semantics.
*
* The reference chatbot is environment-validation only — there is no LLM.
* This iterator yields canned tokens on a timer and exits cleanly when its
* AbortSignal is fired. Disposal of the extension aborts any in-flight
* controller, which is the contract that proves async cancellation works.
*/
const TICK_MS = 40;
const buildReply = (prompt: string): string => {
const trimmed = prompt.trim();
if (!trimmed) {
return 'Reference chatbot online. Send a message to validate streaming.';
}
return (
`[reference-chatbot] received "${trimmed}". ` +
'Streaming token-by-token to validate cancellation and teardown.'
);
};
const sleep = (ms: number, signal: AbortSignal): Promise<void> =>
new Promise((resolve, reject) => {
if (signal.aborted) {
reject(new DOMException('aborted', 'AbortError'));
return;
}
const timer = setTimeout(() => {
signal.removeEventListener('abort', onAbort);
resolve();
}, ms);
const onAbort = () => {
clearTimeout(timer);
reject(new DOMException('aborted', 'AbortError'));
};
signal.addEventListener('abort', onAbort, { once: true });
});
export async function* streamReply(
prompt: string,
signal: AbortSignal,
): AsyncIterableIterator<string> {
const tokens = buildReply(prompt).split(/(\s+)/);
for (const token of tokens) {
if (signal.aborted) return;
try {
await sleep(TICK_MS, signal);
} catch {
return;
}
yield token;
}
}

View File

@@ -16,20 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ThemeMode } from '@apache-superset/core/theme';
/**
* Reads the `?themeMode=` URL parameter from the iframe URL and returns
* the corresponding ThemeMode. Falls back to ThemeMode.DEFAULT when the
* param is absent or unrecognised.
* Module-scoped registry of in-flight stream AbortControllers.
*
* Host apps set this via `dashboardUiConfig.urlParams.themeMode` in the
* embed SDK, which forwards it to the iframe URL automatically.
* Lets the master Disposable abort any running stream even when the panel
* is unmounted by a route change or by re-activation of the extension.
*/
export function getInitialThemeMode(): ThemeMode {
const params = new URLSearchParams(window.location.search);
const themeMode = params.get('themeMode');
if (themeMode === 'dark') return ThemeMode.DARK;
if (themeMode === 'system') return ThemeMode.SYSTEM;
return ThemeMode.DEFAULT;
}
const active = new Set<AbortController>();
export const registerActiveController = (c: AbortController): void => {
active.add(c);
};
export const unregisterActiveController = (c: AbortController): void => {
active.delete(c);
};
export const abortAllActiveControllers = (): void => {
active.forEach(c => {
try {
c.abort();
} catch {
// ignore — abort() should not throw, but stay defensive.
}
});
active.clear();
};

View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2019",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "es2019"]
},
"include": ["src"],
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/__tests__"]
}

View File

@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@apache-superset/core": ["src/__tests__/sdkMock.ts"]
},
"typeRoots": [
"./node_modules/@types",
"../../superset-frontend/node_modules/@types"
],
"types": ["jest", "node"]
},
"include": ["src"],
"exclude": []
}

View File

@@ -0,0 +1,108 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const path = require('path');
const fs = require('fs');
const { ModuleFederationPlugin } = require('webpack').container;
const packageConfig = require('./package.json');
const extensionConfig = require('./extension.json');
const MODULE_FEDERATION_NAME = 'apacheSuperset_referenceChatbot';
/**
* Emits the `manifest.json` the host reads from the extension `dist/` root.
*
* The host (`superset/extensions/utils.py`) expects an extension dist laid out
* as `dist/manifest.json` plus the federated bundle under `dist/frontend/dist/`.
* The manifest carries `extension.json` verbatim, plus the composite `id` and a
* `frontend` block naming the content-hashed `remoteEntry` so the host can load
* the right file. Because the hash is only known after the build, the manifest
* is written from the final asset names rather than checked in.
*/
class EmitManifestPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('EmitManifestPlugin', compilation => {
const assets = Object.keys(compilation.assets);
const remoteEntry = assets.find(name => /^remoteEntry\..*\.js$/.test(name));
if (!remoteEntry) {
throw new Error('EmitManifestPlugin: no remoteEntry asset was emitted');
}
const manifest = {
...extensionConfig,
id: `${extensionConfig.publisher}.${extensionConfig.name}`,
frontend: {
remoteEntry,
moduleFederationName: MODULE_FEDERATION_NAME,
},
};
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'manifest.json'),
`${JSON.stringify(manifest, null, 2)}\n`,
);
});
}
}
module.exports = (env, argv) => {
const isProd = argv.mode === 'production';
return {
entry: isProd ? {} : './src/index.tsx',
mode: isProd ? 'production' : 'development',
devtool: isProd ? false : 'eval-cheap-module-source-map',
devServer: {
port: 3030,
headers: { 'Access-Control-Allow-Origin': '*' },
},
output: {
clean: true,
filename: isProd ? undefined : '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist', 'frontend', 'dist'),
publicPath: `/api/v1/extensions/${extensionConfig.publisher}/${extensionConfig.name}/`,
},
resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx'] },
externalsType: 'window',
externals: { '@apache-superset/core': 'superset' },
module: {
rules: [
{ test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
],
},
plugins: [
new ModuleFederationPlugin({
name: MODULE_FEDERATION_NAME,
filename: 'remoteEntry.[contenthash].js',
exposes: { './index': './src/index.tsx' },
shared: {
react: {
singleton: true,
requiredVersion: packageConfig.peerDependencies.react,
import: false,
},
'react-dom': {
singleton: true,
requiredVersion: packageConfig.peerDependencies['react-dom'],
import: false,
},
},
}),
new EmitManifestPlugin(),
],
};
};

138
extensions/chat2/README.md Normal file
View File

@@ -0,0 +1,138 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Reference Chatbot Extension
Canonical environment-validation extension for the `superset.chatbot`
contribution area. **Not** a product chatbot — there is no LLM, no backend,
no persistence. Its purpose is to exercise the extension platform end-to-end:
- `views.registerView` at `superset.chatbot` (singleton resolution)
- Lifecycle activation + a master disposable that tears down everything
- `commands.registerCommand` for `core.chatbot__open|close|toggle`
- Mock streaming with `AbortController` cancellation on dispose
- Defense-in-depth React error boundary inside the panel
- A single P3 page-context seam that lights up automatically as the
`dashboard` / `explore` / `dataset` / `navigation` namespaces become
available at runtime on the host
It is intended as the reference implementation third-party chatbot extension
authors copy. Anything that ships as host-internal (the mount point, the
admin picker, the `getActiveChatbot` resolver) is **not** here — see the
host side at `superset-frontend/src/components/ChatbotMount/` and
`superset-frontend/src/core/chatbot/`.
## Layout
```
extensions/chat/
├── extension.json Manifest (app.chatbot view + commands)
├── package.json
├── tsconfig.json
├── webpack.config.js ModuleFederation → window.superset
├── jest.config.js Self-contained unit tests
└── src/
├── index.tsx MF entry — calls activate() once
├── activate.ts Returns master disposable
├── commands.ts core.chatbot__open|close|toggle
├── state.ts Module-scoped open/closed + emitter
├── ReferenceChatbot.tsx Root component (bubble ↔ panel)
├── components/
│ ├── Bubble.tsx
│ ├── Panel.tsx
│ └── ErrorBoundary.tsx
├── streaming/
│ ├── mockStream.ts AsyncIterable<string> + AbortSignal
│ └── registry.ts Cross-component abort tracking
├── context/
│ └── pageContext.ts P3 namespace seam (defensive)
└── __tests__/
├── sdkMock.ts In-memory @apache-superset/core mock
└── activate.test.tsx
```
## Run the unit tests
```bash
cd extensions/chat
npm install # first time only
npx jest
```
The tests mock `@apache-superset/core` via `src/__tests__/sdkMock.ts` so they
do not depend on host runtime wiring.
## Build / bundle for deployment
```bash
# from the extension folder
npm install
npm run build
# packaging into a .supx is handled by the Superset extensions CLI
pip install apache-superset-extensions-cli
superset-extensions bundle # produces apache-superset.reference-chatbot-0.1.0.supx
```
Drop the `.supx` into the `EXTENSIONS_PATH` of a Superset instance that has
`FEATURE_FLAGS = { "ENABLE_EXTENSIONS": True }`.
## Selecting it as the active chatbot
The host's singleton picker reads `active_chatbot_id` from the admin
settings endpoint (`/api/v1/extensions/settings`). Set it to:
```
apache-superset.reference-chatbot
```
If no admin selection exists, the host falls back to the first-to-register
chatbot — installing this extension alone is enough for the bubble to appear.
## P3 integration seams
All page-context derivation lives in [`src/context/pageContext.ts`](src/context/pageContext.ts).
Each namespace branch (`dashboard`, `explore`, `dataset`, `navigation`) is
called defensively — when the host implementation lands, the returned value
becomes non-undefined automatically with no other change in the extension.
The panel re-reads context on `popstate`. Once `navigation.onDidChangePage`
is live on the host, the panel's `useEffect` should subscribe to it instead;
that is the only file in the extension that needs to change for full P3
context sync.
## Known intentional non-features
- No conversation persistence — by design (extension scope per SIP §2).
- No real network. The mock stream is a `setTimeout` token emitter so the
cancellation contract is exercised without external dependencies.
- No keyboard shortcut binding (Cmd+K). Extensions own that, but it adds
surface area not needed for platform validation.
- No notification badge / icon mutation. SIP §3.2 recommends static icons;
the bubble re-renders freely already.
## TODOs
- **P1**: if/when the host gains `deactivate(): Promise<void>`, wrap the
master disposer in `activate.ts` to flush async work before returning.
- **P3**: replace the `popstate` listener in `Panel.tsx` with
`navigation.onDidChangePage` once that event is wired up host-side.
- **P4**: if the host pre-registers `core.chatbot__*` as host-owned intents,
swap `commands.registerCommand` for the implementation hook in
`commands.ts`. Command IDs do not change.

View File

@@ -0,0 +1,23 @@
{
"publisher": "apache-superset",
"name": "alt-chatbot",
"displayName": "Alt Chatbot",
"description": "Second chatbot for testing multi-chatbot selection in the superset.chatbot contribution area.",
"version": "0.1.0",
"license": "Apache-2.0",
"permissions": [],
"contributes": {
"views": {
"app": {
"chatbot": [
{
"id": "apache-superset.alt-chatbot",
"name": "Alt Chatbot",
"description": "Second chatbot for testing singleton resolution.",
"icon": "Star"
}
]
}
}
}
}

View File

@@ -0,0 +1,53 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const path = require('path');
// When run as a standalone package (`cd extensions/chat && npm test`), modules
// resolve from this folder's own node_modules. When run from the superset-frontend
// workspace (CI, dev convenience), resolve ts-jest there too.
const tsJest = (() => {
try {
require.resolve('ts-jest');
return 'ts-jest';
} catch {
return path.resolve(
__dirname,
'..',
'..',
'superset-frontend',
'node_modules',
'ts-jest',
);
}
})();
module.exports = {
testEnvironment: 'jsdom',
rootDir: __dirname,
testMatch: ['<rootDir>/src/**/*.test.{ts,tsx}'],
// When running from the extension folder without node_modules installed,
// resolve react / react-dom from the superset-frontend workspace.
modulePaths: [path.resolve(__dirname, '..', '..', 'superset-frontend', 'node_modules')],
moduleNameMapper: {
'^@apache-superset/core$': '<rootDir>/src/__tests__/sdkMock.ts',
},
transform: {
'^.+\\.tsx?$': [tsJest, { tsconfig: '<rootDir>/tsconfig.test.json' }],
},
};

View File

@@ -0,0 +1,26 @@
{
"name": "@apache-superset/alt-chatbot",
"version": "0.1.0",
"private": true,
"license": "Apache-2.0",
"description": "Second chatbot extension for testing multi-chatbot selection in the Superset chatbot contribution area.",
"scripts": {
"start": "webpack serve --mode development",
"build": "webpack --stats-error-details --mode production"
},
"peerDependencies": {
"@apache-superset/core": "^0.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@apache-superset/core": "^0.1.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"ts-loader": "^9.5.0",
"typescript": "^5.0.0",
"webpack": "^5.0.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^5.0.0"
}
}

View File

@@ -0,0 +1,46 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useState } from 'react';
import { Bubble } from './components/Bubble';
import { Panel } from './components/Panel';
import { ExtensionErrorBoundary } from './components/ErrorBoundary';
import { isOpen, setOpen, subscribe } from './state';
/**
* Root extension component. Mirrors module-state into React via `subscribe`.
*
* Unlike the Reference Chatbot, Alt registers no `core.chatbot__*` commands
* (those ids are globally owned by Reference), so the bubble↔panel transition
* drives the local open-state directly via `setOpen`.
*/
export const ReferenceChatbot: React.FC = () => {
const [open, setOpenState] = useState<boolean>(isOpen());
useEffect(() => subscribe(setOpenState), []);
return (
<ExtensionErrorBoundary>
{open ? (
<Panel onClose={() => setOpen(false)} />
) : (
<Bubble onClick={() => setOpen(true)} />
)}
</ExtensionErrorBoundary>
);
};

View File

@@ -0,0 +1,131 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { registry, reset } from './sdkMock';
import { activate, VIEW_ID, CHATBOT_LOCATION } from '../activate';
import { isOpen, setOpen } from '../state';
import { streamReply } from '../streaming/mockStream';
import {
registerActiveController,
unregisterActiveController,
abortAllActiveControllers,
} from '../streaming/registry';
beforeEach(() => {
reset();
});
test('registers one view at superset.chatbot and no commands', () => {
const disposable = activate();
try {
expect(registry.views.size).toBe(1);
const entry = registry.views.get(VIEW_ID);
expect(entry?.location).toBe(CHATBOT_LOCATION);
expect(entry?.view.icon).toBe('Star');
// Alt Chatbot is view-only — the core.chatbot__* command ids are owned by
// the Reference Chatbot, so Alt registers none of its own.
expect(registry.commands.size).toBe(0);
} finally {
disposable.dispose();
}
});
test('setOpen drives open/close through module state', () => {
const disposable = activate();
try {
expect(isOpen()).toBe(false);
setOpen(true);
expect(isOpen()).toBe(true);
setOpen(false);
expect(isOpen()).toBe(false);
} finally {
disposable.dispose();
}
});
test('disposing the master disposable unregisters the view', () => {
const disposable = activate();
expect(registry.views.size).toBe(1);
disposable.dispose();
expect(registry.views.size).toBe(0);
expect(registry.commands.size).toBe(0);
});
test('disposal is idempotent', () => {
const disposable = activate();
disposable.dispose();
expect(() => disposable.dispose()).not.toThrow();
expect(registry.views.size).toBe(0);
});
test('re-activate after dispose works (validates replace semantics)', () => {
const first = activate();
first.dispose();
const second = activate();
try {
expect(registry.views.size).toBe(1);
expect(isOpen()).toBe(false); // resetState() cleared open flag
} finally {
second.dispose();
}
});
test('aborting an active controller stops the stream cleanly', async () => {
const controller = new AbortController();
registerActiveController(controller);
const iter = streamReply('hello world', controller.signal);
const received: string[] = [];
const consume = (async () => {
for await (const tok of iter) received.push(tok);
})();
// Abort after a single tick — the iterator must return without throwing.
await new Promise(r => setTimeout(r, 50));
abortAllActiveControllers();
await expect(consume).resolves.toBeUndefined();
unregisterActiveController(controller);
expect(received.length).toBeLessThan(20); // would be ~20+ tokens if uncancelled
});
test('disposing the extension aborts any in-flight controller', async () => {
const disposable = activate();
const controller = new AbortController();
registerActiveController(controller);
const iter = streamReply('a longer prompt to ensure many tokens', controller.signal);
const consume = (async () => {
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
for await (const _tok of iter) {
// drain
}
})();
await new Promise(r => setTimeout(r, 30));
disposable.dispose();
await expect(consume).resolves.toBeUndefined();
expect(controller.signal.aborted).toBe(true);
});

View File

@@ -0,0 +1,119 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* In-memory mock of `@apache-superset/core` for unit-testing the extension.
*
* Mirrors only the surfaces the reference chatbot consumes:
* - views.registerView returns a disposable that removes the view
* - commands.registerCommand / executeCommand round-trip handlers
* - sqlLab.getCurrentTab returns undefined (no SQL Lab in tests)
*
* The mock is intentionally observable: tests can read `registry.views` and
* `registry.commands` to assert contract compliance.
*/
import type { ReactElement } from 'react';
type Provider = () => ReactElement;
interface ViewDescriptor {
id: string;
name: string;
icon?: string;
description?: string;
}
interface DisposableLike {
dispose(): void;
}
interface RegisteredView {
view: ViewDescriptor;
location: string;
provider: Provider;
}
interface RegisteredCommand {
id: string;
title: string;
handler: (...args: any[]) => any;
}
export const registry = {
views: new Map<string, RegisteredView>(),
commands: new Map<string, RegisteredCommand>(),
};
export const reset = (): void => {
registry.views.clear();
registry.commands.clear();
};
export const views = {
registerView(
view: ViewDescriptor,
location: string,
provider: Provider,
): DisposableLike {
registry.views.set(view.id, { view, location, provider });
return {
dispose: () => {
registry.views.delete(view.id);
},
};
},
getViews(location: string) {
return Array.from(registry.views.values())
.filter(v => v.location === location)
.map(v => v.view);
},
};
export const commands = {
registerCommand(
command: { id: string; title: string },
handler: (...args: any[]) => any,
): DisposableLike {
registry.commands.set(command.id, {
id: command.id,
title: command.title,
handler,
});
return {
dispose: () => {
registry.commands.delete(command.id);
},
};
},
async executeCommand(id: string, ...rest: any[]): Promise<unknown> {
const cmd = registry.commands.get(id);
return cmd?.handler(...rest);
},
getCommands() {
return Array.from(registry.commands.values()).map(c => ({
id: c.id,
title: c.title,
}));
},
};
export const sqlLab = {
getCurrentTab: () => undefined,
};

View File

@@ -0,0 +1,83 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { views } from '@apache-superset/core';
import { ReferenceChatbot } from './ReferenceChatbot';
import { abortAllActiveControllers } from './streaming/registry';
import { resetState } from './state';
export const VIEW_ID = 'apache-superset.alt-chatbot';
export const CHATBOT_LOCATION = 'superset.chatbot';
interface DisposableLike {
dispose(): void;
}
/**
* Registers the reference chatbot and returns a single disposable that
* tears down everything it created. Idempotent across activate/dispose cycles.
*
* Cleanup order matters: stop in-flight streams first so listeners do not
* receive late tokens, then unregister commands (so user clicks during teardown
* become no-ops), then unregister the view (so the host's ChatbotMount unmounts
* the React tree), and finally reset module state.
*
* Returns a plain `{ dispose }` object rather than constructing a Disposable
* from the SDK — the SDK class is host-injected and only reliably available
* via window.superset at runtime, while plain disposable-likes work in both
* runtime and unit-test contexts.
*
* TODO(P1): when the host gains an async `deactivate(): Promise<void>` hook,
* wrap the master disposer to flush in-flight async work before returning.
*/
export const activate = (): DisposableLike => {
// Alt Chatbot deliberately registers no commands: the `core.chatbot__*`
// command ids are owned by the Reference Chatbot, and command ids are global,
// so a second registrant would collide. Alt is a view-only chatbot used to
// exercise multi-chatbot selection.
const viewDisposable = views.registerView(
{
id: VIEW_ID,
name: 'Alt Chatbot',
icon: 'Star',
description: 'Second chatbot for testing singleton resolution.',
},
CHATBOT_LOCATION,
() => React.createElement(ReferenceChatbot),
);
let disposed = false;
return {
dispose() {
if (disposed) return;
disposed = true;
try {
abortAllActiveControllers();
} catch {
// streams are best-effort during teardown
}
try {
viewDisposable.dispose();
} catch {
// ignore
}
resetState();
},
};
};

View File

@@ -0,0 +1,46 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
interface Props {
onClick: () => void;
}
export const Bubble: React.FC<Props> = ({ onClick }) => (
<button
type="button"
onClick={onClick}
data-test="reference-chatbot-bubble"
aria-label="Open Alt chatbot"
style={{
width: 56,
height: 56,
borderRadius: '50%',
border: 'none',
background: '#2da44e',
color: '#fff',
fontSize: 24,
fontWeight: 600,
cursor: 'pointer',
boxShadow: '0 4px 14px rgba(0,0,0,0.18)',
}}
>
?
</button>
);

View File

@@ -0,0 +1,66 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
interface State {
error: Error | null;
}
/**
* Defense-in-depth boundary. The host already wraps the mount in its own
* ErrorBoundary; this one keeps a panel crash from also bringing down the
* bubble next to it.
*/
export class ExtensionErrorBoundary extends React.Component<
React.PropsWithChildren<{}>,
State
> {
state: State = { error: null };
static getDerivedStateFromError(error: Error): State {
return { error };
}
componentDidCatch(error: Error): void {
// eslint-disable-next-line no-console
console.error('[reference-chatbot] render error', error);
}
render() {
if (this.state.error) {
return (
<div
data-test="reference-chatbot-error"
style={{
padding: 12,
border: '1px solid #f5222d',
borderRadius: 6,
background: '#fff1f0',
color: '#a8071a',
fontSize: 12,
maxWidth: 320,
}}
>
Reference chatbot crashed: {this.state.error.message}
</div>
);
}
return <>{this.props.children}</>;
}
}

View File

@@ -0,0 +1,307 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { streamReply } from '../streaming/mockStream';
import { getPageContext, PageContext, subscribeToPageChanges } from '../context/pageContext';
import { registerActiveController, unregisterActiveController } from '../streaming/registry';
interface Props {
onClose: () => void;
}
interface Message {
id: number;
from: 'user' | 'bot';
text: string;
}
let messageSeq = 0;
/**
* Builds the full set of context fields the host exposes for the current
* surface, as ordered [label, value] rows. Whatever the host provides for where
* the user is, the panel shows — nothing is summarized away. Returns an empty
* array for surfaces with no active entity (list/home pages), where the
* `page:` line alone is the context.
*/
const contextRows = (ctx: PageContext): Array<[string, string]> => {
const rows: Array<[string, string]> = [];
const push = (label: string, value: unknown) => {
if (value !== undefined && value !== null && value !== '') {
rows.push([label, String(value)]);
}
};
const chart = ctx.chart as
| {
chartId?: number | null;
chartName?: string | null;
vizType?: string;
datasourceId?: number | null;
datasourceName?: string | null;
}
| undefined;
if (chart) {
push('chart', chart.chartName ?? (chart.chartId == null ? '(unsaved)' : ''));
push('chartId', chart.chartId);
push('viz', chart.vizType);
push('datasource', chart.datasourceName);
push('datasourceId', chart.datasourceId);
}
const dashboard = ctx.dashboard as
| { dashboardId?: number; title?: string; filters?: Array<{ label: string; value: unknown }> }
| undefined;
if (dashboard) {
push('dashboard', dashboard.title);
push('dashboardId', dashboard.dashboardId);
const filters = dashboard.filters ?? [];
if (filters.length) {
push(
'filters',
filters.map(f => `${f.label}=${JSON.stringify(f.value)}`).join(', '),
);
}
}
const dataset = ctx.dataset as
| {
datasetId?: number;
datasetName?: string;
schema?: string | null;
catalog?: string | null;
databaseName?: string | null;
isVirtual?: boolean;
}
| undefined;
if (dataset) {
push('dataset', dataset.datasetName);
push('datasetId', dataset.datasetId);
push('schema', dataset.schema);
push('catalog', dataset.catalog);
push('database', dataset.databaseName);
if (typeof dataset.isVirtual === 'boolean') {
push('virtual', dataset.isVirtual);
}
}
if (ctx.sqlLab) {
push('tab', ctx.sqlLab.title);
}
return rows;
};
export const Panel: React.FC<Props> = ({ onClose }) => {
const [input, setInput] = useState('');
const [messages, setMessages] = useState<Message[]>([]);
const [streaming, setStreaming] = useState(false);
const [pageContext, setPageContext] = useState<PageContext>(() => getPageContext());
const controllerRef = useRef<AbortController | null>(null);
useEffect(
() => subscribeToPageChanges(() => setPageContext(getPageContext())),
[],
);
useEffect(
() => () => {
// Component unmount cancels any in-flight stream.
controllerRef.current?.abort();
},
[],
);
const send = useCallback(async () => {
const prompt = input.trim();
if (!prompt || streaming) return;
setInput('');
const userMsg: Message = { id: ++messageSeq, from: 'user', text: prompt };
const botMsg: Message = { id: ++messageSeq, from: 'bot', text: '' };
setMessages(prev => [...prev, userMsg, botMsg]);
setStreaming(true);
const controller = new AbortController();
controllerRef.current = controller;
registerActiveController(controller);
try {
for await (const token of streamReply(prompt, controller.signal)) {
setMessages(prev =>
prev.map(m => (m.id === botMsg.id ? { ...m, text: m.text + token } : m)),
);
}
} finally {
unregisterActiveController(controller);
controllerRef.current = null;
setStreaming(false);
}
}, [input, streaming]);
const cancel = useCallback(() => {
controllerRef.current?.abort();
}, []);
return (
<div
data-test="reference-chatbot-panel"
style={{
width: 360,
maxHeight: 480,
display: 'flex',
flexDirection: 'column',
background: '#fff',
border: '1px solid #d9d9d9',
borderRadius: 8,
boxShadow: '0 8px 24px rgba(0,0,0,0.18)',
overflow: 'hidden',
fontSize: 13,
}}
>
<header
style={{
padding: '8px 12px',
background: '#2da44e',
color: '#fff',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<span>Alt Chatbot</span>
<button
type="button"
onClick={onClose}
aria-label="Close chatbot"
data-test="reference-chatbot-close"
style={{
background: 'transparent',
border: 'none',
color: '#fff',
fontSize: 16,
cursor: 'pointer',
}}
>
×
</button>
</header>
<div
data-test="reference-chatbot-context"
style={{
padding: '6px 12px',
background: '#f6f8fa',
borderBottom: '1px solid #eaecef',
fontFamily: 'monospace',
fontSize: 11,
color: '#57606a',
wordBreak: 'break-all',
}}
>
<div>page: {pageContext.pageType}</div>
{contextRows(pageContext).map(([label, value]) => (
<div key={label}>
{label}: {value}
</div>
))}
</div>
<div style={{ flex: 1, overflowY: 'auto', padding: 12 }}>
{messages.length === 0 && (
<p style={{ color: '#8c8c8c' }}>
Ask anything replies are canned tokens streamed by the Alt Chatbot extension.
</p>
)}
{messages.map(m => (
<div
key={m.id}
data-test={`reference-chatbot-msg-${m.from}`}
style={{
margin: '6px 0',
textAlign: m.from === 'user' ? 'right' : 'left',
}}
>
<span
style={{
display: 'inline-block',
padding: '4px 8px',
borderRadius: 6,
background: m.from === 'user' ? '#2da44e' : '#eef0f3',
color: m.from === 'user' ? '#fff' : '#1f2328',
maxWidth: '85%',
whiteSpace: 'pre-wrap',
}}
>
{m.text || '…'}
</span>
</div>
))}
</div>
<footer
style={{
padding: 8,
borderTop: '1px solid #eaecef',
display: 'flex',
gap: 6,
}}
>
<input
aria-label="Chat input"
data-test="reference-chatbot-input"
value={input}
onChange={e => setInput(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
send();
}
}}
placeholder="Type a message"
style={{
flex: 1,
padding: '4px 8px',
border: '1px solid #d9d9d9',
borderRadius: 4,
}}
/>
{streaming ? (
<button
type="button"
onClick={cancel}
data-test="reference-chatbot-cancel"
style={{ padding: '4px 10px' }}
>
Stop
</button>
) : (
<button
type="button"
onClick={send}
data-test="reference-chatbot-send"
disabled={!input.trim()}
style={{ padding: '4px 10px' }}
>
Send
</button>
)}
</footer>
</div>
);
};

View File

@@ -0,0 +1,159 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Single integration seam for the P3 namespaces.
*
* Each surface namespace is consumed via a try/catch — the host may ship a
* version where a namespace function is declared but not yet implemented at
* runtime, and the reference extension must keep working in that case. As
* each namespace lights up on the host, that branch starts returning real
* data without any change here.
*
* Route inference is the fallback when navigation.getPageType() is absent.
*/
import * as core from '@apache-superset/core';
export type PageType =
| 'home'
| 'dashboard'
| 'dashboard_list'
| 'chart'
| 'chart_list'
| 'sqllab'
| 'query_history'
| 'saved_queries'
| 'dataset'
| 'dataset_list'
| 'unknown';
export interface PageContext {
pageType: PageType;
dashboard?: unknown;
chart?: unknown;
dataset?: unknown;
sqlLab?: { tabId: string; title: string };
href: string;
}
const tryCall = <T>(fn: () => T | undefined): T | undefined => {
try {
return fn();
} catch {
return undefined;
}
};
const inferPageType = (pathname: string): PageType => {
if (pathname.startsWith('/sqllab/history')) return 'query_history';
if (pathname.startsWith('/savedqueryview/list')) return 'saved_queries';
if (pathname.startsWith('/sqllab')) return 'sqllab';
if (pathname.startsWith('/dashboard/list')) return 'dashboard_list';
if (
pathname.startsWith('/superset/dashboard') ||
pathname.startsWith('/dashboard')
)
return 'dashboard';
if (pathname.startsWith('/chart/list')) return 'chart_list';
if (pathname.startsWith('/explore') || pathname.startsWith('/chart'))
return 'chart';
if (pathname.startsWith('/tablemodelview/list')) return 'dataset_list';
if (pathname.startsWith('/tablemodelview') || pathname.startsWith('/dataset'))
return 'dataset';
if (pathname === '/' || pathname.startsWith('/superset/welcome'))
return 'home';
return 'unknown';
};
const readSqlLabTab = (): PageContext['sqlLab'] => {
const tab = tryCall(() => (core as any).sqlLab?.getCurrentTab?.());
return tab ? { tabId: tab.id, title: tab.title } : undefined;
};
const readPageType = (pathname: string): PageType => {
const fromNav = tryCall(() => (core as any).navigation?.getPageType?.());
return (fromNav as PageType | undefined) ?? inferPageType(pathname);
};
/**
* Subscribe to page-context changes and invoke `onChange` whenever any part of
* the context may have changed. Returns a cleanup function.
*
* Three classes of change are watched:
* - Navigation (`navigation.onDidChangePage`, or `popstate` as a fallback for
* hosts without the namespace) — the user moved to a different surface.
* - Entity hydration (`explore.onDidChangeChart`, `dashboard.onDidChangeDashboard`,
* `dataset.onDidChangeDataset`) — the surface's entity loaded or changed
* *after* navigation settled. This matters because a surface (notably Explore)
* can finish hydrating several seconds after the route change fires, so a
* navigation-only subscription would read empty entity context and never
* refresh once the real data arrives.
* - In-surface SQL Lab changes (`sqlLab.onDidChangeActiveTab`,
* `sqlLab.onDidChangeTabTitle`) — switching or renaming a tab does not change
* the route, so without these the panel would keep showing the first tab.
*/
export const subscribeToPageChanges = (onChange: () => void): (() => void) => {
const disposers: Array<() => void> = [];
const nav = tryCall(() => (core as any).navigation);
if (nav?.onDidChangePage) {
const sub = nav.onDidChangePage(onChange);
disposers.push(() => sub.dispose());
} else {
window.addEventListener('popstate', onChange);
disposers.push(() => window.removeEventListener('popstate', onChange));
}
// Entity-context change events. Each is optional — a host may not implement a
// given namespace yet — so subscribe defensively and collect any disposer.
const subscribeEntity = (
getNamespace: () => any,
method: string,
): void => {
const sub = tryCall(() => getNamespace()?.[method]?.(onChange));
if (sub?.dispose) {
disposers.push(() => sub.dispose());
}
};
subscribeEntity(() => (core as any).explore, 'onDidChangeChart');
subscribeEntity(() => (core as any).dashboard, 'onDidChangeDashboard');
subscribeEntity(() => (core as any).dataset, 'onDidChangeDataset');
// SQL Lab tab switches/renames happen without a route change.
subscribeEntity(() => (core as any).sqlLab, 'onDidChangeActiveTab');
subscribeEntity(() => (core as any).sqlLab, 'onDidChangeTabTitle');
return () => disposers.forEach(dispose => dispose());
};
export const getPageContext = (): PageContext => {
const { pathname, href } =
typeof window !== 'undefined'
? window.location
: { pathname: '', href: '' };
return {
pageType: readPageType(pathname),
dashboard: tryCall(() => (core as any).dashboard?.getCurrentDashboard?.()),
chart: tryCall(() => (core as any).explore?.getCurrentChart?.()),
dataset: tryCall(() => (core as any).dataset?.getCurrentDataset?.()),
sqlLab: readSqlLabTab(),
href,
};
};

View File

@@ -0,0 +1,30 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Module Federation entry. The host loads `./index` and invokes the factory;
* the side effect below registers the view + commands. The host's loader
* intercepts registerView calls to collect disposables for deactivation, so
* returning the master Disposable here is also captured by the test harness
* for direct assertion.
*/
import { activate } from './activate';
export const disposable = activate();

View File

@@ -0,0 +1,57 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Module-scoped open/closed state plus a tiny emitter the UI subscribes to.
*
* Lives entirely inside the extension — never reaches into the host store.
* Reset on dispose so re-activation starts cleanly.
*/
export type OpenStateListener = (open: boolean) => void;
let open = false;
const listeners = new Set<OpenStateListener>();
export const isOpen = (): boolean => open;
export const setOpen = (next: boolean): void => {
if (next === open) return;
open = next;
listeners.forEach(fn => {
try {
fn(open);
} catch {
// A listener throwing must not block other listeners or flip our state back.
}
});
};
export const subscribe = (fn: OpenStateListener): (() => void) => {
listeners.add(fn);
return () => {
listeners.delete(fn);
};
};
/** Drains listeners and resets state. Called from the master Disposable. */
export const resetState = (): void => {
open = false;
listeners.clear();
};

View File

@@ -0,0 +1,73 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Mock streaming reply used to validate stream teardown semantics.
*
* The reference chatbot is environment-validation only — there is no LLM.
* This iterator yields canned tokens on a timer and exits cleanly when its
* AbortSignal is fired. Disposal of the extension aborts any in-flight
* controller, which is the contract that proves async cancellation works.
*/
const TICK_MS = 40;
const buildReply = (prompt: string): string => {
const trimmed = prompt.trim();
if (!trimmed) {
return 'Reference chatbot online. Send a message to validate streaming.';
}
return (
`[reference-chatbot] received "${trimmed}". ` +
'Streaming token-by-token to validate cancellation and teardown.'
);
};
const sleep = (ms: number, signal: AbortSignal): Promise<void> =>
new Promise((resolve, reject) => {
if (signal.aborted) {
reject(new DOMException('aborted', 'AbortError'));
return;
}
const timer = setTimeout(() => {
signal.removeEventListener('abort', onAbort);
resolve();
}, ms);
const onAbort = () => {
clearTimeout(timer);
reject(new DOMException('aborted', 'AbortError'));
};
signal.addEventListener('abort', onAbort, { once: true });
});
export async function* streamReply(
prompt: string,
signal: AbortSignal,
): AsyncIterableIterator<string> {
const tokens = buildReply(prompt).split(/(\s+)/);
for (const token of tokens) {
if (signal.aborted) return;
try {
await sleep(TICK_MS, signal);
} catch {
return;
}
yield token;
}
}

View File

@@ -17,23 +17,30 @@
* under the License.
*/
import { withTimeout } from "./withTimeout";
/**
* Module-scoped registry of in-flight stream AbortControllers.
*
* Lets the master Disposable abort any running stream even when the panel
* is unmounted by a route change or by re-activation of the extension.
*/
test("resolves with the value when the promise settles in time", async () => {
await expect(withTimeout(Promise.resolve("ok"), 1000, "fetch")).resolves.toBe(
"ok"
);
});
const active = new Set<AbortController>();
test("rejects when the promise does not settle within the timeout", async () => {
const never = new Promise<string>(() => {});
await expect(withTimeout(never, 10, "fetch")).rejects.toThrow(
/fetch did not resolve within 10ms/
);
});
export const registerActiveController = (c: AbortController): void => {
active.add(c);
};
test("passes the promise through unchanged when the timeout is disabled", async () => {
await expect(withTimeout(Promise.resolve("ok"), 0, "fetch")).resolves.toBe(
"ok"
);
});
export const unregisterActiveController = (c: AbortController): void => {
active.delete(c);
};
export const abortAllActiveControllers = (): void => {
active.forEach(c => {
try {
c.abort();
} catch {
// ignore — abort() should not throw, but stay defensive.
}
});
active.clear();
};

View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2019",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "es2019"]
},
"include": ["src"],
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/__tests__"]
}

View File

@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@apache-superset/core": ["src/__tests__/sdkMock.ts"]
},
"typeRoots": [
"./node_modules/@types",
"../../superset-frontend/node_modules/@types"
],
"types": ["jest", "node"]
},
"include": ["src"],
"exclude": []
}

View File

@@ -0,0 +1,108 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const path = require('path');
const fs = require('fs');
const { ModuleFederationPlugin } = require('webpack').container;
const packageConfig = require('./package.json');
const extensionConfig = require('./extension.json');
const MODULE_FEDERATION_NAME = 'apacheSuperset_altChatbot';
/**
* Emits the `manifest.json` the host reads from the extension `dist/` root.
*
* The host (`superset/extensions/utils.py`) expects an extension dist laid out
* as `dist/manifest.json` plus the federated bundle under `dist/frontend/dist/`.
* The manifest carries `extension.json` verbatim, plus the composite `id` and a
* `frontend` block naming the content-hashed `remoteEntry` so the host can load
* the right file. Because the hash is only known after the build, the manifest
* is written from the final asset names rather than checked in.
*/
class EmitManifestPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('EmitManifestPlugin', compilation => {
const assets = Object.keys(compilation.assets);
const remoteEntry = assets.find(name => /^remoteEntry\..*\.js$/.test(name));
if (!remoteEntry) {
throw new Error('EmitManifestPlugin: no remoteEntry asset was emitted');
}
const manifest = {
...extensionConfig,
id: `${extensionConfig.publisher}.${extensionConfig.name}`,
frontend: {
remoteEntry,
moduleFederationName: MODULE_FEDERATION_NAME,
},
};
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'manifest.json'),
`${JSON.stringify(manifest, null, 2)}\n`,
);
});
}
}
module.exports = (env, argv) => {
const isProd = argv.mode === 'production';
return {
entry: isProd ? {} : './src/index.tsx',
mode: isProd ? 'production' : 'development',
devtool: isProd ? false : 'eval-cheap-module-source-map',
devServer: {
port: 3031,
headers: { 'Access-Control-Allow-Origin': '*' },
},
output: {
clean: true,
filename: isProd ? undefined : '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist', 'frontend', 'dist'),
publicPath: `/api/v1/extensions/${extensionConfig.publisher}/${extensionConfig.name}/`,
},
resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx'] },
externalsType: 'window',
externals: { '@apache-superset/core': 'superset' },
module: {
rules: [
{ test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
],
},
plugins: [
new ModuleFederationPlugin({
name: MODULE_FEDERATION_NAME,
filename: 'remoteEntry.[contenthash].js',
exposes: { './index': './src/index.tsx' },
shared: {
react: {
singleton: true,
requiredVersion: packageConfig.peerDependencies.react,
import: false,
},
'react-dom': {
singleton: true,
requiredVersion: packageConfig.peerDependencies['react-dom'],
import: false,
},
},
}),
new EmitManifestPlugin(),
],
};
};

Some files were not shown because too many files have changed in this diff Show More