Repository navigation
Conversation
superset init -> sync_role_definitions creates missing permissions and runs clean_perms, but clean_perms only ever deletes PermissionView rows whose Permission/ViewMenu foreign keys are NULL. It never removes well-formed PVMs whose underlying endpoint/method has since been removed from the codebase, so permissions deprecated over many past releases (can_select_star being the reported example) silently persist forever across upgrades. This adds a new delete_pvms() helper to the existing, actively-used security_converge.py shared module (previously only migrate_roles() existed, which cannot express a pure deletion with no successor - an empty replacement tuple is silently never processed), plus two chained migrations: - One pure-deletion migration for 25 permissions individually confirmed to have no successor (endpoint/method deleted outright, not renamed), verified against current code, the full migrations history, and UPDATING.md. - One rename migration, using the existing unmodified migrate_roles(), for 12 permissions that were consolidated onto a verified live successor (e.g. can_explore_json -> can_read on Chart), so role assignments are preserved rather than dropped. Both migrations target explicit (view_menu, permission) pairs only, never a name-based sweep, so the per-object database_access / datasource_access / schema_access / catalog_access permissions - reused across many view menus - are structurally unreachable by either migration. Fixes apache#33272
Code Review Agent Run #33fffaActionable Suggestions - 0Additional Suggestions - 1
Review 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #44142 +/- ##
=======================================
Coverage 80.90% 80.90%
=======================================
Files 2948 2948
Lines 177121 177137 +16
Branches 41054 41060 +6
=======================================
+ Hits 143304 143317 +13
- Misses 31118 31119 +1
- Partials 2699 2701 +2
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:
|
|
@Ujjwaljain16 nice work tracking down the actual removed/renamed permissions here, the migration docstrings are thorough. Pre-commit's failing for real though: |
migrate_roles() expects dict[Pvm, tuple[Pvm, ...]], but the inline dict literal in test_migrate_roles_renames_permission_and_migrates_role was inferred as dict[Pvm, tuple[Pvm]] -- a fixed-length one-tuple type, not the variadic form -- since dict is invariant in its value type, mypy correctly rejects passing the narrower inferred type where the wider one is expected. Annotating the local with the existing PvmMigrationMapType alias (used elsewhere in security_converge.py for exactly this purpose) resolves it with no behavior change. Confirmed via: mypy --check-untyped-defs on the file reports no issues.
…SSIONS
("can_test_conn", "Superset") has been marked "Deprecated permission
remove on 3.0.0" in this set literal since before 3.0.0, but was never
actually removed. This PR's deletion migration removes the underlying
PVM from the database, so leaving the entry here would contradict the
cleanup by keeping dead data in the one place that already knew about
it. _is_sql_lab_only() only checks set membership against PVMs that
still exist, so removing an entry whose PVM is gone changes nothing at
runtime.
Flagged by automated review on apache#44142.
|
@rusackas |
Code Review Agent Run #0d2e2fActionable 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 |
|
Request changes: genuinely high-quality migration — helper logic is sound, the security model is intact (no privilege escalation/loss in any of the 12 renames), the alembic chain is clean (single head, chains correctly), and every one of the 25 deletions I could confirm dead is dead. But two entries carry the wrong permission name and silently no-op, and one of those loses a custom-role grant it was meant to preserve. Note: despite the 🟡 Medium — 🟡 Medium — 🟢 Low — Cleanup is incomplete; docstring over-claims an exhaustive sweep 🟢 Low — Stale MCP doc reference to a removed permission 🟢 Low — Missing regression guard for the PVM_LIST / PVM_MAP disjointness invariant 🟢 Low — No test that a role keeps its other permissions after a delete/rename 🟢 Low — Test polish (nits) |
…in review A contributor review on this PR found that two PVM_LIST entries were phantom permission names (can_get_or_create_table never existed; can_test_conn should have been can_testconn) that would silently no-op instead of preserving the roles that held them. Chasing that down further, two independent audit passes -- checking every candidate against its actual removal PR diff, @deprecated(new_target=...) decorators, and FAB's MODEL_API_RW_METHOD_PERMISSION_MAP resolution to a live REST endpoint, rather than trusting the earlier "no successor" classification -- found the same defect in 17 more of the original 25 PVM_LIST entries: they have a real, verifiable live successor and were only ever deletions by mistake. PVM_LIST now holds exactly 6 entries independently confirmed to have no successor at all (endpoint/method deleted outright, no @deprecated(new_target=...) or equivalent). PVM_MAP grew from 12 to 34 entries: the 11 originally-correct renames, the corrected can_sqllab_table_viz key (replacing the phantom can_get_or_create_table), 19 reclassified entries, and 2 permissions (can_annotation_json, can_fave_dashboards_by_username) that were missing from both lists entirely. NEW_PVMS is expanded to match, including three new view menus (AvailableDomains, SecurityRestApi, SavedQuery). A final targeted verification pass on the four weakest-evidence mappings caught one more real gap before commit: can_my_queries's successor was correct but incomplete -- SavedQuery.can_list only gates the page shell, while the actual data comes from a separate SavedQuery.can_read-gated API call, so a migrated role would have landed on a blank page. Fixed to grant both, mirroring the existing can_favstar dual-target pattern. The other three mappings checked in that pass (can_import_dashboards, can_favstar, and the SECURITY.md doc fix) were independently confirmed correct against live endpoint code. Also fixes a dangling permission reference in superset/mcp_service/SECURITY.md (can_sql_json, which this PR renames, was documented against the wrong view menu besides). Tests: added a PVM_LIST/PVM_MAP disjointness assertion, strengthened two existing tests to confirm a role's other permissions survive a delete/rename untouched, and added chained-migration and rename-idempotency regression tests.
|
@rebenitez1802 really appreciate the deep dive here both of your Medium findings checked out, and pulling that thread turned out to matter a lot more than i expected
the bigger surprise was yr "incomplete cleanup" note i went and actually checked PR #24400's diff for the six permissions you called out as a minor doc nit, and every single one of them has a real also added fixed the one more thing came up on a final pass i did over the shakier mappings before merging: two mappings ( tests went from 154 to 157 |
Code Review Agent Run #2a077bActionable Suggestions - 0Additional Suggestions - 2
Review 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 |
gabotorresruiz
left a comment
There was a problem hiding this comment.
Hey @Ujjwaljain16, thanks for the thorough work here. This is one of the most carefully evidenced migration PRs I have reviewed, and the split into pure deletions vs role-preserving renames is exactly the right shape for #33272.
I verified it empirically on this branch rather than just reading the diff:
pytest tests/unit_tests/migrationspasses (161 tests) andpytest tests/unit_tests/securitypasses (345 tests).- On a fresh sqlite metastore upgraded to
7e2c9a4f1b83, I seeded a custom role holdingcan_profile,can_approve,can_sql_json,can_select_starandcan_testconn, plus an operator-custom PVM and an object-specdatabase_accessPVM, then ransuperset db upgrade. The deprecated PVMs are deleted, the role lands on exactly the verified successors, and both the custom and object-spec PVMs survive untouched. Downgrade past both migrations and a second upgrade also run clean. - I reproduced your
migrate_rolesclaim: an empty successor tuple really is a silent no-op, sodelete_pvmsis genuinely needed. - Spot-checked the history: every
PVM_MAPkey existed as a real view method at 1.5.0/2.1.0,save_dashwas removed with a bare@deprecated()in #24353,sqllab_table_vizwas the real permission behind/get_or_create_table/, and UPDATING.md's statedcan execute/can resultssuccessors indeed do not exist in a live DB. Good catches on all three corrections.
One blocking item, and it is mechanical: the branch currently resolves to 3 Alembic heads (c7f53d184ea2, 88a01c781622, 3ce9a4572f8a) because two other migrations landed on master with the same down_revision = "7e2c9a4f1b83" this branch was cut from. Every red CI job I checked (enforce-single-migration-head, test-postgres, docker-build, cypress-matrix) fails on the same Multiple head revisions error during superset db upgrade, so rebasing 1f5f4fb8bfc1 onto the current head (or adding the no-op merge revision the CI error suggests) should turn everything green in one shot.
Not a blocker: since this migration changes role grants on upgraded installs, an UPDATING.md entry describing what moves where would help operators with custom roles.
Happy to approve once the heads are sorted and CI is green.
…oadening A second review round found three more issues, all fixed here: Master had grown two new migrations sharing this branch's original down_revision, so the branch resolved to 3 Alembic heads and every CI job failed on "Multiple head revisions" during superset db upgrade. Adds a no-op merge migration reconciling all three heads, following this repo's own established pattern for exactly this situation. A reviewer verified empirically that three PVM_MAP renames resurrect long-dead permissions as a live, strictly broader capability instead of the narrow one they used to gate: can_testconn (a role holding only this dead permission has no live capability today) would come out of the migration holding Database.can_write, which covers creating, editing and deleting any database connection, not just testing one. Chasing this further, the same defect exists in can_sqllab_viz (-> Dataset.can_write) and can_import_dashboards (-> Dashboard.can_write, which also turns out to have no UPDATING.md guidance for this removal at all), plus a fourth entry the reviewer didn't flag: can_add_slices (-> Chart.can_write), which on top of the broadening issue looks mapped to the wrong resource entirely -- the old action mutated a dashboard's chart membership, not chart records themselves. All four move from the rename migration to the delete migration; NEW_PVMS is trimmed of the now-unused can_write grants on Chart/Database/Dataset. can_copy_dash keeps its Dashboard.can_write rename, since Superset's current copy_dash REST endpoint is still gated by that exact permission today -- a genuine like-for-like match, not broadening. Also: trimmed both migration docstrings, which had been narrating this PR's own draft history (an earlier 25-entry list, an 11-entry map) that never shipped and would send a future reader looking for something that doesn't exist -- the per-entry inline comments already carry the needed context. Added an UPDATING.md entry explaining the delete-vs- rename split to operators with custom roles. Finally, an automated review caught two real bugs in the migration tests added for the previous round. The PVM_LIST/PVM_MAP disjointness test's second assertion checked NEW_PVMS.get(pvm.view, ()), but every PVM_LIST entry's view is "Superset", which is never a NEW_PVMS key -- the lookup always returned () and the assertion passed regardless of content. Fixed to flatten every NEW_PVMS successor permission across all views and check for a collision against that full set. Separately, the rename-migration idempotency test's "old PVM is gone" assertion filtered on permission name alone; PVM_MAP contains same-name, different-view pairs (can_recent_activity -> Log/can_recent_activity), so it would have spuriously failed had the dict's iteration order ever put one of those first. Fixed to filter on both view and permission name. No production migration logic changed for either fix.
…rmissions-cleanup-33272 # Conflicts: # UPDATING.md
|
@gabotorresruiz thanks for both passes on this the head-conflict catch and the write-permission question in particular were exactly the kind of thing worth slowing down for The Alembic head conflict fixed with a merge migration reconciling all three heads, like you suggested. Then master moved again and brought in its own fix for the same underlying split (a different merge migration resolving the same two heads), which made mine redundant and would've quietly created a new two-way split underneath it. Caught that by actually computing the head graph from all the migration files rather than trusting On the write-permission question you were right, and chasing it further turned up more of the same. Also trimmed both migration docstrings per your nit they don't narrate the earlier 25-entry/11-entry draft history anymore, just the final evidence. And added the One more thing came out of an automated review pass afterward, which I checked by hand before touching anything: two real bugs in the tests from the previous round. The Tests are at 161 passing, ruff's clean, and i re-ran the full chain fresh after every change rather than assuming it still worked |
Code Review Agent Run #dfda57Actionable Suggestions - 0Additional Suggestions - 1
Review 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 |
rebenitez1802
left a comment
There was a problem hiding this comment.
Approve: the latest revision resolves every blocking finding from the prior review rounds — the four broadening can_write renames (can_testconn, can_sqllab_viz, can_import_dashboards, can_add_slices) are now pure deletes, the 3-head Alembic conflict is merged to a single head, the disjointness test's vacuous assertion is fixed, and UPDATING.md now documents the delete-vs-rename split for operators. I re-verified on the latest commit: PVM_LIST (10) ∩ PVM_MAP (29) = ∅, NEW_PVMS is exactly its 16 successors (no dangling, no extra), and both origin/master and this branch resolve to a single Alembic head. Only minor, non-blocking notes remain.
🟢 Low — can_copy_dash → Dashboard.can_write is the one remaining broadening
rename…33272.py:132. This is a conscious, documented exception: the live copy_dash REST endpoint is gated by exactly Dashboard.can_write, so it's argued as a 1:1 action match. Strictly, Dashboard.can_write is still broader than the old copy-only action (it also grants edit/delete of all dashboards), so a custom role that held only the dead can_copy_dash gains full dashboard write. It's Gamma-tier (built-in Gamma already holds it; only an unusual custom role is affected) and copy has no narrower successor, so keeping it is defensible — just noting it's the same broadening shape as the four deletes, one tier down. Your call.
🟢 Low — Database.can_read consolidation of four dead read perms
can_select_star/can_validate_sql_json/can_schemas_access_for_file_upload/can_extra_table_metadata all fold into the full Database.can_read surface. Bounded (scoped by DatabaseFilter to already-accessible databases, metadata-only, secrets stay write-gated/masked), so informational rather than a boundary issue.
🟢 Nit — stale removal-PR citation
The delete migration's docstring cites can_override_role_permissions removal as PR #23714; that PR only added the @deprecated decorator — the actual removal was #24266.
gabotorresruiz
left a comment
There was a problem hiding this comment.
LGTM. The write successor concern is resolved, and I confirmed it end to end on dc234b16 rather than reading the diff.
- Seeded a custom role holding
can_testconn,can_sqllab_viz,can_import_dashboards,can_add_slicesandcan_save_dashon a metastore at7e2c9a4f1b83, plus an object leveldatabase_accessPVM and an operator custom PVM, then ransuperset db upgrade: the role loses all five and gains nothing, so no dead grant comes back as a live write. Identical before/after sets on SQLite and on PostgreSQL 17. can_copy_dashstaying a rename checks out:copy_dashinsuperset/dashboards/api.py:2694carries@permission_name("write"), soDashboard.can_writeis genuinely the gate on the live route.- Downgrade past both migrations runs clean and restores nothing, matching the documented no-op, and a second
superset db upgradelands on identical state, so the pass is idempotent. - Against a fresh
superset init(231 PVMs): none of the 10PVM_LISTentries or 29PVM_MAPkeys exist, every successor does, andNEW_PVMSis exactly the successor closure. TheSupersetview menu keeps 16 live PVMs, so it is never orphan deleted. superset db headsresolves to2ce579e91ae6alone, andtests/unit_tests/migrations(161) plustests/unit_tests/securityandtests/unit_tests/initialization_test.py(397) all pass.
Not a blocker: nothing in the suite pins the policy this round landed. I put Pvm("Superset", "can_testconn"): (Pvm("Database", "can_write"),) back into PVM_MAP locally and all 161 tests still passed, so a later edit could quietly re-broaden a dead permission again. One assertion in tests/unit_tests/migrations/test_deprecated_permissions_33272.py would pin it:
def test_can_copy_dash_is_the_only_write_level_rename() -> None:
write_renames = {
old_pvm
for old_pvm, successors in PVM_MAP.items()
if any(successor.permission == "can_write" for successor in successors)
}
assert write_renames == {Pvm("Superset", "can_copy_dash")}It fails on that re-broadened map and passes as written on this head.
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @Ujjwaljain16 Your base branch
|
1 similar comment
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @Ujjwaljain16 Your base branch
|
Two small fixes from rebenitez1802's approval review: - The delete migration's docstring cited PR apache#23714 as the removal of can_override_role_permissions. Verified against the actual PR: apache#23714 only added the @deprecated() decorator; the endpoint itself (the method, its @expose, and its tests) was deleted later, in PR apache#24266. Docstring now cites both correctly. - Added the regression test gabotorresruiz proposed, pinning that can_copy_dash is the only write-level rename in PVM_MAP. They showed this by hand -- reintroducing can_testconn -> Database.can_write locally still passed all 161 existing tests, meaning nothing would catch that exact regression recurring. Verified the same way before adding it: constructed the regression in an isolated script (never touching the tracked file) and confirmed the new assertion fails against it while passing against the current PVM_MAP. Also merges another master-side Alembic head split that landed since the last push: master resolved its own theme-editors/purge-audit head conflict with a new merge migration, which doesn't chain from ours, so the branch was back to 2 heads. Added one more small merge migration reconciling the two. Verified via master's own new tests/unit_tests/migrations/test_single_migration_head.py (added in this same master pull) rather than just this branch's own head-counting script.
can_testconn, can_sqllab_viz, can_import_dashboards, and can_add_slices were moved to the delete migration because their proposed successor represented a substantially different, broader capability than the dead permission ever granted. can_copy_dash looks like the same shape (Dashboard.can_write is also broader than the historical action) but is materially different: the live copy_dash endpoint is itself authorized by exactly Dashboard.can_write today, so migrating it preserves access to the modern implementation of the same feature rather than resurrecting a dead, unrelated grant. Without this, a future contributor comparing the four deletes against this one rename could reasonably wonder why it wasn't treated the same way.
Code Review Agent Run #cf483bActionable 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 |
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @Ujjwaljain16 Your base branch
|
|
@Ujjwaljain16 this looks good to go, can you just check if your migrations have conflicts, if it doesn't I can merge your pr. |
gabotorresruiz
left a comment
There was a problem hiding this comment.
LGTM, re-verified on df6dfccb.
The chain is the part worth confirming given how much master has moved: I combined this branch's superset/migrations/versions with current master (a7dab4a5) and the union resolves to exactly one head, 53a7abc31422. On a seeded metastore the round trip still behaves on both SQLite and PostgreSQL 17: the same 39 dead PVMs removed and 9 successors added as on the previous head, superset db downgrade past both migrations restores nothing, and a second superset db upgrade is a no-op. tests/unit_tests/migrations 167 passed.
Thanks for adding the write-level rename guard. I confirmed it earns its place: putting Pvm("Superset", "can_testconn"): (Pvm("Database", "can_write"),) back into PVM_MAP makes test_can_copy_dash_is_the_only_write_level_rename fail at tests/unit_tests/migrations/test_deprecated_permissions_33272.py:139, which is exactly the regression it needs to catch.
|
@sadpandajoe no conflicts |
🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️ 🙅♂️❗ @Ujjwaljain16 Your base branch
|
…xecution ownership) Master landed superset/migrations/versions/2026-09-16_00-00_93d1b4a76c02_add_report_execution_ownership.py as its own single head, but it never got folded into this branch's merge-migration chain, so after the last few "Update branch" syncs the branch had two heads: 93d1b4a76c02 (master's real head) and 53a7abc31422 (this branch's prior merge tip). Verified independently, outside the blocked Codespace, by cloning apache/superset:master and this branch fresh and computing the Alembic head graph directly from the migration files: master's own head is genuinely 93d1b4a76c02, and this branch had exactly the two heads above before this commit. Also cross-checked against the enforce-single-migration-head CI job's own log, which reports the identical two heads. The docker-build (dev) job's failure is the same root cause: its docker-compose sanity check hits the same flask_migrate "Multiple head revisions" error. Adds one more no-op merge migration joining the two heads, same pattern as the three prior rounds of this. No production migration logic changes.
|
@rusackas Root cause: fixed by adding one more no-op merge migration joining the two heads CI is green now |
Code Review Agent Run #23e6d2Actionable Suggestions - 0Additional Suggestions - 2
Review 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 |
rusackas
left a comment
There was a problem hiding this comment.
LGTM. This got an unusually thorough pass already, real DB round-trips on SQLite and Postgres, seeded custom roles, idempotency checks, the write-level broadening question actually traced through to the live route. I re-verified the head myself since the last full review: 77e39422 only adds one more no-op Alembic merge stub on top of df6dfccb, same shape as the ones already reviewed, nothing substantive changed. CI's green, single migration head, merging.
SUMMARY
Deprecated permissions are never cleaned up after an upgrade (#33272).
superset init→sync_role_definitionscreates missing permissions and runsclean_perms, butclean_permsonly ever deletesPermissionViewrows whosePermission/ViewMenuforeign keys areNULL— it never removes well-formed PVMs whose underlying endpoint/method has since been deleted from the codebase.can_select_star(the reporter's example) is one of many such permissions that silently accumulate on every upgraded install while never appearing on a fresh one.The maintainer thread on the issue correctly flagged the risk here: a naive "delete everything not in a hardcoded current-permissions allow-list" approach could delete permissions a custom role or an installed extension still legitimately needs, since Superset has no built-in way to distinguish "genuinely dead" from "just not used by a built-in role." This PR deliberately avoids that failure mode:
(view_menu, permission)pairs. There is no "find by permission name" logic anywhere, so the per-objectdatabase_access/datasource_access/schema_access/catalog_accesspermissions — which are legitimately reused across many view menus (one per Database/SqlaTable/schema/catalog) — are structurally unreachable by this code, not just excluded by convention.superset/views/API code, the entiresuperset/migrations/history (to rule out double-handling), andUPDATING.md's actual PR history for the underlying feature removal. Anything without affirmative "removed, not renamed" evidence was left out, even when it looked plausible.ModelRestApimigration of the old monolithicSupersetview — e.g.can_explore_json→can_readonChart). These use the existingmigrate_roles()machinery unmodified, so a role holding the old permission is moved onto the verified live successor rather than just losing it. Two of these mappings also correct an actual inaccuracy inUPDATING.mditself (can_sql_json/can_results's stated successors don't exist in a live DB; the real ones, confirmed by queryingab_permission/ab_permission_view, arecan_execute_sql_query/can_get_resultsonSQLLab).Implementation-wise,
migrate_roles()can't express a pure deletion with no successor (an empty replacement tuple is silently never processed — confirmed by reading the function), so this adds one small new helper,delete_pvms(), to the existingsuperset/migrations/shared/security_converge.pymodule. It reuses_delete_old_permissions()'s existing orphan-safe deletion logic (delete thePermissionView, then thePermission/ViewMenuonly if no other PVM still references them) rather than duplicating it, and does its own role-unassignment pass first.migrate_roles(),clean_perms(), and FAB'ssecurity_cleanup()are all untouched.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable — this is a backend/migration-only change with no UI impact.
TESTING INSTRUCTIONS
pytest tests/unit_tests/migrations/shared/security_converge_test.py— 7 tests coveringdelete_pvms()directly: removal + role-association cleanup, orphan deletion, shared-permission preservation, idempotency (running twice is a safe no-op), and that a dynamic/object-style permission is left untouched because it's simply never in the explicit input list.pytest tests/unit_tests/migrations/test_deprecated_permissions_33272.py— 4 tests that import the two actual migration modules and exercise their realPVM_LIST/PVM_MAP(not hand-copied subsets), so editing either list in the future automatically re-exercises the updated data.pytest tests/unit_tests/migrations/— full suite, 154 passed, no regressions.superset db upgradefrom a fresh install runs both migrations cleanly and lands on a single new head with no branching;superset db downgradeback past both migrations also completes without error (bothdowngrade()s are intentionally documented no-ops, since there's nothing meaningful to restore for a pure deletion, and reversing the renames would strip active permissions from roles).ruff format --check/ruff checkclean on all changed files.ADDITIONAL INFORMATION
Runtime/downtime note: both migrations only touch
ab_permission/ab_view_menu/ab_permission_view/ab_permission_view_rolerows for a fixed, small (37 total) set of named permissions — not a table scan — so runtime is negligible regardless of instance size, and no downtime is expected.