Resolve admin plan limits by plan_name_uid

What does this MR do and why?

Resolves the plan in the admin plan-limits flow by plan_name_uid instead of plan_id:

  • Admin::PlanLimitsController looks up the plan with Plan.find_by_plan_name_uid! only; the plan_id fallback and its permit entry are removed.
  • The inert plan_id hidden field is dropped from the CI/CD and package-registry settings partials.

The plans table is being replaced by an application-defined model, so plan references must stop depending on its environment-specific row ids; plan_name_uid is the stable identifier that survives the table's removal. This is safe now because the form has rendered and submitted plan_name_uid since !235913 (merged) shipped in 19.2, and an unresolvable uid raises RecordNotFound (404) instead of matching the wrong plan.

The remaining Phase 2 items (model write path, admin REST API, migration helper) are tracked in the issue. No schema change.

Issue: #596997 (closed)

How to set up and validate locally

  1. Run the touched specs:
bin/rspec spec/controllers/admin/plan_limits_controller_spec.rb \
          spec/views/admin/application_settings/_ci_cd.html.haml_spec.rb \
          spec/views/admin/application_settings/_package_registry.html.haml_spec.rb
  1. Go to Admin → Settings → CI/CD, expand Continuous Integration and Deployment, and scroll to the CI/CD limits form at the bottom of the section.

  2. Change a limit and save. Confirm the save succeeds and the POST /admin/plan_limits parameters in log/development.log include plan_limits[plan_name_uid] and no plan_id.

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 Ryan Cobb

Merge request reports

Loading
Loading