Check the plan and the terms on Artifact Registry activation (AR#2019 stack: 1/4)
What does this MR do and why?
This MR adds two checks that run when an owner activates Artifact Registry for an organization: a trial plan refusal and a CustomersDot terms check. The checks follow the Phase 2 terms check and trial refusal rows of S10 (activation and deactivation spec). It is part 1 of 4 of the split of the billing state driver MR, and it depends on nothing else in the stack.
- Trial refusal.
ArtifactRegistry::ProvisionNamespaceServicerefuses activation on a free trial plan (:trial_plan). A paying customer who trials a higher tier is not on a trial plan:ultimate_trial_paid_customeron GitLab.com, or a trial license over an active paid license elsewhere. - Terms check. The new
ArtifactRegistry::UsageLimitResolverasks the CustomersDot resolve endpoint for a verdict. Activation is refused when the overage terms are not accepted (:overage_terms_not_accepted), and a failed call refuses with:terms_check_unavailableand a try-again message. An offline or legacy license runs no terms check. - Billing entity. Off GitLab.com there is no billing group, so provisioning keeps
PLACEHOLDER_BILLING_ENTITY_ID.
Points for the reviewer:
- The checks take effect on merge. They run under the existing shared Artifact Registry flag
artifact_registry_ui(default on) and add no flag of their own, as the S10 feature flag section states. - A third activation refusal. The S10 terms check row names two outcomes: refuse on
overage_terms_not_accepted, and refuse when the call fails. This MR adds a branch for three CustomersDot namespace verdicts (402or403withno_billable_source_error,community_plan_errororamazon_q_plan_error): they refuse with:subscription_not_eligible, a message to contact GitLab Support, and no retry. Every other unknown answer still fails closed with the try-again message. - The resolver serves the driver too. Part 3 of the stack uses the same verdict for the usage-limit block, which is why
Verdictcarriesalerting?.
Readings taken where the spec says nothing
- The checks run after the claim throttle, so a refused claim spends the throttle and a burst of claims cannot flood CustomersDot.
- A
402withusage_not_alloweddoes not refuse activation. - A
403withusage_not_allowedis an unknown verdict, because S17 lists only a402as blocking. - Off GitLab.com, the resolve request uses the
self-managedrealm withinstance_id,unique_instance_idand the license token header. Neither spec gives this request shape.
Why the namespace verdicts get their own refusal
- CustomersDot gives the same answer for these three reasons on the next attempt, so a try-again message is not true for them.
UsageLimitResolver::Verdict#namespace_verdict?names the same set that the driver's fault alert leaves out, so the activation check and the alert read one predicate.
The stack
- This MR: activation checks and
UsageLimitResolver. - Billing state driver, suspension arm, behind
artifact_registry_billing_state_driver. - Billing state driver, usage-limit arm, behind
artifact_registry_usage_limit_block. - The scheduled workers and the renewal subscription.
References
- S10 (activation and deactivation spec)
- S17 (billing state driver spec), for the verdict table the resolver maps.
- Follow-up: user documentation for the refusals.
Related to the issue
Screenshots or screen recordings
n/a: this MR changes no frontend code. The new refusal messages reach the user through the payload errors of the existing activation mutation.
How to set up and validate locally
These steps need a GDK with the Artifact Registry service and CustomersDot configured. They were not run for this MR.
- On a GitLab.com-mode GDK, put a top-level group on a trial plan, then run the activation mutation of
ee/app/graphql/mutations/artifact_registry/activate.rbfor it. Expect the payload errorArtifact Registry is not available on a trial plan. - Put the group on Premium and make CustomersDot answer
402withoverage_terms_not_accepted, then run the mutation again. Expect the payload errorAccept the overage terms of your subscription to activate Artifact Registry.
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.
- Quality. All new and changed specs use
spec_helperand need the test database, so CI is their first run. Locally, only RuboCop ran. - Database. No migration and no new query.
- Performance and reliability. Activation makes at most one resolve call, with a 2-second open timeout, a 5-second read timeout, and no retry.
- Security. The resolve call presents the CustomersDot admin headers on GitLab.com and the license token elsewhere, and never a user token. Log lines carry the status and the reason only, never a request header.
- Feature flags. None new: the checks run under
artifact_registry_ui. - Changelog. Commit cdad0ae4 carries
Changelog: addedandEE: true.