[AAP-88658] XLAB Implementing user rights #3630
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3630"
general
weight: 0.35
lgalis
Summary
AAP-88658 Implementing user rights
<!-- What changed and why? -->
This pull request refactors the
AutomationDashboardMainPageto handle access and visibility for the Dashboard and Leaderboards tabs based on user permissions and server-side flags. It also updates the documentation to explain the new logic, improves test coverage for different access scenarios, and clarifies the data flow for the Leaderboards tab.Access control and rendering logic:
AutomationDashboardMainPage.tsxnow renders the Dashboard, Leaderboards, both (with tabs), or an error/unauthorized state based oncanSeeDashboard,canSeeLeaderboard, anderrorfromuseAutomationDashboardCollectionStatus. Tabs are only shown if both are visible; otherwise, the appropriate single view or state is rendered. [[1]](diffhunk://#diff-315fa004ee04f4fe2afcc6648ec5b6c6f643a3a95f5cdedba1e3bf8987dc576bR7-L29) [[2]](diffhunk://#diff-315fa004ee04f4fe2afcc6648ec5b6c6f643a3a95f5cdedba1e3bf8987dc576bL46-R94)Testing improvements:
AutomationDashboardMainPage.test.tsxis refactored to use a newmockStatushelper, and now includes comprehensive tests for all combinations of dashboard/leaderboard visibility and error states. [[1]](diffhunk://#diff-c65a1d5f6f2fefcdb13db356b4040d44b5dedf58c30fec156435d274fe5d885aL1-R10) [[2]](diffhunk://#diff-c65a1d5f6f2fefcdb13db356b4040d44b5dedf58c30fec156435d274fe5d885aR40-R76) [[3]](diffhunk://#diff-c65a1d5f6f2fefcdb13db356b4040d44b5dedf58c30fec156435d274fe5d885aL83-R158)Documentation updates:
README.mdis extensively updated to document the new access and visibility logic, including a new "Access and visibility" section, updated architecture diagrams, and an explanation of how navigation and page rendering respond to user roles and server flags. [[1]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L11-R17) [[2]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9R30-R33) [[3]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L47-R56) [[4]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L69-R75) [[5]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L94-R148) [[6]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L116-R159) [[7]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L137-R189) [[8]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L228-R284) [[9]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L264-R324) [[10]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L292-R355)Data flow and API integration:
/dashboard_reports/leaderboard/via SWR, and the hookuseAutomationLeaderboardsViewis wired to the real API. [[1]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L47-R56) [[2]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L69-R75) [[3]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L228-R284)Codebase organization:
applyAutomationDashboardNavVisibilityand how navigation visibility is managed. [[1]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9R30-R33) [[2]](diffhunk://#diff-6f4f55dd8574088afadae79d9faed42ebaebb4949ede2d43a07e8a453f566eb9L264-R324)These changes ensure that the dashboard UI accurately reflects user permissions and server configuration, provide robust test coverage for all access scenarios, and keep the documentation in sync with the implementation.
Type of Change
Risk Analysis - REQUIRED
<!-- SELECT ONE. This is required — the PR check will fail if none is selected. -->
Dependencies
<!-- List any dependent PRs, required backend changes, or manual setup steps. Remove this section if none. -->
Testing
Ephemeral E2E Tests
Once PR is ready and preliminary checks pass, trigger tests by posting a comment
/run-playwrighton this PR.External Server E2E Runs
<!-- If applicable, attach run(s) from an external server using the GitHub Actions below. Mention the deployment type of the environment used.
-->
Manual Testing
Tip: to change
show_dashboard/show_gamification/enabled, override the/api/metrics/v1/dashboard_reports/collection_status/response (e.g. Chrome DevTools → Network → Override content).Platform build (Automation Analytics → Automation Dashboard)
Dashboard / Leaderboards visibility
show_dashboard: true,show_gamification: true: verify both Dashboard and Leaderboards tabs are shown.show_dashboard: true,show_gamification: false: verify only the Dashboard content is shown, with no tabs. Open.../automation-dashboard/leaderboardsdirectly and verify it does not render the Leaderboards.show_dashboard: false,show_gamification: true: verify only the Leaderboards content is shown, with no tabs. Open.../automation-dashboard/dashboarddirectly and verify it does not render the Dashboard.true: verify only the Leaderboards content is shown. The Dashboard requires superuser or auditor.show_gamification: false: verify the Automation Dashboard nav entry is hidden.false: verify the Automation Dashboard nav entry is hidden.Navigation
enabled: false: verify the Automation Dashboard entry is removed from the nav.Error handling
collection_statusreturn 500 on first load. Verify the nav entry stays and the page shows the error state instead of disappearing.collection_statusreturn 401 (or let the session expire). Verify the login screen appears right away, not up to 10 s later.<!-- Steps to verify this change, if not obvious from the Jira issue. -->
Screenshots
<!-- If applicable. Any visual/UI changes MUST include before and after screenshots. -->
<img width="1465" height="715" alt="image" src="https://github.com/user-attachments/assets/7ed80e5a-82be-4ee2-abcd-9162ad902fb9" />
<img width="1465" height="715" alt="image" src="https://github.com/user-attachments/assets/92f262e3-58fd-420b-82c7-c69965c322cb" />
<img width="1465" height="715" alt="image" src="https://github.com/user-attachments/assets/520f7687-d361-4210-ad0e-7184698734af" />