feat(metadata): add the instance plan

What does this MR do?

GitLab 19.6 adds plan to GET /metadata, and to the deprecated GET /version, which answers with the same entity. I added it to GitLab in gitlab-org/gitlab!256936 (merged), and the API docs describe it:

  • the plan of the license the instance runs under, such as premium or ultimate, an active trial included,
  • free on CE, and on EE with no license or an expired trial,
  • null where subscriptions are scoped to each namespace, such as GitLab.com.

This adds Plan *string to Metadata, after Enterprise as in the docs table. It is a pointer because null has a meaning here; a release before 19.6, which does not send the key, reads as nil as well. Version stays as it is, since it only models version and revision.

I need it in gitlab-mcp-server, which reads the plan to tell which tools an instance can serve.

Is this a breaking change?

No. It adds a field to a response struct.

How was this tested?

  • TestGetMetadata now decodes "plan": "ultimate". TestGetMetadata_NullPlan decodes "plan": null and TestGetMetadata_NoPlan an answer without the key, and both read nil. Two mutants of the json tag each fail TestGetMetadata.
  • Against GitLab 19.6.1, CE answers "free", EE without a license "free" and EE with an Ultimate license "ultimate", to an administrator and to a regular user alike. GitLab.com, on 19.7.0-pre, answers "plan": null.
  • make generate and make fmt leave no drift, golangci-lint 2.15.0 reports 0 issues, buf format and buf lint pass, and go test work -race passes on Go 1.26 and 1.27.

This contribution was developed with AI assistance (Claude Code). I reviewed, tested and own every change.

Edited by José M. Requena Plens

Merge request reports

Loading
Loading