Loading
Add plan context and flag for Feature catalog Explore pages
What does this MR do and why?
Adds the first backend piece for the Feature catalog Explore pages: working out which plan the viewer holds and which Explore pages apply to them.
Onboarding::FeatureLibrary::CurrentPlanContextreturns the edition, deployment, current plan, base plan and trial state, plustier_pages, the Explore pages still available to the viewer. On CE every viewer is on Free and gets both pages.- The EE override reads the root namespace's plan on GitLab.com and the instance license on self-managed. A trial compares against the plan the viewer returns to when it ends: Free for a Free namespace or instance, Premium for a Premium customer trialing Ultimate.
- The retired Starter and Bronze plans count as Free, because they include fewer features than Premium.
- Adds the
feature_catalog_explore_pageswipflag (default off), with the root namespace as actor, and exposesexplore_pages_availablein the super sidebar context. The endpoint, UI, search and CE work all check this one flag.
No user-facing change: the flag is off, and nothing reads the new sidebar key yet.
| Viewer | base_plan |
tier_pages |
|---|---|---|
| Free, or Free trialing Ultimate | free |
premium, ultimate |
| Premium, or Premium trialing Ultimate | premium |
ultimate |
| Ultimate | ultimate |
none |
| CE | free |
premium, ultimate |
Implementation notes
- On GitLab.com, a Premium customer trialing Ultimate is on the
ultimate_trial_paid_customerplan. On self-managed it's a trial license over a valid paid license, whichLicense.billable_licensealready returns. This dropsultimate_trial_paid_customer_plan?from the unused-code baseline, since it's used now. - The plan mapping doesn't reuse
EE::Sidebars::Menu::LEGACY_PLAN_TIERS. That constant maps Starter to Premium for tier badges, which is the wrong answer for "what plan does this viewer hold". - The endpoint that uses this comes after the Feature catalog registry stack merges.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/632721
- https://gitlab.com/gitlab-org/gitlab/-/work_items/631003
- Feature catalog registry stack: !261972 (merged)
Screenshots or screen recordings
Not applicable: no UI change.
How to set up and validate locally
-
In the Rails console on a GitLab.com-simulated GDK, check a Free group and a Premium group:
Onboarding::FeatureLibrary::CurrentPlanContext.new(resource: Group.find_by_full_path('<free-group>')).then { |c| [c.to_h, c.tier_pages] } # => [{ edition: :ee, deployment: :saas, current_plan: :free, base_plan: :free, trial: false }, [:premium, :ultimate]] Onboarding::FeatureLibrary::CurrentPlanContext.new(resource: Group.find_by_full_path('<premium-group>')).tier_pages # => [:ultimate] -
Enable the flag for a group, then visit any page in that group and check that
explore_pages_availableistruein the super sidebar data:Feature.enable(:feature_catalog_explore_pages, Group.find_by_full_path('<free-group>'))
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Kiesha Herman