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 <branch>.<revision>, and its four per-pipeline
subjects are said on <branch>.<revision> (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
This commit is contained in:
2026-11-21 00:25:58 +01:00
parent 595510ef38
commit 396893dcac
10 changed files with 83 additions and 83 deletions
@@ -65,9 +65,9 @@ const (
// StreamPipelineStarted is the stream pipeline-started is kept in. // StreamPipelineStarted is the stream pipeline-started is kept in.
const StreamPipelineStarted = "SEAT_mesh-pipeline-runner_pipeline-started" const StreamPipelineStarted = "SEAT_mesh-pipeline-runner_pipeline-started"
// SubjectPipelineStarted is where pipeline-started is published, on 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.<branch>.<revision>.
func SubjectPipelineStarted(branch, source string) string { func SubjectPipelineStarted(branch, revision string) string {
return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + source return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + revision
} }
// SubjectPipelineStartedAll hears every pipeline-started. // 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. // StreamPipelineEnded is the stream pipeline-ended is kept in.
const StreamPipelineEnded = "SEAT_mesh-pipeline-runner_pipeline-ended" const StreamPipelineEnded = "SEAT_mesh-pipeline-runner_pipeline-ended"
// SubjectPipelineEnded is where pipeline-ended is published, on 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.<branch>.<revision>.
func SubjectPipelineEnded(branch, source string) string { func SubjectPipelineEnded(branch, revision string) string {
return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + source return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + revision
} }
// SubjectPipelineEndedAll hears every pipeline-ended. // 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. // StreamWaitHeld is the stream wait-held is kept in.
const StreamWaitHeld = "SEAT_mesh-pipeline-runner_wait-held" const StreamWaitHeld = "SEAT_mesh-pipeline-runner_wait-held"
// SubjectWaitHeld is where wait-held is published, on 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.<branch>.<revision>.
func SubjectWaitHeld(branch, source string) string { func SubjectWaitHeld(branch, revision string) string {
return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + source return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + revision
} }
// SubjectWaitHeldAll hears every wait-held. // 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. // StreamWaitEnded is the stream wait-ended is kept in.
const StreamWaitEnded = "SEAT_mesh-pipeline-runner_wait-ended" const StreamWaitEnded = "SEAT_mesh-pipeline-runner_wait-ended"
// SubjectWaitEnded is where wait-ended is published, on 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.<branch>.<revision>.
func SubjectWaitEnded(branch, source string) string { func SubjectWaitEnded(branch, revision string) string {
return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + source return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + revision
} }
// SubjectWaitEndedAll hears every wait-ended. // SubjectWaitEndedAll hears every wait-ended.
@@ -156,11 +156,11 @@ const (
StateStepOutputs = "step-outputs" StateStepOutputs = "step-outputs"
) )
// PipelinesByBranchSourceKey is the key of one value of the state pipelines under the form "<branch>.<source>". // PipelinesByBranchRevisionKey is the key of one value of the state pipelines under the form "<branch>.<revision>".
func PipelinesByBranchSourceKey(branch, source string) string { return branch + "." + source } func PipelinesByBranchRevisionKey(branch, revision string) string { return branch + "." + revision }
// ParsePipelinesByBranchSourceKey reads the parts of a key of the form "<branch>.<source>", in the order of the form; the last result is false for a key of another form. // ParsePipelinesByBranchRevisionKey reads the parts of a key of the form "<branch>.<revision>", in the order of the form; the last result is false for a key of another form.
func ParsePipelinesByBranchSourceKey(key string) (string, string, bool) { func ParsePipelinesByBranchRevisionKey(key string) (string, string, bool) {
rest := key rest := key
v0, after0, found0 := strings.Cut(rest, ".") v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" { if !found0 || v0 == "" {
@@ -178,9 +178,9 @@ func ParsePipelinesByBranchSourceKey(key string) (string, string, bool) {
return v0, v2, true return v0, v2, true
} }
// DecodePipelinesByBranchSourceValue reads one value of the state pipelines under the form "<branch>.<source>", refusing a field PipelinesByBranchSourceValue does not know and any text after the value. // DecodePipelinesByBranchRevisionValue reads one value of the state pipelines under the form "<branch>.<revision>", refusing a field PipelinesByBranchRevisionValue does not know and any text after the value.
func DecodePipelinesByBranchSourceValue(raw []byte) (PipelinesByBranchSourceValue, error) { func DecodePipelinesByBranchRevisionValue(raw []byte) (PipelinesByBranchRevisionValue, error) {
var v PipelinesByBranchSourceValue var v PipelinesByBranchRevisionValue
dec := json.NewDecoder(bytes.NewReader(raw)) dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields() dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil { 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) // the modules the pipeline moves, its take-in's entries (design 47 H §746)
Movers []Mover `json:"movers"` Movers []Mover `json:"movers"`
Outcome string `json:"outcome"` Outcome string `json:"outcome"`
// the pipeline's key, <branch>.<source>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<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, <branch>.<revision>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<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"` Pipeline string `json:"pipeline"`
// for a pipeline a package's publish started, that publish (A-202) // for a pipeline a package's publish started, that publish (A-202)
Published *Published `json:"published,omitempty"` 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) // 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"` Movers []MoverEnded `json:"movers"`
Outcome string `json:"outcome"` Outcome string `json:"outcome"`
// the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) // the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
Pipeline string `json:"pipeline"` Pipeline string `json:"pipeline"`
// the catalog graph revision of the branch the pipeline runs for // the catalog graph revision of the branch the pipeline runs for
Revision int64 `json:"revision,omitempty"` Revision int64 `json:"revision,omitempty"`
@@ -753,7 +753,7 @@ type PipelineStarted struct {
Call string `json:"call,omitempty"` Call string `json:"call,omitempty"`
// the pipeline's movers // the pipeline's movers
Movers []Mover `json:"movers"` Movers []Mover `json:"movers"`
// the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) // the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
Pipeline string `json:"pipeline"` Pipeline string `json:"pipeline"`
// for a pipeline a package's publish started, that publish (A-202) // for a pipeline a package's publish started, that publish (A-202)
Published *Published `json:"published,omitempty"` Published *Published `json:"published,omitempty"`
@@ -814,7 +814,7 @@ type StepEvent struct {
// the module's build-input fingerprint at the commit // the module's build-input fingerprint at the commit
Fingerprint string `json:"fingerprint,omitempty"` Fingerprint string `json:"fingerprint,omitempty"`
Module string `json:"module"` Module string `json:"module"`
// the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) // the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
Pipeline string `json:"pipeline"` Pipeline string `json:"pipeline"`
Result StepResult `json:"result"` Result StepResult `json:"result"`
// the catalog graph revision of the branch the pipeline runs for // the catalog graph revision of the branch the pipeline runs for
@@ -966,7 +966,7 @@ type ToolchainUsed struct {
Version string `json:"version"` 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 <branch>.<source> (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 <branch>.<revision> (design 47 H-A-72, H-A-221).
type Wait struct { type Wait struct {
Artifact string `json:"artifact,omitempty"` Artifact string `json:"artifact,omitempty"`
// the step's own ask, where it has one (design 47 G §731) // 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"` Module string `json:"module,omitempty"`
// what the step waits on (design 47 *Health and going back*) // what the step waits on (design 47 *Health and going back*)
On string `json:"on"` On string `json:"on"`
// the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) // the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
Pipeline string `json:"pipeline"` Pipeline string `json:"pipeline"`
// the catalog graph revision of the branch the pipeline runs for // the catalog graph revision of the branch the pipeline runs for
Revision int64 `json:"revision,omitempty"` 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). // Waiting is a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72).
type Waiting struct { type Waiting struct {
// the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) // the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
Pipeline string `json:"pipeline"` Pipeline string `json:"pipeline"`
} }
@@ -1355,8 +1355,8 @@ type FullEvent = Fill
// RoomEvent is the body of the event room. // RoomEvent is the body of the event room.
type RoomEvent = Fill type RoomEvent = Fill
// PipelinesByBranchSourceValue is one value of the state pipelines under the key <branch>.<source>. // PipelinesByBranchRevisionValue is one value of the state pipelines under the key <branch>.<revision>.
type PipelinesByBranchSourceValue = Pipeline type PipelinesByBranchRevisionValue = Pipeline
// PipelinesByBranchSourcePublishedPackageVersionValue is one value of the state pipelines under the key <branch>.<source>.published.<package>.<version>. // PipelinesByBranchSourcePublishedPackageVersionValue is one value of the state pipelines under the key <branch>.<source>.published.<package>.<version>.
type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline
@@ -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\\.[^.*> ]+\\.[^.*> ]+\\.[^.*> ]+$")}, 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}", {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) { decode: func(b []byte) (any, error) {
var v PipelinesByBranchSourceValue var v PipelinesByBranchRevisionValue
err := json.Unmarshal(b, &v) err := json.Unmarshal(b, &v)
return v, err return v, err
}, subjectIs: nil}, }, subjectIs: nil},
@@ -73,13 +73,13 @@ func TestFixtures(t *testing.T) {
}, subjectIs: nil}, }, 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}", {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) { decode: func(b []byte) (any, error) {
var v PipelinesByBranchSourceValue var v PipelinesByBranchRevisionValue
err := json.Unmarshal(b, &v) err := json.Unmarshal(b, &v)
return v, err return v, err
}, subjectIs: nil}, }, 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}", {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) { decode: func(b []byte) (any, error) {
var v PipelinesByBranchSourceValue var v PipelinesByBranchRevisionValue
err := json.Unmarshal(b, &v) err := json.Unmarshal(b, &v)
return v, err return v, err
}, subjectIs: nil}, }, subjectIs: nil},
@@ -1,7 +1,7 @@
[ [
{ {
"name": "a take-in's pipeline kept, its steps naming their mover", "name": "a take-in's pipeline kept, its steps naming their mover",
"of": "state:pipelines/<branch>.<source>", "of": "state:pipelines/<branch>.<revision>",
"given": { "given": {
"pipeline": "main.3589", "pipeline": "main.3589",
"branch": "main", "branch": "main",
@@ -200,7 +200,7 @@
}, },
{ {
"name": "a pipeline waiting its turn, its seq given", "name": "a pipeline waiting its turn, its seq given",
"of": "state:pipelines/<branch>.<source>", "of": "state:pipelines/<branch>.<revision>",
"given": { "given": {
"pipeline": "main.3590", "pipeline": "main.3590",
"branch": "main", "branch": "main",
@@ -224,7 +224,7 @@
}, },
{ {
"name": "a waiting pipeline names the movers a newer take-in took out of it", "name": "a waiting pipeline names the movers a newer take-in took out of it",
"of": "state:pipelines/<branch>.<source>", "of": "state:pipelines/<branch>.<revision>",
"given": { "given": {
"pipeline": "main.3590", "pipeline": "main.3590",
"branch": "main", "branch": "main",
@@ -672,7 +672,7 @@
"events": [ "events": [
{ {
"name": "pipeline-started", "name": "pipeline-started",
"subject": "pipeline-started.<branch>.<source>", "subject": "pipeline-started.<branch>.<revision>",
"body": { "body": {
"$ref": "#/defs/PipelineStarted" "$ref": "#/defs/PipelineStarted"
}, },
@@ -683,7 +683,7 @@
}, },
{ {
"name": "pipeline-ended", "name": "pipeline-ended",
"subject": "pipeline-ended.<branch>.<source>", "subject": "pipeline-ended.<branch>.<revision>",
"body": { "body": {
"$ref": "#/defs/PipelineEnded" "$ref": "#/defs/PipelineEnded"
}, },
@@ -727,7 +727,7 @@
}, },
{ {
"name": "wait-held", "name": "wait-held",
"subject": "wait-held.<branch>.<source>", "subject": "wait-held.<branch>.<revision>",
"body": { "body": {
"$ref": "#/defs/Wait" "$ref": "#/defs/Wait"
}, },
@@ -738,7 +738,7 @@
}, },
{ {
"name": "wait-ended", "name": "wait-ended",
"subject": "wait-ended.<branch>.<source>", "subject": "wait-ended.<branch>.<revision>",
"body": { "body": {
"$ref": "#/defs/Wait" "$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)", "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-forms": [
{ {
"key": "<branch>.<source>", "key": "<branch>.<revision>",
"value": { "value": {
"$ref": "#/defs/Pipeline" "$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": "<branch>.<source>.published.<package>.<version>", "key": "<branch>.<source>.published.<package>.<version>",
@@ -1199,7 +1199,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<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, <branch>.<revision>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<run> for a run on request; a branch escaped as a key's name is (design 47 H §746, §747; H-A-83)"
}, },
"branch": { "branch": {
"type": "string", "type": "string",
@@ -1313,7 +1313,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> 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, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)"
}, },
"branch": { "branch": {
"type": "string", "type": "string",
@@ -1388,7 +1388,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> 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, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)"
}, },
"branch": { "branch": {
"type": "string", "type": "string",
@@ -1495,7 +1495,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> 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, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)"
}, },
"module": { "module": {
"type": "string" "type": "string"
@@ -1550,7 +1550,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> 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, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)"
}, },
"module": { "module": {
"type": "string", "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": "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 <branch>.<source> (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 <branch>.<revision> (design 47 H-A-72, H-A-221)",
"required": [ "required": [
"v", "v",
"pipeline", "pipeline",
@@ -1978,7 +1978,7 @@
"properties": { "properties": {
"pipeline": { "pipeline": {
"type": "string", "type": "string",
"description": "the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> 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, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> 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)", "description": "a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72)",
@@ -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 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 pipelineStartedSubjectAll: "mesh.seat.mesh-pipeline-runner.event.pipeline-started.*.*";
export declare const pipelineEndedStream: "SEAT_mesh-pipeline-runner_pipeline-ended"; 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.*.*"; 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 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 waitHeldSubjectAll: "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*";
export declare const waitEndedStream: "SEAT_mesh-pipeline-runner_wait-ended"; 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.*.*"; export declare const waitEndedSubjectAll: "mesh.seat.mesh-pipeline-runner.event.wait-ended.*.*";
@@ -94,11 +94,11 @@ export declare const states: {
readonly stepOutputs: "step-outputs"; readonly stepOutputs: "step-outputs";
}; };
/** The key of one value of the state pipelines under the form "<branch>.<source>". */ /** The key of one value of the state pipelines under the form "<branch>.<revision>". */
export declare function pipelinesByBranchSourceKey(branch: string, source: string): string; export declare function pipelinesByBranchRevisionKey(branch: string, revision: string): string;
/** The parts of a key of the form "<branch>.<source>", or undefined for a key of another form. */ /** The parts of a key of the form "<branch>.<revision>", or undefined for a key of another form. */
export declare function parsePipelinesByBranchSourceKey(_key: string): { branch: string; source: string } | undefined; export declare function parsePipelinesByBranchRevisionKey(_key: string): { branch: string; revision: string } | undefined;
/** The key of one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>". */ /** The key of one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>". */
export declare function pipelinesByBranchSourcePublishedPackageVersionKey(branch: string, source: string, packagePart: string, version: string): string; 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) */ /** the modules the pipeline moves, its take-in's entries (design 47 H §746) */
"movers": Mover[]; "movers": Mover[];
"outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled"; "outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled";
/** the pipeline's key, <branch>.<source>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<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, <branch>.<revision>, <branch>.<source>.published.<package>.<version> for a pipeline a publish started, or <branch>.run.<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; "pipeline": string;
/** for a pipeline a package's publish started, that publish (A-202) */ /** for a pipeline a package's publish started, that publish (A-202) */
"published"?: Published; "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) */ /** per mover its fingerprint, released version, step results and tier, in the delivery order (design 47 H §746, H-A-2) */
"movers": MoverEnded[]; "movers": MoverEnded[];
"outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled"; "outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled";
/** the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ /** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
"pipeline": string; "pipeline": string;
/** the catalog graph revision of the branch the pipeline runs for */ /** the catalog graph revision of the branch the pipeline runs for */
"revision"?: number; "revision"?: number;
@@ -322,7 +322,7 @@ export interface PipelineStarted {
"call"?: string; "call"?: string;
/** the pipeline's movers */ /** the pipeline's movers */
"movers": Mover[]; "movers": Mover[];
/** the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ /** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
"pipeline": string; "pipeline": string;
/** for a pipeline a package's publish started, that publish (A-202) */ /** for a pipeline a package's publish started, that publish (A-202) */
"published"?: Published; "published"?: Published;
@@ -383,7 +383,7 @@ export interface StepEvent {
/** the module's build-input fingerprint at the commit */ /** the module's build-input fingerprint at the commit */
"fingerprint"?: string; "fingerprint"?: string;
"module": string; "module": string;
/** the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ /** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
"pipeline": string; "pipeline": string;
"result": StepResult; "result": StepResult;
/** the catalog graph revision of the branch the pipeline runs for */ /** the catalog graph revision of the branch the pipeline runs for */
@@ -490,7 +490,7 @@ export interface ToolchainUsed {
"version": string; "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 <branch>.<source> (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 <branch>.<revision> (design 47 H-A-72, H-A-221) */
export interface Wait { export interface Wait {
"artifact"?: string; "artifact"?: string;
/** the step's own ask, where it has one (design 47 G §731) */ /** the step's own ask, where it has one (design 47 G §731) */
@@ -507,7 +507,7 @@ export interface Wait {
"module"?: string; "module"?: string;
/** what the step waits on (design 47 *Health and going back*) */ /** what the step waits on (design 47 *Health and going back*) */
"on": "person" | "build node" | "revision view" | "pipelines-at-once"; "on": "person" | "build node" | "revision view" | "pipelines-at-once";
/** the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ /** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
"pipeline": string; "pipeline": string;
/** the catalog graph revision of the branch the pipeline runs for */ /** the catalog graph revision of the branch the pipeline runs for */
"revision"?: number; "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) */ /** a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72) */
export interface Waiting { export interface Waiting {
/** the pipeline's key, <branch>.<source>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */ /** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
"pipeline": string; "pipeline": string;
} }
@@ -800,8 +800,8 @@ export type FullEvent = Fill;
/** is the body of the event room. */ /** is the body of the event room. */
export type RoomEvent = Fill; export type RoomEvent = Fill;
/** is one value of the state pipelines under the key <branch>.<source>. */ /** is one value of the state pipelines under the key <branch>.<revision>. */
export type PipelinesByBranchSourceValue = Pipeline; export type PipelinesByBranchRevisionValue = Pipeline;
/** is one value of the state pipelines under the key <branch>.<source>.published.<package>.<version>. */ /** is one value of the state pipelines under the key <branch>.<source>.published.<package>.<version>. */
export type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline; export type PipelinesByBranchSourcePublishedPackageVersionValue = Pipeline;
@@ -40,16 +40,16 @@ export const family = { name: "mesh-pipeline-runner.events", maxAgeDays: 7 };
export const pipelineStartedStream = "SEAT_mesh-pipeline-runner_pipeline-started"; export const pipelineStartedStream = "SEAT_mesh-pipeline-runner_pipeline-started";
export function pipelineStartedSubject(branch, source) { export function pipelineStartedSubject(branch, revision) {
return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + source; return "mesh.seat.mesh-pipeline-runner.event.pipeline-started." + branch + "." + revision;
} }
export const pipelineStartedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.pipeline-started.*.*"; export const pipelineStartedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.pipeline-started.*.*";
export const pipelineEndedStream = "SEAT_mesh-pipeline-runner_pipeline-ended"; export const pipelineEndedStream = "SEAT_mesh-pipeline-runner_pipeline-ended";
export function pipelineEndedSubject(branch, source) { export function pipelineEndedSubject(branch, revision) {
return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + source; return "mesh.seat.mesh-pipeline-runner.event.pipeline-ended." + branch + "." + revision;
} }
export const pipelineEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.pipeline-ended.*.*"; 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 const waitHeldStream = "SEAT_mesh-pipeline-runner_wait-held";
export function waitHeldSubject(branch, source) { export function waitHeldSubject(branch, revision) {
return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + source; return "mesh.seat.mesh-pipeline-runner.event.wait-held." + branch + "." + revision;
} }
export const waitHeldSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*"; export const waitHeldSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-held.*.*";
export const waitEndedStream = "SEAT_mesh-pipeline-runner_wait-ended"; export const waitEndedStream = "SEAT_mesh-pipeline-runner_wait-ended";
export function waitEndedSubject(branch, source) { export function waitEndedSubject(branch, revision) {
return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + source; return "mesh.seat.mesh-pipeline-runner.event.wait-ended." + branch + "." + revision;
} }
export const waitEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-ended.*.*"; export const waitEndedSubjectAll = "mesh.seat.mesh-pipeline-runner.event.wait-ended.*.*";
@@ -108,23 +108,23 @@ export const states = {
stepOutputs: "step-outputs", stepOutputs: "step-outputs",
}; };
/** The key of one value of the state pipelines under the form "<branch>.<source>". */ /** The key of one value of the state pipelines under the form "<branch>.<revision>". */
export function pipelinesByBranchSourceKey(branch, source) { export function pipelinesByBranchRevisionKey(branch, revision) {
return branch + "." + source; return branch + "." + revision;
} }
/** The parts of a key of the form "<branch>.<source>", or undefined for a key of another form. */ /** The parts of a key of the form "<branch>.<revision>", or undefined for a key of another form. */
export function parsePipelinesByBranchSourceKey(_key) { export function parsePipelinesByBranchRevisionKey(_key) {
let _rest = _key; let _rest = _key;
const _at0 = _rest.indexOf("."); const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined; if (_at0 <= 0) return undefined;
const branch = _rest.slice(0, _at0); const branch = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1); _rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined; if (_rest === "") return undefined;
const source = _rest; const revision = _rest;
_rest = ""; _rest = "";
if (_rest !== "") return undefined; if (_rest !== "") return undefined;
return { branch, source }; return { branch, revision };
} }
/** The key of one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>". */ /** The key of one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>". */
@@ -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). // 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 { 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 { 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) 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) return 0, fmt.Errorf("the pin of %s: %w", BranchObject(branch, number), err)
@@ -206,7 +206,7 @@ func (r Reads) pipelineOf(key string, all []string) (seat.Pipeline, bool, error)
if raw == nil { if raw == nil {
return seat.Pipeline{}, false, nil return seat.Pipeline{}, false, nil
} }
p, err := seat.DecodePipelinesByBranchSourceValue(raw) p, err := seat.DecodePipelinesByBranchRevisionValue(raw)
if err != nil { if err != nil {
return seat.Pipeline{}, false, fmt.Errorf("%s %s: %w", seat.StatePipelines, key, err) return seat.Pipeline{}, false, fmt.Errorf("%s %s: %w", seat.StatePipelines, key, err)
} }
@@ -50,7 +50,7 @@ type Begin struct {
// Key is a take-in's pipeline key in the state pipelines, `<branch>.<source>`, the branch escaped as a key's name is // Key is a take-in's pipeline key in the state pipelines, `<branch>.<source>`, the branch escaped as a key's name is
// (design 47 H §746). // (design 47 H §746).
func Key(branch string, source int64) string { 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, `<branch>.<source>.published.<package>.<version>`, // PublishedKey is the key of a pipeline a package's publish starts, `<branch>.<source>.published.<package>.<version>`,
@@ -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 { if _, err := s.Start(Begin{Branch: "release.1", Source: 3, Movers: []seat.Mover{{Module: "app"}}}); err != nil {
t.Fatal(err) 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)) 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 { if _, err := s.Start(Begin{Branch: "main", Movers: []seat.Mover{{Module: "app"}}}); err == nil {