feat(tags): add favorites filter to Tags list view - #41461
Conversation
Add a "Favorite" filter to the Tags list view, matching the pattern and ordering used by the Charts and Dashboards CRUD list views. Tag favorites live in the dedicated user_favorite_tag_table M2M table (not in FavStar), so a new TagFavoriteFilter (not a BaseFavoriteFilter subclass) queries that table for the current user. The filter is registered under the "id" search key and "id" is added to the API search_columns. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review Agent Run #3d0a91
Actionable Suggestions - 1
-
superset/tags/filters.py - 1
- Missing unit tests for TagFavoriteFilter · Line 52-74
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
tests/integration_tests/tags/api_tests.py - 1
- Missing type annotation on test · Line 605-605
Review Details
-
Files reviewed - 5 · Commit Range:
c1e764b..c1e764b- superset-frontend/src/components/ListView/types.ts
- superset-frontend/src/pages/Tags/index.tsx
- superset/tags/api.py
- superset/tags/filters.py
- tests/integration_tests/tags/api_tests.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ 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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41461 +/- ##
==========================================
- Coverage 64.52% 64.51% -0.01%
==========================================
Files 2664 2664
Lines 146153 146173 +20
Branches 33713 33718 +5
==========================================
+ Hits 94307 94309 +2
- Misses 50131 50146 +15
- Partials 1715 1718 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rusackas
left a comment
There was a problem hiding this comment.
LGTM — checked TagFavoriteFilter.apply against BaseFavoriteFilter and it's a faithful mirror (tag favorites live in user_favorite_tag_table, not FavStar, so not subclassing is right), and the registration under search_filters["id"] matches how dashboards do it. Integration test covers both directions.
One thing worth being aware of rather than fixing: the new explicit search_columns list narrows what FAB used to derive for the Tag API (e.g. changed_on drops out of searchability). It matches the charts/dashboards convention so I read it as cleanup, but flagging in case anyone was leaning on the old surface.
SUMMARY
Adds a "Favorite" filter to the Tags list view, mirroring the pattern (and ordering) already used by the Charts and Dashboards CRUD list views. Users can now filter the Tags list to show only their favorited tags (or only non-favorited).
Frontend
ListView/types.ts: addedTagIsFav = 'tag_is_favorite'to theListViewFilterOperatorenum.pages/Tags/index.tsx: added a memoizedfavoritesFilter(Yes/No select,operator: TagIsFav), included in the filters array guarded byuserId. The Tags list has no Owner/Certified filters, so it's placed between Name and Modified by — consistent with where Charts/Dashboards put Favorite (after owner-type filters, before "Modified by").Backend
tags/filters.py: newTagFavoriteFilter. Note tag favorites are stored inuser_favorite_tag_table(a dedicated M2M table), not inFavStar— so this deliberately does not subclassBaseFavoriteFilter. It builds a subquery of favorited tag ids for the current user (anonymous users pass through unfiltered), mirroringTagDAO.favorited_ids.tags/api.py: registeredTagFavoriteFilterunder the"id"key insearch_filtersand added an explicitsearch_columnslist includingid.A companion PR fixes the (separate) bug where the Tags favorite star did not toggle: #41460
TESTING INSTRUCTIONS
New integration test
tests/integration_tests/tags/api_tests.py::test_get_list_tag_filtered_by_favoriteassertstag_is_favorite=True/Falsereturns the correct tags for the current user.ADDITIONAL INFORMATION