Loading
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
premiumorultimate, an active trial included, freeon CE, and on EE with no license or an expired trial,nullwhere 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?
TestGetMetadatanow decodes"plan": "ultimate".TestGetMetadata_NullPlandecodes"plan": nullandTestGetMetadata_NoPlanan answer without the key, and both readnil. Two mutants of the json tag each failTestGetMetadata.- 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 generateandmake fmtleave no drift, golangci-lint 2.15.0 reports 0 issues,buf formatandbuf lintpass, andgo test work -racepasses 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