From 5b8fa23a8dc323101a152d82d3f26a9aeb0a0c13 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 13:03:57 +0100 Subject: [PATCH 1/2] watchman: the integration test seeds steps through the runner's stands verb; its findings name the runner's verbs (W1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G-24 §731, §732, §733 (watchman case); A-469p --- .../integration_test.go | 33 ++++++++++++++++++- .../internal/watch/pipelines.go | 2 +- .../internal/watch/steps.go | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go index ae028d0b..68fed8d9 100644 --- a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go +++ b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go @@ -357,6 +357,28 @@ func TestWatchmanWhole(t *testing.T) { // 1135/AC8 until("the step stands again", func() bool { return finding(stepFinding) }) sayStep("step-ended", time.Now().UTC()) until("the step's end clears it", func() bool { return !finding(stepFinding) }) + + // A step the runner's stands named at the start (seeded through the seat verb) and that no progress follows is + // `pipeline-stands`; the approval waiting on a person is owed none. + seeded := func(step string) string { + return watch.FindingKey(watch.ScopeDelivery, watch.StepFindingID(seededPipeline+"/"+step+"/"), watch.KindPipelineStands) + } + until("the seeded composition step with no progress", func() bool { return finding(seeded("composition")) }) + if finding(seeded("approval")) { + t.Error("a step waiting on a person raised pipeline-stands") + } + // A test step whose run's ask ended with no step-ended of its own stands five minutes (here the short bound) after that end. + const runAsk = "run-ask-2" + testStep, _ := json.Marshal(meshpipelinerunner.StepEvent{Pipeline: "main.6.web", Branch: "main", Module: "web", Commit: "c2", + Result: meshpipelinerunner.StepResult{Step: "unit", Artifact: "web:program", Ask: "t-ask", Outcome: meshpipelinerunner.StepResultOutcomeRunning, + Shared: []meshpipelinerunner.Shared{{Run: "r2", Ask: runAsk}}}}) + if _, err := js.Publish(ctx, "mesh.seat.mesh-pipeline-runner.event.step-started.web.main.c2", testStep); err != nil { + t.Fatal(err) + } + sayAsk(t, ctx, js, "step-ended", runAsk) + until("the test step whose run ended with no end of its own", func() bool { + return finding(watch.FindingKey(watch.ScopeDelivery, watch.StepFindingID("main.6.web/unit/web:program"), watch.KindPipelineStands)) + }) // A-274: the finding is said under the watchman's binding finding-events. until("a finding-written under the binding finding-events", func() bool { st, err := js.Stream(ctx, "WATCHMAN_FINDINGS") @@ -631,6 +653,9 @@ const ( testWantsBucket = testAssigner + "_" + meshwants.StateWants ) +// seededPipeline is the pipeline the stand-in runner's stands names. +const seededPipeline = "main.5.web" + // serveCatalogHalf answers the catalog half's first views (design 47 G §614): the gate's one source branch, the stand-in // registered on it, and its trunk revision whose entry claims mesh-module-assigner. func serveCatalogHalf(t *testing.T, nc *nats.Conn) { @@ -643,7 +668,13 @@ func serveCatalogHalf(t *testing.T, nc *nats.Conn) { Entries: []meshcatalog.CatalogEntry{{Module: testAssigner, ManifestDigest: "d1", Manifest: map[string]any{"module": testAssigner, "claims": []any{map[string]any{"name": "mesh-module-assigner", "scope": "mesh"}}}}}} registrations := meshcatalog.RegistrationsAnswer{Registrations: []meshcatalog.Registration{{Module: testAssigner, Version: 1, Branches: []string{"release"}}}} - for subject, handle := range map[string]nats.MsgHandler{"mesh.seat.mesh-catalog.call.revision": respond(revision), + // The runner's stands (design 47 G §731, A-469p), which the watchman seeds its open steps from at its start: a composition step + // waiting on the assigner, a test step reading a run, and an approval waiting on a person. + stands := meshpipelinerunner.StandsAnswer{Stands: []meshpipelinerunner.Wait{ + {Pipeline: seededPipeline, Step: "composition", Ask: "seeded-ask", Module: "web", Branch: "main", Since: time.Now().UTC(), V: 1}, + {Pipeline: seededPipeline, Step: "approval", On: meshpipelinerunner.WaitOnPerson, Module: "web", Branch: "main", Since: time.Now().UTC(), V: 1}}} + for subject, handle := range map[string]nats.MsgHandler{"mesh.seat.mesh-pipeline-runner.call.stands": respond(stands), + "mesh.seat.mesh-catalog.call.revision": respond(revision), "mesh.seat.mesh-catalog.call.registrations": respond(registrations), "mesh.seat.mesh-delivery.call.source": respond(map[string]any{"branches": []string{"release"}})} { for _, s := range []string{subject, subject + ".>"} { sub, err := nc.Subscribe(s, handle) diff --git a/modules/mesh-delivery-watchman/internal/watch/pipelines.go b/modules/mesh-delivery-watchman/internal/watch/pipelines.go index 11faf479..05cb4a7b 100644 --- a/modules/mesh-delivery-watchman/internal/watch/pipelines.go +++ b/modules/mesh-delivery-watchman/internal/watch/pipelines.go @@ -69,7 +69,7 @@ func (w *Watchman) timeHead(branch string) { Headline: "A change has started no pipeline", Explanation: "The head of the watched branch " + branch + " (source revision " + fmt.Sprint(h.revision) + ") moved " + HeadBound.String() + " ago or more and the pipeline runner has said no pipeline started for it.", - Needs: "the runner to start the pipeline (its pipeline_stands and list tools say where it is)"} + Needs: "the runner to start the pipeline (its verbs mesh-pipeline-runner.stands and mesh-pipeline-runner.list say where it is)"} left := HeadBound - w.now().Sub(h.at) if left > 0 { w.signal(headRow, id, left, signalDue{Do: dueFind, Finding: f}) diff --git a/modules/mesh-delivery-watchman/internal/watch/steps.go b/modules/mesh-delivery-watchman/internal/watch/steps.go index 9b9d0ee6..27c3be1d 100644 --- a/modules/mesh-delivery-watchman/internal/watch/steps.go +++ b/modules/mesh-delivery-watchman/internal/watch/steps.go @@ -190,7 +190,7 @@ func (w *Watchman) timeStep(key string) { Headline: "A pipeline step has stopped saying it lives", Explanation: "The step " + name + " started and has not ended, and neither it nor the run it reads has said its progress for " + w.progressBound.String() + " or more" + last + ".", - Needs: "the part that runs it to say its progress, or the step ended (the runner's pipeline_stands and runner_cancel tools)"} + Needs: "the part that runs it to say its progress, or the step ended (the runner's verbs mesh-pipeline-runner.stands and mesh-pipeline-runner.cancel)"} if left := w.progressBound - w.now().Sub(s.at); left > 0 { w.signal(stepRow, id, left, signalDue{Do: dueFind, Finding: f}) return From 16cb874cccf65a1db317590d989b7540a2c39fe7 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 13:10:25 +0100 Subject: [PATCH 2/2] watchman: the integration test proves the end of a run's ask begins a test step's clock again (W1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G-24 §732, §733 (watchman case) --- .../cmd/mesh-delivery-watchman/integration_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go index 68fed8d9..bab80b58 100644 --- a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go +++ b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/integration_test.go @@ -369,16 +369,18 @@ func TestWatchmanWhole(t *testing.T) { // 1135/AC8 } // A test step whose run's ask ended with no step-ended of its own stands five minutes (here the short bound) after that end. const runAsk = "run-ask-2" - testStep, _ := json.Marshal(meshpipelinerunner.StepEvent{Pipeline: "main.6.web", Branch: "main", Module: "web", Commit: "c2", + old := time.Now().UTC().Add(-time.Minute) // started longer ago than the short bound: it stands at once + testStep, _ := json.Marshal(meshpipelinerunner.StepEvent{Pipeline: "main.6.web", Branch: "main", Module: "web", Commit: "c2", At: &old, Result: meshpipelinerunner.StepResult{Step: "unit", Artifact: "web:program", Ask: "t-ask", Outcome: meshpipelinerunner.StepResultOutcomeRunning, Shared: []meshpipelinerunner.Shared{{Run: "r2", Ask: runAsk}}}}) if _, err := js.Publish(ctx, "mesh.seat.mesh-pipeline-runner.event.step-started.web.main.c2", testStep); err != nil { t.Fatal(err) } + testFinding := watch.FindingKey(watch.ScopeDelivery, watch.StepFindingID("main.6.web/unit/web:program"), watch.KindPipelineStands) + until("the test step standing since its old start", func() bool { return finding(testFinding) }) sayAsk(t, ctx, js, "step-ended", runAsk) - until("the test step whose run ended with no end of its own", func() bool { - return finding(watch.FindingKey(watch.ScopeDelivery, watch.StepFindingID("main.6.web/unit/web:program"), watch.KindPipelineStands)) - }) + until("the end of the run's ask begins the clock again, so the finding is cleared", func() bool { return !finding(testFinding) }) + until("the test step whose run ended with no end of its own, one bound after that end", func() bool { return finding(testFinding) }) // A-274: the finding is said under the watchman's binding finding-events. until("a finding-written under the binding finding-events", func() bool { st, err := js.Stream(ctx, "WATCHMAN_FINDINGS")