From c974a11c9795b20f45f22ad1a43381e3516f8801 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 4 Nov 2026 14:58:14 +0100 Subject: [PATCH] J3 pick for A3p: delivery.VersionNumbered and BuildAnswer.OutOfStep as join-mesh-sdk 712b21b has them Only version_numbered.go and stepasks.go of 712b21b, so mesh-build-go builds against them before the join; identical to the join's, dropped there. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig --- go/delivery/stepasks.go | 4 +++ go/delivery/version_numbered.go | 57 +++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 go/delivery/version_numbered.go diff --git a/go/delivery/stepasks.go b/go/delivery/stepasks.go index 327e87d..753f50d 100644 --- a/go/delivery/stepasks.go +++ b/go/delivery/stepasks.go @@ -583,6 +583,10 @@ type BuildAnswer struct { // once (novox/hq ADR 0593 ยง2): a Go build module reports them, the builder carries them onto the build's end // (BuildLogEntry.Imports). Absent from a build module that reports none. Imports []string `json:"imports,omitempty"` + // OutOfStep are the generated files the build's compare found out of step with what their generator writes (the test + // step's `out-of-step`, answered by a trunk build's ask too): the builder carries them onto the build's end + // (BuildLogEntry.OutOfStep). Absent when none is, or from a build module that compares none. + OutOfStep []string `json:"out-of-step,omitempty"` } // AskBuilt is one artifact a build ask built. diff --git a/go/delivery/version_numbered.go b/go/delivery/version_numbered.go new file mode 100644 index 0000000..634cb84 --- /dev/null +++ b/go/delivery/version_numbered.go @@ -0,0 +1,57 @@ +package delivery + +import ( + "encoding/json" + "fmt" +) + +// The builder's event version.numbered (design 51 *Events of the builder*, *The floor*): said once per version the builder +// numbers, on its own family `version` (seven days), apart from its builds' ends, so a waiter on a build's end does not +// wake on it. A build module consumes it to publish a build's version with the held digest, which stores nothing. +const ( + // VersionNumberedEvent is the event's local name. + VersionNumberedEvent = "version.numbered" + // VersionNumberedSubject is its subject, as a consumer's filter names it. + VersionNumberedSubject = "mesh.mod." + BuilderModule + ".event." + VersionNumberedEvent +) + +// VersionNumbered is the body of VersionNumberedEvent: a numbered version of a name, the build it was numbered for, and +// what the build module needs to publish it. +type VersionNumbered struct { + // Name is the numbered name, as builder_versions lists it; Kind its artifact's kind. + Name string `json:"name"` + Kind string `json:"kind"` + Version string `json:"version"` + Tag string `json:"tag,omitempty"` + // Module and Fingerprint are the build the version was numbered for; Commit its source commit. + Module string `json:"module"` + Fingerprint string `json:"fingerprint"` + Commit string `json:"commit,omitempty"` + // Digest is the built artifact's, when the build held one; Seat the registry seat it is published through. + Digest string `json:"digest,omitempty"` + Seat string `json:"seat,omitempty"` + // Head is the head the version answers, when it answers a tag ask. + Head string `json:"head,omitempty"` + // Again is when builder_publish_again said it once more, so the bus's dedup does not drop it. + Again string `json:"again,omitempty"` +} + +// EncodeVersionNumbered writes the body, refusing one that names no name, version, module or fingerprint. +func EncodeVersionNumbered(n VersionNumbered) ([]byte, error) { + if n.Name == "" || n.Version == "" || n.Module == "" || n.Fingerprint == "" { + return nil, fmt.Errorf("delivery: %s names its name, version, module and fingerprint", VersionNumberedEvent) + } + return json.Marshal(n) +} + +// DecodeVersionNumbered reads the body, with the same refusal. +func DecodeVersionNumbered(data []byte) (VersionNumbered, error) { + var n VersionNumbered + if err := json.Unmarshal(data, &n); err != nil { + return VersionNumbered{}, fmt.Errorf("delivery: %s is not readable: %w", VersionNumberedEvent, err) + } + if _, err := EncodeVersionNumbered(n); err != nil { + return VersionNumbered{}, err + } + return n, nil +}