From 6457cf1eba9d8139d29c51b471e35093194f0fe1 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 10:37:39 +0100 Subject: [PATCH] Join 11: the indexer reads a validation's answer with StepEnded.ReadOutput (B5g6 piece 2b) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The validation run's answer is read from the step's end through steprun's ReadOutput, whole or from the build seat's output object, and the indexer invokes seat:node-build-go.output for it (A-254); the patch B5g6 left for the join, applied on the merged heads. Builds: design 47 G §712, §713; lead answers A-254, A-268 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-delivery-indexer/integration_test.go | 5 ++-- .../cmd/mesh-delivery-indexer/main.go | 4 +++- .../internal/index/candidates.go | 7 +++--- .../internal/index/pending.go | 2 +- .../internal/index/pending_test.go | 2 +- .../internal/index/validation_wait.go | 23 +++++-------------- .../internal/index/validation_wait_test.go | 4 ++-- .../mesh-delivery-indexer/manifest_test.go | 1 + modules/mesh-delivery-indexer/module.json | 1 + 9 files changed, 21 insertions(+), 28 deletions(-) diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/integration_test.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/integration_test.go index c8cbd77a..0f957ff1 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/integration_test.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/integration_test.go @@ -480,7 +480,7 @@ func (s *standIn) asked() []sdkstep.StepAsk { } // standInBuildSeat keeps the seat's check queue as a stream and hears the indexer's asks on it (accept.check.indexer): each is -// ended at once with step-ended on the seat's family, its answer inline (A-254) the manifest validator's verdict over both cases, +// ended at once with step-ended on the seat's family, its answer inline (A-254), the program's last line: the manifest validator's verdict over both cases, // the change case refusing the manifest refusing names for the job's commit. func standInBuildSeat(t *testing.T, ctx context.Context, js jetstream.JetStream, refusing *sync.Map) *standIn { t.Helper() @@ -513,9 +513,8 @@ func standInBuildSeat(t *testing.T, ctx context.Context, js jetstream.JetStream, change.Manifests[module.(string)] = composer.ManifestRead{Refused: "the stand-in's problem"} } verdict, _ := json.Marshal(composer.Verdict{V: 1, Cases: []composer.CaseVerdict{change, {Name: judge.TrunkCase, Manifests: map[string]composer.ManifestRead{}}}}) - answer, _ := json.Marshal(sdkstep.RunAnswer{Built: true, Exit: 0, Output: verdict}) end, _ := json.Marshal(sdkstep.StepEnded{V: 1, ID: a.ID, Ask: a.ID, Asker: index.ValidationAsker, Node: "n1", Outcome: sdkstep.OutcomePassed, - Output: string(answer), At: time.Now().UTC()}) + Output: string(verdict), At: time.Now().UTC()}) if _, err := js.Publish(ctx, nodebuildgo.SubjectStepEnded("n1"), end); err != nil { t.Errorf("the stand-in build seat could not say step-ended: %v", err) } diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go index 42cfc2c5..0c37ff93 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go @@ -479,7 +479,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro Pending: awaitedStore{b: process.AwaitBucket(ctx, js, conn, index.PendingBucket, "no merge is held for the indexer its revision names: each is taken in at once", logger.Printf)}, SayTakeIn: sayTakeIn(js, cred), // The validation's run ask (design 47 G §713, A-247, A-248), put under the indexer's own asker. - ValidationAsks: buildrun.Asker{Name: index.ValidationAsker, Publisher: buildrun.JetStreamAsks{JS: js}}} + ValidationAsks: buildrun.Asker{Name: index.ValidationAsker, Publisher: buildrun.JetStreamAsks{JS: js}}, + // The build seat's verb output, for a validation's answer kept as an object (A-254). + AskVerb: calls.Call} // The registrations and the changes that wait for their warrant (design 47 G §2, §667): their states are bound when they // appear; a warrant is heard on the router's decided event for this module, below. registry := newRegistry(js, conn, cred, calls.Call, diff --git a/modules/mesh-delivery-indexer/internal/index/candidates.go b/modules/mesh-delivery-indexer/internal/index/candidates.go index f33619f1..376a350c 100644 --- a/modules/mesh-delivery-indexer/internal/index/candidates.go +++ b/modules/mesh-delivery-indexer/internal/index/candidates.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-sdk/go/stateobjects" "reflect" "slices" @@ -225,9 +226,9 @@ type Indexer struct { // ValidationAsks puts the validation's run ask (design 47 G §713, A-247: buildrun.Asker, named as the indexer's asker, // A-248); nil validates nothing, and a revision is taken in as before. ValidationAsks ValidationAsks - // ReadStepOutput reads a step-ended's output object, where the build seat keeps an answer too large for the event - // (A-247); nil reads none, and such an answer could not validate. - ReadStepOutput func(ctx context.Context, object string) ([]byte, error) + // AskVerb asks a seat verb as the runtime calls it: the build seat's verb output, for a run's answer the seat keeps as an + // object (design 47 G A-254, buildstep.StepEnded.ReadOutput); nil reads none, and such an answer could not validate. + AskVerb buildstep.AskVerb // Runs is the state runs: the runs on request the indexer holds a candidate for (runcandidates.go, A-174); nil keeps none. Runs Store runMu sync.Mutex // one run event at a time (runcandidates.go) diff --git a/modules/mesh-delivery-indexer/internal/index/pending.go b/modules/mesh-delivery-indexer/internal/index/pending.go index 22ecc65b..526f52b0 100644 --- a/modules/mesh-delivery-indexer/internal/index/pending.go +++ b/modules/mesh-delivery-indexer/internal/index/pending.go @@ -920,7 +920,7 @@ func (ix *Indexer) dry() *dryRun { x := &Indexer{Manifests: ix.Manifests, Packages: ix.Packages, JudgeID: ix.JudgeID, Files: ix.Files, GoSum: ix.GoSum, GoMod: ix.GoMod, Now: ix.Now, Builds: ix.Builds, Named: ix.Named, Trunk: ix.Trunk, Read: ix.Read, Contains: ix.Contains, ReadOpen: nil, OwnBuild: nil, Message: ix.Message, SayRefused: nil, SayAccepted: nil, SayTakeIn: nil, Pending: nil, - ValidationAsks: nil, ReadStepOutput: nil, // a dry run asks no validation (§713) + ValidationAsks: nil, AskVerb: nil, // a dry run asks no validation (§713) // The registry milestone's fields: what a take-in would write on the bus stays out of a dry run, so the states of the // requirements, findings, seat definitions, holds and their bounds are not overlaid, nothing is said, and no hold is // weighed (Holds and Counted nil hold nothing); ReadFile only reads. diff --git a/modules/mesh-delivery-indexer/internal/index/pending_test.go b/modules/mesh-delivery-indexer/internal/index/pending_test.go index 04c22a84..f894d343 100644 --- a/modules/mesh-delivery-indexer/internal/index/pending_test.go +++ b/modules/mesh-delivery-indexer/internal/index/pending_test.go @@ -1131,7 +1131,7 @@ func TestTakeIn(t *testing.T) { // 1585/T3-T13 (ADR 0633) for _, f := range []string{"Store", "Modules", "Manifests", "Predefined", "ConfigCandidates", "Taken", "Verdicts", "OldSections", "Unjudged", "JudgeID", "SayRefused", "SayAccepted", "Packages", "Graph", "Files", "GoSum", "GoMod", "Now", "Builds", "Named", "Trunk", "Read", "Contains", "Logf", "ReadOpen", "OwnBuild", "Message", "Pending", "SayTakeIn", - "Requirements", "Findings", "SeatDefinitions", "ReadFile", "SaySeatDefinition", "Runs", "OwnBuildState", "Heard", "Placement", "RunningWhole", "Revisions", "SayCatalogRevision", "SayFill", "EntryIndex", "NamedSets", "Registry", "SeedModules", "Versions", "SayVersionReleased", "SayVersionsFilled", "Inputs", "InputObjects", "BuildEdges", "Pins", "PinsPending", "ValidationAsks", "ReadStepOutput"} { + "Requirements", "Findings", "SeatDefinitions", "ReadFile", "SaySeatDefinition", "Runs", "OwnBuildState", "Heard", "Placement", "RunningWhole", "Revisions", "SayCatalogRevision", "SayFill", "EntryIndex", "NamedSets", "Registry", "SeedModules", "Versions", "SayVersionReleased", "SayVersionsFilled", "Inputs", "InputObjects", "BuildEdges", "Pins", "PinsPending", "ValidationAsks", "AskVerb"} { named[f] = true } ty := reflect.TypeOf(Indexer{}) diff --git a/modules/mesh-delivery-indexer/internal/index/validation_wait.go b/modules/mesh-delivery-indexer/internal/index/validation_wait.go index 5e9c7f1e..ec052ce4 100644 --- a/modules/mesh-delivery-indexer/internal/index/validation_wait.go +++ b/modules/mesh-delivery-indexer/internal/index/validation_wait.go @@ -229,25 +229,14 @@ func (ix *Indexer) validationAnswer(ctx context.Context, ready []PendingEntry, e if e.Outcome != buildstep.OutcomePassed { return "", strings.TrimSpace(e.Outcome + ": " + e.Said) } - out := []byte(e.Output) - if len(out) == 0 && e.OutputObject != "" { - if ix.ReadStepOutput == nil { - return "", "the answer is in the output object " + e.OutputObject + ", which this indexer does not read" - } - var err error - if out, err = ix.ReadStepOutput(ctx, e.OutputObject); err != nil { - return "", "the output object " + e.OutputObject + " could not be read: " + err.Error() - } - } - var answer buildstep.RunAnswer - if err := json.Unmarshal(out, &answer); err != nil { - return "", fmt.Sprintf("the run's answer is no run answer: %v", err) - } - if answer.Exit != 0 { - return "", fmt.Sprintf("the manifest validator exited %d: %s", answer.Exit, answer.Said) + // The answer is the program's last line of standard output, inline or kept by the seat as an object (A-254); a program that + // exited other than 0 ended the step failed, read above. + out, err := e.ReadOutput(buildstep.AskGo, ix.AskVerb) + if err != nil { + return "", "the run's answer could not be read: " + err.Error() } var verdict composer.Verdict - if err := json.Unmarshal(answer.Output, &verdict); err != nil { + if err := json.Unmarshal(out, &verdict); err != nil { return "", fmt.Sprintf("%v: the manifest validator's output is no verdict: %v", errNoValidationAnswer, err) } req, _, err := ix.validationRequest(ctx, branchOfRevision(ready), ready) diff --git a/modules/mesh-delivery-indexer/internal/index/validation_wait_test.go b/modules/mesh-delivery-indexer/internal/index/validation_wait_test.go index bc749e59..9588293b 100644 --- a/modules/mesh-delivery-indexer/internal/index/validation_wait_test.go +++ b/modules/mesh-delivery-indexer/internal/index/validation_wait_test.go @@ -63,8 +63,8 @@ func TestAPendingRevisionWaitsForItsValidation(t *testing.T) { out, _ := json.Marshal(answer) return buildstep.StepEnded{Ask: ask, ID: ask, Asker: ValidationAsker, Node: "ace", Outcome: outcome, Said: said, Output: string(out)} } - verdict, _ := json.Marshal(composer.Verdict{Cases: []composer.CaseVerdict{{Name: "change"}, {Name: "trunk"}}}) - accepted := buildstep.RunAnswer{Built: true, Exit: 0, Output: verdict} + // The answer is the manifest validator's verdict itself, the program's last line (A-254). + accepted := composer.Verdict{Cases: []composer.CaseVerdict{{Name: "change"}, {Name: "trunk"}}} // The end of a replaced ask is dropped, written in the journal. if err := b.ix.HearValidationEnded(ctx, end("mvl0frv18d1950", buildstep.OutcomePassed, "", accepted)); err != nil || len(b.keys()) != 1 || !strings.Contains(b.logs.String(), "is dropped") { t.Fatalf("a replaced ask's end: %v, pending %v", err, b.keys()) diff --git a/modules/mesh-delivery-indexer/manifest_test.go b/modules/mesh-delivery-indexer/manifest_test.go index 677d57e3..0b7c1a29 100644 --- a/modules/mesh-delivery-indexer/manifest_test.go +++ b/modules/mesh-delivery-indexer/manifest_test.go @@ -181,6 +181,7 @@ func TestManifestDeclarations(t *testing.T) { // 1238/AC1, 1444 (reads the build // commit is in another (issue 1900). if want := []string{"seat:git.trees", "seat:git.file", "seat:git.contains", "seat:git.open-pulls", "seat:git.branch", "mesh-delivery-forge-bridge.bridge_merged_message", "seat:node-engine.composition", "seat:mesh-delivery.source", "seat:mesh-module-assigner.assignments", "seat:mesh-module-assigner.placement", "seat:mesh-hand-acts.hand-act", "seat:mesh-watchdogs.presence", "seat:node-build-go.steps", "seat:node-build-go.accept.check", // design 47 G A-231: the validation's run ask (§712) on the check queue + "seat:node-build-go.output", // design 47 G A-254: a validation's answer kept as an object "seat:node-build-node.steps", "seat:node-build-image.steps", "mesh-delivery-builder.builder_versions"}; !reflect.DeepEqual(m.Invokes, want) { t.Errorf("invokes = %v, want %v", m.Invokes, want) } diff --git a/modules/mesh-delivery-indexer/module.json b/modules/mesh-delivery-indexer/module.json index 26fdb649..d467259d 100644 --- a/modules/mesh-delivery-indexer/module.json +++ b/modules/mesh-delivery-indexer/module.json @@ -176,6 +176,7 @@ "seat:mesh-watchdogs.presence", "seat:node-build-go.steps", "seat:node-build-go.accept.check", + "seat:node-build-go.output", "seat:node-build-node.steps", "seat:node-build-image.steps", "mesh-delivery-builder.builder_versions"