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

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

  1. Run GDK with GITLAB_SIMULATE_SAAS=1.
  2. Pick a group with no gitlab_subscriptions row (destroy it if present).
  3. GET /api/v4/namespaces/278964/gitlab_subscription — plan.code should be free, and no row created afterwards.
  4. 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

Edited by Lukas Wanko

Merge request reports

Loading
Loading