Add post-trial usage card to the group Billing page
Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/625030
This is MR 3 of 5 in the plan. It is stacked on MR 2 !257638 (merged) (the worker that writes the trial_usages snapshot) and targets its branch, so review only the last nine commits. It will retarget to master when MR 2 merges.
What does this MR do and why?
Adds a dismissible card at the top of the group Billing page for Free group Owners whose Ultimate trial ended in the last 45 days. The card reads the trial_usages row for that trial and shows seats, compute minutes and GitLab Credits next to what Free provides ("5 available in Free", "400 available in Free", "Not available in Free"). The "Upgrade to Premium" CTA uses the existing upgrade URL and the existing cart-abandonment tracking call, same as the Premium plan card.
It is behind the post_trial_usage_card feature flag (gitlab_com_derisk, disabled by default, group actor). Rollout issue: #636216. No changelog because the flag is off by default.
Eligibility is evaluated in BillingPlansHelper#free_trial_plan_billing_attributes. All must hold: flag enabled for the group; GitlabSubscriptions::Trials.recently_expired? with a 45-day window (so an active trial or a paid plan hides it); user can :edit_billing; user has not dismissed the card; a TrialUsage row exists for (namespace, trial_ends_on).
Design decisions
- A metric shows only when seats >= 2, compute minutes >= 200, credits >= 5. Order is Seats, Compute minutes, Credits, and hidden metrics collapse. If none qualify, a low-usage variant shows the heading, a one-line message and the CTA.
- Credits are null when CustomersDot never answered during capture. Null hides the credits metric.
- Compute minutes are the 30-day rate stored by MR 2 (agreed in the MR 2 thread), so the card shows the number next to the monthly Free allowance with no month label.
- Dismissal uses a new
Users::GroupCalloutvaluepost_trial_usage_card: 47, so one Owner dismissing does not hide it for other Owners. The enum is exposed in GraphQL, sodoc/api/graphql/reference/enums.mdand the introspection files are regenerated. - The Billing page has no GraphQL query; it passes a JSON
data-provideblob. The card follows the re-trial card from !253871 (merged) and adds apostTrialUsageobject to that blob, so the page makes no extra request. Extra cost on page load, only for recently expired Free trials: one callout lookup and one indexed lookup ontrial_usages(unique index onnamespace_id, trial_ends_on). - Pajamas only:
@gitlab/uiGlButton,UserGroupCalloutDismisser,gl-*utility classes and container queries, no custom CSS. Metrics use a description list (dl/dt/dd). - Tracking (impression, CTA click, dismiss Snowplow events) is left for MR 4, and the flag stays off until MR 4 merges.
- The re-trial card from !253871 (merged) is hidden while this card shows, as required in https://gitlab.com/gitlab-org/gitlab/-/work_items/625037 ("Card does not render at the same time as the post-trial usage card"). The helper sets
eligibleForRetrialto false for the 45 days after the trial ends while the flag is on, even if the owner dismisses this card (confirmed by PM in the MR thread). - Specs: helper spec (eligibility matrix including 44 vs 45 days, flag off, non-owner, no user, dismissed by this user vs another owner, active trial, paid plan, only an older trial's snapshot), Jest for the card and the app ordering, and feature spec
ee/spec/features/groups/owner_views_post_trial_usage_card_spec.rb(renders, flag off, dismissal persists).
Database
The card reads one row per page load, only for Free groups whose trial ended in the last 45 days. The query is GitlabSubscriptions::TrialUsage.find_for_trial, added in MR 2 !257638 (merged), which is in database review there.
SELECT "trial_usages".* FROM "trial_usages"
WHERE "trial_usages"."namespace_id" = 115 AND "trial_usages"."trial_ends_on" = '2026-10-06'
LIMIT 1trial_usages has no rows on GitLab.com until the MR 2 worker runs, so there is no Database Lab plan. Local plan: the partition key in the filter prunes to one monthly partition, and the unique index on (namespace_id, trial_ends_on) serves the lookup.
Limit (cost=0.15..2.17 rows=1 width=102) (actual time=0.003..0.003 rows=1 loops=1)
Buffers: shared hit=2
-> Index Scan using trial_usages_202610_namespace_id_trial_ends_on_idx on trial_usages_202610 trial_usages (cost=0.15..2.17 rows=1 width=102) (actual time=0.003..0.003 rows=1 loops=1)
Index Cond: ((namespace_id = 115) AND (trial_ends_on = '2026-10-06'::date))
Buffers: shared hit=2
Planning Time: 0.058 ms
Execution Time: 0.008 msScreenshots
Taken in GDK with simulated SaaS. Figma is linked from the issue.
| Case | Screenshot |
|---|---|
| All three metrics on the Billing page | ![]() |
| Two metrics (credits null) | ![]() |
| Low-usage variant | ![]() |
| Narrow layout | ![]() |
How to set up and validate locally
- Run GDK with
GITLAB_SIMULATE_SAAS=1. - In a Rails console, create a Free
gitlab_subscriptionfor a top-level group you own withtrial: true,trial_starts_on50 days ago andtrial_ends_on20 days ago. - Create a
GitlabSubscriptions::TrialUsagerow for that group andtrial_ends_onwithmax_seats_used: 6,compute_minutes_used: 375,compute_minutes_monthset to the first of that month (the card does not show it), andcredits_used: 40. - Run
Feature.enable(:post_trial_usage_card, group). - Visit
/groups/<path>/-/billings.
Setting dashboard_limit to 5 and shared_runners_minutes to 400 in application settings makes the comparison lines match GitLab.com.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.



