feat(mcp): add dashboard owner, role, and certification management tools#41606
Draft
aminghadersohi wants to merge 1 commit into
Draft
feat(mcp): add dashboard owner, role, and certification management tools#41606aminghadersohi wants to merge 1 commit into
aminghadersohi wants to merge 1 commit into
Conversation
update_dashboard intentionally dropped owners/roles as full-replacement fields (no "keep >=1 owner" guard, and a partial list could silently narrow/widen access). Add three dedicated tools with explicit add/remove semantics instead: manage_dashboard_owners (rejects removing the last owner), manage_dashboard_roles (DASHBOARD_RBAC access list), and manage_dashboard_certification (certified_by/certification_details).
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #41606 +/- ##
==========================================
- Coverage 64.42% 64.34% -0.08%
==========================================
Files 2668 2671 +3
Lines 147182 147483 +301
Branches 33947 33976 +29
==========================================
+ Hits 94821 94905 +84
- Misses 50646 50861 +215
- Partials 1715 1717 +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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #40957 (
update_dashboardMCP tool). During that review,owners,roles,certified_by, andcertification_detailswere scoped out ofupdate_dashboardbecause they're distinct governance concerns from layout/theme/metadata, and a full-replacement list has no safety guard (owners=[]could silently orphan a dashboard;roles=[]/partial lists could silently widen or narrow access). See discussion: #40957 (comment)This PR adds three dedicated tools instead, each with explicit add/remove (or set/clear) semantics:
manage_dashboard_owners—add_owner_ids/remove_owner_ids. Rejects removals that are not currently owners, and rejects any change that would leave the dashboard with zero owners. Surfaces a warning when a non-admin caller's self-removal is auto-reverted bypopulate_owner_list's existing self-protection.manage_dashboard_roles—add_role_ids/remove_role_idsfor the DASHBOARD_RBAC access list. Reportsdashboard_rbac_enabledand warns when the flag is off (roles are stored but inert).manage_dashboard_certification— independentcertified_by/certification_detailsfields;Noneleaves a field unchanged,""clears it, mirroring theslug/cssclear-with-empty-string convention already used byupdate_dashboard.theme_id/color_schemeremain out of scope, per the original discussion — there's nolist_themes/get_theme_infodiscovery tool yet, so a caller could only guess an ID.All three tools are RBAC-gated the same way as
update_dashboard(class_permission_name="Dashboard",method_permission_name="write",security_manager.raise_for_ownership). Since their responses disclose current owners/roles,app.py's server instructions were updated with a narrow carve-out (mirroring the existingfind_userscarve-out): that data may only be used to confirm the operation the caller explicitly requested on that specific dashboard, not to answer general "who owns/can access X" questions.Test plan
pytest tests/unit_tests/mcp_service/dashboard/— 288 passed (26 new + all existing dashboard MCP tests, no regressions)pre-commit runon changed files (mypy, ruff, ruff-format, pylint, auto-walrus) — all passeddashboard/tool/__init__.pyand imported inapp.pyDEFAULT_INSTRUCTIONStool listing and write-tool/privacy bullets for accuracy