mikebridge opened a new pull request, #45061: URL: https://github.com/apache/superset/pull/45061
### SUMMARY `SEMANTIC_LAYERS` could previously only be decided at boot. It can now be toggled at runtime: the flag is evaluated per request through the feature-flag hook (`IS_FEATURE_ENABLED_FUNC`), and the semantic-layer APIs are registered on every startup. When the flag is off, every entry point that reads semantic data refuses with "Semantic layers are not enabled." before any data access: chart data, dashboards, Explore, form-data and permalinks, the datasource API, async queries, cache warm-up, dashboard screenshots and thumbnails, and the MCP view tools. Existing role and object permissions still apply when it is on. - SQL datasets are unaffected, as are the dataset paths of MCP tools that accept either a dataset or a semantic view. Unscoped MCP metric listings omit semantic views while the flag is off. - With the flag on, behavior is unchanged. - Stored assets are left intact. Dashboard dataset responses omit semantic views, chart saves reject semantic sources, and legacy batch warm-up records a per-chart unavailable error and continues. - Dashboard images that contain a semantic chart are refused (404) while the flag is off, whether freshly rendered or cached, because a cached image cannot encode the flag. This is documented in `UPDATING.md` and the feature-flags docs. - `ENABLE_EXTENSIONS` remains the deployment prerequisite for provider extensions. During a rolling upgrade, enable the flag at runtime only after all web and worker processes carry these guards. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF No visual redesign. Existing chart error rendering displays "Semantic layers are not enabled." while semantic datasource metadata is unavailable. ### TESTING INSTRUCTIONS 1. Initialize the app and permissions with `SEMANTIC_LAYERS=False`. Verify semantic API routes return 404 and that both API classes and their permission-view pairs are registered. 2. Through an `IS_FEATURE_ENABLED_FUNC` hook, toggle the semantic flag on, off, then on without restarting. Verify normal behavior resumes when enabled, and that while disabled queries, warm-up, metadata, cached images and semantic MCP tools refuse access. Ordinary dataset queries continue to work. 3. With an existing semantic chart and dashboard, verify chart metadata remains listed, dashboard datasets omit semantic entries, and chart create and title-only update are refused while disabled. Stored assets must remain unchanged. 4. Run `pytest tests/integration_tests/semantic_layers/api_flag_test.py` against an initialized test metadata DB, `pytest tests/unit_tests/semantic_layers`, and the focused chart, async-worker and MCP unit tests. Run Jest for `src/components/Chart/Chart.test.tsx`. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `SEMANTIC_LAYERS` - [x] Changes UI: runtime menu labels and existing unavailable-state rendering - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [x] Introduces new feature or API: runtime availability; existing API routes are always registered - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
