diff --git a/modules/artifact-store-tools/README.md b/modules/artifact-store-tools/README.md index 1b747f8f..5a38db8f 100644 --- a/modules/artifact-store-tools/README.md +++ b/modules/artifact-store-tools/README.md @@ -61,7 +61,7 @@ record names leaves its platform manifests unrecorded with it. **What the definitions pin** (hq issue 323). A definition may pin an image of the store the mesh did not make: pushed before the mesh built it, and pinned under the store's current name or a name it had before. No record of the controller names it, yet a machine runs it, so `artifact_store_references` reads every -definition the catalogue holds (`mesh-catalog.catalog_modules`, then `catalog_module` for each, eight at +definition the catalogue holds (the seat mesh-catalog's verbs `modules`, then `module` for each, eight at a time and within twenty seconds) and finds every `/@sha256:…` in any of its strings, under each of the store's names: `artifact-store://`, the store's address as the controller answers it, and the names it had before. Those are the mesh's setting `older-store-names` (space-separated, `none` by diff --git a/modules/artifact-store-tools/cmd/artifact-store-tools/definitions.go b/modules/artifact-store-tools/cmd/artifact-store-tools/definitions.go index ef4ef966..d62bf5a6 100644 --- a/modules/artifact-store-tools/cmd/artifact-store-tools/definitions.go +++ b/modules/artifact-store-tools/cmd/artifact-store-tools/definitions.go @@ -23,10 +23,11 @@ import ( // manifest's. const NamesFileEnv = "MESH_ARTIFACT_STORE_NAMES_FILE" -// CatalogueModules and CatalogueModule are the catalog's tools these definitions are read through. +// CatalogueModules and CatalogueModule are the verbs of the seat mesh-catalog these definitions are read through +// (ADR 0604 §3); the answers are catalogue.CatalogModules and catalogue.CatalogOne. const ( - CatalogueModules = "mesh-catalog.catalog_modules" - CatalogueModule = "mesh-catalog.catalog_module" + CatalogueModules = "seat:mesh-catalog.modules" + CatalogueModule = "seat:mesh-catalog.module" ) // DefinitionsTimeout bounds reading every definition, below the runtime's thirty-second call limit; what @@ -279,11 +280,8 @@ func (c *Catalogue) definition(m catalogueEntry, names StoreNames, nameKey strin return pins, "" } } - args := map[string]any{"module": m.Module} - if m.Commit != "" { - args["commit"] = m.Commit - } - raw, err := c.Ask(CatalogueModule, args) + // The verb takes no commit: it answers the trunk's module, and the answer names the commit it is at. + raw, err := c.Ask(CatalogueModule, map[string]any{"module": m.Module}) if err != nil { return nil, "could not be asked: " + err.Error() } @@ -293,6 +291,7 @@ func (c *Catalogue) definition(m catalogueEntry, names StoreNames, nameKey strin } var one struct { Module *struct { + Commit string `json:"commit"` Manifest json.RawMessage `json:"manifest"` } `json:"module"` Error string `json:"error"` @@ -301,9 +300,11 @@ func (c *Catalogue) definition(m catalogueEntry, names StoreNames, nameKey strin return nil, "not readable: " + firstOf(one.Error, errText(err), "no manifest in the answer") } pins := PinsIn(one.Module.Manifest, names) - if m.Commit != "" { + // Kept by the commit the answer names, which may be newer than the list's: a definition and its commit never + // change together. + if at := firstOf(one.Module.Commit, m.Commit); at != "" { c.mu.Lock() - c.kept[key] = pins + c.kept[m.Module+"@"+at+"|"+nameKey] = pins c.mu.Unlock() } return pins, "" diff --git a/modules/artifact-store-tools/cmd/artifact-store-tools/definitions_test.go b/modules/artifact-store-tools/cmd/artifact-store-tools/definitions_test.go index 316baf2c..c46cb12c 100644 --- a/modules/artifact-store-tools/cmd/artifact-store-tools/definitions_test.go +++ b/modules/artifact-store-tools/cmd/artifact-store-tools/definitions_test.go @@ -211,7 +211,7 @@ func TestReferencesReadTheDefinitionsUnderTheStoresOlderNames(t *testing.T) { } } if before != 2 || after != 2 { - t.Errorf("asked catalog_module %d times, then %d: each definition at its commit is read once", before, after) + t.Errorf("asked the seat's module %d times, then %d: each definition at its commit is read once", before, after) } } diff --git a/modules/artifact-store-tools/cmd/artifact-store-tools/store_test.go b/modules/artifact-store-tools/cmd/artifact-store-tools/store_test.go index c8a527d3..ea6fdccd 100644 --- a/modules/artifact-store-tools/cmd/artifact-store-tools/store_test.go +++ b/modules/artifact-store-tools/cmd/artifact-store-tools/store_test.go @@ -366,8 +366,8 @@ func (a *asked) ask(key string, body any) (json.RawMessage, error) { if a.failing[name] { return nil, fmt.Errorf("no answer") } - if args["commit"] != "c-"+name { - return nil, fmt.Errorf("asked %s at %v", name, args["commit"]) + if _, has := args["commit"]; has { + return nil, fmt.Errorf("asked %s at %v: the seat's verb takes no commit", name, args["commit"]) } manifest, has := a.definitions[name] if !has { @@ -375,7 +375,8 @@ func (a *asked) ask(key string, body any) (json.RawMessage, error) { break } // The catalogue's tool answers through the runtime as the protocol's content list. - raw, _ := json.Marshal(map[string]any{"module": map[string]any{"module": name, "manifest": json.RawMessage(manifest)}}) + raw, _ := json.Marshal(catalogue.CatalogOne{Module: catalogue.CatalogModule{ + CatalogEntry: catalogue.CatalogEntry{Module: name, Commit: "c-" + name}, Manifest: json.RawMessage(manifest)}}) return json.Marshal(map[string]any{"content": []map[string]any{{"type": "text", "text": string(raw)}}}) case "collect": if args["confirm"] == "true" { diff --git a/modules/artifact-store-tools/go.mod b/modules/artifact-store-tools/go.mod index dfdeecbe..f157cfd2 100644 --- a/modules/artifact-store-tools/go.mod +++ b/modules/artifact-store-tools/go.mod @@ -3,7 +3,7 @@ module artifactstoretools go 1.26.0 require ( - git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261102191058-f02f142af128 + git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261103174208-b7abe203a929 github.com/nats-io/nats.go v1.54.0 ) diff --git a/modules/artifact-store-tools/go.sum b/modules/artifact-store-tools/go.sum index 43cc4ec7..abad2969 100644 --- a/modules/artifact-store-tools/go.sum +++ b/modules/artifact-store-tools/go.sum @@ -1,5 +1,5 @@ -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261102191058-f02f142af128 h1:aI1DhZAuqVBXbybSqhLNOGX5rUOrn9T0cHNCDUQF7IQ= -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261102191058-f02f142af128/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261103174208-b7abe203a929 h1:RtAFbUJRP1qO9AIMM2ue+cXNzqj7WZ7IOlSqNvttwuU= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261103174208-b7abe203a929/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI= github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo= diff --git a/modules/artifact-store-tools/module.json b/modules/artifact-store-tools/module.json index eda3a100..54cc5916 100644 --- a/modules/artifact-store-tools/module.json +++ b/modules/artifact-store-tools/module.json @@ -19,8 +19,8 @@ ], "invokes": [ "seat:mesh-hand-acts.hand-act", - "mesh-catalog.catalog_modules", - "mesh-catalog.catalog_module" + "seat:mesh-catalog.modules", + "seat:mesh-catalog.module" ], "reads": [ "mesh-delivery-assigner.wants",