From f9e2dc38d8626858e5ac03fb2b168eeff7d177ed Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 04:51:07 +0100 Subject: [PATCH] W1: the watchman's whole test: a pipeline waiting behind another raises nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The indexer holds a source and takes it in, the runner writes its pipeline waiting its turn (wait-held, step pipeline, on pipelines-at-once) ten minutes back with no step asked, and the pipeline ahead of it stands: no take-in-waits, no pipeline-stands and no head-untaken name the waiting one. Builds: design 47 H §741, §748 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../integration_test.go | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) 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 261d6bfc..03816081 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 @@ -381,6 +381,46 @@ func TestWatchmanWhole(t *testing.T) { // 1135/AC8 sayAsk(t, ctx, js, "step-ended", runAsk) 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) }) + // Design 47 H §741, §748: a pipeline waiting behind another raises nothing. The indexer held its source and took it in, and + // the runner wrote it waiting its turn (wait-held, step pipeline, on pipelines-at-once) ten minutes ago with no step + // asked: no take-in-waits, no pipeline-stands and no head-untaken name it, while the one running ahead of it stands. + const waitingBranch, waitingSource = "main", 11 + waitingPipeline := fmt.Sprintf("%s.%d", waitingBranch, waitingSource) + pending, _ := json.Marshal(meshcatalog.TakeInPending{Branch: waitingBranch, Source: waitingSource, Why: "the catalog store full"}) + taken, _ := json.Marshal(meshcatalog.TakeInTaken{Branch: waitingBranch, Source: waitingSource, Call: "novox/web@7", Revision: 11}) + behind, _ := json.Marshal(meshpipelinerunner.WaitHeldEvent{V: 1, Pipeline: waitingPipeline, Branch: waitingBranch, Source: waitingSource, + Step: "pipeline", On: meshpipelinerunner.WaitOnPipelinesAtOnce, Since: time.Now().UTC().Add(-10 * time.Minute)}) + for _, e := range []struct { + subject string + body []byte + }{ + {"mesh.mod." + watch.IndexerModule + ".event.take-in.pending", pending}, + {"mesh.mod." + watch.IndexerModule + ".event.take-in.taken", taken}, + {meshpipelinerunner.SubjectWaitHeld(waitingBranch, fmt.Sprint(waitingSource)), behind}, + } { + if _, err := js.Publish(ctx, e.subject, e.body); err != nil { + t.Fatal(err) + } + } + // The pipeline running ahead of it: its step, heard after the waiting one's events, stands at once. + ahead := time.Now().UTC().Add(-6 * time.Minute) + aheadStep, _ := json.Marshal(meshpipelinerunner.StepEvent{Pipeline: "main.10", Branch: "main", Module: "web", Commit: "c10", At: &ahead, + Result: meshpipelinerunner.StepResult{Step: "composition", Ask: "ahead-ask", Outcome: meshpipelinerunner.StepResultOutcomeRunning}}) + if _, err := js.Publish(ctx, "mesh.seat.mesh-pipeline-runner.event.step-started.web.main.c10", aheadStep); err != nil { + t.Fatal(err) + } + until("the pipeline running ahead stands", func() bool { + return finding(watch.FindingKey(watch.ScopeDelivery, watch.StepFindingID("main.10/composition/"), watch.KindPipelineStands)) + }) + keys, err := kvs[watchmanModule+"_findings"].Keys(ctx) + if err != nil { + t.Fatal(err) + } + for _, k := range keys { + if strings.Contains(k, "main_11") || strings.Contains(k, waitingPipeline) || strings.Contains(k, watch.KindTakeInWaits) { + t.Errorf("the pipeline waiting behind another raised %s", k) + } + } // 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")