villebro opened a new pull request, #38200:
URL: https://github.com/apache/superset/pull/38200

   # SUMMARY
   
   Introduces publisher concept for Superset extensions, adding organizational 
namespaces similar to VS Code extensions. This change adds mandatory 
`publisher` fields, renames current `name` to `displayName`, uses current 
validation logic for new technical `name` field, generates composite IDs in 
`publisher.name` format, supports npm organization format (`@publisher/name`), 
nested Python structure (`superset_extensions.publisher.name`), and 
collision-safe Module Federation naming (`publisher_name`). The publisher 
concept enables organizational identity while preventing naming conflicts 
between extensions from different publishers.
   
   ## Problem & Organizational Namespace Need
   
   **Extension Namespace Collision Challenge:**
   Without organizational namespaces, extensions from different organizations 
could easily conflict:
   
   - Organization A creates extension "dashboard-widgets"
   - Organization B also creates extension "dashboard-widgets" 
   - Result: Name collision preventing both extensions from coexisting
   
   **Current Simple Structure (Collision Prone):**
   ```json
   {
     "id": "dashboard-widgets",
     "name": "Dashboard Widgets",
     "version": "1.0.0"
   }
   ```
   
   **Generated Paths (No Collision Protection):**
   - Python: `superset_extensions.dashboard_widgets`
   - NPM: `dashboard_widgets` 
   - Module Federation: `dashboardWidgets`
   - REST API: `/api/v1/extensions/dashboard-widgets/{file}`
   
   ## Solution: Publisher-Based Organizational Namespacing
   
   **After (Collision-Safe Publisher Structure):**
   ```json
   {
     "publisher": "acme-corp",
     "name": "dashboard-widgets", 
     "displayName": "Dashboard Widgets",
     "version": "1.0.0"
   }
   ```
   
   **Generated Paths (Fully Collision-Safe):**
   - Composite ID: `acme-corp.dashboard-widgets` (internal registry)
   - Python: `superset_extensions.acme_corp.dashboard_widgets`
   - NPM: `@acme-corp/dashboard-widgets` (scoped package)
   - Module Federation: `acmeCorp_dashboardWidgets` (collision-safe JS 
identifier)  
   - Backend Package: `acme_corp-dashboard_widgets` (collision-safe 
distribution)
   - REST API: `/api/v1/extensions/acme-corp/dashboard-widgets/{file}`
   
   ### Why Publisher Namespaces?
   
   Publisher namespaces provide organizational identity similar to VS Code 
extensions while preventing naming conflicts:
   - **Organizational Identity**: Clear attribution for extension publishers
   - **Collision Prevention**: Multiple organizations can create extensions 
with the same technical name
   - **Distribution Safety**: NPM scoped packages, collision-safe Python 
packages, unique Module Federation names
   - **Enterprise Support**: Multiple extension publishers can coexist
   - **Industry Standards**: Follows established patterns (VS Code, npm 
organizations)
   
   ## Key Changes
   
   ### CLI (`superset-extensions-cli/`)
   - **types.py**: Added `ExtensionNames` TypedDict with publisher-aware name 
variants
   - **utils.py**: Added publisher validation, technical name validation, 
display name validation, and name transformation functions
   - **cli.py**: Redesigned three-step publisher workflow (display name → 
technical name → publisher)
   - **constants.py**: Centralized validation patterns with improved regex 
preventing consecutive hyphens
   - **templates/**: Updated all templates for publisher/name structure with 
proper field usage
   
   ### Superset Core (`superset-core/`)
   - **types.py**: Enhanced `BaseExtension` with `publisher`, `name` 
(technical), `displayName` fields and composite `id` in `Manifest`
   - **constants.py**: Shared validation patterns ensuring consistency across 
CLI and core
   
   ### REST API (`superset/`)
   - **extensions/api.py**: Updated endpoints from `/extensions/{id}` to 
`/extensions/{publisher}/{name}` structure
   - **extensions/utils.py**: Updated URL generation to use publisher/name paths
   
   ### Documentation (`docs/`)
   - **quick-start.md**: Updated examples to show publisher workflow and new 
field structure
   - **API endpoints**: Reflect new publisher/name URL patterns
   
   ## Flow Example
   
   ```bash
   # CLI prompts (new three-step flow)
   Extension display name: Dashboard Widgets
   Extension name (dashboard-widgets): [Enter] 
   Publisher (e.g., my-org): acme-corp
   
   # Generated names (all collision-safe)
   Composite ID: "acme-corp.dashboard-widgets" (internal registry)
   NPM package: "@acme-corp/dashboard-widgets" (scoped)
   Module Federation: "acmeCorp_dashboardWidgets" (collision-safe JS)
   Backend package: "acme_corp-dashboard_widgets" (collision-safe Python 
distribution)
   Python namespace: "superset_extensions.acme_corp.dashboard_widgets" (clean 
imports)
   ```
   
   ## Architecture Benefits
   
   ### Collision Prevention at Multiple Levels
   - **NPM Scoped Packages**: `@acme-corp/widgets` vs `@other-org/widgets`
   - **Module Federation Safety**: `acmeCorp_widgets` vs `otherOrg_widgets`
   - **Backend Distribution**: `acme_corp-widgets` vs `other_org-widgets`  
   - **Python Namespaces**: `superset_extensions.acme_corp.widgets` vs 
`superset_extensions.other_org.widgets`
   
   ### Developer Experience
   - **Name Suggestions**: Display name automatically suggests technical name
   - **Three-Step Flow**: Display name → Technical name → Publisher workflow
   - **Consistent Validation**: Centralized patterns with clear error messages
   - **Directory Naming**: Composite ID structure (`publisher.name`) for 
organization
   
   ### Enterprise Features
   - **Organizational Branding**: Publishers provide clear attribution
   - **Multi-Tenant Support**: Different organizations can develop extensions 
independently
   - **Industry Standards**: Aligns with VS Code extension model and npm 
organizations
   
   ## Testing
   
   - **Comprehensive Test Suite**: All CLI, template, validation, and 
integration tests updated
   - **Name Transformation Tests**: Validation patterns, collision-safe naming, 
Module Federation compatibility
   - **CLI Workflow Tests**: Three-step publisher creation, error handling, 
retry logic
   - **Template Generation**: Publisher/name structure, nested directory 
creation, field validation
   - **API Endpoint Tests**: Publisher/name URL structure, composite ID 
reconstruction
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to