J8b: sdk/forms reads the seat form through catalogue, upstream naming included

catalogue.InRegistrySeat now reads the holder's upstream naming and InArtifactStore derives its store path, so forms'
own reader goes, and the upstream rows run the encode check again.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
2026-11-04 15:58:59 +01:00
parent bf92a37730
commit 0e44467b70
2 changed files with 8 additions and 31 deletions
@@ -1403,8 +1403,7 @@ func aDoneKeyKeepsEachFormACountedNodeReads(t *testing.T) {
t.Errorf("%s %s: the want of %s is held", k.kind, row.name, node)
}
}
// mesh-sdk's referenceProblem does not yet know the holder's upstream/<host>/<path> naming (a request to the SDK's owner).
if _, err := delivery.EncodeBuilderBuild(delivery.BuilderBuild{State: delivery.BuildDone, Manifest: strings.TrimPrefix(digest, "sha256:"), Artifacts: []delivery.BuiltArtifact{a}, Needs: needs}); err != nil && k.kind != "upstream" {
if _, err := delivery.EncodeBuilderBuild(delivery.BuilderBuild{State: delivery.BuildDone, Manifest: strings.TrimPrefix(digest, "sha256:"), Artifacts: []delivery.BuiltArtifact{a}, Needs: needs}); err != nil {
t.Errorf("%s %s: %v", k.kind, row.name, err)
}
}
+7 -29
View File
@@ -36,27 +36,11 @@ const (
// <seat>/<module>/<artifact>@sha256:<digest> (novox/hq ADR 0605 §9; catalogue.SeatReference, read back by
// catalogue.InRegistrySeat): a bundle or an archive through oci-artifact-registry, an image through
// container-image-registry, and an upstream copy through container-image-registry under the holder's own naming,
// container-image-registry/upstream/<host>/<path>@sha256:<digest>. It is read by a node-engine that states
// container-image-registry/upstream/<host>/<path>@sha256:<digest> (catalogue.InUpstream). It is read by a node-engine that states
// form:seat-reference (catalogue.ReferenceFormSeat). Not a first form: an engine stating nothing reads the artifact in the
// older artifact-store form, which it derives (Older).
const FormSeatReference = catalogue.ReferenceFormSeat
// upstreamPrefix opens an upstream copy's name in the image seat's answer: the holder's naming, upstream/<host>/<path>.
const upstreamPrefix = "upstream/"
// inSeatReference reads a reference in the seat form: the seat it came through and the name and digest after it,
// <module>/<artifact>@<digest> (or upstream/<host>/<path>@<digest> for an upstream copy of the image seat).
func inSeatReference(r string) (seat, path string, ok bool) {
if seat, path, ok = catalogue.InRegistrySeat(r); ok {
return seat, path, true
}
rest, found := strings.CutPrefix(r, catalogue.ContainerImageRegistrySeat+"/"+upstreamPrefix)
if !found || !strings.Contains(rest, "@sha256:") {
return "", "", false
}
return catalogue.ContainerImageRegistrySeat, upstreamPrefix + rest, true
}
// ArtifactForm is one reference form: its name, whether it is a first form, the artifact kinds it names, how a
// reference is told to be in it, and, for a form that names the same artifact an older form does, that older reference
// (Older, nil when it derives none): the old-form window writes it beside the answered one (ADR 0624 §1, §3).
@@ -84,19 +68,13 @@ var Current = ArtifactForms{
{Name: FormPackageVersion, First: true, Is: func(r string) bool { return strings.LastIndex(r, "@") > 0 && !strings.Contains(r, "@sha256:") },
Kinds: []string{catalogue.ArtifactPackage}},
{Name: FormSeatReference, Kinds: []string{catalogue.ArtifactBundle, catalogue.ArtifactArchive, catalogue.ArtifactImage, catalogue.ArtifactUpstream},
Is: func(r string) bool {
seat, _, ok := inSeatReference(r)
return ok && (seat == catalogue.OciArtifactRegistrySeat || seat == catalogue.ContainerImageRegistrySeat)
},
// The same artifact in the artifact store's form: oci-artifact-registry/<m>/<a>@<d> is artifact-store://<m>/<a>/blobs/<d>;
// container-image-registry/<m>/<a>@<d> (an upstream copy's upstream/<h>/<p>@<d> likewise) is artifact-store://<m>/<a>@<d>.
Is: func(r string) bool { _, _, ok := catalogue.InRegistrySeat(r); return ok },
// The same artifact in the artifact store's form (catalogue.InArtifactStore): oci-artifact-registry/<m>/<a>@<d> is
// artifact-store://<m>/<a>/blobs/<d>; container-image-registry/<m>/<a>@<d> is artifact-store://<m>/<a>@<d>, and an
// upstream copy's container-image-registry/upstream/<h>/<p>@<d> is artifact-store://upstream/<h>/<p>@<d>.
Older: func(r string) string {
seat, rest, _ := inSeatReference(r)
if seat == catalogue.OciArtifactRegistrySeat {
path, _ := catalogue.InArtifactStore(r)
return catalogue.ArtifactStoreScheme + path
}
return catalogue.ArtifactStoreScheme + rest
path, _ := catalogue.InArtifactStore(r)
return catalogue.ArtifactStoreScheme + path
}},
}