Skip to content

Optional showSoftDeleted arg for aiCatalogItem

What does this MR do and why?

This MR adds an optional argument to return a soft-deleted item through the Query.aiCatalogItem field.

How to set up and validate locally

  1. Enable global_ai_catalog feature flag
  2. Create a soft-deleted agent on the rails console:
    project = Project.last # Project must be Premium+ and have opted-in to Beta AI Features
    FactoryBot.create(:ai_catalog_agent, public: true, project: project, deleted_at: Time.now)

Query for the item, update the ID to be the ID of the item that was just created:

{
  aiCatalogItem(id: "gid://gitlab/Ai::Catalog::Item/<ID>", ) {
    id
  }
}

The response should be null:

{
  "data": {
    "aiCatalogItem": null
  },
  "correlationId": "01K7JE37VAP8BJ4QJMKDNSV3AV"
}

Now use the new argument:

{
  aiCatalogItem(id: "gid://gitlab/Ai::Catalog::Item/<ID>", showSoftDeleted: true) {
    id
  }
}

You should get the item id and the response should not be null:

{
  "data": {
    "aiCatalogItem": {
      "id": "gid://gitlab/Ai::Catalog::Item/190"
    }
  },
  "correlationId": "01K7JE5D8RPG280HSQ7X36SM6A"
}

Note the regular permissions around who can actually view the item still apply, due to authorizations on the type.

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.

Related to #575127

Edited by Luke Duncalfe

Merge request reports

Loading