From f2d3172eacad84c0ef2525d8f3f7e9d02afaa955 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 21:11:59 +0100 Subject: [PATCH] Design 47 H1: the seat mesh-pipeline-runner keeps a mover's steps under its own key, and show names a mover (H-A-187) A pipeline record of 112 or 129 movers exceeded the bus's message limit once its steps were placed (main.26, main.30), so its steps could never be written. The state pipelines gains the key form steps.., one mover's steps, and show takes an optional mover whose steps it answers alone. The seat's definition changes: its Go and TypeScript contracts are generated again. Builds: design 47 H H-A-187 --- .../go/seats/meshpipelinerunner/contract.go | 49 ++++++++++++++++++- .../seats/mesh-pipeline-runner/seat.json | 20 ++++++-- .../ts/seats/meshpipelinerunner/index.d.ts | 13 ++++- .../ts/seats/meshpipelinerunner/index.js | 21 ++++++++ 4 files changed, 98 insertions(+), 5 deletions(-) diff --git a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go index ce60aa65..b5cf079d 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go @@ -276,6 +276,48 @@ func DecodePipelinesByBranchRunRunValue(raw []byte) (PipelinesByBranchRunRunValu return v, nil } +// PipelinesByStepsPipelineMoverKey is the key of one value of the state pipelines under the form "steps..". +func PipelinesByStepsPipelineMoverKey(pipeline, mover string) string { + return "steps." + pipeline + "." + mover +} + +// ParsePipelinesByStepsPipelineMoverKey reads the parts of a key of the form "steps..", in the order of the form; the last result is false for a key of another form. +func ParsePipelinesByStepsPipelineMoverKey(key string) (string, string, bool) { + rest := key + if !strings.HasPrefix(rest, "steps.") { + return "", "", false + } + rest = rest[6:] + v1, after1, found1 := strings.Cut(rest, ".") + if !found1 || v1 == "" { + return "", "", false + } + rest = after1 + if rest == "" { + return "", "", false + } + v3 := rest + rest = "" + if rest != "" { + return "", "", false + } + return v1, v3, true +} + +// DecodePipelinesByStepsPipelineMoverValue reads one value of the state pipelines under the form "steps..", refusing a field PipelinesByStepsPipelineMoverValue does not know and any text after the value. +func DecodePipelinesByStepsPipelineMoverValue(raw []byte) (PipelinesByStepsPipelineMoverValue, error) { + var v PipelinesByStepsPipelineMoverValue + dec := json.NewDecoder(bytes.NewReader(raw)) + dec.DisallowUnknownFields() + if err := dec.Decode(&v); err != nil { + return v, err + } + if dec.More() { + return v, errors.New("text after the value") + } + return v, nil +} + // QueueByQueueNextKey is the key of one value of the state queue under the form "queue.next". func QueueByQueueNextKey() string { return "queue.next" } @@ -637,7 +679,7 @@ type Pipeline struct { // the source revision of the watched branch; the pipeline is keyed by it (ADR 0666 section 9) Source int64 `json:"source"` Started *time.Time `json:"started,omitempty"` - // every mover's steps, each naming its mover, approval last + // every mover's steps, each naming its mover, approval last; in the state pipelines a record's own are empty, each mover's kept under its own key (H-A-187) Steps []StepResult `json:"steps"` // the modules a newer waiting take-in of the same branch took out of the pipeline, written with the movers by compare-and-set; at its placing the runner writes a mover's build-step why from it (design 47 H §748, H-A-107) Superseded []string `json:"superseded,omitempty"` @@ -1026,6 +1068,8 @@ type StartAnswer struct { // ShowInput is what show takes. type ShowInput struct { + // a mover's module: the answer's pipeline then holds that mover's steps alone (H-A-187) + Mover string `json:"mover,omitempty"` // the pipeline's key Pipeline string `json:"pipeline"` } @@ -1314,6 +1358,9 @@ type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline // PipelinesByBranchRunRunValue is one value of the state pipelines under the key .run.. type PipelinesByBranchRunRunValue = Pipeline +// PipelinesByStepsPipelineMoverValue is one value of the state pipelines under the key steps... +type PipelinesByStepsPipelineMoverValue = []StepResult + // QueueByQueueNextValue is one value of the state queue under the key queue.next. type QueueByQueueNextValue = int64 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 7a5c3607..6c16edf2 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json @@ -86,13 +86,17 @@ }, { "name": "show", - "description": "One pipeline whole: its steps, its step log and its outputs, with the stores' fill. Reads only.", + "description": "One pipeline whole: its record with every mover's steps, or one mover's steps alone when it names the mover, its step log and its outputs, with the stores' fill. Reads only.", "input": { "type": "object", "properties": { "pipeline": { "type": "string", "description": "the pipeline's key" + }, + "mover": { + "type": "string", + "description": "a mover's module: the answer's pipeline then holds that mover's steps alone (H-A-187)" } }, "required": [ @@ -771,7 +775,7 @@ "name": "pipelines", "template": "state", "history": 1, - "description": "one key per pipeline, one per take-in, written by compare-and-set on its absence (design 47 H §746, §747)", + "description": "one key per pipeline, one per take-in, written by compare-and-set on its absence (design 47 H §746, §747), and one key per mover of a pipeline holding that mover's steps (H-A-187)", "key-forms": [ { "key": ".", @@ -793,6 +797,16 @@ "$ref": "#/defs/Pipeline" }, "description": "a run on request's pipeline, one per run, its movers the named commits' modules; it delivers nothing (H-A-83)" + }, + { + "key": "steps..", + "value": { + "type": "array", + "items": { + "$ref": "#/defs/StepResult" + } + }, + "description": "one mover's steps in a pipeline, its key the pipeline's and the mover's module escaped as a key's name, written by compare-and-set as the pipeline's record is; the record's own steps stay empty, so a record never grows with the catalog (H-A-187)" } ] }, @@ -1238,7 +1252,7 @@ "items": { "$ref": "#/defs/StepResult" }, - "description": "every mover's steps, each naming its mover, approval last" + "description": "every mover's steps, each naming its mover, approval last; in the state pipelines a record's own are empty, each mover's kept under its own key (H-A-187)" }, "started": { "type": "string", 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 4fb293a0..84486bac 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts @@ -112,6 +112,12 @@ export declare function pipelinesByBranchRunRunKey(branch: string, run: string): /** The parts of a key of the form ".run.", or undefined for a key of another form. */ export declare function parsePipelinesByBranchRunRunKey(_key: string): { branch: string; run: string } | undefined; +/** The key of one value of the state pipelines under the form "steps..". */ +export declare function pipelinesByStepsPipelineMoverKey(pipeline: string, mover: string): string; + +/** The parts of a key of the form "steps..", or undefined for a key of another form. */ +export declare function parsePipelinesByStepsPipelineMoverKey(_key: string): { pipeline: string; mover: string } | undefined; + /** The key of one value of the state queue under the form "queue.next". */ export declare function queueByQueueNextKey(): string; @@ -264,7 +270,7 @@ export interface Pipeline { /** the source revision of the watched branch; the pipeline is keyed by it (ADR 0666 section 9) */ "source": number; "started"?: string; - /** every mover's steps, each naming its mover, approval last */ + /** every mover's steps, each naming its mover, approval last; in the state pipelines a record's own are empty, each mover's kept under its own key (H-A-187) */ "steps": StepResult[]; /** the modules a newer waiting take-in of the same branch took out of the pipeline, written with the movers by compare-and-set; at its placing the runner writes a mover's build-step why from it (design 47 H §748, H-A-107) */ "superseded"?: string[]; @@ -556,6 +562,8 @@ export interface StartAnswer { /** is what show takes. */ export interface ShowInput { + /** a mover's module: the answer's pipeline then holds that mover's steps alone (H-A-187) */ + "mover"?: string; /** the pipeline's key */ "pipeline": string; } @@ -795,6 +803,9 @@ export type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline; /** is one value of the state pipelines under the key .run.. */ export type PipelinesByBranchRunRunValue = Pipeline; +/** is one value of the state pipelines under the key steps... */ +export type PipelinesByStepsPipelineMoverValue = StepResult[]; + /** is one value of the state queue under the key queue.next. */ export type QueueByQueueNextValue = number; diff --git a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js index 32282d84..213a3df3 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js @@ -173,6 +173,27 @@ export function parsePipelinesByBranchRunRunKey(_key) { return { branch, run }; } +/** The key of one value of the state pipelines under the form "steps..". */ +export function pipelinesByStepsPipelineMoverKey(pipeline, mover) { + return "steps." + pipeline + "." + mover; +} + +/** The parts of a key of the form "steps..", or undefined for a key of another form. */ +export function parsePipelinesByStepsPipelineMoverKey(_key) { + let _rest = _key; + if (!_rest.startsWith("steps.")) return undefined; + _rest = _rest.slice(6); + const _at1 = _rest.indexOf("."); + if (_at1 <= 0) return undefined; + const pipeline = _rest.slice(0, _at1); + _rest = _rest.slice(_at1 + 1); + if (_rest === "") return undefined; + const mover = _rest; + _rest = ""; + if (_rest !== "") return undefined; + return { pipeline, mover }; +} + /** The key of one value of the state queue under the form "queue.next". */ export function queueByQueueNextKey() { return "queue.next";