mirror of
https://github.com/apache/superset.git
synced 2026-05-22 08:15:36 +00:00
Address /review-code findings — the previous round's hardening fixed flake but a few assertions still gave weak signals: - The chart-rendered selector matched a still-loading chart cell, since Superset's `Loading` spinner itself renders an SVG. Exclude the spinner via `:not(:has([data-test="loading-indicator"]))` and centralize the selector as `EmbeddedPage.RENDERED_CHART_SELECTOR`. - The "dashboard renders" test only proved iframe/header chrome, not the dashboard. Add `waitForChartRendered()` so the test name matches what it asserts. - The `hideTitle` test passed for the wrong reason if the locator drifted (`toBeHidden()` succeeds for absent elements). Add an explicit `toHaveCount(0)` so the contrast against the baseline visibility check in test 1 is load-bearing. - `tokenCallCount` was a `>=1` check that any rendered dashboard would satisfy. Tighten to `=== 1` to actually exercise the SDK's caching contract. - Drop the redundant `appUrl` shadow of `appServer.url`. - Move `import os` to module top in the docker-light config; document the strict `"true"`-only env-var truthiness convention. Pre-commit clean (type-check, prettier, oxlint, ruff, mypy). Local re-verification blocked by an unrelated worktree env issue (semantic layers feature has incomplete state — the docker-compose-light stack doesn't bind-mount superset-core/, so the image's stale copy lacks the new submodule); CI on the chromium-embedded project will validate. Changes are strictly stronger assertions and refactors so they cannot turn a previously-passing test into a false positive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
2.8 KiB
Python
69 lines
2.8 KiB
Python
# 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.
|
|
#
|
|
# Configuration for docker-compose-light.yml - disables Redis and uses minimal services
|
|
|
|
# Import all settings from the main config first
|
|
import os
|
|
|
|
from flask_caching.backends.filesystemcache import FileSystemCache
|
|
|
|
from superset_config import * # noqa: F403
|
|
|
|
# Override caching to use simple in-memory cache instead of Redis
|
|
RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab")
|
|
|
|
CACHE_CONFIG = {
|
|
"CACHE_TYPE": "SimpleCache",
|
|
"CACHE_DEFAULT_TIMEOUT": 300,
|
|
"CACHE_KEY_PREFIX": "superset_light_",
|
|
}
|
|
DATA_CACHE_CONFIG = CACHE_CONFIG
|
|
THUMBNAIL_CACHE_CONFIG = CACHE_CONFIG
|
|
|
|
|
|
# Disable Celery entirely for lightweight mode
|
|
CELERY_CONFIG = None # type: ignore[assignment,misc]
|
|
|
|
# Honor SUPERSET_FEATURE_<NAME> env vars on top of any flags inherited from
|
|
# superset_config. Lets local dev/e2e enable features (e.g. EMBEDDED_SUPERSET)
|
|
# without editing shipped config files. Only the literal string "true"
|
|
# (case-insensitive) is treated as enabled — "1"/"yes"/"on" are not, matching
|
|
# the strict-string convention used elsewhere in Superset's env parsing.
|
|
FEATURE_FLAGS = {
|
|
**FEATURE_FLAGS, # noqa: F405
|
|
**{
|
|
name[len("SUPERSET_FEATURE_") :]: value.strip().lower() == "true"
|
|
for name, value in os.environ.items()
|
|
if name.startswith("SUPERSET_FEATURE_")
|
|
},
|
|
}
|
|
|
|
# Disable Talisman so /embedded/<uuid> doesn't return X-Frame-Options:SAMEORIGIN.
|
|
# Without this, browsers refuse to render Superset inside an iframe from a
|
|
# different origin (i.e. the embedded SDK use case). Production/CI configures
|
|
# Talisman with explicit `frame-ancestors`; for the lightweight local stack we
|
|
# just turn it off.
|
|
TALISMAN_ENABLED = False
|
|
|
|
# Guest tokens (used by the embedded SDK) inherit the "Public" role's perms.
|
|
# Out of the box Public has zero perms, so embedded dashboards immediately fail
|
|
# their first call (`/api/v1/me/roles/`) with 403. Mirror Public to Gamma —
|
|
# the standard read-only viewer role — so the embedded flow can authenticate
|
|
# and load dashboard data in local dev.
|
|
PUBLIC_ROLE_LIKE = "Gamma"
|