Skip to content

refactor(core): reorganize superset-core packages into feature-based structure#38448

Merged
michael-s-molina merged 6 commits intoapache:masterfrom
michael-s-molina:reorganize-core-packages
Mar 5, 2026
Merged

refactor(core): reorganize superset-core packages into feature-based structure#38448
michael-s-molina merged 6 commits intoapache:masterfrom
michael-s-molina:reorganize-core-packages

Conversation

@michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Mar 5, 2026

User description

SUMMARY

Reorganizes both the Python (superset_core) and TypeScript (superset-core) packages from layer-based containers into a feature-based structure. This is a clean break — no backward-compatible shims.

Note for reviewers

The diff is large because all consumers were updated to the new import paths. The substantive change is the reorganization of the superset-core packages themselves — everything else is mechanical import updates.

Motivation

This follows the same principles as SIP-61, which reorganized the main superset-frontend/src/ from layer-based directories into feature-based ones. We apply the same thinking here to superset_core and superset-core.

Both packages previously grouped code by layer (api/, ui/) rather than by feature. The api/ layer bundled unrelated concerns: query execution types, async task infrastructure, MCP tool decorators, REST API utilities, and shared models — all in the same directory. The ui/ layer similarly co-located theme tokens, translation utilities, and UI components. This made it hard to understand what a given subpackage was for, and meant every consumer had to know which single file a symbol came from rather than which domain.

Python (superset_core)

# Before                  # After
superset_core/             superset_core/
└── api/                   ├── common/
    ├── models.py           │   ├── models.py
    ├── daos.py             │   └── daos.py
    ├── tasks.py            ├── queries/
    ├── types.py            │   ├── types.py
    ├── query.py            │   ├── models.py
    ├── mcp.py              │   ├── daos.py
    └── rest_api.py         │   └── query.py
                            ├── tasks/
                            │   ├── types.py
                            │   ├── decorators.py
                            │   ├── models.py
                            │   └── daos.py
                            ├── mcp/
                            │   └── decorators.py
                            ├── rest_api/
                                ├── decorators.py
                            │   └── api.py
                            └── extensions/

TypeScript (superset-core/src)

# Before               # After
src/                   src/
├── api/               ├── common/
│   ├── core.ts        │   └── index.ts
│   ├── commands.ts    ├── commands/
│   ├── editors.ts     │   └── index.ts
│   ├── views.ts       ├── editors/
│   └── ...            │   └── index.ts
└── ui/                ├── theme/
    ├── theme/         │   └── index.ts
    ├── translation/   ├── translation/
    └── components/    │   └── index.ts
                       ├── components/
                       │   └── Alert.tsx
                       └── utils/
                           └── index.ts

TESTING INSTRUCTIONS

  1. Run pre-commit: pre-commit run — all hooks should pass.
  2. Build packages: npm run plugins:build inside superset-frontend/ — all 23 packages should compile cleanly.
  3. Run tests

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

CodeAnt-AI Description

Reorganize and expose a feature-based core package with a complete theming and translation surface

What Changed

  • Introduces a consolidated theme subsystem: Theme object, provider, global styles, example themes, serialization/deserialization, utilities for font sizes, color variants, dark-mode detection, and tests — components can now consume theme from '@apache-superset/core/theme'
  • Adds a lightweight Alert component and story exported from the core package for consistent alerts across the app
  • Adds a translation singleton and moves translation helpers to '@apache-superset/core/translation'; updates many consumer imports to use the new feature paths (theme, translation, common)
  • Tests added for theme serialization, merging with base themes, algorithm handling, color utilities, and helper functions to validate behavior in light/dark modes

Impact

✅ Consistent theming across the app (single Theme API and provider)
✅ Reliable dark-mode detection and theme serialization for persistence
✅ Simplified, feature-focused import paths for theme and translation

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@michael-s-molina michael-s-molina force-pushed the reorganize-core-packages branch from f3b4a75 to 591dcfe Compare March 5, 2026 16:46
@netlify
Copy link

netlify bot commented Mar 5, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit f3b4a75
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a9b26ab257f400083ee1d8
😎 Deploy Preview https://deploy-preview-38448--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Mar 5, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 8937114
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a9d42a7d63920008b5b316
😎 Deploy Preview https://deploy-preview-38448--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@michael-s-molina michael-s-molina marked this pull request as ready for review March 5, 2026 17:02
@dosubot dosubot bot added change:backend Requires changing the backend change:frontend Requires changing the frontend packages labels Mar 5, 2026
@michael-s-molina michael-s-molina moved this from In Progress to In Review in Superset Extensions Mar 5, 2026
@github-project-automation github-project-automation bot moved this from In Review to Done in Superset Extensions Mar 5, 2026
@github-actions github-actions bot added doc Namespace | Anything related to documentation plugins dependencies:npm labels Mar 5, 2026
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.08%. Comparing base (f0416ef) to head (b1fcf40).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #38448      +/-   ##
==========================================
+ Coverage   64.82%   65.08%   +0.26%     
==========================================
  Files        1815     2520     +705     
  Lines       71917   127270   +55353     
  Branches    22915    29228    +6313     
==========================================
+ Hits        46618    82834   +36216     
- Misses      25299    43007   +17708     
- Partials        0     1429    +1429     
Flag Coverage Δ
hive 41.65% <ø> (?)
javascript 64.82% <ø> (ø)
mysql 63.41% <ø> (?)
postgres 63.48% <ø> (?)
presto 41.66% <ø> (?)
python 65.16% <ø> (?)
sqlite 63.10% <ø> (?)
superset-extensions-cli 89.94% <ø> (?)
unit 100.00% <ø> (?)

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.

@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Mar 5, 2026
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

That's a ridiculous number of changed files 😆 LGTM

@michael-s-molina michael-s-molina merged commit 357e35d into apache:master Mar 5, 2026
72 of 80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend change:frontend Requires changing the frontend dependencies:npm doc Namespace | Anything related to documentation packages plugins size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

Development

Successfully merging this pull request may close these issues.

2 participants