diff --git a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go index 4b4d21351..d2f3b6a76 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go @@ -14,13 +14,13 @@ const Seat = "mesh-pipeline-runner" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". -const Form = 6 +const Form = 7 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( - generatedForms = "6" - generatedFieldsDigest = "AcceptAnswer=224df0394653 Accepted=d2b011e5090f AskAgainAnswer=224df0394653 CancelAnswer=a0dcc32b3f57 EndAgainAnswer=a0dcc32b3f57 FailedStep=cd7184342136 Fill=7a76c9ceb157 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 KeptAnswer=dfe0d48bc169 KeptByLevelDigestValue=f06c90f7da7f KeptResult=af5f81f189b7 ListAnswer=284210b3c054 LogEntry=b059967b2ae4 Member=8a103baec01f Mover=5db376275bcf MoverEnded=4b35095f6829 MoverRow=b61f41d131a3 Pipeline=2663792125bf PipelineEnded=523f8fc0fe41 PipelineEndedEvent=cb44007f7173 PipelineEndedPhases=9d1c33ce4cc4 PipelineEndedPhasesBuild=a08d49692a09 PipelineEndedPhasesComposition=a08d49692a09 PipelineEndedPhasesIntegration=a08d49692a09 PipelineEndedPhasesLint=a08d49692a09 PipelineEndedPhasesUnit=a08d49692a09 PipelineEndedPhasesValidate=a08d49692a09 PipelineRow=64600be410e9 PipelineStarted=a3d000f095db PipelineStartedEvent=eaa401af4117 PipelinesByBranchRevisionUnfinishedModuleValue=693580eed498 PipelinesByBranchRevisionValue=693580eed498 PipelinesByBranchRunRunValue=693580eed498 PipelinesByBranchSourcePublishedPackageVersionValue=693580eed498 PipelinesByStepsPipelineMoverValue=94de99db7816 PlaceAnswer=a0dcc32b3f57 PlaceUnfinishedAnswer=ed94ced4513a Published=d9af3024dacc QueueByQueueNextValue=765a2918a728 QueueByRunningPipelineValue=ed94ced4513a QueueByWaitingSequenceValue=99605298ae13 RePinnedEvent=92fd04bfa6d3 RerunAnswer=9b7efd0df344 ReviewAnswer=f397b8965179 RoomEvent=5bd4df78ed84 RunAnswer=96bd45aa2e62 RunStarted=b280617410c3 RunStartedEvent=0767a9358fa3 Shared=c981cf6aa860 SharedAskedBy=c9b30cc4d0d0 ShowAnswer=48b8cecc529a StandsAnswer=0afa3693bf3b StartAnswer=ed94ced4513a StepEndedEvent=799020642c19 StepEvent=64f18c40ed5d StepLogByPipelineValue=ffdde090a101 StepResult=0dac0e15d017 StepStartedEvent=799020642c19 TestCounts=9c1332427159 TestRun=ca5a87f3b6b8 TestRunPackage=a7d30558470d TestRunReader=c9b30cc4d0d0 TestRunsAnswer=7ab81a45ca33 TestRunsDropAnswer=8ee70b35469d ToolchainUsed=43b6d42376fb Wait=21e4ee7a3ef1 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0 Waiting=ed94ced4513a WhyCarriedAnswer=8e2fcea6479f Widening=e2790a307466" + generatedForms = "7" + generatedFieldsDigest = "AcceptAnswer=224df0394653 Accepted=d2b011e5090f AskAgainAnswer=224df0394653 CancelAnswer=a0dcc32b3f57 EndAgainAnswer=a0dcc32b3f57 FailedStep=cd7184342136 Fill=7a76c9ceb157 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 KeptAnswer=dfe0d48bc169 KeptByLevelDigestValue=f06c90f7da7f KeptResult=af5f81f189b7 ListAnswer=284210b3c054 LogEntry=b059967b2ae4 Member=8a103baec01f Mover=5db376275bcf MoverEnded=4b35095f6829 MoverRow=b61f41d131a3 Pipeline=2663792125bf PipelineEnded=523f8fc0fe41 PipelineEndedEvent=cb44007f7173 PipelineEndedPhases=9d1c33ce4cc4 PipelineEndedPhasesBuild=a08d49692a09 PipelineEndedPhasesComposition=a08d49692a09 PipelineEndedPhasesIntegration=a08d49692a09 PipelineEndedPhasesLint=a08d49692a09 PipelineEndedPhasesUnit=a08d49692a09 PipelineEndedPhasesValidate=a08d49692a09 PipelineRow=f58dbdcaf2d4 PipelineStarted=a3d000f095db PipelineStartedEvent=eaa401af4117 PipelinesByBranchRevisionUnfinishedModuleValue=693580eed498 PipelinesByBranchRevisionValue=693580eed498 PipelinesByBranchRunRunValue=693580eed498 PipelinesByBranchSourcePublishedPackageVersionValue=693580eed498 PipelinesByStepsPipelineMoverValue=94de99db7816 PlaceAnswer=a0dcc32b3f57 PlaceUnfinishedAnswer=ed94ced4513a Published=d9af3024dacc QueueByQueueNextValue=765a2918a728 QueueByRunningPipelineValue=ed94ced4513a QueueByWaitingSequenceValue=99605298ae13 RePinnedEvent=92fd04bfa6d3 RerunAnswer=9b7efd0df344 ReviewAnswer=f397b8965179 RoomEvent=5bd4df78ed84 RunAnswer=96bd45aa2e62 RunStarted=b280617410c3 RunStartedEvent=0767a9358fa3 Shared=c981cf6aa860 SharedAskedBy=c9b30cc4d0d0 ShowAnswer=48b8cecc529a StandsAnswer=0afa3693bf3b StartAnswer=ed94ced4513a StepEndedEvent=799020642c19 StepEvent=64f18c40ed5d StepLogByPipelineValue=ffdde090a101 StepResult=0dac0e15d017 StepStartedEvent=799020642c19 TestCounts=9c1332427159 TestRun=ca5a87f3b6b8 TestRunPackage=a7d30558470d TestRunReader=c9b30cc4d0d0 TestRunsAnswer=7ab81a45ca33 TestRunsDropAnswer=8ee70b35469d ToolchainUsed=43b6d42376fb Wait=21e4ee7a3ef1 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0 Waiting=ed94ced4513a WhyCarriedAnswer=8e2fcea6479f Widening=e2790a307466" ) const ( @@ -73,7 +73,7 @@ func VerbDescription(verb string) string { case VerbShow: return "One pipeline: naming a mover, its steps alone; with no mover, each mover's row (its module, outcome and failed step), never every step of every mover, or the steps of any mover the step and state filters hold; and its step log, with the stores' fill (design 47 H2 §789, H-A-376). Reads only." case VerbList: - return "The pipelines and runs of a module, a branch or a commit, newest first: by default one short row per pipeline, the newest 20 (its key, call, start, end, outcome, movers' count and first failed or could-not-run step with its module and why); the whole pipelines, each record with its movers and steps counted, never its steps (show gives those), only with full and a limit (design 47 H2 H-A-376). Reads only." + return "The pipelines and runs of a module, a branch or a commit, newest first: by default one short row per pipeline, the newest 20 (its key, call, source, revision, start, end, outcome, movers' count, its steps counted per outcome and first failed or could-not-run step with its module and why); the whole pipelines, each record with its movers and steps counted, never its steps (show gives those), only with full and a limit (design 47 H2 H-A-376, H-A-467). Reads only." case VerbStands: return "What stands still, and since when: each step not ended and each wait held. Reads only." case VerbWhyCarried: @@ -879,7 +879,7 @@ const ( PipelineEndedOutcomeCancelled = "cancelled" ) -// PipelineRow is one pipeline in list's short form (design 47 H2 H-A-376). +// PipelineRow is one pipeline in list's short form, with its source, revision and its steps counted per outcome (design 47 H2 H-A-376, H-A-467). type PipelineRow struct { // the merge call whose source revision the take-in took in Call string `json:"call,omitempty"` @@ -889,8 +889,14 @@ type PipelineRow struct { MoverCount int64 `json:"mover-count"` Outcome string `json:"outcome"` // the pipeline's key - Pipeline string `json:"pipeline"` - Started *time.Time `json:"started,omitempty"` + Pipeline string `json:"pipeline"` + // the catalog graph revision of the branch the pipeline runs for (design 47 H2 H-A-467) + Revision int64 `json:"revision,omitempty"` + // the source revision of the watched branch the pipeline runs for, its key (design 47 H2 H-A-467) + Source int64 `json:"source,omitempty"` + Started *time.Time `json:"started,omitempty"` + // how many of the pipeline's steps hold each outcome, by the step's outcome (design 47 H2 H-A-467) + Steps map[string]int64 `json:"steps,omitempty"` } // The values of PipelineRow's outcome. diff --git a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json index 7c49d7d1c..1108dbd64 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json @@ -171,7 +171,7 @@ }, { "name": "list", - "description": "The pipelines and runs of a module, a branch or a commit, newest first: by default one short row per pipeline, the newest 20 (its key, call, start, end, outcome, movers' count and first failed or could-not-run step with its module and why); the whole pipelines, each record with its movers and steps counted, never its steps (show gives those), only with full and a limit (design 47 H2 H-A-376). Reads only.", + "description": "The pipelines and runs of a module, a branch or a commit, newest first: by default one short row per pipeline, the newest 20 (its key, call, source, revision, start, end, outcome, movers' count, its steps counted per outcome and first failed or could-not-run step with its module and why); the whole pipelines, each record with its movers and steps counted, never its steps (show gives those), only with full and a limit (design 47 H2 H-A-376, H-A-467). Reads only.", "input": { "type": "object", "properties": { @@ -2275,6 +2275,14 @@ "type": "string", "description": "the merge call whose source revision the take-in took in" }, + "source": { + "type": "integer", + "description": "the source revision of the watched branch the pipeline runs for, its key (design 47 H2 H-A-467)" + }, + "revision": { + "type": "integer", + "description": "the catalog graph revision of the branch the pipeline runs for (design 47 H2 H-A-467)" + }, "started": { "type": "string", "format": "date-time" @@ -2301,9 +2309,16 @@ }, "failed": { "$ref": "#/defs/FailedStep" + }, + "steps": { + "type": "object", + "additionalProperties": { + "type": "integer" + }, + "description": "how many of the pipeline's steps hold each outcome, by the step's outcome (design 47 H2 H-A-467)" } }, - "description": "one pipeline in list's short form (design 47 H2 H-A-376)", + "description": "one pipeline in list's short form, with its source, revision and its steps counted per outcome (design 47 H2 H-A-376, H-A-467)", "required": [ "pipeline", "outcome", @@ -2338,5 +2353,5 @@ ] } }, - "form": 6 + "form": 7 } diff --git a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts index 9a8f438e6..4e280f950 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts @@ -420,7 +420,7 @@ export interface PipelineEnded { "why"?: string; } -/** one pipeline in list's short form (design 47 H2 H-A-376) */ +/** one pipeline in list's short form, with its source, revision and its steps counted per outcome (design 47 H2 H-A-376, H-A-467) */ export interface PipelineRow { /** the merge call whose source revision the take-in took in */ "call"?: string; @@ -431,7 +431,13 @@ export interface PipelineRow { "outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled"; /** the pipeline's key */ "pipeline": string; + /** the catalog graph revision of the branch the pipeline runs for (design 47 H2 H-A-467) */ + "revision"?: number; + /** the source revision of the watched branch the pipeline runs for, its key (design 47 H2 H-A-467) */ + "source"?: number; "started"?: string; + /** how many of the pipeline's steps hold each outcome, by the step's outcome (design 47 H2 H-A-467) */ + "steps"?: Record; } /** a pipeline's start, said at its write, a waiting one's too (design 47 H §746, H-A-52) */ diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/read.go b/modules/mesh-delivery-pipeline/internal/pipeline/read.go index 0dc31a785..2699dcf43 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/read.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/read.go @@ -286,12 +286,27 @@ func (r Reads) List(in seat.ListInput) (seat.ListAnswer, error) { } rows := make([]seat.PipelineRow, 0, len(out)) for _, p := range out { - rows = append(rows, seat.PipelineRow{Pipeline: p.Pipeline, Call: p.Call, Started: p.Started, Ended: p.Ended, Outcome: p.Outcome, - MoverCount: p.MoverCount, Failed: firstFailed(steps[p.Pipeline])}) + // A row carries its source, its revision and its steps counted per outcome (design 47 H2 H-A-467): a page's list is + // one read of the short form. + rows = append(rows, seat.PipelineRow{Pipeline: p.Pipeline, Call: p.Call, Source: p.Source, Revision: p.Revision, + Started: p.Started, Ended: p.Ended, Outcome: p.Outcome, MoverCount: p.MoverCount, Steps: stepCounts(steps[p.Pipeline]), + Failed: firstFailed(steps[p.Pipeline])}) } return seat.ListAnswer{Rows: rows}, nil } +// stepCounts is how many of steps hold each outcome (design 47 H2 H-A-467), nil for none. +func stepCounts(steps []seat.StepResult) map[string]int64 { + if len(steps) == 0 { + return nil + } + out := map[string]int64{} + for _, s := range steps { + out[s.Outcome]++ + } + return out +} + // Stands is every step that has started and not ended, with what it waits on and since when (§75, §83): the watchman // seeds its open waits from it. func (r Reads) Stands() (seat.StandsAnswer, error) { diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/read_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/read_test.go index bea62fc46..93d44a278 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/read_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/read_test.go @@ -67,7 +67,7 @@ func TestReads(t *testing.T) { Step: seat.StepResultStepApproval, Status: "required", Outcome: seat.StepResultOutcomeWaiting, On: seat.WaitOnPerson, Started: &t2}}, Unlogged: []seat.LogEntry{{Pipeline: "next.8", Module: "delta", Step: seat.StepResultStepBuild, What: seat.LogEntryWhatEnded, At: t1}}}) // A pipeline that failed: list's row names its first failed step (design 47 H2 H-A-376). - put(t, pipes, "gone.2", seat.Pipeline{Pipeline: "gone.2", Branch: "gone", Call: "call-2", Outcome: seat.PipelineOutcomeFailed, Started: &t0, Ended: &t1, + put(t, pipes, "gone.2", seat.Pipeline{Pipeline: "gone.2", Branch: "gone", Call: "call-2", Source: 2, Revision: 5, Outcome: seat.PipelineOutcomeFailed, Started: &t0, Ended: &t1, Movers: []seat.Mover{{Module: "zeta", Commit: "g2"}}, Steps: []seat.StepResult{ {Module: "zeta", Step: seat.StepResultStepLint, Artifact: "zeta:program", Status: "optional", Outcome: seat.StepResultOutcomeFailed}, {Module: "zeta", Step: seat.StepResultStepUnit, Artifact: "zeta:program", Status: "required", Outcome: seat.StepResultOutcomeCouldNotRun, Why: "its node lacks node-build-node"}}}) @@ -150,13 +150,19 @@ func TestReads(t *testing.T) { a, err := r.List(seat.ListInput{Branch: "main", Limit: 1}) return names(a.Rows), err }, "main.7.gamma"}, - // Design 47 H2 H-A-376: a row is the pipeline's key, call, start, end, outcome, movers' count and first failed step; + // Design 47 H2 H-A-376, H-A-467: a row is the pipeline's key, call, source, revision, start, end, outcome, movers' count, + // its steps per outcome and first failed step; // the whole pipelines are answered only with full and a limit; with no limit the rows are the newest 20. {"list's row of a failed pipeline", func() (string, error) { a, err := r.List(seat.ListInput{Branch: "gone"}) raw, _ := json.Marshal(a.Rows) return fmt.Sprint(string(raw), " ", len(a.Pipelines)), err - }, `[{"call":"call-2","ended":"2026-11-11T10:01:00Z","failed":{"artifact":"zeta:program","module":"zeta","outcome":"could not run","step":"unit","why":"its node lacks node-build-node"},"mover-count":1,"outcome":"failed","pipeline":"gone.2","started":"2026-11-11T10:00:00Z"}] 0`}, + }, `[{"call":"call-2","ended":"2026-11-11T10:01:00Z","failed":{"artifact":"zeta:program","module":"zeta","outcome":"could not run","step":"unit","why":"its node lacks node-build-node"},"mover-count":1,"outcome":"failed","pipeline":"gone.2","revision":5,"source":2,"started":"2026-11-11T10:00:00Z","steps":{"could not run":1,"failed":1}}] 0`}, + // Design 47 H2 H-A-467: a row counts the steps per outcome, a mover's kept steps (H-A-187) with them. + {"list's row counts its steps per outcome", func() (string, error) { + a, err := r.List(seat.ListInput{Branch: "next"}) + return fmt.Sprint(a.Rows[0].Source, " ", a.Rows[0].Steps), err + }, "8 map[passed:2 waiting:1]"}, {"list's full needs a limit", func() (string, error) { _, err := r.List(seat.ListInput{Full: true}) return "", err