Draft: Remove the limit_ml_candidate_graphql_fields feature flag

Warning

Do not merge yet. This MR brings a breaking change to self-managed and Dedicated. Before it merges, the Breaking Change Exception (https://gitlab.com/gitlab-com/Product/-/work_items/14590) needs: the Support sign-off, the public deprecation issue, the deprecations docs entry, the Corporate Communications and Customer Success sign-off, the Support Preparedness issue, and a release post item for the milestone of this MR.

What does this MR do and why?

The GraphQL fields MlCandidate.metrics, params and metadata now resolve for one candidate per operation on every instance, including self-managed and Dedicated. A query that nests them under a candidate list gets an error for each candidate after the first. The limit has run at 100% on GitLab.com behind the limit_ml_candidate_graphql_fields feature flag since 2026-11-05, and this MR removes the flag. Rollback is a revert of this MR.

Design notes
  • The three fields in app/graphql/types/ml/candidate_type.rb use Gitlab::Graphql::Limit::FieldCallCount with limit: 1 directly, as MlModel.versions does. The subclass that checked the flag (lib/gitlab/graphql/limit/ml_candidate_field_call_count.rb) and its spec are deleted.
  • The field descriptions drop the flag sentence and keep the limit: "This field can only be resolved for one candidate per operation." The GraphQL reference and both introspection files are regenerated.
  • Specs: the flag-off contexts in spec/requests/api/graphql/ml/experiments_spec.rb and spec/requests/api/graphql/ml/models_spec.rb, and the per-project flag context in the experiments spec, are removed. The enabled-path examples (limit error for the second candidate, one query per child table) stay as they are, so no spec now tests something different.
  • The flag type is gitlab_com_derisk, so there is no default-on step before the removal.

Breaking change

Self-managed and Dedicated get the limit for the first time with this MR. API clients that select these fields for several candidates in one query need one query per candidate, or the MLflow-compatible REST API runs/get. The GitLab UI and the MLflow client are not affected. The change uses the performance exemption of the GraphQL deprecation process, with a VP-approved Breaking Change Exception: https://gitlab.com/gitlab-com/Product/-/work_items/14590. The exception names the flag removal as the point where self-managed and Dedicated get the limit.

References

Screenshots or screen recordings

No UI change.

How to set up and validate locally

  1. In any project, go to Deploy > Model registry, select Create model, and create a model.

  2. On the model page, select Create new version and create version 1.0.0. Repeat for version 1.0.1.

  3. Open the model page, then the page of version 1.0.0. Expect: both pages load as on master, with no error message.

  4. Open http://gdk.test:3000/-/graphql-explorer and run the query below with the model ID from the page URL. Expect: versions.nodes has one version with its candidate's metrics, and one null entry in place of the other version. errors has "metrics" field can be requested only for 1 MlCandidate(s) at a time.

    query {
      mlModel(id: "gid://gitlab/Ml::Model/<model_id>") {
        versions { nodes { version candidate { id metrics { nodes { name value } } } } }
      }
    }

No feature flag step is needed: the limit is always on.

More scenarios
  • Experiments: mlExperiment(id: "gid://gitlab/Ml::Experiment/<id>") { candidates { nodes { id params { nodes { name } } } } } on an experiment with two or more candidates returns the params of one candidate, null for the others, and the "params" limit error. metadata behaves the same.
  • A query that selects metrics, params and metadata for one candidate, for example mlModel { latestVersion { candidate { ... } } }, returns no error.

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.

Database review

Not needed: the change adds and changes no query, index or migration.

Merge request reports

Loading
Loading