Revert: the registry seats still hold versions; the engine asks it again

The resolved definitions of oci-artifact-registry and container-image-registry
on mesh-delivery feat/47-H2 (42788501) both still hold versions, from the
registry part they include; D4a (ac99946f) only gave list a module filter and
a cursor. The validator's refusal came from a request that did not resolve
the includes, so nothing the definitions hold is changed: this reverts
845de026.

Builds: design 47 H2 §813 (7); H-A-415 (2) and its addendum
This commit is contained in:
2026-11-22 01:13:44 +01:00
parent 9d0ca8e954
commit b305a5f08c
5 changed files with 50 additions and 95 deletions
+2 -2
View File
@@ -117,14 +117,14 @@
"mesh.control.NODE.>", "mesh.control.NODE.>",
"mesh.seat.mesh-catalog.call.entry.node~NODE", "mesh.seat.mesh-catalog.call.entry.node~NODE",
"mesh.seat.mesh-catalog.call.module.node~NODE", "mesh.seat.mesh-catalog.call.module.node~NODE",
"mesh.seat.container-image-registry.call.list.node~NODE", "mesh.seat.container-image-registry.call.versions.node~NODE",
"mesh.seat.mesh-catalog.call.revision.node~NODE", "mesh.seat.mesh-catalog.call.revision.node~NODE",
"mesh.seat.mesh-grants.call.withheld.node~NODE", "mesh.seat.mesh-grants.call.withheld.node~NODE",
"mesh.seat.mesh-module-assigner.call.assignments.node~NODE", "mesh.seat.mesh-module-assigner.call.assignments.node~NODE",
"mesh.seat.mesh-recovery.call.kept-points.node~NODE", "mesh.seat.mesh-recovery.call.kept-points.node~NODE",
"mesh.seat.mesh-recovery.call.restore-kept.node~NODE", "mesh.seat.mesh-recovery.call.restore-kept.node~NODE",
"mesh.seat.mesh-recovery.call.snapshot-kept.node~NODE", "mesh.seat.mesh-recovery.call.snapshot-kept.node~NODE",
"mesh.seat.oci-artifact-registry.call.list.node~NODE", "mesh.seat.oci-artifact-registry.call.versions.node~NODE",
"mesh.seat.mesh-catalog.call.seat-definitions.node~NODE", "mesh.seat.mesh-catalog.call.seat-definitions.node~NODE",
"mesh.seat.node-backup.call.backed-up.NODE.node~NODE", "mesh.seat.node-backup.call.backed-up.NODE.node~NODE",
"mesh.seat.node-backup.call.now.NODE.node~NODE", "mesh.seat.node-backup.call.now.NODE.node~NODE",
+5 -5
View File
@@ -470,8 +470,8 @@ func testTheNodeComposesItsWantsFromTheBus(t *testing.T) {
// resolves the digests). // resolves the digests).
e.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) { e.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) {
if seat == "container-image-registry" && args.(map[string]string)["name"] == "de-spiegel/site" { if seat == "container-image-registry" && args.(map[string]string)["name"] == "de-spiegel/site" {
return json.RawMessage(`{"repositories":[{"name":"de-spiegel/site","manifests":[{"digest":"sha256:` + return json.RawMessage(`{"name":"de-spiegel/site","versions":[{"name":"de-spiegel/site","kind":"image","digest":"sha256:` +
strings.Repeat("6", 64) + `","tags":["1"]}]}]}`), nil strings.Repeat("6", 64) + `","version":"1"}]}`), nil
} }
return nil, errors.New("not held") return nil, errors.New("not held")
}) })
@@ -1119,9 +1119,9 @@ func testTheNodeComposesItsWantsFromTheBus(t *testing.T) {
catalogEntries[artFp] = artEntry catalogEntries[artFp] = artEntry
// art's files archive at version 1, which the candidate "art-with" names (the candidate's version, never a digest). // art's files archive at version 1, which the candidate "art-with" names (the candidate's version, never a digest).
senv.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) { senv.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) {
if seat == "oci-artifact-registry" && args.(map[string]string)["module"] == "art" { if seat == "oci-artifact-registry" && args.(map[string]string)["name"] == "art/files" {
return json.RawMessage(`{"repositories":[{"name":"art/files","manifests":[{"digest":"sha256:` + strings.Repeat("8", 64) + return json.RawMessage(`{"name":"art/files","versions":[{"name":"art/files","kind":"archive","digest":"sha256:` +
`","artifact":"sha256:` + strings.Repeat("9", 64) + `","tags":["1"]}]}]}`), nil strings.Repeat("9", 64) + `","version":"1"}]}`), nil
} }
return nil, errors.New("not held") return nil, errors.New("not held")
}) })
+30 -64
View File
@@ -19,7 +19,7 @@ import (
// **A want names its version; the node-engine resolves the digests** (design 47 G A-430, A-430a, the lead's answer A-430b). // **A want names its version; the node-engine resolves the digests** (design 47 G A-430, A-430a, the lead's answer A-430b).
// A want of a released build names the module's version and no parts: each artifact of the build's entry is looked up at that // A want of a released build names the module's version and no parts: each artifact of the build's entry is looked up at that
// version through the verb `list` of the registry seat of its kind (oci-artifact-registry for a bundle or an archive, // version through the verb `versions` of the registry seat of its kind (oci-artifact-registry for a bundle or an archive,
// container-image-registry for an image), under the name the builder numbered it by: `<module>/<artifact>`, or the entry's // container-image-registry for an image), under the name the builder numbered it by: `<module>/<artifact>`, or the entry's
// package name for a package. An upstream copy is not numbered (it is mirrored by its pinned digest): its digest is the one its // package name for a package. An upstream copy is not numbered (it is mirrored by its pinned digest): its digest is the one its
// manifest's `from` pins. A want that names parts (a build no version is known of) is read by its parts as before. A lookup that // manifest's `from` pins. A want that names parts (a build no version is known of) is read by its parts as before. A lookup that
@@ -37,12 +37,8 @@ func (c *Composer) resolveAgain() time.Duration {
return DefaultResolveAgain return DefaultResolveAgain
} }
// listVerb is the verb a lookup asks: the registry seats read a version through `list`, filtered by module on // versionsVerb is the verb a lookup asks.
// oci-artifact-registry (design 47 H2 §813 (7), DMC-10, H-A-415 (2)). const versionsVerb = "versions"
const listVerb = "list"
// listPagesMost bounds the pages one lookup reads of a seat's list.
const listPagesMost = 64
// resolvedKey names one resolution: a module's build at a version. // resolvedKey names one resolution: a module's build at a version.
type resolvedKey struct{ module, fp, version string } type resolvedKey struct{ module, fp, version string }
@@ -57,21 +53,13 @@ type versionParts struct {
forgotten bool forgotten bool
} }
// registryList is the answer of either seat's verb `list` (form 2): each repository with the manifests it holds, each // registryVersions is the answer of either seat's verb `versions`: the two seats answer the same shape.
// manifest's digest, the blob it keeps (a bundle's or an archive's) and the tags naming it; capped with next when the rest type registryVersions struct {
// is on another page. Versions []struct {
type registryList struct { Digest string `json:"digest"`
Repositories []struct { Tag string `json:"tag,omitempty"`
Name string `json:"name"` Version string `json:"version,omitempty"`
Manifests []struct { } `json:"versions"`
Digest string `json:"digest"`
Artifact string `json:"artifact,omitempty"`
Tags []string `json:"tags,omitempty"`
} `json:"manifests"`
} `json:"repositories"`
Capped bool `json:"capped,omitempty"`
Total int64 `json:"total,omitempty"`
Next string `json:"next,omitempty"`
} }
// seatOfKind is the registry seat an artifact of kind is numbered in, and whether one is (design 51 *The seats*). // seatOfKind is the registry seat an artifact of kind is numbered in, and whether one is (design 51 *The seats*).
@@ -230,7 +218,7 @@ func (c *Composer) lookUp(module string, e meshcatalog.CatalogEntry, w meshwants
fail("(none)", a.Ref, "no registry seat the node-engine reads numbers an artifact of kind "+a.Kind) fail("(none)", a.Ref, "no registry seat the node-engine reads numbers an artifact of kind "+a.Kind)
continue continue
} }
digest, why := c.versionDigest(seat, module, registryName(module, a), w) digest, why := c.versionDigest(seat, registryName(module, a), w)
if why != "" { if why != "" {
fail(seat, a.Ref, why) fail(seat, a.Ref, why)
continue continue
@@ -244,52 +232,30 @@ func (c *Composer) lookUp(module string, e meshcatalog.CatalogEntry, w meshwants
return parts, "" return parts, ""
} }
// versionDigest is the digest the seat's verb list answers for the repository name at w's version, a tag naming it: a // versionDigest is the digest the seat's verb versions answers for name at w's version (its version or its tag), the newest
// version names one build (A-430a). oci-artifact-registry is asked for the module's repositories (`list {module}`) and // first: a version names one build (A-430a), so the version alone is matched.
// answers the blob a manifest keeps, the digest a bundle or an archive is fetched by; container-image-registry, whose list func (c *Composer) versionDigest(seat, name string, w meshwants.WantsByWantNodeModuleValue) (string, string) {
// takes no module, is asked for the repository by its name and answers the image manifest's digest. Every page is read
// while the answer says next (design 47 H2 §779, §813 (7), H-A-415 (2)).
func (c *Composer) versionDigest(seat, module, name string, w meshwants.WantsByWantNodeModuleValue) (string, string) {
if c.env.Registry == nil { if c.env.Registry == nil {
return "", "this node-engine reads no registry seat" return "", "this node-engine reads no registry seat"
} }
in := map[string]string{"name": name} raw, err := c.env.Registry("seat:"+seat+"."+versionsVerb, map[string]string{"name": name})
if seat == ociartifactregistry.Seat { if err != nil {
in = map[string]string{"module": module} return "", fmt.Sprintf("the call for %s failed: %v", name, err)
} }
for page := 0; page < listPagesMost; page++ { answer, said, ok := buscalls.Unwrap(raw)
raw, err := c.env.Registry("seat:"+seat+"."+listVerb, in) if !ok {
if err != nil { return "", fmt.Sprintf("the seat refused %s: %s", name, said)
return "", fmt.Sprintf("the call for %s failed: %v", name, err)
}
answer, said, ok := buscalls.Unwrap(raw)
if !ok {
return "", fmt.Sprintf("the seat refused %s: %s", name, said)
}
var l registryList
if err := json.Unmarshal(answer, &l); err != nil {
return "", fmt.Sprintf("its answer for %s cannot be read: %v", name, err)
}
for _, r := range l.Repositories {
if r.Name != name {
continue
}
for _, m := range r.Manifests {
if !slices.Contains(m.Tags, w.Version) || m.Digest == "" {
continue
}
if seat == ociartifactregistry.Seat && m.Artifact != "" {
return m.Artifact, ""
}
return m.Digest, ""
}
}
if l.Next == "" {
return "", fmt.Sprintf("it holds no version %s of %s", w.Version, name)
}
in["next"] = l.Next
} }
return "", fmt.Sprintf("its list of %s did not end within %d pages", module, listPagesMost) var v registryVersions
if err := json.Unmarshal(answer, &v); err != nil {
return "", fmt.Sprintf("its answer for %s cannot be read: %v", name, err)
}
for _, a := range v.Versions {
if (a.Version == w.Version || a.Tag == w.Version) && a.Digest != "" {
return a.Digest, ""
}
}
return "", fmt.Sprintf("it holds no version %s of %s", w.Version, name)
} }
// pinnedDigest is the digest the manifest's upstream artifact pins in its from (`<image>@sha256:<hex>`); "" when none. // pinnedDigest is the digest the manifest's upstream artifact pins in its from (`<image>@sha256:<hex>`); "" when none.
+10 -21
View File
@@ -36,13 +36,11 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
}}} }}}
entry := meshcatalog.CatalogEntry{Module: "mail", Fp: fp, Manifest: manifest, Artifacts: []meshcatalog.Artifact{ entry := meshcatalog.CatalogEntry{Module: "mail", Fp: fp, Manifest: manifest, Artifacts: []meshcatalog.Artifact{
{Ref: "mail:server", Kind: "upstream"}, {Ref: "mail:files", Kind: "archive"}, {Ref: "mail:web", Kind: "image"}}} {Ref: "mail:server", Kind: "upstream"}, {Ref: "mail:files", Kind: "archive"}, {Ref: "mail:web", Kind: "image"}}}
// The seats hold mail/files and mail/web, each version a tag of its manifest; an archive's blob is what it is fetched // The seats hold mail/files and mail/web; versions newest first.
// by (design 47 H2 §813 (7), H-A-415 (2): the version is read through list).
held := map[string]string{ held := map[string]string{
"oci-artifact-registry.mail/files": `{"name":"mail/files","manifests":[{"digest":"` + d("8") + `","artifact":"` + d("2") + "oci-artifact-registry.mail/files": `{"name":"mail/files","versions":[{"name":"mail/files","kind":"archive","digest":"` + d("2") + `","version":"1.3.0"},{"name":"mail/files","kind":"archive","digest":"` + d("1") + `","version":"1.2.3"}]}`,
`","tags":["1.3.0"]},{"digest":"` + d("7") + `","artifact":"` + d("1") + `","tags":["1.2.3"]}]}`, "container-image-registry.mail/web": `{"name":"mail/web","versions":[{"name":"mail/web","kind":"image","digest":"` + d("3") + `","version":"1.2.3"}]}`,
"container-image-registry.mail/web": `{"name":"mail/web","manifests":[{"digest":"` + d("3") + `","tags":["1.2.3"]}]}`, "container-image-registry.mail/other": `{"name":"mail/other","versions":[]}`,
"container-image-registry.mail/other": `{"name":"mail/other","manifests":[]}`,
} }
for name, row := range map[string]struct { for name, row := range map[string]struct {
want meshwants.WantsByWantNodeModuleValue want meshwants.WantsByWantNodeModuleValue
@@ -64,25 +62,17 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
calls := 0 calls := 0
env.Registry = EntryCall(func(_ context.Context, seat, verb string, args any) (json.RawMessage, error) { env.Registry = EntryCall(func(_ context.Context, seat, verb string, args any) (json.RawMessage, error) {
calls++ calls++
in := args.(map[string]string) if verb != "versions" {
// oci-artifact-registry is asked by the module, container-image-registry by the repository's name. t.Errorf("%s: asked %s.%s", name, seat, verb)
if verb != "list" || (seat == "oci-artifact-registry") != (in["module"] == "mail" && in["name"] == "") {
t.Errorf("%s: asked %s.%s %v", name, seat, verb, in)
} }
if seat == row.down { if seat == row.down {
return nil, errors.New("no responders") return nil, errors.New("no responders")
} }
var repos []string answer, ok := held[seat+"."+args.(map[string]string)["name"]]
for key, repo := range held { if !ok {
r, ok := strings.CutPrefix(key, seat+".")
if ok && (r == in["name"] || (in["module"] != "" && strings.HasPrefix(r, in["module"]+"/"))) {
repos = append(repos, repo)
}
}
if len(repos) == 0 {
return nil, errors.New("not held") return nil, errors.New("not held")
} }
return json.RawMessage(`{"repositories":[` + strings.Join(repos, ",") + `]}`), nil return json.RawMessage(answer), nil
}) })
env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) { env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
return nil, errors.New("not asked") return nil, errors.New("not asked")
@@ -321,8 +311,7 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
calls := 0 calls := 0
env.Registry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) { env.Registry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
calls++ calls++
return json.RawMessage(`{"repositories":[{"name":"mail/files","manifests":[{"digest":"sha256:` + strings.Repeat("e", 64) + return json.RawMessage(`{"versions":[{"digest":"` + row.answer + `","version":"1.2.3"}]}`), nil
`","artifact":"` + row.answer + `","tags":["1.2.3"]}]}]}`), nil
}) })
env.Fetch = func(context.Context, string) ([]byte, error) { return body, row.fetch } env.Fetch = func(context.Context, string) ([]byte, error) { return body, row.fetch }
env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) { env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
+3 -3
View File
@@ -46,7 +46,7 @@
} }
], ],
"invokes": [ "invokes": [
"seat:container-image-registry.list", "seat:container-image-registry.versions",
"seat:mesh-catalog.entry", "seat:mesh-catalog.entry",
"seat:mesh-catalog.module", "seat:mesh-catalog.module",
{"verb": "seat:mesh-catalog.revision", "fields": ["none-yet"]}, {"verb": "seat:mesh-catalog.revision", "fields": ["none-yet"]},
@@ -57,7 +57,7 @@
"seat:mesh-recovery.restore-kept", "seat:mesh-recovery.restore-kept",
"seat:mesh-recovery.snapshot-kept", "seat:mesh-recovery.snapshot-kept",
"seat:node-packet-filter.allowed", "seat:node-packet-filter.allowed",
"seat:oci-artifact-registry.list" "seat:oci-artifact-registry.versions"
], ],
"consumes": [ "consumes": [
"mesh-catalog.catalog-revision", "mesh-catalog.catalog-revision",
@@ -126,7 +126,7 @@
}, },
"resolve-again-minutes": { "resolve-again-minutes": {
"type": "number", "type": "number",
"description": "How long the node-engine holds a module whose want's version it could not resolve to its artifacts' digests, or whose resolution it forgot after a failed fetch, before it asks the registry seats' verb list again, in minutes (design 47 H, H-A-146).", "description": "How long the node-engine holds a module whose want's version it could not resolve to its artifacts' digests, or whose resolution it forgot after a failed fetch, before it asks the registry seats' verb versions again, in minutes (design 47 H, H-A-146).",
"minimum": 1, "minimum": 1,
"maximum": 60, "maximum": 60,
"default": 1 "default": 1