Catalog feature checks instance Duo feature availability

What does this MR do and why?

Currently, we only check a feature flag. When the feature flag is removed, or made to be default enabled, it would make AI Catalog visible for instances that haven't enabled Duo features.

This MR updates the AI Catalog to additionally check duo_features_enabled, which is true when the instance has Duo features enabled. And also observe the instance's opt-in the Experimental/Beta AI features while the AI Catalog is not GA.

How to set up and validate locally

  1. In rails console enable the feature flag
    Feature.enable(:global_ai_catalog)

As SM/Dedicated:

  1. Start your webserver in regular (non-SaaS mode)
  2. Set the instance's duo_features_enabled property to false, replace <YOUR PAT> with a Personal Access Token for your root user on your local GDK instance.
     curl --location --request PUT 'http://gdk.test:3000/api/v4/application/settings?duo_features_enabled=false&lock_duo_features_enabled=true' \
     --header 'Authorization: Bearer <YOUR PAT>'
  3. Visit http://gdk.test:3000/explore you should not set an AI Catalog menu item
  4. Visit http://gdk.test:3000/explore/ai-catalog you should see a 404
  5. Use the search bar, and search for catalog, you should not see any AI Catalog links
  6. Now set the instance's duo_features_enabled property to true. Wait about 30s for caches to clear.
     curl --location --request PUT 'http://gdk.test:3000/api/v4/application/settings?duo_features_enabled=true&lock_duo_features_enabled=false' \
     --header 'Authorization: Bearer <YOUR PAT>'
  7. Visit http://gdk.test:3000/explore you should see an AI Catalog menu item
  8. Visit http://gdk.test:3000/explore/ai-catalog should load
  9. Use the search bar, and search for catalog, you should see some AI Catalog Jump to links

If you are logged out, you will still be able to access the page.

As SaaS:

  1. Start your webserver in SaaS mode
  2. Ensure all top-level groups you are a member of do not have Experimental/Beta AI settings enabled. (Go Settings > GitLab Duo, select Change configuration, ensure Turn on experiment and beta GitLab Duo features is not selected)
  3. Visit http://gdk.test:3000/explore you should not set an AI Catalog menu item
  4. Visit http://gdk.test:3000/explore/ai-catalog you should see a 404
  5. Use the search bar, and search for catalog, you should not see any AI Catalog links
  6. Now set at least 1 top-level groups you are a member to have Experimental/Beta AI settings enabled. (Go Settings > GitLab Duo, select Change configuration, ensure Turn on experiment and beta GitLab Duo features is selected)
  7. Visit http://gdk.test:3000/explore you should see an AI Catalog menu item
  8. Visit http://gdk.test:3000/explore/ai-catalog should load
  9. Use the search bar, and search for catalog, you should see some AI Catalog Jump to links

If you are logged out, you will be redirected to the login page. This is because the SaaS Experimental/Beta setting check requires the user to be authenticated.

MR acceptance checklist

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 Luke Duncalfe

Merge request reports

Loading