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

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. work-capability-outcomes-errors

After: the panels show the no-access state. after-work-capability-outcomes-no-access

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

  1. On GDK, sign in as a user without read_pro_ai_analytics on a group, for example a group with no ai_analytics licence.
  2. Open /explore/analytics_dashboards/dap_impact?scope=<group> and select the Work tab.
  3. Check that panels backed by duoUsageEvents show "You don't have access".
  4. 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.

Edited by Chandra Saripaka

Merge request reports

Loading
Loading