From cb26645614e1178cecd85e9ef34be3cf28a389ad Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 23:05:08 +0100 Subject: [PATCH] Design 47 H1: the build step's end reports the pins it was built with (H-A-207) A test step held for an entry's empty pin had nothing to run with once the build passed: the builder took the pin from the registry and kept it to itself. The seat mesh-builds' step end gains packages, and the builder sets it from the pins each entry was built with, the registry's included, so the runner asks the held steps with what the build was built against. The seat's definition changes: its Go and TypeScript contracts are generated again. Builds: design 47 H H-A-207 --- .../internal/build/step.go | 19 ++++++++++++++++--- .../internal/build/step_test.go | 4 ++++ .../go/seats/meshbuilds/contract.go | 8 +++++--- .../seats/mesh-builds/seat.json | 7 +++++++ .../ts/seats/meshbuilds/index.d.ts | 2 ++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/modules/mesh-delivery-builder/internal/build/step.go b/modules/mesh-delivery-builder/internal/build/step.go index 09687285..cfff2cac 100644 --- a/modules/mesh-delivery-builder/internal/build/step.go +++ b/modules/mesh-delivery-builder/internal/build/step.go @@ -41,7 +41,18 @@ func (b *Builder) BuildStep(ctx context.Context, run meshbuilds.StepRun) meshbui } var failed []string for _, e := range run.Entries { - outcome, said := b.buildEntry(ctx, e) + var pins map[string]string + outcome, said := b.buildEntry(ctx, e, &pins) + // The end reports the pins each entry was built with, so the runner asks its held test steps with them (H-A-207). + for path, version := range pins { + if version == "" { + continue + } + if end.Packages == nil { + end.Packages = map[string]string{} + } + end.Packages[path] = version + } switch outcome { case meshbuilds.StepEndedOutcomeCouldNotRun: return finish(outcome, said) @@ -55,8 +66,9 @@ func (b *Builder) BuildStep(ctx context.Context, run meshbuilds.StepRun) meshbui return finish(meshbuilds.StepEndedOutcomePassed, "") } -// buildEntry builds one entry at its fingerprint and waits for its end. -func (b *Builder) buildEntry(ctx context.Context, e meshbuilds.BuildEntry) (outcome, said string) { +// buildEntry builds one entry at its fingerprint and waits for its end; pins is set to the pins it is built with, the +// entry's own and those the registry gave a package the entry named with none (H-A-207). +func (b *Builder) buildEntry(ctx context.Context, e meshbuilds.BuildEntry, pins *map[string]string) (outcome, said string) { entry, err := b.StepEntry(ctx, e.Fingerprint) if err != nil { return meshbuilds.StepEndedOutcomeCouldNotRun, fmt.Sprintf("the entry %s at %s cannot be read: %v", e.Module, e.Fingerprint, err) @@ -70,6 +82,7 @@ func (b *Builder) buildEntry(ctx context.Context, e meshbuilds.BuildEntry) (outc return outcome, said } entry.Packages = pinned + *pins = pinned key, err := builds.BuilderBuildKey(entry.Module, entry.Fp) if err != nil { return meshbuilds.StepEndedOutcomeCouldNotRun, err.Error() diff --git a/modules/mesh-delivery-builder/internal/build/step_test.go b/modules/mesh-delivery-builder/internal/build/step_test.go index 6a777cf2..08bbbedd 100644 --- a/modules/mesh-delivery-builder/internal/build/step_test.go +++ b/modules/mesh-delivery-builder/internal/build/step_test.go @@ -189,6 +189,10 @@ func aPackageWithNoPinWaitsForItsRelease(t *testing.T) { !reflect.DeepEqual(asks[0].Packages, buildstep.PackageVersions{unpinnedX: "v0.1.3", "git.novox.be/novox/mesh-sdk/go": "v0.1.20"}) { t.Errorf("end = %+v, asks %+v; want passed, built with x at v0.1.3", end, asks) } + // The end reports the pins the build was built with, the one the publish gave included (H-A-207). + if !reflect.DeepEqual(end.Packages, map[string]string{unpinnedX: "v0.1.3", "git.novox.be/novox/mesh-sdk/go": "v0.1.20"}) { + t.Errorf("the end reports the pins %v; want the ones it was built with", end.Packages) + } } func aPackageWithNoReleaseFailsPastItsBound(t *testing.T) { diff --git a/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go b/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go index 836f14e0..4cc3285b 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go @@ -114,9 +114,11 @@ type StepEnded struct { // the node the builder ran it on, as in the subject Node string `json:"node"` // never passed for a build that built nothing - Outcome string `json:"outcome"` - Pipeline string `json:"pipeline"` - Rerun bool `json:"rerun,omitempty"` + Outcome string `json:"outcome"` + // the pins the step's entries were built with, each mesh package's version by its module path, the ones the builder took from the registry for a package the entry named with none included; the runner asks the entry's held test steps with them (H-A-207) + Packages map[string]string `json:"packages,omitempty"` + Pipeline string `json:"pipeline"` + Rerun bool `json:"rerun,omitempty"` // why it failed or could not run: the entry not built, the part not heard Said string `json:"said,omitempty"` Started *time.Time `json:"started,omitempty"` diff --git a/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json b/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json index d10eec4f..fc3d717d 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json @@ -363,6 +363,13 @@ "$ref": "#/defs/BuildEntry" }, "description": "each entry the step built, by module and fingerprint" + }, + "packages": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "the pins the step's entries were built with, each mesh package's version by its module path, the ones the builder took from the registry for a package the entry named with none included; the runner asks the entry's held test steps with them (H-A-207)" } }, "required": [ diff --git a/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts index d142d6d9..947f2e52 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts @@ -89,6 +89,8 @@ export interface StepEnded { "node": string; /** never passed for a build that built nothing */ "outcome": "passed" | "failed" | "nothing to run" | "could not run"; + /** the pins the step's entries were built with, each mesh package's version by its module path, the ones the builder took from the registry for a package the entry named with none included; the runner asks the entry's held test steps with them (H-A-207) */ + "packages"?: Record; "pipeline": string; "rerun"?: boolean; /** why it failed or could not run: the entry not built, the part not heard */