chore(tags): TAGGING_SYSTEM to True by default#39888
chore(tags): TAGGING_SYSTEM to True by default#39888sfirke wants to merge 2 commits intoapache:masterfrom
Conversation
Code Review Agent Run #83a85bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #39888 +/- ##
==========================================
- Coverage 64.37% 56.04% -8.33%
==========================================
Files 2569 2569
Lines 134745 134745
Branches 31278 31278
==========================================
- Hits 86739 75522 -11217
- Misses 46508 58570 +12062
+ Partials 1498 653 -845
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| "SSH_TUNNELING": False, | ||
| # Enables the tagging system for organizing assets | ||
| # @lifecycle: testing | ||
| "TAGGING_SYSTEM": True, |
There was a problem hiding this comment.
Suggestion: Setting TAGGING_SYSTEM to enabled by default causes SQLAlchemy tagging listeners to be registered during app initialization, and those listeners continue firing even when tests or runtime code later mock the flag to disabled. This breaks the expected feature-flag contract (disabled mode should not create tags), because listener lifecycle is startup-bound while flag checks are runtime-bound. Keep the default off until listener registration/unregistration is made fully dynamic with flag changes. [logic error]
Severity Level: Major ⚠️
- ❌ Tagging disabled-mode test fails; tags still created.
- ⚠️ Runtime flag toggles cannot disable SQLA tagging listeners.
- ⚠️ TAGGING_SYSTEM feature flag semantics become inconsistent, surprising.Steps of Reproduction ✅
1. Initialize the integration test application using `create_app` in
`tests/integration_tests/test_app.py:20-32`, which builds the global `app`. During app
initialization, `SupersetApp.sync_config_to_db` in `superset/app.py:161-186` is called by
the initializer, and because `DEFAULT_FEATURE_FLAGS["TAGGING_SYSTEM"]` is set to `True` in
`superset/config.py:669`, the check
`feature_flag_manager.is_feature_enabled("TAGGING_SYSTEM")` at `superset/app.py:183`
returns True and `register_sqla_event_listeners()` is invoked at `superset/app.py:186`.
2. The call to `register_sqla_event_listeners` at `superset/tags/core.py:20-53` registers
SQLAlchemy `after_insert`, `after_update`, and `after_delete` event listeners on
`SqlaTable`, `Slice`, `Dashboard`, `FavStar`, and `SavedQuery` (e.g.
`sqla.event.listen(SqlaTable, "after_insert", DatasetUpdater.after_insert)` at lines
36-52). These listeners do not consult the feature flag; once registered, they fire on
every corresponding SQLA event for the lifetime of the process.
3. Run the integration test `TestTagging.test_tagging_system` defined in
`tests/integration_tests/tagging_tests.py:231-259`. This test is decorated with
`@with_feature_flags(TAGGING_SYSTEM=False)` at
`tests/integration_tests/tagging_tests.py:231`, which uses the helper `with_feature_flags`
in `tests/integration_tests/conftest.py:224-243` to patch
`feature_flag_manager.get_feature_flags` so that it returns `TAGGING_SYSTEM=False` during
the test, but it does not unregister or modify any already-registered SQLAlchemy
listeners.
4. Inside `test_tagging_system`, the test clears the `TaggedObject` table, then creates
and commits a `SqlaTable`, `Slice`, `Dashboard`, `SavedQuery`, and `FavStar` (object
creation and `db.session.commit()` around
`tests/integration_tests/tagging_tests.py:244-259`). These commits trigger the previously
registered listeners from `register_sqla_event_listeners`, which create
`Tag`/`TaggedObject` rows via the updater `after_insert` methods in
`superset/tags/models.py:221-236`. The test then asserts that no tags exist (checking
`self.query_tagged_object_table()` and asserting length 0 at
`tests/integration_tests/tagging_tests.py:238-244`), but the assertion fails because tags
were still created even though `TAGGING_SYSTEM` was mocked to False, demonstrating that
once the feature was enabled at startup, disabling it via the flag no longer prevents
tagging.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset/config.py
**Line:** 669:669
**Comment:**
*Logic Error: Setting `TAGGING_SYSTEM` to enabled by default causes SQLAlchemy tagging listeners to be registered during app initialization, and those listeners continue firing even when tests or runtime code later mock the flag to disabled. This breaks the expected feature-flag contract (disabled mode should not create tags), because listener lifecycle is startup-bound while flag checks are runtime-bound. Keep the default off until listener registration/unregistration is made fully dynamic with flag changes.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
SUMMARY
Replacing/continuing #37852, trying setting TAGGING_SYSTEM to True by default.