Drop public column from ai_catalog_items

What does this MR do and why?

This is the last step of dropping the legacy public boolean column on ai_catalog_items (#606737 (closed)). The column was replaced by the visibility enum in #603111 (closed) and ignored in 19.4 via #609087 (closed). Per GitLab's 3-release column removal process, the actual drop has to wait until 19.5, which is now.

Along with the migration, this also removes Ai::FoundationalChatAgent#public and the matching public: true/false keys in foundational_chat_agents_definitions.rb. That attribute was just duplicating visibility on every entry, so it's redundant now that the DB column is gone. Specs that used .public/select(&:public) on FoundationalChatAgent are updated to use visibility instead.

References

#606737 (closed)

How to set up and validate locally

Validation steps
  1. Run the migration and check the column and its index are gone
  2. Go to Explore > AI Catalog > Agents.
  3. Confirm agents and their "Visibility: Public/Private" labels still show correctly.
  4. Open an individual agent's detail page and confirm it loads with no errors.

GraphQL

Run this in the GraphQL explorer (/-/graphql-explorer):

query {
  aiCatalogCustomAndFoundationalItems(first: 50) {
    nodes {
      ... on AiCatalogItem { id name visibility public }
      ... on AiFoundationalChatAgent { id name visibility reference selectableInChat }
    }
  }
}

Foundational agents should come back with visibility: "PUBLIC" and no errors.

Data deletion

Recovery. The public column's values have already been migrated to the visibility enum column (issue #603111 (closed)), which holds the source of truth for catalog item visibility. The column itself has been ignored since 19.4, meaning Rails hasn't written to it for two releases and the data is stale. Since the real values are fully captured in visibility, dropping the column doesn't delete any meaningful information. A rollback would re-add the column with a default of false, which is fine because the actual visibility state already lives in visibility.

Records affected. ~14,028 rows (current count in ai_catalog_items on GitLab.com; table_size: small per the database dictionary).

User experience impact. None. All read paths have used the visibility column since #603111 (closed). The GraphQL AiCatalogItem.public field resolves through a visibility_public? method rather than the raw column, so API consumers see no behavior change.

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 #606737 (closed)

Edited by Jaydip Pansuriya

Merge request reports

Loading
Loading