Add CLI to clean up stale roles in Auth0 dev tenant - #2906
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2906 +/- ##
==========================================
+ Coverage 74.21% 74.23% +0.02%
==========================================
Files 330 331 +1
Lines 25393 25417 +24
Branches 2532 2537 +5
==========================================
+ Hits 18845 18869 +24
Misses 6498 6498
Partials 50 50
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:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new role listing helper risks missing roles due to pagination handling, and the cleanup command’s dry-run messaging is misleading when there is nothing to delete.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
This PR adds a new bwiz clean-up-roles CLI utility intended to remove stale Auth0 roles from the Auth0 dev tenant by comparing roles in Auth0 against the role IDs present in the seeded database table.
Changes:
- Introduces
clean_up_roles()CLI functionality and wires it intobwizsubcommands with a dev-safety guard. - Refactors Auth0 CLI service logic to add a
get_roles()helper and throttles role deletions. - Adds model tests covering the new cleanup behavior and documents the available CLI utilities in the backend README.
| File | Description |
|---|---|
| back/test/model_tests/test_cli.py | Adds tests validating dry-run vs --force cleanup behavior. |
| back/README.md | Documents bwiz utilities, including the new dev-tenant role cleanup command. |
| back/boxtribute_server/cli/service.py | Adds get_roles() and introduces a short delay between role deletions. |
| back/boxtribute_server/cli/main.py | Adds the clean-up-roles subcommand and dev-only execution guard. |
| back/boxtribute_server/cli/clean_up_roles.py | Implements role cleanup by diffing Auth0 roles vs seeded DB role IDs. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.


https://trello.com/c/0XGckxmL