From 396893dcacca1604ee639a88550f4a662399b1dd Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 00:25:58 +0100 Subject: [PATCH] Design 47 H1: the pipeline-runner seat names a pipeline's key and its subjects by revision The seat's key form of a pipeline is ., and its four per-pipeline subjects are said on . (the definition and generated contracts the same as the runner branch's). The indexer pins a revision for the pipeline keyed PipelinesByBranchRevisionKey, and this branch's runner copy follows the renamed generated functions; the wire form is unchanged. Builds: design 47 H H-A-213 (4), H-A-219, H-A-221 --- .../go/seats/meshpipelinerunner/contract.go | 56 +++++++++---------- .../seats/meshpipelinerunner/contract_test.go | 6 +- .../mesh-pipeline-runner/fixtures/states.json | 6 +- .../seats/mesh-pipeline-runner/seat.json | 26 ++++----- .../ts/seats/meshpipelinerunner/index.d.ts | 34 +++++------ .../ts/seats/meshpipelinerunner/index.js | 30 +++++----- .../internal/index/catalog_revisions.go | 2 +- .../internal/pipeline/read.go | 2 +- .../internal/pipeline/start.go | 2 +- .../internal/pipeline/start_test.go | 2 +- 10 files changed, 83 insertions(+), 83 deletions(-) diff --git a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go index 058625fb..8b5f340e 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go @@ -65,9 +65,9 @@ const ( // StreamPipelineStarted is the stream pipeline-started is kept in. const StreamPipelineStarted = "SEAT_mesh-pipeline-runner_pipeline-started" -// SubjectPipelineStarted is where pipeline-started is published, on mesh.seat.mesh-pipeline-runner.event.pipeline-started... -func SubjectPipelineStarted(branch, source string) string { - return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + source +// SubjectPipelineStarted is where pipeline-started is published, on mesh.seat.mesh-pipeline-runner.event.pipeline-started... +func SubjectPipelineStarted(branch, revision string) string { + return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + revision } // SubjectPipelineStartedAll hears every pipeline-started. @@ -76,9 +76,9 @@ const SubjectPipelineStartedAll = "mesh.seat.mesh-pipeline-runner.event.pipeline // StreamPipelineEnded is the stream pipeline-ended is kept in. const StreamPipelineEnded = "SEAT_mesh-pipeline-runner_pipeline-ended" -// SubjectPipelineEnded is where pipeline-ended is published, on mesh.seat.mesh-pipeline-runner.event.pipeline-ended... -func SubjectPipelineEnded(branch, source string) string { - return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + source +// SubjectPipelineEnded is where pipeline-ended is published, on mesh.seat.mesh-pipeline-runner.event.pipeline-ended... +func SubjectPipelineEnded(branch, revision string) string { + return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + revision } // SubjectPipelineEndedAll hears every pipeline-ended. @@ -120,9 +120,9 @@ const SubjectStepEndedAll = "mesh.seat.mesh-pipeline-runner.event.step-ended.*.* // StreamWaitHeld is the stream wait-held is kept in. const StreamWaitHeld = "SEAT_mesh-pipeline-runner_wait-held" -// SubjectWaitHeld is where wait-held is published, on mesh.seat.mesh-pipeline-runner.event.wait-held... -func SubjectWaitHeld(branch, source string) string { - return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + source +// SubjectWaitHeld is where wait-held is published, on mesh.seat.mesh-pipeline-runner.event.wait-held... +func SubjectWaitHeld(branch, revision string) string { + return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + revision } // SubjectWaitHeldAll hears every wait-held. @@ -131,9 +131,9 @@ const SubjectWaitHeldAll = "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*" // StreamWaitEnded is the stream wait-ended is kept in. const StreamWaitEnded = "SEAT_mesh-pipeline-runner_wait-ended" -// SubjectWaitEnded is where wait-ended is published, on mesh.seat.mesh-pipeline-runner.event.wait-ended... -func SubjectWaitEnded(branch, source string) string { - return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + source +// SubjectWaitEnded is where wait-ended is published, on mesh.seat.mesh-pipeline-runner.event.wait-ended... +func SubjectWaitEnded(branch, revision string) string { + return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + revision } // SubjectWaitEndedAll hears every wait-ended. @@ -156,11 +156,11 @@ const ( StateStepOutputs = "step-outputs" ) -// PipelinesByBranchSourceKey is the key of one value of the state pipelines under the form ".". -func PipelinesByBranchSourceKey(branch, source string) string { return branch + "." + source } +// PipelinesByBranchRevisionKey is the key of one value of the state pipelines under the form ".". +func PipelinesByBranchRevisionKey(branch, revision string) string { return branch + "." + revision } -// ParsePipelinesByBranchSourceKey reads the parts of a key of the form ".", in the order of the form; the last result is false for a key of another form. -func ParsePipelinesByBranchSourceKey(key string) (string, string, bool) { +// ParsePipelinesByBranchRevisionKey reads the parts of a key of the form ".", in the order of the form; the last result is false for a key of another form. +func ParsePipelinesByBranchRevisionKey(key string) (string, string, bool) { rest := key v0, after0, found0 := strings.Cut(rest, ".") if !found0 || v0 == "" { @@ -178,9 +178,9 @@ func ParsePipelinesByBranchSourceKey(key string) (string, string, bool) { return v0, v2, true } -// DecodePipelinesByBranchSourceValue reads one value of the state pipelines under the form ".", refusing a field PipelinesByBranchSourceValue does not know and any text after the value. -func DecodePipelinesByBranchSourceValue(raw []byte) (PipelinesByBranchSourceValue, error) { - var v PipelinesByBranchSourceValue +// DecodePipelinesByBranchRevisionValue reads one value of the state pipelines under the form ".", refusing a field PipelinesByBranchRevisionValue does not know and any text after the value. +func DecodePipelinesByBranchRevisionValue(raw []byte) (PipelinesByBranchRevisionValue, error) { + var v PipelinesByBranchRevisionValue dec := json.NewDecoder(bytes.NewReader(raw)) dec.DisallowUnknownFields() if err := dec.Decode(&v); err != nil { @@ -670,7 +670,7 @@ type Pipeline struct { // the modules the pipeline moves, its take-in's entries (design 47 H §746) Movers []Mover `json:"movers"` Outcome string `json:"outcome"` - // the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83) + // the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83) Pipeline string `json:"pipeline"` // for a pipeline a package's publish started, that publish (A-202) Published *Published `json:"published,omitempty"` @@ -720,7 +720,7 @@ type PipelineEnded struct { // per mover its fingerprint, released version, step results and tier, in the delivery order (design 47 H §746, H-A-2) Movers []MoverEnded `json:"movers"` Outcome string `json:"outcome"` - // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) + // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) Pipeline string `json:"pipeline"` // the catalog graph revision of the branch the pipeline runs for Revision int64 `json:"revision,omitempty"` @@ -753,7 +753,7 @@ type PipelineStarted struct { Call string `json:"call,omitempty"` // the pipeline's movers Movers []Mover `json:"movers"` - // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) + // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) Pipeline string `json:"pipeline"` // for a pipeline a package's publish started, that publish (A-202) Published *Published `json:"published,omitempty"` @@ -814,7 +814,7 @@ type StepEvent struct { // the module's build-input fingerprint at the commit Fingerprint string `json:"fingerprint,omitempty"` Module string `json:"module"` - // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) + // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) Pipeline string `json:"pipeline"` Result StepResult `json:"result"` // the catalog graph revision of the branch the pipeline runs for @@ -966,7 +966,7 @@ type ToolchainUsed struct { Version string `json:"version"` } -// Wait is a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72). +// Wait is a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72, H-A-221). type Wait struct { Artifact string `json:"artifact,omitempty"` // the step's own ask, where it has one (design 47 G §731) @@ -983,7 +983,7 @@ type Wait struct { Module string `json:"module,omitempty"` // what the step waits on (design 47 *Health and going back*) On string `json:"on"` - // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) + // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) Pipeline string `json:"pipeline"` // the catalog graph revision of the branch the pipeline runs for Revision int64 `json:"revision,omitempty"` @@ -1024,7 +1024,7 @@ const ( // Waiting is a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72). type Waiting struct { - // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) + // the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) Pipeline string `json:"pipeline"` } @@ -1355,8 +1355,8 @@ type FullEvent = Fill // RoomEvent is the body of the event room. type RoomEvent = Fill -// PipelinesByBranchSourceValue is one value of the state pipelines under the key .. -type PipelinesByBranchSourceValue = Pipeline +// PipelinesByBranchRevisionValue is one value of the state pipelines under the key .. +type PipelinesByBranchRevisionValue = Pipeline // PipelinesByBranchSourcePublishedPackageVersionValue is one value of the state pipelines under the key ..published... type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline diff --git a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract_test.go b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract_test.go index 23b59e9c..4aaa6d53 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract_test.go +++ b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract_test.go @@ -45,7 +45,7 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-pipeline-runner\\.event\\.step-ended\\.[^.*> ]+\\.[^.*> ]+\\.[^.*> ]+$")}, {name: "a take-in's pipeline kept, its steps naming their mover", subject: "", given: "{\"branch\":\"main\",\"call\":\"0123456789abcdef\",\"end-count\":1,\"ended\":\"2026-11-10T10:20:00Z\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"passed\",\"pipeline\":\"main.3589\",\"revision\":12,\"source\":3589,\"started\":\"2026-11-10T10:00:00Z\",\"steps\":[{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"seat\":\"node-build-go\",\"status\":\"required\",\"step\":\"lint\"},{\"artifact\":\"nats:program\",\"carried-from\":\"main.3588\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"outcome\":\"carried\",\"status\":\"required\",\"step\":\"unit\",\"tests\":{\"unit\":42}},{\"artifact\":\"nats:program\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"failed\",\"seat\":\"node-build-go\",\"status\":\"optional\",\"step\":\"integration\",\"tests\":{\"integration\":3},\"why\":\"TestTheBusWhole failed\"},{\"module\":\"nats\",\"outcome\":\"passed\",\"seat\":\"mesh-wants\",\"status\":\"required\",\"step\":\"composition\"},{\"module\":\"nats\",\"outcome\":\"bypassed\",\"status\":\"bypass\",\"step\":\"review\"},{\"module\":\"nats\",\"outcome\":\"passed\",\"status\":\"required\",\"step\":\"approval\"}],\"v\":1}", wire: "{\"branch\":\"main\",\"call\":\"0123456789abcdef\",\"end-count\":1,\"ended\":\"2026-11-10T10:20:00Z\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"passed\",\"pipeline\":\"main.3589\",\"revision\":12,\"source\":3589,\"started\":\"2026-11-10T10:00:00Z\",\"steps\":[{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"seat\":\"node-build-go\",\"status\":\"required\",\"step\":\"lint\"},{\"artifact\":\"nats:program\",\"carried-from\":\"main.3588\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"outcome\":\"carried\",\"status\":\"required\",\"step\":\"unit\",\"tests\":{\"unit\":42}},{\"artifact\":\"nats:program\",\"fingerprint\":\"fp-0123\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"failed\",\"seat\":\"node-build-go\",\"status\":\"optional\",\"step\":\"integration\",\"tests\":{\"integration\":3},\"why\":\"TestTheBusWhole failed\"},{\"module\":\"nats\",\"outcome\":\"passed\",\"seat\":\"mesh-wants\",\"status\":\"required\",\"step\":\"composition\"},{\"module\":\"nats\",\"outcome\":\"bypassed\",\"status\":\"bypass\",\"step\":\"review\"},{\"module\":\"nats\",\"outcome\":\"passed\",\"status\":\"required\",\"step\":\"approval\"}],\"v\":1}", decode: func(b []byte) (any, error) { - var v PipelinesByBranchSourceValue + var v PipelinesByBranchRevisionValue err := json.Unmarshal(b, &v) return v, err }, subjectIs: nil}, @@ -73,13 +73,13 @@ func TestFixtures(t *testing.T) { }, subjectIs: nil}, {name: "a pipeline waiting its turn, its seq given", subject: "", given: "{\"branch\":\"main\",\"call\":\"fedcba9876543210\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0124\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"waiting\",\"pipeline\":\"main.3590\",\"revision\":13,\"seq\":2,\"source\":3590,\"steps\":[],\"v\":1}", wire: "{\"branch\":\"main\",\"call\":\"fedcba9876543210\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0124\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"waiting\",\"pipeline\":\"main.3590\",\"revision\":13,\"seq\":2,\"source\":3590,\"steps\":[],\"v\":1}", decode: func(b []byte) (any, error) { - var v PipelinesByBranchSourceValue + var v PipelinesByBranchRevisionValue err := json.Unmarshal(b, &v) return v, err }, subjectIs: nil}, {name: "a waiting pipeline names the movers a newer take-in took out of it", subject: "", given: "{\"branch\":\"main\",\"call\":\"fedcba9876543210\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0124\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"waiting\",\"pipeline\":\"main.3590\",\"revision\":13,\"seq\":2,\"source\":3590,\"steps\":[],\"superseded\":[\"mesh-config\"],\"v\":1}", wire: "{\"branch\":\"main\",\"call\":\"fedcba9876543210\",\"movers\":[{\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0124\",\"module\":\"nats\",\"repository\":\"mesh-networking\",\"tier\":1}],\"outcome\":\"waiting\",\"pipeline\":\"main.3590\",\"revision\":13,\"seq\":2,\"source\":3590,\"steps\":[],\"superseded\":[\"mesh-config\"],\"v\":1}", decode: func(b []byte) (any, error) { - var v PipelinesByBranchSourceValue + var v PipelinesByBranchRevisionValue err := json.Unmarshal(b, &v) return v, err }, subjectIs: nil}, diff --git a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/fixtures/states.json b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/fixtures/states.json index cb8363f2..9229229f 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/fixtures/states.json +++ b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/fixtures/states.json @@ -1,7 +1,7 @@ [ { "name": "a take-in's pipeline kept, its steps naming their mover", - "of": "state:pipelines/.", + "of": "state:pipelines/.", "given": { "pipeline": "main.3589", "branch": "main", @@ -200,7 +200,7 @@ }, { "name": "a pipeline waiting its turn, its seq given", - "of": "state:pipelines/.", + "of": "state:pipelines/.", "given": { "pipeline": "main.3590", "branch": "main", @@ -224,7 +224,7 @@ }, { "name": "a waiting pipeline names the movers a newer take-in took out of it", - "of": "state:pipelines/.", + "of": "state:pipelines/.", "given": { "pipeline": "main.3590", "branch": "main", 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 5bf14a52..fd84b289 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json @@ -672,7 +672,7 @@ "events": [ { "name": "pipeline-started", - "subject": "pipeline-started..", + "subject": "pipeline-started..", "body": { "$ref": "#/defs/PipelineStarted" }, @@ -683,7 +683,7 @@ }, { "name": "pipeline-ended", - "subject": "pipeline-ended..", + "subject": "pipeline-ended..", "body": { "$ref": "#/defs/PipelineEnded" }, @@ -727,7 +727,7 @@ }, { "name": "wait-held", - "subject": "wait-held..", + "subject": "wait-held..", "body": { "$ref": "#/defs/Wait" }, @@ -738,7 +738,7 @@ }, { "name": "wait-ended", - "subject": "wait-ended..", + "subject": "wait-ended..", "body": { "$ref": "#/defs/Wait" }, @@ -778,11 +778,11 @@ "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": ".", + "key": ".", "value": { "$ref": "#/defs/Pipeline" }, - "description": "a take-in's pipeline" + "description": "a pipeline of one catalog revision, keyed by the revision's number (design 47 H-A-213 (4), H-A-219); one kept from before under its source has the same form" }, { "key": "..published..", @@ -1199,7 +1199,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83)" + "description": "the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83)" }, "branch": { "type": "string", @@ -1313,7 +1313,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" + "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" }, "branch": { "type": "string", @@ -1388,7 +1388,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" + "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" }, "branch": { "type": "string", @@ -1495,7 +1495,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" + "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" }, "module": { "type": "string" @@ -1550,7 +1550,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" + "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" }, "module": { "type": "string", @@ -1635,7 +1635,7 @@ "description": "the run the step waits on, where the runner knows it: a test step's run key and ask (design 47 G §731, A-469v)" } }, - "description": "a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72)", + "description": "a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72, H-A-221)", "required": [ "v", "pipeline", @@ -1978,7 +1978,7 @@ "properties": { "pipeline": { "type": "string", - "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" + "description": "the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)" } }, "description": "a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72)", 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 748152b9..5c11adad 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts @@ -40,13 +40,13 @@ export declare const family: { readonly name: "mesh-pipeline-runner.events"; rea export declare const pipelineStartedStream: "SEAT_mesh-pipeline-runner_pipeline-started"; -export declare function pipelineStartedSubject(branch: string, source: string): string; +export declare function pipelineStartedSubject(branch: string, revision: string): string; export declare const pipelineStartedSubjectAll: "mesh.seat.mesh-pipeline-runner.event.pipeline-started.*.*"; export declare const pipelineEndedStream: "SEAT_mesh-pipeline-runner_pipeline-ended"; -export declare function pipelineEndedSubject(branch: string, source: string): string; +export declare function pipelineEndedSubject(branch: string, revision: string): string; export declare const pipelineEndedSubjectAll: "mesh.seat.mesh-pipeline-runner.event.pipeline-ended.*.*"; @@ -70,13 +70,13 @@ export declare const stepEndedSubjectAll: "mesh.seat.mesh-pipeline-runner.event. export declare const waitHeldStream: "SEAT_mesh-pipeline-runner_wait-held"; -export declare function waitHeldSubject(branch: string, source: string): string; +export declare function waitHeldSubject(branch: string, revision: string): string; export declare const waitHeldSubjectAll: "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*"; export declare const waitEndedStream: "SEAT_mesh-pipeline-runner_wait-ended"; -export declare function waitEndedSubject(branch: string, source: string): string; +export declare function waitEndedSubject(branch: string, revision: string): string; export declare const waitEndedSubjectAll: "mesh.seat.mesh-pipeline-runner.event.wait-ended.*.*"; @@ -94,11 +94,11 @@ export declare const states: { readonly stepOutputs: "step-outputs"; }; -/** The key of one value of the state pipelines under the form ".". */ -export declare function pipelinesByBranchSourceKey(branch: string, source: string): string; +/** The key of one value of the state pipelines under the form ".". */ +export declare function pipelinesByBranchRevisionKey(branch: string, revision: string): string; -/** The parts of a key of the form ".", or undefined for a key of another form. */ -export declare function parsePipelinesByBranchSourceKey(_key: string): { branch: string; source: string } | undefined; +/** The parts of a key of the form ".", or undefined for a key of another form. */ +export declare function parsePipelinesByBranchRevisionKey(_key: string): { branch: string; revision: string } | undefined; /** The key of one value of the state pipelines under the form "..published..". */ export declare function pipelinesByBranchSourcePublishedPackageVersionKey(branch: string, source: string, packagePart: string, version: string): string; @@ -261,7 +261,7 @@ export interface Pipeline { /** the modules the pipeline moves, its take-in's entries (design 47 H §746) */ "movers": Mover[]; "outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled"; - /** the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83) */ + /** the pipeline's key, ., ..published.. for a pipeline a publish started, or .run. for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83) */ "pipeline": string; /** for a pipeline a package's publish started, that publish (A-202) */ "published"?: Published; @@ -300,7 +300,7 @@ export interface PipelineEnded { /** per mover its fingerprint, released version, step results and tier, in the delivery order (design 47 H §746, H-A-2) */ "movers": MoverEnded[]; "outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled"; - /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ + /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ "pipeline": string; /** the catalog graph revision of the branch the pipeline runs for */ "revision"?: number; @@ -322,7 +322,7 @@ export interface PipelineStarted { "call"?: string; /** the pipeline's movers */ "movers": Mover[]; - /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ + /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ "pipeline": string; /** for a pipeline a package's publish started, that publish (A-202) */ "published"?: Published; @@ -383,7 +383,7 @@ export interface StepEvent { /** the module's build-input fingerprint at the commit */ "fingerprint"?: string; "module": string; - /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ + /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ "pipeline": string; "result": StepResult; /** the catalog graph revision of the branch the pipeline runs for */ @@ -490,7 +490,7 @@ export interface ToolchainUsed { "version": string; } -/** a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72) */ +/** a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283); said on . (design 47 H-A-72, H-A-221) */ export interface Wait { "artifact"?: string; /** the step's own ask, where it has one (design 47 G §731) */ @@ -507,7 +507,7 @@ export interface Wait { "module"?: string; /** what the step waits on (design 47 *Health and going back*) */ "on": "person" | "build node" | "revision view" | "pipelines-at-once"; - /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ + /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ "pipeline": string; /** the catalog graph revision of the branch the pipeline runs for */ "revision"?: number; @@ -527,7 +527,7 @@ export interface Wait { /** a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72) */ export interface Waiting { - /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ + /** the pipeline's key, ., or ..published.. for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ "pipeline": string; } @@ -800,8 +800,8 @@ export type FullEvent = Fill; /** is the body of the event room. */ export type RoomEvent = Fill; -/** is one value of the state pipelines under the key .. */ -export type PipelinesByBranchSourceValue = Pipeline; +/** is one value of the state pipelines under the key .. */ +export type PipelinesByBranchRevisionValue = Pipeline; /** is one value of the state pipelines under the key ..published... */ export type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline; diff --git a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js index 213a3df3..d8ff25e6 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.js @@ -40,16 +40,16 @@ export const family = { name: "mesh-pipeline-runner.events", maxAgeDays: 7 }; export const pipelineStartedStream = "SEAT_mesh-pipeline-runner_pipeline-started"; -export function pipelineStartedSubject(branch, source) { - return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + source; +export function pipelineStartedSubject(branch, revision) { + return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + revision; } export const pipelineStartedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.pipeline-started.*.*"; export const pipelineEndedStream = "SEAT_mesh-pipeline-runner_pipeline-ended"; -export function pipelineEndedSubject(branch, source) { - return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + source; +export function pipelineEndedSubject(branch, revision) { + return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + revision; } export const pipelineEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.pipeline-ended.*.*"; @@ -80,16 +80,16 @@ export const stepEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.step-en export const waitHeldStream = "SEAT_mesh-pipeline-runner_wait-held"; -export function waitHeldSubject(branch, source) { - return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + source; +export function waitHeldSubject(branch, revision) { + return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + revision; } export const waitHeldSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*"; export const waitEndedStream = "SEAT_mesh-pipeline-runner_wait-ended"; -export function waitEndedSubject(branch, source) { - return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + source; +export function waitEndedSubject(branch, revision) { + return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + revision; } export const waitEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-ended.*.*"; @@ -108,23 +108,23 @@ export const states = { stepOutputs: "step-outputs", }; -/** The key of one value of the state pipelines under the form ".". */ -export function pipelinesByBranchSourceKey(branch, source) { - return branch + "." + source; +/** The key of one value of the state pipelines under the form ".". */ +export function pipelinesByBranchRevisionKey(branch, revision) { + return branch + "." + revision; } -/** The parts of a key of the form ".", or undefined for a key of another form. */ -export function parsePipelinesByBranchSourceKey(_key) { +/** The parts of a key of the form ".", or undefined for a key of another form. */ +export function parsePipelinesByBranchRevisionKey(_key) { let _rest = _key; const _at0 = _rest.indexOf("."); if (_at0 <= 0) return undefined; const branch = _rest.slice(0, _at0); _rest = _rest.slice(_at0 + 1); if (_rest === "") return undefined; - const source = _rest; + const revision = _rest; _rest = ""; if (_rest !== "") return undefined; - return { branch, source }; + return { branch, revision }; } /** The key of one value of the state pipelines under the form "..published..". */ diff --git a/modules/mesh-delivery-indexer/internal/index/catalog_revisions.go b/modules/mesh-delivery-indexer/internal/index/catalog_revisions.go index 548e8c93..38a96ead 100644 --- a/modules/mesh-delivery-indexer/internal/index/catalog_revisions.go +++ b/modules/mesh-delivery-indexer/internal/index/catalog_revisions.go @@ -412,7 +412,7 @@ func (ix *Indexer) keepBranchEntries(ctx context.Context, branch string, src int } // The take-in's revision pinned for its one pipeline before any judge can remove it (§743, §749, A-449a). if len(movers) > 0 && ix.Pins != nil { - record := PipelineRecord(runner.PipelinesByBranchSourceKey(keys.EscapeName(branch), strconv.FormatInt(number, 10))) + record := PipelineRecord(runner.PipelinesByBranchRevisionKey(keys.EscapeName(branch), strconv.FormatInt(number, 10))) if err := ix.pin(ctx, PinKey(branch, number), record); err != nil { ix.logf("pins: the revision %s is not pinned for %s: %v", BranchObject(branch, number), record, err) return 0, fmt.Errorf("the pin of %s: %w", BranchObject(branch, number), err) diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/read.go b/modules/mesh-delivery-pipeline/internal/pipeline/read.go index e6a0762b..668d2ed8 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/read.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/read.go @@ -206,7 +206,7 @@ func (r Reads) pipelineOf(key string, all []string) (seat.Pipeline, bool, error) if raw == nil { return seat.Pipeline{}, false, nil } - p, err := seat.DecodePipelinesByBranchSourceValue(raw) + p, err := seat.DecodePipelinesByBranchRevisionValue(raw) if err != nil { return seat.Pipeline{}, false, fmt.Errorf("%s %s: %w", seat.StatePipelines, key, err) } diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start.go b/modules/mesh-delivery-pipeline/internal/pipeline/start.go index cfb8cc48..4c9c49cc 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start.go @@ -50,7 +50,7 @@ type Begin struct { // Key is a take-in's pipeline key in the state pipelines, `.`, the branch escaped as a key's name is // (design 47 H §746). func Key(branch string, source int64) string { - return seat.PipelinesByBranchSourceKey(keys.EscapeName(branch), strconv.FormatInt(source, 10)) + return seat.PipelinesByBranchRevisionKey(keys.EscapeName(branch), strconv.FormatInt(source, 10)) } // PublishedKey is the key of a pipeline a package's publish starts, `..published..`, diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go index 019127c7..07198145 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go @@ -40,7 +40,7 @@ func TestStarts(t *testing.T) { if _, err := s.Start(Begin{Branch: "release.1", Source: 3, Movers: []seat.Mover{{Module: "app"}}}); err != nil { t.Fatal(err) } - if b, r, ok := seat.ParsePipelinesByBranchSourceKey(Key("release.1", 3)); !ok || r != "3" || b == "release" { + if b, r, ok := seat.ParsePipelinesByBranchRevisionKey(Key("release.1", 3)); !ok || r != "3" || b == "release" { t.Errorf("the key of release.1 is %q", Key("release.1", 3)) } if _, err := s.Start(Begin{Branch: "main", Movers: []seat.Mover{{Module: "app"}}}); err == nil {