Seat mesh-builds: step-progress, said while a build step builds or waits

The runner arms an ask's bound again at each step-progress, which only the
seat mesh-wants said: a build step whose build waits for a package said
nothing for the bound and ended ask-unanswered. The seat mesh-builds gains
step-progress, with the fields of mesh-wants', and its generated contract.

Builds: design 47 H2 H-A-514 addendum
This commit is contained in:
2026-11-23 02:39:06 +01:00
parent 131dfe71a7
commit 668ef8d467
6 changed files with 199 additions and 2 deletions
@@ -19,7 +19,7 @@ const Form = 2
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "2"
generatedFieldsDigest = "AskTakenEvent=6d5d3da7ac39 BuildEntry=3c829a0a3d58 Dependency=90a32b07c563 DropAnswer=7538f2f5e68e PackagePublished=34dd069a6aab PackagePublishedEvent=8e12888c1559 PublishQueueAnswer=0f1326e35e17 PublishQueueAnswerCountsItem=b770db2f0920 PublishQueueAnswerQueueItem=b1eebc09f41e PublishedAnswer=69a801982819 ReservedAnswer=2272a4d6f0f4 ReservedAnswerArtifactsItem=d74eb6e00abb StepAccept=18efeefb6c34 StepEnded=40a0090f7cb5 StepEndedEvent=207787118dac StepRun=dc5893aef7e5 ToolchainAgreed=f3d9ce993734 ToolchainAgreedDigestsItem=1d42893a96b9 ToolchainAgreedEvent=e3502d6f194d VersionReservedEvent=984547d6ad07"
generatedFieldsDigest = "AskTakenEvent=6d5d3da7ac39 BuildEntry=3c829a0a3d58 Dependency=90a32b07c563 DropAnswer=7538f2f5e68e PackagePublished=34dd069a6aab PackagePublishedEvent=8e12888c1559 PublishQueueAnswer=0f1326e35e17 PublishQueueAnswerCountsItem=b770db2f0920 PublishQueueAnswerQueueItem=b1eebc09f41e PublishedAnswer=69a801982819 ReservedAnswer=2272a4d6f0f4 ReservedAnswerArtifactsItem=d74eb6e00abb Shared=c981cf6aa860 SharedAskedBy=c9b30cc4d0d0 StepAccept=18efeefb6c34 StepEnded=40a0090f7cb5 StepEndedEvent=207787118dac StepProgressEvent=8215e490ea8d StepRun=dc5893aef7e5 ToolchainAgreed=f3d9ce993734 ToolchainAgreedDigestsItem=1d42893a96b9 ToolchainAgreedEvent=e3502d6f194d VersionReservedEvent=984547d6ad07"
)
const (
@@ -38,6 +38,7 @@ const (
EventToolchainAgreed = "toolchain-agreed"
EventStepEnded = "step-ended"
EventAskTaken = "ask-taken"
EventStepProgress = "step-progress"
EventVersionReserved = "version-reserved"
)
@@ -64,7 +65,7 @@ func VerbDescription(verb string) string {
// Events is every event published on the seat's subject: a new copy each call.
func Events() []string {
return []string{EventPackagePublished, EventToolchainAgreed, EventStepEnded, EventAskTaken, EventVersionReserved}
return []string{EventPackagePublished, EventToolchainAgreed, EventStepEnded, EventAskTaken, EventStepProgress, EventVersionReserved}
}
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
@@ -100,6 +101,14 @@ func SubjectAskTaken(ask string) string { return "mesh.seat.mesh-builds.event.as
// SubjectAskTakenAll hears every ask-taken.
const SubjectAskTakenAll = "mesh.seat.mesh-builds.event.ask-taken.*"
// SubjectStepProgress is where step-progress is published, on mesh.seat.mesh-builds.event.step-progress.<node>.
func SubjectStepProgress(node string) string {
return "mesh.seat.mesh-builds.event.step-progress." + node
}
// SubjectStepProgressAll hears every step-progress.
const SubjectStepProgressAll = "mesh.seat.mesh-builds.event.step-progress.*"
// SubjectVersionReserved is where version-reserved is published.
const SubjectVersionReserved = "mesh.seat.mesh-builds.event.version-reserved"
@@ -150,6 +159,26 @@ type PackagePublished struct {
Version string `json:"version"`
}
// SharedAskedBy is the step that asked the run, for a test step reading another's run.
type SharedAskedBy struct {
// its artifact, <module>:<artifact>
Artifact string `json:"artifact"`
// its pipeline's key
Pipeline string `json:"pipeline"`
}
// Shared is a run whose result a step took or waits on, asked once for every step that reads it (design 47 G §729, A-469t): for a composition step one per machine composed, `run` the `composition-runs` key and `ask` its run ask's id; for a test step one with no machine, `run` the `test-runs` key, `ask` its build seat ask's id and `asked-by` the step that asked the run, left out for that step itself.
type Shared struct {
// the id of the run's ask of the build seat
Ask string `json:"ask"`
// the step that asked the run, for a test step reading another's run
AskedBy *SharedAskedBy `json:"asked-by,omitempty"`
// the machine composed, for a composition run
Machine string `json:"machine,omitempty"`
// the run's key: in the assigner's composition-runs, or the runner's test-runs
Run string `json:"run"`
}
// StepEnded is the build step's end, said by the builder on the node it runs on (design 47 G A-97; ADR 0666 section 21): the runner takes it only from that holder's account, naming the ask and each entry's fingerprint it was asked at.
type StepEnded struct {
// for a rerun, the caller the runtime proved
@@ -403,6 +432,26 @@ type AskTakenEvent struct {
Node string `json:"node"`
}
// StepProgressEvent is the body of the event step-progress.
type StepProgressEvent struct {
Ask string `json:"ask"`
Asker string `json:"asker"`
At time.Time `json:"at"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Phase string `json:"phase"`
// the composition runs the step waits on, by machine, each with its ask (design 47 G §723, §729)
Shared []Shared `json:"shared,omitempty"`
}
// The values of StepProgressEvent's phase.
const (
StepProgressEventPhaseFetch = "fetch"
StepProgressEventPhaseBuild = "build"
StepProgressEventPhaseRun = "run"
StepProgressEventPhaseReport = "report"
)
// VersionReservedEvent is the body of the event version-reserved.
type VersionReservedEvent struct {
Artifact string `json:"artifact"`
@@ -489,6 +538,15 @@ func DecodeAskTakenEvent(raw []byte) (AskTakenEvent, int, error) {
return v, formRead(raw), nil
}
// DecodeStepProgressEvent reads a StepProgressEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeStepProgressEvent(raw []byte) (StepProgressEvent, int, error) {
var v StepProgressEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeVersionReservedEvent reads a VersionReservedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeVersionReservedEvent(raw []byte) (VersionReservedEvent, int, error) {
var v VersionReservedEvent
@@ -31,6 +31,8 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v AskTakenEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-builds\\.event\\.ask-taken\\.[^.*> ]+$")},
{name: "a version reserved at a fingerprint", subject: "mesh.seat.mesh-builds.event.version-reserved", given: "{\"artifact\":\"mesh-sdk:go\",\"fingerprint\":\"sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\",\"form\":1,\"module\":\"mesh-sdk\",\"path\":\"git.novox.be/novox/mesh-sdk/go\",\"revision\":\"412\",\"version\":\"0.1.21\"}", wire: "{\"artifact\":\"mesh-sdk:go\",\"fingerprint\":\"sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\",\"form\":1,\"module\":\"mesh-sdk\",\"path\":\"git.novox.be/novox/mesh-sdk/go\",\"revision\":\"412\",\"version\":\"0.1.21\"}",
decode: func(b []byte) (any, error) { var v VersionReservedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-builds\\.event\\.version-reserved$")},
{name: "a build step's progress while its build waits for a package", subject: "mesh.seat.mesh-builds.event.step-progress.anchor", given: "{\"ask\":\"a1b2\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-23T02:40:00Z\",\"phase\":\"build\"}", wire: "{\"ask\":\"a1b2\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-23T02:40:00Z\",\"phase\":\"build\"}",
decode: func(b []byte) (any, error) { var v StepProgressEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-builds\\.event\\.step-progress\\.[^.*> ]+$")},
{name: "reserved asks a module", subject: "", given: "{\"module\":\"mesh-sdk\"}", wire: "{\"module\":\"mesh-sdk\"}",
decode: func(b []byte) (any, error) { var v ReservedInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "reserved asks a package by its name", subject: "", given: "{\"name\":\"git.novox.be/novox/mesh-sdk/go\",\"version\":\"0.1.15\"}", wire: "{\"name\":\"git.novox.be/novox/mesh-sdk/go\",\"version\":\"0.1.15\"}",
@@ -140,5 +140,16 @@
"revision": "412",
"form": 1
}
},
{
"name": "a build step's progress while its build waits for a package",
"of": "event:step-progress",
"subject": "mesh.seat.mesh-builds.event.step-progress.anchor",
"given": {
"asker": "mesh-delivery-pipeline",
"ask": "a1b2",
"phase": "build",
"at": "2026-11-23T02:40:00Z"
}
}
]
@@ -373,6 +373,48 @@
"description": "the seat's holder took the ask from the seat's work queue, at the pull: only the holder says it; the runner arms the ask's bound from it (design 47 H2 §777, §778)"
}
},
{
"name": "step-progress",
"subject": "step-progress.<node>",
"body": {
"type": "object",
"description": "a build step's progress, said once a minute while the seat's holder builds it or its build waits for a package, so the asker's bound of the ask is armed again (design 47 H2 H-A-514 addendum)",
"properties": {
"asker": {
"type": "string"
},
"ask": {
"type": "string"
},
"phase": {
"type": "string",
"enum": [
"fetch",
"build",
"run",
"report"
]
},
"at": {
"type": "string",
"format": "date-time"
},
"shared": {
"type": "array",
"items": {
"$ref": "#/defs/Shared"
},
"description": "the composition runs the step waits on, by machine, each with its ask (design 47 G §723, §729)"
}
},
"required": [
"asker",
"ask",
"phase",
"at"
]
}
},
{
"name": "version-reserved",
"body": {
@@ -703,6 +745,46 @@
"module",
"fingerprint"
]
},
"Shared": {
"type": "object",
"description": "a run whose result a step took or waits on, asked once for every step that reads it (design 47 G §729, A-469t): for a composition step one per machine composed, `run` the `composition-runs` key and `ask` its run ask's id; for a test step one with no machine, `run` the `test-runs` key, `ask` its build seat ask's id and `asked-by` the step that asked the run, left out for that step itself",
"properties": {
"machine": {
"type": "string",
"description": "the machine composed, for a composition run"
},
"run": {
"type": "string",
"description": "the run's key: in the assigner's composition-runs, or the runner's test-runs"
},
"ask": {
"type": "string",
"description": "the id of the run's ask of the build seat"
},
"asked-by": {
"type": "object",
"description": "the step that asked the run, for a test step reading another's run",
"properties": {
"pipeline": {
"type": "string",
"description": "its pipeline's key"
},
"artifact": {
"type": "string",
"description": "its artifact, <module>:<artifact>"
}
},
"required": [
"pipeline",
"artifact"
]
}
},
"required": [
"run",
"ask"
]
}
},
"form": 2
@@ -20,6 +20,7 @@ export declare const events: {
readonly toolchainAgreed: "toolchain-agreed";
readonly stepEnded: "step-ended";
readonly askTaken: "ask-taken";
readonly stepProgress: "step-progress";
readonly versionReserved: "version-reserved";
};
@@ -43,6 +44,10 @@ export declare function askTakenSubject(ask: string): string;
export declare const askTakenSubjectAll: "mesh.seat.mesh-builds.event.ask-taken.*";
export declare function stepProgressSubject(node: string): string;
export declare const stepProgressSubjectAll: "mesh.seat.mesh-builds.event.step-progress.*";
export declare const versionReservedSubject: "mesh.seat.mesh-builds.event.version-reserved";
export declare const stepSubject: "mesh.seat.mesh-builds.accept.step";
@@ -91,6 +96,26 @@ export interface PackagePublished {
"version": string;
}
/** the step that asked the run, for a test step reading another's run */
export interface SharedAskedBy {
/** its artifact, <module>:<artifact> */
"artifact": string;
/** its pipeline's key */
"pipeline": string;
}
/** a run whose result a step took or waits on, asked once for every step that reads it (design 47 G §729, A-469t): for a composition step one per machine composed, `run` the `composition-runs` key and `ask` its run ask's id; for a test step one with no machine, `run` the `test-runs` key, `ask` its build seat ask's id and `asked-by` the step that asked the run, left out for that step itself */
export interface Shared {
/** the id of the run's ask of the build seat */
"ask": string;
/** the step that asked the run, for a test step reading another's run */
"asked-by"?: SharedAskedBy;
/** the machine composed, for a composition run */
"machine"?: string;
/** the run's key: in the assigner's composition-runs, or the runner's test-runs */
"run": string;
}
/** the build step's end, said by the builder on the node it runs on (design 47 G A-97; ADR 0666 section 21): the runner takes it only from that holder's account, naming the ask and each entry's fingerprint it was asked at */
export interface StepEnded {
/** for a rerun, the caller the runtime proved */
@@ -309,6 +334,18 @@ export interface AskTakenEvent {
"node": string;
}
/** is the body of the event step-progress. */
export interface StepProgressEvent {
"ask": string;
"asker": string;
"at": string;
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
"form"?: number;
"phase": "fetch" | "build" | "run" | "report";
/** the composition runs the step waits on, by machine, each with its ask (design 47 G §723, §729) */
"shared"?: Shared[];
}
/** is the body of the event version-reserved. */
export interface VersionReservedEvent {
"artifact": string;
@@ -20,6 +20,7 @@ export const events = {
toolchainAgreed: "toolchain-agreed",
stepEnded: "step-ended",
askTaken: "ask-taken",
stepProgress: "step-progress",
versionReserved: "version-reserved",
};
@@ -47,6 +48,12 @@ export function askTakenSubject(ask) {
export const askTakenSubjectAll = "mesh.seat.mesh-builds.event.ask-taken.*";
export function stepProgressSubject(node) {
return "mesh.seat.mesh-builds.event.step-progress." + node;
}
export const stepProgressSubjectAll = "mesh.seat.mesh-builds.event.step-progress.*";
export const versionReservedSubject = "mesh.seat.mesh-builds.event.version-reserved";
export const stepSubject = "mesh.seat.mesh-builds.accept.step";