Skip to content

Conversation

@innovark37
Copy link
Contributor

SUMMARY

This PR fixes theme token handling for subdirectory deployments by ensuring brandSpinnerUrl gets properly prefixed with the application root path, similar to how brandLogoUrl and APP_ICON are already handled.

Problem

When Superset is deployed under a subdirectory (e.g., /superset/, /analytics/), the loading spinner image (brandSpinnerUrl) would break because its URL wasn't being prefixed with the application root. This caused 404 errors for the spinner image in non-root deployments.

Root Cause

The application initialization code already handled brandLogoUrl and APP_ICON for subdirectory deployments, but missed brandSpinnerUrl, which is another theme token that references static assets.

Solution

Extend the existing subdirectory handling logic to include brandSpinnerUrl token, applying the same pattern used for brandLogoUrl.

TESTING INSTRUCTIONS

  1. Create test theme configuration:
THEME_DEFAULT = {
   "token": {
       "brandSpinnerUrl": "/static/assets/images/loading.gif",
   },
   "algorithm": "default",
}
  1. Start Superset with subdirectory deployment:
SUPERSET_APP_ROOT=/analytics
  1. Verify loading spinner appears

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 28, 2026

Code Review Agent Run #f98b39

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: aa970ee..aa970ee
    • superset/app.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the global:theming Related to theming Superset label Jan 28, 2026
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.58%. Comparing base (76d897e) to head (aa970ee).
⚠️ Report is 3536 commits behind head on master.

Files with missing lines Patch % Lines
superset/app.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #37523      +/-   ##
==========================================
+ Coverage   60.48%   66.58%   +6.09%     
==========================================
  Files        1931      643    -1288     
  Lines       76236    49051   -27185     
  Branches     8568     5501    -3067     
==========================================
- Hits        46114    32661   -13453     
+ Misses      28017    15095   -12922     
+ Partials     2105     1295     -810     
Flag Coverage Δ
hive 41.91% <0.00%> (-7.24%) ⬇️
javascript ?
mysql 64.64% <0.00%> (?)
postgres 64.72% <0.00%> (?)
presto 41.93% <0.00%> (-11.87%) ⬇️
python 66.55% <0.00%> (+3.05%) ⬆️
sqlite 64.42% <0.00%> (?)
unit 100.00% <ø> (+42.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends subdirectory deployment support so that the theme token brandSpinnerUrl is treated consistently with brandLogoUrl and APP_ICON, preventing broken spinner images when Superset runs under a non-root path.

Changes:

  • In create_app, when SUPERSET_APP_ROOT (or superset_app_root) is set and APP_ICON is a /static/ path, update the theme tokens to also prefix brandSpinnerUrl with the application root when it points to /static/.

Comment on lines +82 to 86
if token.get("brandSpinnerUrl", "").startswith("/static/"):
token["brandSpinnerUrl"] = f"{app_root}{token['brandSpinnerUrl']}"
# Update brandLogoUrl if it points to /static/
if token.get("brandLogoUrl", "").startswith("/static/"):
token["brandLogoUrl"] = f"{app_root}{token['brandLogoUrl']}"
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brandSpinnerUrl defaults to None in THEME_DEFAULT (see superset/config.py), so token.get("brandSpinnerUrl", "").startswith("/static/") will attempt to call .startswith on None when running under a subdirectory, causing an AttributeError during app startup for the default configuration. To avoid this, normalize the value before calling .startswith (for example, by using an intermediate variable and falling back to an empty string when the token value is None or falsy) and then updating the token only when that normalized string starts with /static/.

Suggested change
if token.get("brandSpinnerUrl", "").startswith("/static/"):
token["brandSpinnerUrl"] = f"{app_root}{token['brandSpinnerUrl']}"
# Update brandLogoUrl if it points to /static/
if token.get("brandLogoUrl", "").startswith("/static/"):
token["brandLogoUrl"] = f"{app_root}{token['brandLogoUrl']}"
brand_spinner_url = token.get("brandSpinnerUrl") or ""
if brand_spinner_url.startswith("/static/"):
token["brandSpinnerUrl"] = f"{app_root}{brand_spinner_url}"
# Update brandLogoUrl if it points to /static/
brand_logo_url = token.get("brandLogoUrl") or ""
if brand_logo_url.startswith("/static/"):
token["brandLogoUrl"] = f"{app_root}{brand_logo_url}"

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +83
# Update brandSpinnerUrl if it points to /static/
if token.get("brandSpinnerUrl", "").startswith("/static/"):
token["brandSpinnerUrl"] = f"{app_root}{token['brandSpinnerUrl']}"
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new subdirectory handling for brandSpinnerUrl is not covered by tests, even though superset/app.py already has integration tests around subdirectory deployments (see tests/integration_tests/test_subdirectory_deployments.py). Please add tests that (1) verify brandSpinnerUrl values starting with /static/ are correctly prefixed with SUPERSET_APP_ROOT, and (2) ensure the default None value for brandSpinnerUrl does not cause errors when running under a subdirectory.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

global:theming Related to theming Superset size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant