docs(specs): amend S33 for the billing enforcement states
Summary
Problem. S33 held three reversible namespace conditions, one derived status and a masked 404 for a blocked or disabled namespace. The service had nowhere to hold GitLab's second billing state, no billing predicate that excluded a lapsed plan, no per-condition client reason and no billing anchor in the resolution response.
Impact. No user sees a change, because no code ships in this merge request. The readers are the platform team that sets these states and the team that implements the surface later. The code lands in a later merge request.
Change. The amendment to docs/specs/S33-gitlab-api.md adds the limit block as a fourth reversible condition, with the column limit_blocked_at, the actions limit_block and unlimit_block, and the status limit_blocked in the precedence order. It adds a billing predicate that answers no suspended namespace and answers a limit-blocked one, while retention keeps reading a suspended namespace. It gives each of the four conditions its own 403 reason message, keeps the 404 for a deleted or purged namespace, and adds the billing anchor to the resolution response. The reason code travels only where the error shape of the surface carries the shared error vocabulary, so the OCI DENIED answer and the Go text/plain line carry the message alone. A disabled or blocked namespace answers its reads 403, so a Go client with GOPROXY=<registry>,direct stops and does not fall back to the source host of the module. A caller that the authorization layer denies gets the S09 (authorization) denial answer: the masked 404 without read access, and the generic 403 with it. The four condition gates run after the authorization allow, so namespace resolution answers 404 only for a deleted, purged or absent namespace. The S33 row in docs/specs/README.md moves from Implemented to Approved.
Downsides. The OpenAPI document api/openapi/gitlab-v1.yaml does not yet carry the limit-block endpoints, the limit_blocked status or the billing anchor fields, so it wins on conflict until the later implementation merge request. The same gap holds for api/openapi/v1.yaml, for rows of S16, S17, S20-a, S30, S32, S37 and S38, for the namespace-not-found definition in docs/dev/observability.md, for two format resolver notes, and for the gate order of S09 (authorization). The spec names each of these files in its Follow-ups section, and those bullets point at issue 1823 for the implementation. The Rails client spec monolith/S02 still maps every 403 to AuthorizationError and reports it to error tracking, so the condition gates do not ship until the Rails client maps the four reason codes. The Follow-ups bullet for that Rails client work points at issue 1790. Under the limit block, the spec refuses client deletes and the purger skips the namespace while usage is still billed. Issue 1790 decides whether that holds, because it depends on whether the usage limit counts stored bytes. The endpoint names and the reason texts are proposals, so a Staff+ approver still has to accept them.
Checklist
-
Ran it: Nothing ran against a service, because the change ships no behavior and no program reads
docs/specs/at run time. The evidence in this bullet is from commit5f154da0. The later commits change onlydocs/specs/S33-gitlab-api.md. The hook chain ran on every commit on this branch and passed: markdownlint-cli2, lychee, vale, the document word limit (the spec is 5,905 words against a 15,000 limit at that commit), the AGENTS.md citation check, gitlint, editorconfig, gitleaks, and the whitespace, EOF and line-ending checks. The Go hooks reported no files to check.gate-runre-ran the new-markdown, doc-size and agents-citations rows by hand, and all three passed; the same three rows passed again when they ran by hand at that commit. The merged-tree check ran againstorigin/mainand the seven sibling merge requests that touch the spec index. The Debian hosted (S36) spec merge request has a union that conflicts withmainon six files, anddocs/specs/README.mdis one of them. The same conflict appears with this branch atorigin/mainand no commit of its own, so it belongs to that sibling and not to this change. That union was not built, and none of its gates ran. The other seven unions merged clean. None of the eight unions edits the S33 row, so the S33 row alone merges with each of them. No Go test exists for this change and none was written, so there is no real client to run. -
Interfaces and data: The change alters no API, configuration, schema, wire format or storage format, so existing clients and stored data keep working. It describes future ones: the fourth condition, the
limit_blockedstatus, four403reason codes and the billing anchor in theGETresponse. The spec says where the contract still wins:api/openapi/gitlab-v1.yamldoes not yet carry the limit-block endpoints, thelimit_blockedstatus or the billing anchor fields, so the document wins on conflict until the later implementation merge request. The same gap holds forapi/openapi/v1.yaml, for rows of S16, S17, S20-a, S30, S32, S37 and S38, for thenamespace-not-founddefinition indocs/dev/observability.md, for two format resolver notes and for the gate order of S09, and the spec names these files in its Follow-ups section. -
Failure: n/a, because no code changes here. The future failure surface sits in the spec: each condition answers
403with its own reason message, and with its reason code where the error shape of the surface carries the shared error vocabulary, a deleted or purged namespace answers404, and a caller that the authorization layer denies gets the S09 denial answer, the masked404without read access and the generic403with it. -
Rollout: Nothing changes during a deploy, because the change touches no code, no schema and no configuration, so a running deployment keeps its current behavior. The spec records that a replica which predates the billing anchor answers without it, so a caller treats the anchor as optional until every replica serves it.
-
Hot path: No. The change adds no query, no allocation and no unbounded work to a request path. The spec records that the sixth lifecycle column carries no index and is read with the existing namespace lookups.
-
Database: No. This merge request adds no migration and changes no query, so there is no database review evidence to add. The spec describes a sixth column,
limit_blocked_at, for the later implementation, and it carries no index. -
Security: The change adds no input, no route, no permission and no audited action, and it does not change how callers are authenticated or authorized. The spec records where the future access checks sit: the limit-block action rides the same ADR-020 service token as every other route, its action segment is a literal, so scanning traffic lands on no state-bearing route. The condition gates run after the authorization allow, so a reason reaches only a caller that the S09 authorization layer has already admitted. A caller that the authorization layer denies gets the S09 denial answer: the masked
404without read access, and the generic403with it. The namespace details route and the repository listing route bind only to the organization, so a member of the owning organization with no role on the namespace reads the condition reason there. -
ADRs: ADR-022 governs the namespace lifecycle and its service conditions, and ADR-010 governs the deletion clock. The amendment rests on the operator's ruling and on the ADR amendment in the billing states ADR merge request, which merged on 2026-11-05, and it holds their constraints. It restates no deletion clock: only a plan lapse starts one. This change writes no ADR.
-
E2E: No scenario row changes, because the change ships no behavior. The candidate rows for the later implementation merge request are in the block below.
-
Simplicity: One rejected alternative is a diff that amends the spec file alone and leaves the index row at
Implemented. The index row has to move toApproved, becausedocs/specs/README.mdis the effective status where the index and the file disagree, so the merge has to carry the acceptance item. The other rejected alternative is a diff that carries the OpenAPI documents, the sibling specs and the Go code as well. The acceptance item is the amendment merging asApproved, and the code lands in a later merge request.
The spec coverage table: every obligation, the source it comes from, and what this amendment does with it
Amended = the amendment must change this row; Not covered = the amendment leaves it alone; Owned elsewhere = another issue or the operator's handbook merge request owns it.
| # | Obligation | Source | Status | Note |
|---|---|---|---|---|
| A1 | The S33 amendment merges with status Approved |
card acceptance; issue body Acceptance |
Amended | The spec file's status line already reads Approved (S33:3); the index row (docs/specs/README.md:87) reads Implemented today, and docs/specs/README.md:40 makes the index the effective status where the two disagree, so the row must move to Approved for the merge to carry it. |
| B1 | POST provisioning → 201, row created, response carries UUID, slug, status: active |
S33 AC1 | Not covered | Provisioning is untouched by the four scope items; implemented in internal/gitlabapi/create.go. |
| B2 | Repeat POST with the same anchor → 200, row unaltered, no second row | S33 AC2 | Not covered | Unchanged by the amendment. |
| B3 | Repeat POST with a disagreeing body → 409, row unchanged | S33 AC3 | Not covered | Unchanged. |
| B4 | Brand-List Validator enabled and unreachable → 503, no row (unless the anchor already holds one) | S33 AC4 | Not covered | Unchanged. |
| B5 | Syntactic, reserved-name or brand-list slug failure → 422, no row | S33 AC5 | Not covered | Unchanged. |
| B6 | Slug taken by another namespace → 409 | S33 AC6 | Not covered | Unchanged. |
| B7 | GET returns the anchor, the slug and the derived status; unknown UUID → 404; non-canonical id → 400 | S33 AC7 | Amended | "the anchor" must name the billing anchor as well: the GET response gains billing_entity_type/billing_entity_id (scope item 4). Today the anchor is the owner anchor only (S33:109) and the billing anchor never reaches the wire. |
| B8 | Each condition endpoint sets or clears exactly its own column; response and subsequent GET report the derived status with the precedence | S33 AC8 | Amended | The endpoint set grows from six actions (S33:127) to eight (the limit-block pair), and the precedence (S33:112) gains the limit-block status and its place in the order (the author's proposal, card derived.limit_block_design). |
| B9 | With suspended_at set a download succeeds and a push is rejected; with blocked_at, disabled_at or deleted_at set both are rejected |
S33 AC9 | Amended | The limit-block state joins the table (pulls served, pushes refused); the disabled and blocked arms change from a bare "rejected" to "rejected with its own client reason" (card derived.error_messages). |
| B10 | Management-surface requests under a gated namespace are rejected by the same predicate table | S33 AC10 | Amended | The predicate table (S33:139-143) gains the limit-block column and the subscription-lifecycle row's suspended_at NULL (scope item 2). |
| B11 | Verifications → 204 / 422 with the failing ids / 400; a soft-deleted repository still verifies | S33 AC11 | Not covered, but must stay true | The new gating column must not gate the GitLab API routes: S33:152 exempts them, so a limit-blocked namespace still verifies. The amendment should say so. |
| B12 | Resolution, condition and verification endpoints work on a namespace in every state, including soft-deleted and purged | S33 AC12 | Amended | The limit-block state must be one of the "every state" (conditions apply in any state, S33:131). |
| B13 | The OpenAPI document defines every endpoint, schema and response above and validates against the OpenAPI 3.1 schema in CI | S33 AC13 | Owned elsewhere | api/openapi/gitlab-v1.yaml changes in the implementation MR (card derived.files); the amendment must fix the new endpoint's path, method and statuses and the billing anchor's schema so the document can follow. |
| C1 | All: missing or invalid service token → 401 unauthorized |
S33 EC row 1 | Not covered | Unchanged; the new endpoint rides the same mount guard. |
| C2 | All: malformed JSON body → 400 bad_request |
S33 EC row 2 | Not covered | Unchanged. |
| C3 | Provision: slug fails syntactic, reserved-name or brand-list validation → 422 | S33 EC row 3 | Not covered | Unchanged. |
| C4 | Provision: owner anchor is not the locked triple → 422 | S33 EC row 4 | Not covered | Unchanged. |
| C5 | Provision: slug taken by another namespace → 409 | S33 EC row 5 | Not covered | Unchanged. |
| C6 | Provision: replay body disagrees with the stored row → 409 | S33 EC row 6 | Not covered | Unchanged. |
| C7 | Provision: Brand-List Validator enabled but unreachable → 503 | S33 EC row 7 | Not covered | Unchanged. |
| C8 | Resolution, conditions, verifications: :uuid is not a canonical UUID → 400 |
S33 EC row 8 | Amended | The endpoint list must name the new condition route: it is a conditions route and inherits the canonical-id rule. |
| C9 | Resolution, conditions, verifications: unknown namespace UUID → 404 | S33 EC row 9 | Amended | The same, for the new route. |
| C10 | Conditions: unknown <action> segment → 404 |
S33 EC row 10 | Amended | Action names are literal route segments, not a wildcard (internal/gitlabapi/handler.go:33-42), so the new pair's names must be stated and any other segment still takes the subtree fallback's 404. |
| C11 | All: body over the request size cap → 413 | S33 EC row 11 | Not covered | Unchanged. |
| C12 | Verifications: empty or oversized batch, or a non-canonical id → 400 | S33 EC row 12 | Not covered | Unchanged. |
| C13 | Verifications: any id unknown or outside the namespace → 422 with error.details.repository_ids |
S33 EC row 13 | Not covered | Unchanged. |
| C14 | service_unavailable (503) is new to the shared transport set |
S33 EC prose | Not covered | Unchanged. |
| C15 | The verifications 422 adds the optional details object |
S33 EC prose | Not covered | Unchanged. |
| C16 | The 401 uses the envelope, with no WWW-Authenticate challenge |
S33 EC prose | Not covered | Unchanged. |
| C17 | Four distinct client reasons — plan lapse, limit block, disabled, blocked — each with its status and envelope code | card scope item 3; 1790 ## Decided ("Each state has its own reason in the UI and in client errors"); card derived.error_messages |
Amended | Today a suspended namespace gets a bare 403 (S33:151) and blocked/disabled/deleted are masked behind a 404 (S33:150), and Resolution 7 (S33:289) fixes that mapping. The amendment replaces it for disabled and blocked and adds the limit block's. The exact codes and texts are the author's, under Staff+ review. |
| C18 | The masked 404 for a principal with no role survives | S09:700 ("Suspension gate ordering"); card derived.error_messages |
Amended (stated, not changed) | The amendment must say the new reasons do not reach that principal: a write by a principal with no role on a suspended namespace still gets the masked 404, not the 403. |
| D1 | The surface is internet-facing but never customer-facing; the ADR-020 service token is the only guard, and the opaque 401 tells a scanner nothing | S33 SC1 | Not covered, but extended | The new endpoint is under the same token guard; the amendment should say the limit-block action lives in the same literal route table, so scanner traffic lands on the fallback's 404 series and not on a state-bearing route. |
| D2 | The verifications 422 lists the failing ids but never the reason | S33 SC2 | Not covered | Unchanged. |
| D3 | No organization data leaves the registry: resolution returns the anchor the caller already persisted | S33 SC3 | Amended | The GET now also returns the billing anchor. The amendment must justify it as the caller's own provisioning input (S33:80, "Nothing is derived server-side; the caller owns every field"), so it discloses nothing new. |
| D4 | Slug input crosses a trust boundary into SQL and the Brand-List Validator call; the CHECK constraints and parameterized queries bound it | S33 SC4 | Not covered | Unchanged. |
| D5 | The distinct client reasons disclose a state the masked 404 used to hide | derived from SC3 and the masked-404 change | Amended | The masked 404 was an existence-disclosure control (S33:150). The amendment must name who may read the reason — the platform's client, or every client — and how that sits with S09:700. |
| E1 | Pulls: plan lapse served; usage-limit block served; security block refused | 1790 ## Decided, "Pulls" |
Amended | The amendment states that a limit-blocked namespace still serves pulls; the security block is unchanged. |
| E2 | Pushes: plan lapse refused; usage-limit block refused; security block refused | 1790 ## Decided, "Pushes" |
Amended | Each refusal carries its own reason (C17). |
| E3 | Usage: plan lapse written off; usage-limit block billed | 1790 ## Decided, "Usage" |
Owned elsewhere | The billing events stay in issue 1629 / S24-A (the issue body's out-of-scope list). What the amendment carries is the predicate that decides it: the billing predicate excludes suspended namespaces (scope item 2). |
| E4 | Deletion clock: plan lapse day 0-30 read-only, 30-60 soft delete, 60+ hard delete; usage-limit block none | 1790 ## Decided, "Deletion clock" |
Owned elsewhere (operator) | The operator's handbook MR amends ADR-010 (credit exhaustion becomes the billed limit block, no deletion clock) and ADR-022 (the fourth condition; billing stopping under suspension). The S33 amendment must not restate the clock. The conflict is reported below as a fact. |
| E5 | Lifts when: the plan is renewed; the limit is raised or the month resets; staff lift the security block | 1790 ## Decided, "Lifts when" |
Amended | The service side names the endpoint that lifts each state (the limit-block pair); the trigger itself is Rails' (issue 1790's Rails side). |
| E6 | Each state has its own reason in the UI and in client errors | 1790 ## Decided bullet |
Amended (service half) | The client half is scope item 3; the UI half is monolith/S10, in issue 1790. |
| E7 | The usage limit applies on GitLab.com only; on Self-Managed and Dedicated a plan lapse is the only restriction | 1790 ## Decided bullet |
Not covered | The service cannot see the tier — it "never learns why Rails set it" (issue body). The amendment must not encode a tier check. |
| E8 | Triggers at GA: a plan lapse (expiry, or a downgrade below Premium) | 1790 ## Decided bullet |
Not covered | Rails' trigger (issue 1790's Rails side). |
| E9 | Terms after a subscription change are prevented; the scheduled resolve returns overage_terms_not_accepted and the namespace gets the limit-like block |
1790 ## Decided bullet |
Not covered | The terms check is Rails' (issue 1790, proposed, waiting on Fulfillment). The service side is the limit-block state the amendment defines, including its client message (card derived.limit_block_design gives the overage-terms message to the author). |
| E10 | No registry on standard Premium or Ultimate trials at GA | 1790 ## Decided bullet |
Not covered | Rails' activation refusal (monolith/S10). |
| E11 | Offline licenses skip the terms check | 1790 ## Decided bullet |
Not covered | Rails. |
| E12 | A state lifts within minutes and applies within an hour | 1790 ## Decided bullet |
Not covered | The service's condition endpoints are immediate and idempotent (S33:130); the hour is Rails' reconciliation, outside the amendment. |
| E13 | Token exchange checks enablement only | 1790 ## Decided bullet (ADR-020) |
Not covered | Unchanged; the four reasons belong to the response layer, not to the authentication surface. |
The rows come from the card's acceptance, from S33's Acceptance Criteria, Error Cases and Security Considerations, and from issue 1790's ## Decided table. The notes read the pre-amendment text, so a count such as "six actions" is the count before the amendment, and the amendment's own count is eight action segments.
Candidate e2e scenario rows for the later implementation merge request
- A plan-lapsed namespace serves a pull and refuses a push with the plan-lapse reason.
- A limit-blocked namespace serves a pull, refuses a push with the limit-block reason, and stays billable, because the billing predicate excludes a suspended namespace and not a limit-blocked one.
- A disabled namespace and a blocked namespace each answer with their own reason, while a caller that the authorization layer denies still gets the S09 denial answer.
- The resolution
GETreturns the billing anchor.
Merge order
Nothing blocks this merge request on the ADR amendment: !3778 docs(adr): amend ADR-004, ADR-010 and ADR-022 for billing states and re-anchoring merged on 2026-11-05. That merge request is the ADR amendment for the billing states, and it:
- adds the limit block as a fourth service condition,
- keeps the plan lapse as the only trigger of the deletion lifecycle,
- bills usage under every condition except the suspension,
- scopes the limit block to GitLab.com.
The spec no longer names that merge request or a merge order. It points the billing and retention rules for each service condition at the ADR-010 section that the amendment added.
This merge request changes no code behavior, so nothing it writes can break a running deployment. The code lands in a later merge request.
Two other open merge requests trim the same two decisions: the ADR-022 trim merge request (docs(adr): trim ADR-022 to its rules and decisions) and the ADR-010 trim merge request (docs(adr): trim ADR-010 and re-point the citations it removes). The spec links to section anchors in both decisions. If either of those two merge requests merges first, the links in the spec have to be checked again. This merge request does not wait for them.
The work item that still needs a note is issue 1790, which carries the platform side. Its handbook item must also cover the fourth service condition. No such note exists today.
Related to https://gitlab.com/gitlab-org/ops/artifact-registry/-/work_items/1823