Report the free plan for namespaces without a subscription
What does this MR do and why?
GET /namespaces/278964/gitlab_subscription returned plan: { code: null } for a
namespace with no gitlab_subscription row. Such a namespace is on the free plan
— EE::Namespace#actual_plan already returns ::Plan.free there. The endpoint
now presents a non-persisted free-plan subscription, so the GET stays read-only.
The null code made hasFreePlan false on the Seats tab, so the card labelled a
free-user-cap seat count "Seats in use / Seats available" instead of "Free seats
used". seats_tab_spec.rb asserted that output and was flaky, because
actual_plan creates the row as a side effect of a read. Its expectation is
corrected, and the request spec gains coverage for the previously untested
no-subscription branch.
The feature spec also now creates the free plan record. Every real environment
has one; the test database does not, so the group's free subscription resolved to
a nil plan and the card rendered the other label regardless of the row.
References
- Incident: https://gitlab.com/gitlab-org/quality/analytics/ci-health-incidents/-/issues/1325
- Raised the failure rate (not at fault, will be re-landed): !256561 (merged)
- Revert: !257818 (merged)
- Follow-ups: #631329, #631330, #631331
Screenshots or screen recordings
No visual change for groups that render correctly today — they already show "Free seats used". Groups without a row now match instead of showing a mislabelled card.
How to set up and validate locally
- Run GDK with
GITLAB_SIMULATE_SAAS=1. - Pick a group with no
gitlab_subscriptionsrow (destroy it if present). GET /api/v4/namespaces/278964/gitlab_subscription—plan.codeshould befree, and no row created afterwards.- Open the group's Usage quotas > Seats tab; it should read "Free seats used".
Ran locally: the request spec and the full seats_tab_spec.rb pass across
several seeds. One unrelated pre-existing flake remains in that file (a seat
table load timeout), tracked in
#631329
MR acceptance checklist
Reviewed against https://docs.gitlab.com/development/code_review/#acceptance-checklist