feat: variant-proxy — server-computed variant index (Phase B) - #6
Merged
Conversation
cmd/variant-proxy is a stateless reverse proxy in front of any V2 registry that serves GET /v2/<name>/_variants/<version> by running the same BuildIndex tag-scan used by `index update`, so plain `docker push` of labeled images is sufficient — no client-side index maintenance. Everything else passes through unchanged (docker push/pull work through the proxy). Errors use the OCI distribution error envelope; the served index advertises the proxy authority as its repository. Client side: FetchIndex now tries the _variants extension endpoint first and falls back to the "<version>-variants" tag artifact, with a size cap on the accepted document. e2e: new proxy section — variants pushed only via plain docker push through the proxy (asserting no index artifact tag exists upstream), endpoint content and 404 behavior, and variant pull via the proxy selecting cu128/null per mocked hardware. Claude-Session: https://claude.ai/code/session_01D383U8kkQkJc1yzyC5H5Nk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked PR 6/7 (base: #5). Delivers the "registry provides the variant index from image labels" requirement as a deployable component:
httputil.ReverseProxyin front of any V2 registry (--upstream,--listen,--upstream-https). InterceptsGET|HEAD /v2/<name>/_variants/<version>and serves an index computed on demand via the sharedBuildIndextag-scan (label/tag drift and unlabeled tags logged and skipped); 404 in the OCI error envelope when no variant tags exist; everything else — includingdocker push/pulltraffic — passes through unchanged.FetchIndexnow queries the_variantsextension endpoint first, falling back to the-variantstag artifact, so the samedocker variant pullworks against Phase A registries and the proxy transparently. The endpoint contract is deliberately implementation-agnostic — a future native registry extension is a drop-in replacement.Testing
e2e extended and passing: variants published only via plain
docker pushthrough the proxy (script asserts no-variantstag exists upstream), endpoint serves the computed index, unknown version → 404, andvariant pullthrough the proxy selects cu128 (GPU profile) / null (CPU profile) with zero client-side index maintenance. Unit tests and prior e2e sections unchanged-green.https://claude.ai/code/session_01D383U8kkQkJc1yzyC5H5Nk