docs(specs): specify Go hosted (S37)

Summary

  • Problem: the Artifact Registry has no Go format. Go teams cannot publish first-party modules to the governed registry, and the GOPROXY protocol has no publish operation to build on.
  • Impact: a CI job publishes a module zip with curl on a tag push, and the go command resolves it through GOPROXY. Platform engineers manage Go modules and versions with the same repositories, roles and management API as the other formats. Users see a new go repository format.
  • Change: S37 specifies hosted Go:
    • the five GOPROXY reads (@v/list, .info, .mod, .zip, @latest), with Go's case escaping, and an @latest that answers what go get <module>@latest would choose: Go's version precedence, never text order, and Go's +incompatible rule;
    • a zip-only publish route, which checks the zip against Go's own zip rules before the bytes become a blob, and also refuses entries that Go's own zip writer never writes, so that every stored zip is one Go's tools could have built;
    • one ordered table of publish outcomes and atomic publication guarantees, including checksum and cap behavior under concurrent publishes;
    • a parity rule: the registry's checks and its two hashes match Go's own code, and a test runs both on one set of zips;
    • a quota check before upload admission, retries included, and a checksum-database probe that answers 404, so public modules verify against sum.golang.org directly;
    • the h1 hashes that go.sum pins, stored beside the SHA-256 blob identity;
    • a version ledger retaining each name's zip h1, so a deleted version can be recovered with the same content but never replaced with different content;
    • the Go rows in S01, S08, S09 and S23, the index row, and the planned Go management contract in S37.
  • Downsides:
    • Hosted only. Clients fall back to direct, so a miss here goes to the module's own source host through version control, outside the registry, and public dependencies come straight from their hosts until Go virtual repositories serve them.
    • No pseudo-versions or branch queries on a hosted repository.
    • Zip validation reads finalized staging data before blob publication, using bounded sequential windows.

Checklist

  • Gaps:
    • Remote and virtual Go, the work item's other acceptance criteria, come with their own specs.
    • Building the zip is the client's job. glab artifact-registry publish --go builds it natively with Go's module zip package, and login --go sets up credentials (gitlab-org/cli#8667). Until then the user docs show .netrc and Go's own tools.
    • Pseudo-versions and branch queries are refused on a hosted repository, because only the source repository can check them.
    • Audit logging waits for S21.
    • The spec leaves the zip checker's implementation to the code MR; its acceptance and hash results must match Go's tools on the same fixtures.
    • No e2e catalog row in this MR, on purpose. docs/testing/e2e/README.md scopes the catalogs to "only what the closed beta ships", so a go.md now would describe behavior nothing can run yet. It lands with the implementation MR, which also adds the go row to that README's Interfaces table.
    • This MR is spec-only. S37 describes the planned Go management extension; S17 and the authoritative OpenAPI remain unchanged. The first implementation step updates OpenAPI, Bruno requests, contract tests and S17 together, before handlers or generated clients depend on Go support. Go has no file routes.
    • The 25,000-name cap is a lifetime limit. Deletes and purges do not free names; matching retries and same-hash recovery consume no new slot.
  • Least sure:
    • Validation before blob publication relies on ranged reads of finalized staging data, supported by both GCS and S3. A backend unable to serve that data would change the design. Go has no client resume route.
    • The fixed cap of 100,000 entries per zip. The largest public modules hold under 20,000 (Azure SDK pre-split: 18,327; Kubernetes: 8,019). A real module above the cap would change it.
    • The direct-fallback client setup (GOPROXY=<repo>,direct with GONOPROXY=none). It never sends a private module path to a third-party proxy, but a miss reaches the module's source host outside the registry's permissions and usage tracking, and public dependencies need git and their hosts. Go virtual repositories, which serve public modules through the registry, would change it.
  • Compatibility:
    • Nothing existing changes. Go is a new format with new routes.
    • S17, OpenAPI, Bruno, and implementation code are unchanged; their Go extensions follow in the contract-first implementation step.
    • Go read errors use text/plain; charset=us-ascii, which S01's 404 and 405 rewrite passes through.
    • Go repository creation support deploys last, after the Go schema, monolith format enum/client and Snowplow schema. Until then format=go remains unsupported and returns 400, including direct API calls.
  • Agreement:
    • A Staff+ engineer approves.
    • ADR citations name cross-format constraints. Go-specific schema, limits and ledger behavior live in S37, independent of the ADR catalog trims in handbook!21764 and handbook!21779.
    • The generic (!3427 (closed)) and Debian (!3447 (merged)) spec MRs overlap companion-spec edits in this MR. The MR that merges last rebases.
    • They also collide on one literal. Go takes repositories.format = 5, the next free value because ADR-007 lists only the formats the registry has, and S36 in !3447 (merged) claims 5 for Debian. Whichever merges second takes the next free value, so if Debian lands first this spec moves to 6 in its Data section. Nothing else in the pair depends on the number.
  • Simplicity:
    • Rejected spooling the upload to local disk: it adds a disk requirement on Runway and Self-Managed.
    • Rejected checking the committed blob: a rejected zip would leave up to 500 MiB of orphaned storage until garbage collection ships.
    • Rejected accepting Basic and Bearer: Basic alone serves .netrc, GOAUTH and curl, with one auth row.
    • Rejected a 404 on @latest: scripts and Renovate read it.
    • Rejected per-repository owned prefixes: Go virtual repositories close the disclosure without new settings.

Related to gitlab-org/gitlab#605700

Edited by Moaz Khalifa

Merge request reports

Loading
Loading