Attach the authorization code to inaccessible-source errors
What does this MR do and why?
Dashboard panels now show the no-access state when a user cannot read an aggregation source.
BaseEngineResolver raises ResourceNotAvailable with "The following sources are not accessible: " for missing, out-of-scope and unauthorized sources. These cases are deliberately indistinguishable. The error carried no extensions.code. The GLQL error classifier only maps AGGREGATION_NOT_AUTHORIZED to the no-access state. Without the code, the panel showed a generic "Something went wrong" with a Try again button that can never succeed.
This MR attaches the existing AGGREGATION_NOT_AUTHORIZED code (NOT_AUTHORIZED_CODE on BaseAggregationFieldResolver) to that error. The shared example reports inaccessible sources in ee/spec/requests/api/graphql/analytics/duo_workflows_spec.rb now asserts it. There is no frontend change.
Found during DAP Impact UAT error-state testing. 8 Work tab panels showed the retryable error for a user without read_pro_ai_analytics.
References
- Resolves https://gitlab.com/gitlab-org/gitlab/-/work_items/631677
- Related UAT epic: https://gitlab.com/groups/gitlab-org/-/work_items/23429
Screenshots or screen recordings
The Work tab for a user without AI analytics access, before and after the change.
Before: the panels show the retryable error.

After: the panels show the no-access state.

Verified on GDK at master with the patch applied: the eight panels moved from the retryable error to the no-access state and every response carried AGGREGATION_NOT_AUTHORIZED. The request spec cannot run locally because of a known sass load error, so CI verifies it.
How to set up and validate locally
- On GDK, sign in as a user without
read_pro_ai_analyticson a group, for example a group with noai_analyticslicence. - Open
/explore/analytics_dashboards/dap_impact?scope=<group>and select the Work tab. - Check that panels backed by
duoUsageEventsshow "You don't have access". - Run
bundle exec rspec ee/spec/requests/api/graphql/analytics/duo_workflows_spec.rb -e inaccessible.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.