Merge branch 'b9i/registry' into b7/registry

This commit is contained in:
2026-11-05 17:39:18 +01:00
12 changed files with 29 additions and 24 deletions
@@ -17,7 +17,7 @@ import (
"git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"git.novox.be/novox/mesh-delivery/sdk/graph"
)
@@ -16,7 +16,7 @@ import (
"git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
"git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry"
"git.novox.be/novox/mesh-delivery/sdk/buildstep"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"git.novox.be/novox/mesh-delivery/sdk/kept"
"git.novox.be/novox/mesh-delivery/sdk/trunk"
"git.novox.be/novox/mesh-sdk/go/keys"
@@ -1,7 +1,8 @@
// Package forms holds the artifact reference forms the builder writes a done build key in and the assigner holds a want
// by (novox/hq ADR 0618 §1-§2, ADR 0624): logic only those two modules of mesh-delivery share, so it is mesh-delivery's
// and not mesh-sdk's (ADR 0593 §1, ADR 0608 §5). The build key's fields (BuilderBuild.Needs,
// BuiltArtifact.References) are the builder's, in its package `builds`.
// and not mesh-sdk's (ADR 0593 §1, ADR 0608 §5). It lives beside the build key it reads, in the builder's published
// module `builds` (whose fields BuilderBuild.Needs and BuiltArtifact.References are), and reads the registry seat's form
// through the registry clients' reference package (ADR 0634 §4).
package forms
import (
@@ -9,13 +10,16 @@ import (
"sort"
"strings"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
containerimageregistry "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
ociartifactregistry "git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// BuiltArtifact is one artifact of a done build, as the forms read it: its name, kind, digest and the reference that names
// where it is, with every form it is named in (References, Reference among them; novox/hq ADR 0618, ADR 0624). A reader
// that does not know References reads Reference alone. The builder's build key holds the same fields (its package
// `builds`), whose type is this one, since both read the forms and the forms are logic of the sdk alone.
// `builds`), whose type is this one, since both read the forms.
type BuiltArtifact struct {
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
@@ -44,10 +48,10 @@ const (
)
// FormSeatReference is the form a registry seat answers for what it published,
// <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
// <seat>/<module>/<artifact>@sha256:<digest> (novox/hq ADR 0605 §9; reference.SeatReference, read back by
// reference.Seats.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> (catalogue.InUpstream). It is read by a node-engine that states
// container-image-registry/upstream/<host>/<path>@sha256:<digest> (reference.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
@@ -70,7 +74,7 @@ type ArtifactForms []ArtifactForm
// reference by kind), then the registry seat's form of a bundle or an archive.
var Current = ArtifactForms{
// The registry form precedes the artifact-store form: what a build key kept of an image is recorded without the
// registry's address (catalogue.Recorded), so the artifact-store form is the newest first form an image has, the one
// registry's address (reference.Seats.Recorded), so the artifact-store form is the newest first form an image has, the one
// Kept keeps for a node that states nothing.
{Name: FormRegistry, First: true, Is: func(r string) bool { return !strings.HasPrefix(r, artifactStore) && strings.Contains(r, "@sha256:") },
Kinds: []string{catalogue.ArtifactImage, catalogue.ArtifactUpstream}},
@@ -79,13 +83,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 { _, _, ok := catalogue.InRegistrySeat(r); return ok },
// The same artifact in the artifact store's form (catalogue.InArtifactStore): oci-artifact-registry/<m>/<a>@<d> is
Is: func(r string) bool { _, _, ok := registryForms.InRegistrySeat(r); return ok },
// The same artifact in the artifact store's form (reference.Seats.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 {
path, _ := catalogue.InArtifactStore(r)
return catalogue.ArtifactStoreScheme + path
path, _ := registryForms.InArtifactStore(r)
return reference.ArtifactStoreScheme + path
}},
}
@@ -280,3 +284,6 @@ func (fs ArtifactForms) withOlder(kind string, answered []string) []string {
}
return out
}
// registryForms reads a reference of the registry seat's form, with the two registry seats' names from their contracts.
var registryForms = reference.Seats{Image: containerimageregistry.Seat, Object: ociartifactregistry.Seat}
@@ -14,7 +14,6 @@ import (
sweep "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// A done key whose blob the artifact store no longer holds is built again, by the builder whole against the bus
@@ -31,7 +30,7 @@ type heldVerb struct {
func (h *heldVerb) serve(t *testing.T, b *bed) {
t.Helper()
sub, err := b.js.Conn().Subscribe("mesh.seat."+catalogue.ArtifactSweepSeat+".call.held.>", func(m *nats.Msg) {
sub, err := b.js.Conn().Subscribe("mesh.seat."+sweep.Seat+".call.held.>", func(m *nats.Msg) {
var args struct {
References []string `json:"references"`
}
@@ -22,7 +22,7 @@ import (
sdkfindings "git.novox.be/novox/mesh-delivery/sdk/findings"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/buildrun"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
@@ -15,7 +15,7 @@ import (
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"mesh-delivery-builder/internal/versions"
)
@@ -26,9 +26,9 @@ import (
sweep "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/buildrun"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-forge-bridge/forgemsg"
"git.novox.be/novox/mesh-delivery/sdk/enginereads"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"mesh-delivery-builder/internal/build"
"mesh-delivery-builder/internal/versions"
@@ -10,7 +10,6 @@ import (
"github.com/nats-io/nats.go/jetstream"
sweep "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"mesh-delivery-builder/internal/build"
)
@@ -20,7 +19,7 @@ import (
const eventsStream = "EVENTS"
// SeatHeld is the seat mesh-artifact-sweep's verb held (ADR 0571 §2).
const SeatHeld = "seat:" + catalogue.ArtifactSweepSeat + ".held"
const SeatHeld = "seat:" + sweep.Seat + ".held"
// toolCaller calls a tool or a seat verb as the builder's own account (mesh-sdk process.Conn.Call).
type toolCaller func(key string, body any) (json.RawMessage, error)
@@ -19,7 +19,7 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/buildrun"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
repotrunk "git.novox.be/novox/mesh-delivery/sdk/trunk"
"git.novox.be/novox/mesh-sdk/go/catalogue"
@@ -19,7 +19,7 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/buildrun"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/sdk/buildstep"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/keys"
@@ -10,7 +10,7 @@ import (
"time"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
"git.novox.be/novox/mesh-delivery/sdk/window"
)
@@ -13,7 +13,7 @@ import (
"time"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/sdk/forms"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds/forms"
)
// mem is a Store in memory; before runs once before the next Create, to stage a race.