Compare commits
7
Commits
go/v0.1.46
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5547fd028e | ||
|
|
d51d389c1b | ||
|
|
c6edd5987f | ||
|
|
9a49b0f4f7 | ||
|
|
47f81051be | ||
|
|
769d701e2b | ||
|
|
ece9d6b18f |
@@ -288,19 +288,21 @@ func (rv *reservations) heard(ctx context.Context, m jetstream.Msg) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// published marks the artifacts of the reservation a registry seat's published names (its version and digest).
|
||||
func (rv *reservations) published(ctx context.Context, o versions.Outcome) {
|
||||
marked, kept, err := rv.r.Published(ctx, o.Name, o.Version, o.Digest)
|
||||
// published marks the artifacts of the reservation a registry seat's published names (its version and digest). inProgress is told
|
||||
// before a pass that may read many reservations, so the handler says in progress to the bus (design 47 H H-A-280); nil is told
|
||||
// nothing.
|
||||
func (rv *reservations) published(ctx context.Context, o versions.Outcome, inProgress func()) {
|
||||
out, err := rv.r.PublishedRead(ctx, o.Name, o.Version, o.Digest, inProgress)
|
||||
if err != nil {
|
||||
rv.logf("a published of %s@%s is not recorded in the reservations: %v", o.Name, o.Version, err)
|
||||
}
|
||||
if len(kept) > 0 {
|
||||
rv.logf("the published of %s@%s (digest %s, holder %s) is kept on %s until the build records its digests", o.Name, o.Version, o.Digest, o.Holder, strings.Join(kept, ", "))
|
||||
} else if len(marked) == 0 {
|
||||
rv.logf("package-published not said: the published of %s@%s (digest %s, holder %s) marks no artifact of a reservation: %s", o.Name, o.Version, o.Digest, o.Holder, rv.noMark(ctx, o))
|
||||
if len(out.Kept) > 0 {
|
||||
rv.logf("the published of %s@%s (digest %s, holder %s) is kept on %s until the build records its digests", o.Name, o.Version, o.Digest, o.Holder, strings.Join(out.Kept, ", "))
|
||||
} else if len(out.Marked) == 0 {
|
||||
rv.logf("package-published not said: the published of %s@%s (digest %s, holder %s) marks no artifact of a reservation: %s", o.Name, o.Version, o.Digest, o.Holder, rv.noMark(ctx, o, out.Read))
|
||||
}
|
||||
// Each artifact the holder's published newly marked is said as the seat mesh-builds' package-published (design 47 G §52, §334).
|
||||
for _, m := range marked {
|
||||
for _, m := range out.Marked {
|
||||
rv.sayPublished(ctx, m, o.Digest)
|
||||
}
|
||||
}
|
||||
@@ -363,25 +365,29 @@ func (rv *reservations) tagged(ctx context.Context, ev meshcatalog.VersionReleas
|
||||
return nil
|
||||
}
|
||||
|
||||
// noMark says why a published marked nothing: which reservation holds that version, and what it holds of digests, read through the
|
||||
// index by version (H-A-269 (1), H-A-271).
|
||||
func (rv *reservations) noMark(ctx context.Context, o versions.Outcome) string {
|
||||
// noMark says why a published marked nothing, from the reservations the published read (design 47 H H-A-280: no second read):
|
||||
// what each holds of digests, and how many stand at that version by the index by version (its one key, no reservation read).
|
||||
func (rv *reservations) noMark(ctx context.Context, o versions.Outcome, read []versions.ReadReservation) string {
|
||||
version := strings.TrimPrefix(o.Version, "v")
|
||||
if version == "" || o.Digest == "" {
|
||||
return "it names no version or no digest (a by-digest publish)"
|
||||
}
|
||||
at, err := rv.r.AtVersion(ctx, version) // the index by version, never every reservation (H-A-271)
|
||||
if err != nil {
|
||||
return "the reservations at " + version + " cannot be read: " + err.Error()
|
||||
}
|
||||
var out []string
|
||||
for _, v := range at {
|
||||
out = append(out, fmt.Sprintf("%s holds %d built digests %v, published %v (a published heard before the build recorded its digests is kept until it does)", v.Module, len(v.Artifacts), v.Artifacts, v.Published))
|
||||
for _, r := range read {
|
||||
v := r.Reserved
|
||||
if v.Version != version {
|
||||
continue
|
||||
}
|
||||
out = append(out, fmt.Sprintf("%s holds %d built digests %v, published %v", v.Module, len(v.Artifacts), v.Artifacts, v.Published))
|
||||
}
|
||||
standing := "the number standing at it is not read"
|
||||
if keys, err := rv.r.IndexedAt(ctx, version); err == nil {
|
||||
standing = fmt.Sprintf("%d reservations stand at it, the built ones not read", len(keys))
|
||||
}
|
||||
if len(out) == 0 {
|
||||
return "no reservation holds version " + version
|
||||
return "no reservation read holds version " + version + " unbuilt or with that digest (" + standing + ")"
|
||||
}
|
||||
return strings.Join(out, "; ")
|
||||
return strings.Join(out, "; ") + " (" + standing + "; a published heard before the build recorded its digests is kept until it does)"
|
||||
}
|
||||
|
||||
// reserveDoneAct is builder_reserve_done's act (design 47 G A-455): the next version of the series is reserved for a done trunk build
|
||||
@@ -414,7 +420,7 @@ func (rv *reservations) ReleasedFor(ctx context.Context, module, fingerprint str
|
||||
func (rv *reservations) markHeld(ctx context.Context, v versions.ReservedVersion, held []versions.HeldArtifact) {
|
||||
for _, h := range held {
|
||||
rv.logf("%s %s: %s holds %s %s with the built digest %s: marked published from its record", v.Module, v.Version, h.Seat, h.Name, h.Version, h.Digest)
|
||||
rv.published(ctx, versions.Outcome{Name: h.Name, Version: h.Version, Digest: h.Digest, Holder: h.Seat})
|
||||
rv.published(ctx, versions.Outcome{Name: h.Name, Version: h.Version, Digest: h.Digest, Holder: h.Seat}, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,10 +119,10 @@ func TestTheCatalogsWordsMoveTheReservations(t *testing.T) {
|
||||
if !bounds.keys[boundKey] {
|
||||
t.Fatalf("the publish's bound is not armed: %v", bounds.keys)
|
||||
}
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: "1.4.3", Digest: "sha256:a"})
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: "1.4.3", Digest: "sha256:a"}, nil)
|
||||
// Design 47 G §52, A-57: the holder's published is said once, per artifact, as the seat mesh-builds' package-published with the
|
||||
// branch and source revision of the reservation; a second published of the same artifact says nothing.
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: "1.4.3", Digest: "sha256:a"})
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: "1.4.3", Digest: "sha256:a"}, nil)
|
||||
if len(said) != 1 || said[0].Artifact != "m:a" || said[0].Version != "1.4.3" || said[0].Digest != "sha256:a" || said[0].Branch != "main" || said[0].Source != 41 {
|
||||
t.Fatalf("package-published said %+v, want one of m:a at 1.4.3 for main at source 41", said)
|
||||
}
|
||||
@@ -236,8 +236,8 @@ func TestAPublishedHeardBeforeTheDigestsIsSaidWhenTheBuildRecordsThem(t *testing
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: res.Version, Digest: "sha256:a"})
|
||||
rv.published(ctx, versions.Outcome{Name: "m-x", Version: res.Version, Digest: "sha256:x"})
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: res.Version, Digest: "sha256:a"}, nil)
|
||||
rv.published(ctx, versions.Outcome{Name: "m-x", Version: res.Version, Digest: "sha256:x"}, nil)
|
||||
if len(said) != 0 {
|
||||
t.Fatalf("package-published said before the digests are recorded: %+v", said)
|
||||
}
|
||||
@@ -259,7 +259,7 @@ func TestAPublishedHeardBeforeTheDigestsIsSaidWhenTheBuildRecordsThem(t *testing
|
||||
t.Fatalf("no finding raised for the digest the holder holds: %s", raised)
|
||||
}
|
||||
// Taken in once: a published of m:a heard again says nothing more.
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: res.Version, Digest: "sha256:a"})
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: res.Version, Digest: "sha256:a"}, nil)
|
||||
if len(said) != 1 {
|
||||
t.Fatalf("package-published said again: %+v", said)
|
||||
}
|
||||
@@ -450,7 +450,7 @@ func TestARegistrysRecordEndsOrMovesAPublish(t *testing.T) {
|
||||
if err := rv.Built(ctx, module, again.Version, map[string]string{"node-tools:program": "sha256:fresh"}, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
rv.published(ctx, versions.Outcome{Name: "node-tools/program", Version: again.Version, Digest: "sha256:fresh"})
|
||||
rv.published(ctx, versions.Outcome{Name: "node-tools/program", Version: again.Version, Digest: "sha256:fresh"}, nil)
|
||||
return nil
|
||||
}
|
||||
cur, _, _ = rv.r.Of(ctx, "node-tools", "0.1.1")
|
||||
@@ -477,3 +477,58 @@ func TestARegistrysRecordEndsOrMovesAPublish(t *testing.T) {
|
||||
t.Errorf("no version-held-elsewhere naming both digests: %s", raised)
|
||||
}
|
||||
}
|
||||
|
||||
// countedReserve counts the reads of reservation keys (two tokens).
|
||||
type countedReserve struct {
|
||||
*memReserve
|
||||
reads int
|
||||
}
|
||||
|
||||
func (c *countedReserve) Get(ctx context.Context, key string) ([]byte, uint64, bool, error) {
|
||||
if !strings.HasPrefix(key, "index.") {
|
||||
c.reads++
|
||||
}
|
||||
return c.memReserve.Get(ctx, key)
|
||||
}
|
||||
|
||||
// TestAPublishedThatMarksNothingIsSaidFromWhatItRead: design 47 H H-A-280 — a published whose digest no reservation holds, at a
|
||||
// version many reservations share, reads only the unbuilt ones there, each once; its journal line is made from those reads with
|
||||
// no second read; and the handler is told to say in progress before that pass.
|
||||
func TestAPublishedThatMarksNothingIsSaidFromWhatItRead(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
store := &countedReserve{memReserve: &memReserve{vals: map[string][]byte{}, revs: map[string]uint64{}}}
|
||||
none := func(string, any) (json.RawMessage, error) { return json.Marshal(meshcatalog.VersionsAnswer{}) }
|
||||
var logs []string
|
||||
rv := newReservations(store, none, func() jetstream.KeyValue { return &boundsKV{keys: map[string]bool{}} },
|
||||
&findings{module: builds.BuilderModule, w: &memFindings{vals: map[string][]byte{}}, logf: t.Logf, now: time.Now}, nil,
|
||||
func(f string, a ...any) { logs = append(logs, fmt.Sprintf(f, a...)) })
|
||||
rv.filled.Store(true)
|
||||
for i := range 14 {
|
||||
m := fmt.Sprintf("m%02d", i)
|
||||
res, err := rv.Reserve(ctx, m, "0.1", []string{m + ":a"}, versions.Source{Fingerprint: "fp" + m})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if i > 0 { // one stays unbuilt
|
||||
if err := rv.Built(ctx, m, res.Version, map[string]string{m + ":a": "sha256:" + m}, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
store.reads = 0
|
||||
told := 0
|
||||
rv.published(ctx, versions.Outcome{Name: "x", Version: "0.1.0", Digest: "sha256:none"}, func() { told++ })
|
||||
if store.reads != 1 || told != 1 {
|
||||
t.Errorf("%d reservation reads, in progress told %d times: want the one unbuilt read once, and in progress said before", store.reads, told)
|
||||
}
|
||||
if line := strings.Join(logs, "\n"); !strings.Contains(line, "kept on") {
|
||||
t.Errorf("the journal says %q, want the published kept on the unbuilt reservation", line)
|
||||
}
|
||||
logs, store.reads = nil, 0
|
||||
// A digest of a built one whose artifact is published already marks nothing: the line names it from the one read.
|
||||
rv.published(ctx, versions.Outcome{Name: "m05-a", Version: "0.1.0", Digest: "sha256:m05"}, nil)
|
||||
rv.published(ctx, versions.Outcome{Name: "m05-a", Version: "0.1.0", Digest: "sha256:m05"}, nil)
|
||||
if store.reads != 2 || !strings.Contains(strings.Join(logs, "\n"), "m05 holds 1 built digests") || !strings.Contains(strings.Join(logs, "\n"), "14 reservations stand at it") {
|
||||
t.Errorf("%d reads for two publisheds, journal %q: want one read each and the line made from it", store.reads, logs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,12 @@ func (h *seatHearer) heard(ctx context.Context, m jetstream.Msg) bool {
|
||||
h.pub.heard(ctx, se.seat, se.event, o)
|
||||
}
|
||||
if h.res != nil && se.event == versions.HeardPublished {
|
||||
h.res.published(ctx, o)
|
||||
// A pass over many reservations may outlast a third of the ack wait: the bus is told in progress before it (H-A-280).
|
||||
h.res.published(ctx, o, func() {
|
||||
if err := m.InProgress(); err != nil {
|
||||
h.logf("in progress of %s not said: %v", m.Subject(), err)
|
||||
}
|
||||
})
|
||||
}
|
||||
if se.event == versions.HeardPublished && o.Kind == versions.KindPackage && h.b != nil {
|
||||
// A package registry seat's published pins a package an entry names with none, at the version it carries (H-A-192).
|
||||
|
||||
@@ -19,9 +19,12 @@ import (
|
||||
const (
|
||||
indexDigestPrefix = "index.digest."
|
||||
indexVersionPrefix = "index.version."
|
||||
indexUnbuiltPrefix = "index.unbuilt."
|
||||
// IndexDigestFilter and IndexVersionFilter are the filters of the index's two halves.
|
||||
IndexDigestFilter = indexDigestPrefix + "*"
|
||||
IndexVersionFilter = indexVersionPrefix + "*"
|
||||
// IndexUnbuiltFilter is the filter of the reservations at a version whose build has not recorded every digest (H-A-280).
|
||||
IndexUnbuiltFilter = indexUnbuiltPrefix + "*"
|
||||
)
|
||||
|
||||
// IndexDigestKey is the index key of the reservations holding digest as a built artifact's.
|
||||
@@ -30,6 +33,10 @@ func IndexDigestKey(digest string) string { return indexDigestPrefix + EscapeTok
|
||||
// IndexVersionKey is the index key of the reservations standing at version (MAJOR.MINOR.PATCH).
|
||||
func IndexVersionKey(version string) string { return indexVersionPrefix + EscapeToken(version) }
|
||||
|
||||
// IndexUnbuiltKey is the index key of the reservations at version whose build has not recorded every digest (design 47 H
|
||||
// H-A-280): the only ones a published whose digest no reservation holds is kept on (A-415), kept apart from the built.
|
||||
func IndexUnbuiltKey(version string) string { return indexUnbuiltPrefix + EscapeToken(version) }
|
||||
|
||||
// IndexEntry is an index key's value: the reservation keys, sorted.
|
||||
type IndexEntry struct {
|
||||
Keys []string `json:"keys"`
|
||||
@@ -90,6 +97,9 @@ func indexKeys(v ReservedVersion) []string {
|
||||
out := []string{}
|
||||
if v.Version != "" {
|
||||
out = append(out, IndexVersionKey(v.Version))
|
||||
if v.BuiltAt.IsZero() {
|
||||
out = append(out, IndexUnbuiltKey(v.Version))
|
||||
}
|
||||
}
|
||||
for _, d := range v.Artifacts {
|
||||
if d != "" && !slices.Contains(out, IndexDigestKey(d)) {
|
||||
@@ -122,6 +132,11 @@ func (r *Reserver) reindex(ctx context.Context, key string, was, now ReservedVer
|
||||
return nil
|
||||
}
|
||||
|
||||
// IndexedAt are the keys of the reservations standing at version, by the index by version alone (H-A-280): no reservation read.
|
||||
func (r *Reserver) IndexedAt(ctx context.Context, version string) ([]string, error) {
|
||||
return r.indexed(ctx, IndexVersionKey(version))
|
||||
}
|
||||
|
||||
// AtVersion are the reservations standing at version, read through the index by version (H-A-271): one read of the index and
|
||||
// one of each reservation it names.
|
||||
func (r *Reserver) AtVersion(ctx context.Context, version string) ([]ReservedVersion, error) {
|
||||
@@ -160,7 +175,7 @@ func (r *Reserver) Reindex(ctx context.Context) (int, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, filter := range []string{IndexDigestFilter, IndexVersionFilter} {
|
||||
for _, filter := range []string{IndexDigestFilter, IndexVersionFilter, IndexUnbuiltFilter} {
|
||||
keys, err := r.Store.KeysOf(ctx, filter)
|
||||
if err != nil {
|
||||
return len(all), fmt.Errorf("the index cannot be listed: %w", err)
|
||||
|
||||
@@ -62,21 +62,37 @@ func TestTheIndexFindsAPublishedReservationInOneRead(t *testing.T) {
|
||||
t.Errorf("the published listed %d times and read %d reservations, want none listed and one read", l, n)
|
||||
}
|
||||
})
|
||||
t.Run("a digest no reservation holds is judged from its version's keys", func(t *testing.T) {
|
||||
t.Run("a digest no reservation holds is judged from its version's unbuilt keys", func(t *testing.T) {
|
||||
r, store := fill(t)
|
||||
marked, kept, err := r.Published(ctx, "m11-a", "0.1.0", "sha256:early")
|
||||
if err != nil || len(marked) != 0 {
|
||||
t.Fatalf("an unbuilt digest marked %v (%v)", marked, err)
|
||||
}
|
||||
// The 20 unbuilt reservations at 0.1.0 keep it as heard (A-415); the built ones are read and left.
|
||||
if len(kept) != 20 || store.lists.Load() != 0 || store.reads.Load() != 40 {
|
||||
t.Errorf("kept on %d (want 20), listed %d (want 0), read %d (want the 40 at 0.1.0)", len(kept), store.lists.Load(), store.reads.Load())
|
||||
// The 20 unbuilt reservations at 0.1.0 keep it as heard (A-415); the 20 built ones are not read at all (H-A-280).
|
||||
if len(kept) != 20 || store.lists.Load() != 0 || store.reads.Load() != 20 {
|
||||
t.Errorf("kept on %d (want 20), listed %d (want 0), read %d (want only the 20 unbuilt at 0.1.0)", len(kept), store.lists.Load(), store.reads.Load())
|
||||
}
|
||||
at, err := r.AtVersion(ctx, "0.9.9")
|
||||
if err != nil || len(at) != 0 || store.lists.Load() != 0 {
|
||||
t.Errorf("a version no reservation stands at answered %v (%v), listed %d", at, err, store.lists.Load())
|
||||
}
|
||||
})
|
||||
t.Run("a published at a version many share reads each reservation once and hands them on", func(t *testing.T) {
|
||||
r, store := fill(t)
|
||||
// A stale digest entry naming unbuilt reservations too: the second pass takes them as the first read them.
|
||||
stale, _ := json.Marshal(IndexEntry{Keys: []string{ReservedKey("m01", "0.1"), ReservedKey("m03", "0.1")}})
|
||||
if _, err := store.Create(ctx, IndexDigestKey("sha256:stale"), stale); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
slow := 0
|
||||
out, err := r.PublishedRead(ctx, "x", "0.1.0", "sha256:stale", func() { slow++ })
|
||||
if err != nil || len(out.Kept) != 20 || len(out.Read) != 20 || slow != 1 {
|
||||
t.Fatalf("kept %d, read %d, told slow %d (%v): want 20 kept, 20 read and handed on, slow told once", len(out.Kept), len(out.Read), slow, err)
|
||||
}
|
||||
if n := store.reads.Load(); n != 20 {
|
||||
t.Errorf("%d reservation reads, want each of the 20 read once", n)
|
||||
}
|
||||
})
|
||||
t.Run("a release and a drop take the reservation out of the index", func(t *testing.T) {
|
||||
r, store := fill(t)
|
||||
if _, err := r.Released(ctx, "m10", "0.1.0"); err != nil {
|
||||
|
||||
@@ -601,88 +601,138 @@ func (m Marked) PackagePublished(digest string, at time.Time) meshbuilds.Package
|
||||
Version: m.Reserved.Version, Digest: digest, Dependencies: m.Reserved.Dependencies[m.Artifact]}
|
||||
}
|
||||
|
||||
// Published takes a registry seat's published in: the artifacts of a reservation at version (a leading v is the Go form)
|
||||
// whose built digest it names are marked published. It answers each artifact it newly marked, with the reservation as marked.
|
||||
// A published that marks no artifact of a reservation at version whose build has not recorded every digest is kept on that
|
||||
// reservation as heard (name, version, digest), and the keys it is kept on are answered too (design 47 G A-415): Kept marks
|
||||
// it when the build records its digests. The reservation is found through the index (H-A-269 (1), H-A-271): the reservations
|
||||
// holding the digest in one read, and only when none holds it at version, those standing at the version in one more; never a
|
||||
// scan of every reservation.
|
||||
// Published takes a registry seat's published in, as PublishedRead does, answering the artifacts newly marked and the keys it is
|
||||
// kept on.
|
||||
func (r *Reserver) Published(ctx context.Context, name, version, digest string) ([]Marked, []string, error) {
|
||||
out, err := r.PublishedRead(ctx, name, version, digest, nil)
|
||||
return out.Marked, out.Kept, err
|
||||
}
|
||||
|
||||
// ReadReservation is a reservation a published read, as it stood after the published was taken in, and whether one of its built
|
||||
// digests is the published's (design 47 H H-A-280).
|
||||
type ReadReservation struct {
|
||||
Key string
|
||||
Reserved ReservedVersion
|
||||
Matched bool
|
||||
}
|
||||
|
||||
// PublishedOutcome is what a published did: the artifacts it newly marked, the keys it is kept on (A-415), and every reservation it
|
||||
// read, each once, which the journal line is made from (H-A-280).
|
||||
type PublishedOutcome struct {
|
||||
Marked []Marked
|
||||
Kept []string
|
||||
Read []ReadReservation
|
||||
}
|
||||
|
||||
// PublishedRead takes a registry seat's published in: the artifacts of a reservation at version (a leading v is the Go form)
|
||||
// whose built digest it names are marked published. A published that marks no artifact of a reservation at version whose build
|
||||
// has not recorded every digest is kept on that reservation as heard (name, version, digest), and the keys it is kept on are
|
||||
// answered (design 47 G A-415): Kept marks it when the build records its digests. The reservation is found through the index
|
||||
// (H-A-269 (1), H-A-271, H-A-280): the reservations holding the digest in one read, and only when none at version holds it, those
|
||||
// at the version whose build has not recorded every digest in one more; never a scan of every reservation, and each reservation
|
||||
// read at most once (again only on a write that met another). slow is told before the second pass, which may read many, so the
|
||||
// caller can say in progress to the bus; nil is told nothing.
|
||||
func (r *Reserver) PublishedRead(ctx context.Context, name, version, digest string, slow func()) (PublishedOutcome, error) {
|
||||
version = strings.TrimPrefix(version, "v")
|
||||
var out PublishedOutcome
|
||||
if version == "" || digest == "" {
|
||||
return nil, nil, nil
|
||||
return out, nil
|
||||
}
|
||||
keys, err := r.indexed(ctx, IndexDigestKey(digest))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("the index of digest %s cannot be read: %w", digest, err)
|
||||
return out, fmt.Errorf("the index of digest %s cannot be read: %w", digest, err)
|
||||
}
|
||||
marked, kept, matched, err := r.publishedOn(ctx, keys, name, version, digest, false)
|
||||
read := map[string]readOne{}
|
||||
matched, err := r.publishedOn(ctx, keys, name, version, digest, false, read, &out)
|
||||
if err != nil || matched {
|
||||
return marked, kept, err
|
||||
return out, err
|
||||
}
|
||||
keys, err = r.indexed(ctx, IndexVersionKey(version))
|
||||
keys, err = r.indexed(ctx, IndexUnbuiltKey(version))
|
||||
if err != nil {
|
||||
return marked, kept, fmt.Errorf("the index of version %s cannot be read: %w", version, err)
|
||||
return out, fmt.Errorf("the index of the unbuilt at version %s cannot be read: %w", version, err)
|
||||
}
|
||||
m, k, _, err := r.publishedOn(ctx, keys, name, version, digest, true)
|
||||
return append(marked, m...), append(kept, k...), err
|
||||
if len(keys) > 0 && slow != nil {
|
||||
slow()
|
||||
}
|
||||
_, err = r.publishedOn(ctx, keys, name, version, digest, true, read, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// readOne is a reservation as one pass read it, kept so the next pass reads it no more.
|
||||
type readOne struct {
|
||||
v ReservedVersion
|
||||
rev uint64
|
||||
ok bool
|
||||
}
|
||||
|
||||
// publishedOn takes a published in on the reservations under keys: an artifact whose built digest it names is marked; with keep,
|
||||
// a reservation at version whose build has not recorded every digest and that it matches nothing of keeps it (A-415). It also
|
||||
// answers whether a reservation at version holds the digest.
|
||||
func (r *Reserver) publishedOn(ctx context.Context, keys []string, name, version, digest string, keep bool) ([]Marked, []string, bool, error) {
|
||||
var marked []Marked
|
||||
var kept []string
|
||||
// a reservation at version whose build has not recorded every digest and that it matches nothing of keeps it (A-415). A
|
||||
// reservation read by an earlier pass (read) is taken as read; each read is added to out.Read once. It answers whether a
|
||||
// reservation at version holds the digest.
|
||||
func (r *Reserver) publishedOn(ctx context.Context, keys []string, name, version, digest string, keep bool, read map[string]readOne, out *PublishedOutcome) (bool, error) {
|
||||
anyMatched := false
|
||||
for _, k := range keys {
|
||||
again:
|
||||
cur, rev, found, err := r.get(ctx, k)
|
||||
if err != nil {
|
||||
return marked, kept, anyMatched, err
|
||||
}
|
||||
if !found || cur.Version != version {
|
||||
continue
|
||||
}
|
||||
changed, matched, keepIt := false, false, false
|
||||
var arts []string
|
||||
for a, d := range cur.Artifacts {
|
||||
if d != digest {
|
||||
continue
|
||||
}
|
||||
matched = true
|
||||
if !cur.Published[a] {
|
||||
if cur.Published == nil {
|
||||
cur.Published = map[string]bool{}
|
||||
one, seen := read[k]
|
||||
for {
|
||||
if !seen {
|
||||
cur, rev, found, err := r.get(ctx, k)
|
||||
if err != nil {
|
||||
return anyMatched, err
|
||||
}
|
||||
cur.Published[a], changed = true, true
|
||||
arts = append(arts, a)
|
||||
one = readOne{v: cur, rev: rev, ok: found}
|
||||
}
|
||||
}
|
||||
anyMatched = anyMatched || matched
|
||||
sort.Strings(arts)
|
||||
if keep && !matched && cur.BuiltAt.IsZero() && !cur.keeps(name, digest) {
|
||||
cur.Kept = append(cur.Kept, KeptPublished{Name: name, Version: version, Digest: digest})
|
||||
changed, keepIt = true, true
|
||||
}
|
||||
if !changed {
|
||||
continue
|
||||
}
|
||||
raw, _ := json.Marshal(cur)
|
||||
if _, err := r.Store.Update(ctx, k, raw, rev); errors.Is(err, ErrConflict) {
|
||||
goto again
|
||||
} else if err != nil {
|
||||
return marked, kept, anyMatched, fmt.Errorf("%s cannot be written: %w", k, err)
|
||||
}
|
||||
for _, a := range arts {
|
||||
marked = append(marked, Marked{Reserved: cur, Artifact: a})
|
||||
}
|
||||
if keepIt {
|
||||
kept = append(kept, k)
|
||||
seen = false // a write that meets another reads again
|
||||
cur := one.v
|
||||
if !one.ok || cur.Version != version {
|
||||
read[k] = one
|
||||
break
|
||||
}
|
||||
changed, matched, keepIt := false, false, false
|
||||
var arts []string
|
||||
for a, d := range cur.Artifacts {
|
||||
if d != digest {
|
||||
continue
|
||||
}
|
||||
matched = true
|
||||
if !cur.Published[a] {
|
||||
cur.Published = maps.Clone(cur.Published)
|
||||
if cur.Published == nil {
|
||||
cur.Published = map[string]bool{}
|
||||
}
|
||||
cur.Published[a], changed = true, true
|
||||
arts = append(arts, a)
|
||||
}
|
||||
}
|
||||
sort.Strings(arts)
|
||||
if keep && !matched && cur.BuiltAt.IsZero() && !cur.keeps(name, digest) {
|
||||
cur.Kept = append(slices.Clone(cur.Kept), KeptPublished{Name: name, Version: version, Digest: digest})
|
||||
changed, keepIt = true, true
|
||||
}
|
||||
rev := one.rev
|
||||
if changed {
|
||||
raw, _ := json.Marshal(cur)
|
||||
var err error
|
||||
if rev, err = r.Store.Update(ctx, k, raw, one.rev); errors.Is(err, ErrConflict) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
return anyMatched, fmt.Errorf("%s cannot be written: %w", k, err)
|
||||
}
|
||||
for _, a := range arts {
|
||||
out.Marked = append(out.Marked, Marked{Reserved: cur, Artifact: a})
|
||||
}
|
||||
if keepIt {
|
||||
out.Kept = append(out.Kept, k)
|
||||
}
|
||||
}
|
||||
anyMatched = anyMatched || matched
|
||||
if _, was := read[k]; !was {
|
||||
out.Read = append(out.Read, ReadReservation{Key: k, Reserved: cur, Matched: matched})
|
||||
}
|
||||
read[k] = readOne{v: cur, rev: rev, ok: true}
|
||||
break
|
||||
}
|
||||
}
|
||||
return marked, kept, anyMatched, nil
|
||||
return anyMatched, nil
|
||||
}
|
||||
|
||||
func (v ReservedVersion) keeps(name, digest string) bool {
|
||||
|
||||
@@ -150,7 +150,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
}
|
||||
logger.Printf("widens: each read bound %s, %d catalog revisions kept", readBound, revisionsKept)
|
||||
widener := widenerOf(calls.Call, readBound, revisionsKept, logger.Printf)
|
||||
hearer.Widens = widener.Widens
|
||||
hearer.Widens = widener.Reads
|
||||
hearer.LogLast = stepLog{ctx: ctx, js: js, module: cred.Module}.Last
|
||||
hearer.Where = routerRecordOf(cred.Module, calls.Call, calls.Ask)
|
||||
hearer.Failures = &pipeline.Failures{Findings: rv.Findings, Observer: cred.Module, Author: commitAuthor(calls.Call), Logf: logger.Printf}
|
||||
@@ -177,6 +177,8 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
clock := askClock(ctx, bounds, askBound, silentBound, rv.Findings, cred.Module, time.Now)
|
||||
starter.Asks, hearer.Asks = clock, clock
|
||||
starter.Supersede = func(newer seat.Pipeline) { hearer.SupersedeRunning(newer) }
|
||||
starter.Left = hearer.LeftInPlace // a same-source re-pin's superseded steps leave their runs (H-A-284)
|
||||
starter.Revision = widener.Revision // a kept mover is placed from its kept revision (H-A-286)
|
||||
hearer.Unplaced = func(p seat.Pipeline, module string) string { return starter.Unplaced(p, module, rv.Catalog.View) }
|
||||
hearer.AskPinHeld = func(key, module string, pins map[string]string) {
|
||||
if _, err := starter.AskPinHeld(hearer.Store, key, module, pins, widener.Revision); err != nil {
|
||||
@@ -272,6 +274,10 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
if err := placeLostRuns(starter.UnplacedRuns, calls.CallKept, placeHalf, logger.Printf); err != nil {
|
||||
logger.Printf("the runs not placed at the start: %v", err)
|
||||
}
|
||||
// A running pipeline nothing of which is still open ends now, its turn freed, before the queue is placed (H-A-288 (c)).
|
||||
if n, err := hearer.EndAtStart(); err != nil || n > 0 {
|
||||
logger.Printf("the pipelines with nothing open at the start: %d ended (%v)", n, err)
|
||||
}
|
||||
// The queue is placed at the start from its own state (§748).
|
||||
if n, err := starter.StartQueue(rv.Catalog.View); err != nil || n > 0 {
|
||||
logger.Printf("the queue at the start: %d waiting pipelines placed (%v)", n, err)
|
||||
|
||||
@@ -206,6 +206,7 @@ func (h *Hearer) OnDecided(event oc.Warrant) (seat.Pipeline, error) {
|
||||
return seat.Pipeline{}, err
|
||||
}
|
||||
for _, key := range found {
|
||||
wr := h.widensReads() // made before the compare-and-set, kept for its retries (H-A-289)
|
||||
for {
|
||||
p, rev, err := h.Store.Get(key)
|
||||
if err != nil {
|
||||
@@ -219,7 +220,7 @@ func (h *Hearer) OnDecided(event oc.Warrant) (seat.Pipeline, error) {
|
||||
if err != nil || !changed {
|
||||
return p, err
|
||||
}
|
||||
ended := h.endPipeline(&p, now)
|
||||
ended := h.endPipeline(&p, now, wr)
|
||||
i := stepOfAsk(p, w.Ask)
|
||||
if i >= 0 {
|
||||
p.Unlogged = append(p.Unlogged, endEntry(key, p.Steps[i], now))
|
||||
|
||||
@@ -308,6 +308,7 @@ func markRerun(a *Asked, caller string) {
|
||||
// other mover's validate reading the ask with it, a composition its validate held ended not asked, the pipeline ended when
|
||||
// nothing else is open, said and logged as any step's end.
|
||||
func (h *Hearer) endUnanswered(key, ask, why string) error {
|
||||
wr := h.widensReads() // made before the compare-and-set, kept for its retries (H-A-289)
|
||||
for {
|
||||
p, rev, err := h.Store.Get(key)
|
||||
if err != nil {
|
||||
@@ -324,14 +325,14 @@ func (h *Hearer) endUnanswered(key, ask, why string) error {
|
||||
var readers []int
|
||||
if s.Step == seat.StepResultStepValidate {
|
||||
readers = sameValidate(&p, i, now)
|
||||
_, notAsked := releaseCompositions(&p, now)
|
||||
_, notAsked := releaseCompositions(&p, now, h.kept(key))
|
||||
readers = append(readers, notAsked...)
|
||||
}
|
||||
asked, err := askApproval(key, &p, now, h.Asker)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ended := h.endPipeline(&p, now)
|
||||
ended := h.endPipeline(&p, now, wr)
|
||||
if _, err := h.Store.Update(key, p, rev); errors.Is(err, ErrChanged) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshgrants"
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
|
||||
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
|
||||
)
|
||||
|
||||
// refusedOnce is a store whose first write of a pipeline is refused as changed, another write having come between (the
|
||||
// pipeline's key moving while its end is judged, as main.117's did).
|
||||
type refusedOnce struct {
|
||||
memStore
|
||||
refused map[string]bool
|
||||
}
|
||||
|
||||
func (r *refusedOnce) Update(key string, p seat.Pipeline, rev uint64) (uint64, error) {
|
||||
if !r.refused[key] {
|
||||
r.refused[key] = true
|
||||
e := r.memStore[key]
|
||||
e.rev++
|
||||
r.memStore[key] = e
|
||||
return 0, ErrChanged
|
||||
}
|
||||
return r.memStore.Update(key, p, rev)
|
||||
}
|
||||
|
||||
// H-A-288, H-A-289 (met with main.117 and main.76): a pipeline ends, and the next waiting is placed, the moment nothing of it is
|
||||
// still open: when its last mover leaves, when its last open step ends by the silent bound, and at the runner's start pass;
|
||||
// its outcome is said in the journal. The reads its end needs are made once, before the compare-and-set, shared by every mover
|
||||
// and every retry of the write: a write refused once is written at the retry without asking grants-for again.
|
||||
func TestAPipelineWithNothingOpenEndsAtOnce(t *testing.T) {
|
||||
t0 := time.Date(2026, 11, 21, 17, 45, 19, 0, time.UTC)
|
||||
movers := []seat.Mover{{Module: "a", Commit: "c1", Fingerprint: "src2:a1"}, {Module: "b", Commit: "c1", Fingerprint: "src2:b1"},
|
||||
{Module: "c", Commit: "c1", Fingerprint: "src2:c1"}}
|
||||
step := func(module, outcome, ask string) seat.StepResult {
|
||||
return seat.StepResult{Module: module, Step: seat.StepResultStepBuild, Status: seat.StepResultStatusRequired, Outcome: outcome, Ask: ask, Seat: builds.Seat}
|
||||
}
|
||||
rows := []struct {
|
||||
name string
|
||||
steps []seat.StepResult
|
||||
end func(t *testing.T, h *Hearer)
|
||||
outcome string
|
||||
}{
|
||||
{"its last mover leaves for a newer pipeline (H-A-223)",
|
||||
[]seat.StepResult{step("a", seat.StepResultOutcomeRunning, "x1"), step("b", seat.StepResultOutcomePassed, "x2"), step("c", seat.StepResultOutcomePassed, "x3")},
|
||||
func(t *testing.T, h *Hearer) {
|
||||
h.SupersedeRunning(seat.Pipeline{Pipeline: "main.120", Branch: "main", Revision: 120, Movers: []seat.Mover{
|
||||
{Module: "a", Commit: "c2", Fingerprint: "src2:a2"}, {Module: "b", Commit: "c2", Fingerprint: "src2:b2"}, {Module: "c", Commit: "c2", Fingerprint: "src2:c2"}}})
|
||||
}, seat.PipelineOutcomeSuperseded},
|
||||
{"its last open step ends could not run on the silent bound (H-A-243)",
|
||||
[]seat.StepResult{step("a", seat.StepResultOutcomeRunning, "mwql5pio3390aa"), step("b", seat.StepResultOutcomePassed, "x2"), step("c", seat.StepResultOutcomePassed, "x3")},
|
||||
func(t *testing.T, h *Hearer) {
|
||||
if err := h.endUnanswered("main.117", "mwql5pio3390aa", SilentWhy("mwql5pio3390aa")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}, seat.PipelineOutcomeFailed},
|
||||
{"the runner's start pass finds it with nothing open",
|
||||
[]seat.StepResult{step("a", seat.StepResultOutcomePassed, "x1"), step("b", seat.StepResultOutcomePassed, "x2"), step("c", seat.StepResultOutcomePassed, "x3")},
|
||||
func(t *testing.T, h *Hearer) {
|
||||
if n, err := h.EndAtStart(); n != 1 || err != nil {
|
||||
t.Fatalf("the start pass ended %d (%v), want 1", n, err)
|
||||
}
|
||||
}, seat.PipelineOutcomePassed},
|
||||
}
|
||||
for _, r := range rows {
|
||||
t.Run(r.name, func(t *testing.T) {
|
||||
store := &refusedOnce{memStore: memStore{}, refused: map[string]bool{}}
|
||||
store.memStore["main.117"] = struct {
|
||||
p seat.Pipeline
|
||||
rev uint64
|
||||
}{seat.Pipeline{V: 1, Pipeline: "main.117", Branch: "main", Source: 117, Revision: 117, Outcome: seat.PipelineOutcomeRunning,
|
||||
Movers: slices.Clone(movers), Steps: slices.Clone(r.steps)}, 1}
|
||||
// Another running pipeline with a step open, and one waiting its turn: neither ends.
|
||||
store.memStore["main.118"] = struct {
|
||||
p seat.Pipeline
|
||||
rev uint64
|
||||
}{seat.Pipeline{V: 1, Pipeline: "main.118", Branch: "other", Source: 118, Revision: 118, Outcome: seat.PipelineOutcomeRunning,
|
||||
Movers: movers[:1], Steps: []seat.StepResult{step("a", seat.StepResultOutcomeRunning, "y1")}}, 1}
|
||||
store.memStore["main.119"] = struct {
|
||||
p seat.Pipeline
|
||||
rev uint64
|
||||
}{seat.Pipeline{V: 1, Pipeline: "main.119", Branch: "other", Source: 119, Revision: 119, Outcome: seat.PipelineOutcomeWaiting, Movers: movers[:1]}, 1}
|
||||
store.refused["main.118"], store.refused["main.119"] = true, true
|
||||
grants, revisions := 0, 0
|
||||
w := &Widener{
|
||||
Revision: func(string, int64) (Half, error) { revisions++; return Half{}, nil },
|
||||
Holder: func(s string) (string, error) { return s, nil },
|
||||
GrantsFor: func(string, int64) (meshgrants.GrantsFor, error) {
|
||||
grants++
|
||||
return meshgrants.GrantsFor{}, fmt.Errorf("cut after 5s")
|
||||
},
|
||||
}
|
||||
var turned, journal []string
|
||||
h := &Hearer{Store: store, Say: func(string, any) error { return nil }, Now: func() time.Time { return t0 }, Widens: w.Reads,
|
||||
Turn: func(key string) { turned = append(turned, key) },
|
||||
Logf: func(f string, a ...any) { journal = append(journal, fmt.Sprintf(f, a...)) }}
|
||||
r.end(t, h)
|
||||
p, _, _ := store.Get("main.117")
|
||||
if p.Outcome != r.outcome {
|
||||
t.Fatalf("main.117 = %s (%s), want %s", p.Outcome, p.Why, r.outcome)
|
||||
}
|
||||
if !slices.Equal(turned, []string{"main.117"}) {
|
||||
t.Errorf("the turns freed = %v, want main.117's alone, so the next waiting is placed", turned)
|
||||
}
|
||||
if !slices.ContainsFunc(journal, func(l string) bool { return strings.HasPrefix(l, "main.117 ended "+r.outcome) }) {
|
||||
t.Errorf("the journal does not say main.117's end %s: %q", r.outcome, journal)
|
||||
}
|
||||
if grants != 1 || revisions != 2 {
|
||||
t.Errorf("the end asked grants-for %d times and a revision %d times over 3 movers and a refused write, want 1 and 2", grants, revisions)
|
||||
}
|
||||
for _, m := range p.Movers {
|
||||
if len(m.Widens) != 1 || m.Widens[0].Name != "mesh-grants" {
|
||||
t.Errorf("%s's widens = %+v, want the cut grants-for said", m.Module, m.Widens)
|
||||
}
|
||||
}
|
||||
for _, k := range []string{"main.118", "main.119"} {
|
||||
if q, _, _ := store.Get(k); q.Outcome == seat.PipelineOutcomeSuperseded || q.Outcome == seat.PipelineOutcomePassed || q.Outcome == seat.PipelineOutcomeFailed {
|
||||
t.Errorf("%s ended %s with a step open or waiting its turn", k, q.Outcome)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -288,6 +288,65 @@ func (s *MoverStore) Get(key string) (seat.Pipeline, uint64, error) {
|
||||
// when the record or a mover key was written since the read revision gave. A record carrying its steps inline has its
|
||||
// mover keys written before the record, so its steps are never lost between the two.
|
||||
func (s *MoverStore) Update(key string, p seat.Pipeline, revision uint64) (uint64, error) {
|
||||
return s.update(key, p, revision, nil)
|
||||
}
|
||||
|
||||
// UpdateKept is Update with kept laid over the record's kept-revisions (H-A-285): the catalog revision each kept mover's
|
||||
// fingerprint is from (H-A-283, H-A-284 (2)).
|
||||
func (s *MoverStore) UpdateKept(key string, p seat.Pipeline, revision uint64, kept map[string]int64) (uint64, error) {
|
||||
return s.update(key, p, revision, kept)
|
||||
}
|
||||
|
||||
// KeptRevisions are pipeline key's kept-revisions, the catalog revision each mover a same-source re-pin kept in it is from
|
||||
// (H-A-283, H-A-284 (2), H-A-285); none for a pipeline that kept none.
|
||||
func (s *MoverStore) KeptRevisions(key string) (map[string]int64, error) {
|
||||
defer s.lock(key)()
|
||||
raw, _, err := s.Raw.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if raw == nil {
|
||||
return nil, fmt.Errorf("%w: %s", ErrNoPipeline, key)
|
||||
}
|
||||
return keptOf(raw)
|
||||
}
|
||||
|
||||
// keptRevisionsField is the pipeline record's property kept-revisions, beside its movers (H-A-285): written and read by the
|
||||
// runner alone, never part of the seat's Go form of a pipeline, which drops it on every decode.
|
||||
const keptRevisionsField = "kept-revisions"
|
||||
|
||||
// keptOf is the kept-revisions a record carries; none when it carries none.
|
||||
func keptOf(raw []byte) (map[string]int64, error) {
|
||||
var fields map[string]json.RawMessage
|
||||
if err := json.Unmarshal(raw, &fields); err != nil {
|
||||
return nil, fmt.Errorf("the record is no object: %w", err)
|
||||
}
|
||||
f, ok := fields[keptRevisionsField]
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
var kept map[string]int64
|
||||
if err := json.Unmarshal(f, &kept); err != nil {
|
||||
return nil, fmt.Errorf("the record's %s is no map of module to revision: %w", keptRevisionsField, err)
|
||||
}
|
||||
return kept, nil
|
||||
}
|
||||
|
||||
// withKept is record with kept as its kept-revisions.
|
||||
func withKept(record []byte, kept map[string]int64) ([]byte, error) {
|
||||
var fields map[string]json.RawMessage
|
||||
if err := json.Unmarshal(record, &fields); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
raw, err := json.Marshal(kept)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fields[keptRevisionsField] = raw
|
||||
return json.Marshal(fields)
|
||||
}
|
||||
|
||||
func (s *MoverStore) update(key string, p seat.Pipeline, revision uint64, kept map[string]int64) (uint64, error) {
|
||||
defer s.lock(key)()
|
||||
record, want, err := split(key, p)
|
||||
if err != nil {
|
||||
@@ -303,6 +362,20 @@ func (s *MoverStore) Update(key string, p seat.Pipeline, revision uint64) (uint6
|
||||
if cur != revision {
|
||||
return 0, ErrChanged
|
||||
}
|
||||
// The record's kept-revisions ride on through every write, kept laid over them (H-A-285).
|
||||
merged, err := keptOf(raw)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("the pipeline %s: %w", key, err)
|
||||
}
|
||||
if len(kept) > 0 && merged == nil {
|
||||
merged = map[string]int64{}
|
||||
}
|
||||
maps.Copy(merged, kept)
|
||||
if len(merged) > 0 {
|
||||
if record, err = withKept(record, merged); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
vals, revs, err := s.moverKeys(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
||||
@@ -61,7 +61,18 @@ var moduleSteps = []string{seat.StepResultStepValidate, seat.StepResultStepCompo
|
||||
// placement makes the same id at every start and the bus dedupes on it, and each mover's step its own id (design 47 H
|
||||
// §746); started is the pipeline's start time, or a rerun's own (design 47 G A-297).
|
||||
func AskID(started time.Time, pipeline, module, artifact, step string) string {
|
||||
sum := sha256.Sum256([]byte(pipeline + "\n" + module + "\n" + artifact + "\n" + step))
|
||||
return keptAskID(started, pipeline, module, artifact, step, 0)
|
||||
}
|
||||
|
||||
// keptAskID is AskID of a step of a mover a same-source re-pin kept at catalog revision kept (H-A-286): the kept revision
|
||||
// is mixed into the id's sum, so no id equals one the pipeline asked for the mover's old fingerprint, and every placing,
|
||||
// pin-held ask, composition, rerun and restart of the kept mover finds the same ids again; kept 0 is AskID's own form.
|
||||
func keptAskID(started time.Time, pipeline, module, artifact, step string, kept int64) string {
|
||||
in := pipeline + "\n" + module + "\n" + artifact + "\n" + step
|
||||
if kept > 0 {
|
||||
in += "\nkept " + strconv.FormatInt(kept, 10)
|
||||
}
|
||||
sum := sha256.Sum256([]byte(in))
|
||||
return strconv.FormatInt(started.UnixMilli(), 36) + hex.EncodeToString(sum[:3])
|
||||
}
|
||||
|
||||
@@ -80,14 +91,16 @@ func startOf(p seat.Pipeline, now time.Time) time.Time {
|
||||
// could not run naming the missing seat; the module's steps wait. It returns the steps and the asks to put on the seats'
|
||||
// work queues, one per running step.
|
||||
func Place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[string]catalog.CatalogEntry, now time.Time, asker string) ([]seat.StepResult, []Asked) {
|
||||
return place(p, m, reg, entries, now, asker, true)
|
||||
return place(p, m, reg, entries, now, asker, true, 0)
|
||||
}
|
||||
|
||||
// place is Place; share false places each build step its own ask, as a step asked before the test runs is (§730, A-468k).
|
||||
// With share, the build steps of one candidate, level and share digest are asked once (§724): the first artifact's step, in
|
||||
// reference order, asks the run and names it in Shared; every other step of the key reads it, keeping no ask of its own and
|
||||
// naming the run's ask and the step that asked it (A-469m, A-469q).
|
||||
func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[string]catalog.CatalogEntry, now time.Time, asker string, share bool) ([]seat.StepResult, []Asked) {
|
||||
// kept is the catalog revision a same-source re-pin kept m at, 0 for a mover not kept: its every ask id mixes it in
|
||||
// (H-A-286).
|
||||
func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[string]catalog.CatalogEntry, now time.Time, asker string, share bool, kept int64) ([]seat.StepResult, []Asked) {
|
||||
entry := entries[m.Module]
|
||||
candidate, named := CandidateOf(p)
|
||||
share = share && named
|
||||
@@ -99,16 +112,9 @@ func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[
|
||||
// The build step is every mover's first, required whatever the policy names, asked of the seat mesh-builds for the
|
||||
// mover's own entry only (A-99, A-97): each mover is built by its own step (§746).
|
||||
build := seat.StepResult{Step: seat.StepResultStepBuild, Module: m.Module, Status: seat.StepResultStatusRequired, Fingerprint: m.Fingerprint,
|
||||
Seat: builds.Seat, Outcome: seat.StepResultOutcomeRunning, Started: &now, Ask: AskID(startOf(p, now), p.Pipeline, m.Module, "", seat.StepResultStepBuild)}
|
||||
Seat: builds.Seat, Outcome: seat.StepResultOutcomeRunning, Started: &now, Ask: keptAskID(startOf(p, now), p.Pipeline, m.Module, "", seat.StepResultStepBuild, kept)}
|
||||
steps = append(steps, build)
|
||||
// A run on request's build step ask names no source (the seat mesh-builds' contract; H-A-162): its candidate's
|
||||
// fingerprints are never in the builder's picture of the branch, so it waits for no revision there.
|
||||
source := p.Source
|
||||
if p.Run != "" {
|
||||
source = 0
|
||||
}
|
||||
asks = append(asks, Asked{Seat: builds.Seat, ID: build.Ask, Commit: m.Commit, Ask: builds.StepRun{Pipeline: p.Pipeline, Step: builds.StepRunStepBuild, Branch: p.Branch,
|
||||
Revision: p.Revision, Source: source, Entries: []builds.BuildEntry{{Module: m.Module, Commit: m.Commit, Fingerprint: m.Fingerprint}}}})
|
||||
asks = append(asks, buildAsk(p, m, build.Ask))
|
||||
for _, a := range arts {
|
||||
name := a.Ref
|
||||
if _, after, ok := strings.Cut(a.Ref, ":"); ok {
|
||||
@@ -151,7 +157,7 @@ func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[
|
||||
continue
|
||||
}
|
||||
s.Seat, s.Outcome, s.Started = bs, seat.StepResultOutcomeRunning, &now
|
||||
s.Ask = AskID(startOf(p, now), p.Pipeline, m.Module, a.Ref, step)
|
||||
s.Ask = keptAskID(startOf(p, now), p.Pipeline, m.Module, a.Ref, step, kept)
|
||||
body := stepAsk(p, m, entry, a, language, step, s.Ask, asker, now)
|
||||
ask := Asked{Seat: bs, ID: s.Ask, Ask: body, Toolchain: a.Language, Commit: m.Commit}
|
||||
if share && BoundSeat(bs) {
|
||||
@@ -196,7 +202,7 @@ func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[
|
||||
// validate is the assigner's, an accepted kind step of the seat mesh-wants, run once per take-in revision: every
|
||||
// mover's validate step reads the one ask, its id naming no mover (§745, H-A-51).
|
||||
s.Seat, s.Outcome, s.Started, s.Fingerprint = wants.Seat, seat.StepResultOutcomeRunning, &now, m.Fingerprint
|
||||
s.Ask = ValidateAskID(p, now)
|
||||
s.Ask = keptAskID(startOf(p, now), p.Pipeline, "", "", seat.StepResultStepValidate, kept)
|
||||
asks = append(asks, wantsAsk(p, m, s.Ask, wants.StepRunStepValidate))
|
||||
validating = true
|
||||
case seat.StepResultStepComposition:
|
||||
@@ -204,7 +210,7 @@ func place(p seat.Pipeline, m seat.Mover, reg catalog.Registration, entries map[
|
||||
// runner's seat as its asker (H-A-88). It is asked once the mover's validate passed, at once when it has none
|
||||
// (§745).
|
||||
s.Seat, s.Fingerprint = wants.Seat, m.Fingerprint
|
||||
s.Ask = AskID(startOf(p, now), p.Pipeline, m.Module, "", step)
|
||||
s.Ask = keptAskID(startOf(p, now), p.Pipeline, m.Module, "", step, kept)
|
||||
if validating {
|
||||
s.Ask, s.Why = "", "asked once validate passed"
|
||||
break
|
||||
@@ -309,12 +315,13 @@ func (s *Starter) AskPinHeld(store Updater, key, module string, pins map[string]
|
||||
return 0, nil
|
||||
}
|
||||
var entry catalog.CatalogEntry
|
||||
unread := ""
|
||||
switch half, err := readRevision(revision, p.Branch, p.Revision); {
|
||||
at, kept, whose, unread := moverRevision(store, p, module)
|
||||
switch half, err := readRevision(revision, p.Branch, at); {
|
||||
case unread != "":
|
||||
case err != nil:
|
||||
unread = fmt.Sprintf("revision %d of %s, the pipeline's, cannot be read for its entry: %v", p.Revision, p.Branch, err)
|
||||
unread = fmt.Sprintf("revision %d of %s, %s, cannot be read for its entry: %v", at, p.Branch, whose, err)
|
||||
case half.Entries[module].Fp != m.Fingerprint:
|
||||
unread = fmt.Sprintf("revision %d of %s holds %s at %q, not the mover's %s", p.Revision, p.Branch, module, half.Entries[module].Fp, m.Fingerprint)
|
||||
unread = fmt.Sprintf("revision %d of %s holds %s at %q, not the mover's %s", at, p.Branch, module, half.Entries[module].Fp, m.Fingerprint)
|
||||
default:
|
||||
entry = half.Entries[module]
|
||||
}
|
||||
@@ -332,7 +339,7 @@ func (s *Starter) AskPinHeld(store Updater, key, module string, pins map[string]
|
||||
if unread != "" || j < 0 || err != nil {
|
||||
why := unread
|
||||
if why == "" {
|
||||
why = fmt.Sprintf("revision %d of %s names no artifact %s of %s to ask it of", p.Revision, p.Branch, st.Artifact, module)
|
||||
why = fmt.Sprintf("revision %d of %s names no artifact %s of %s to ask it of", at, p.Branch, st.Artifact, module)
|
||||
}
|
||||
st.Outcome, st.Ended = seat.StepResultOutcomeCouldNotRun, &now
|
||||
st.Why = "its build passed with its pins, but " + why + " (H-A-207, H-A-205)"
|
||||
@@ -342,7 +349,7 @@ func (s *Starter) AskPinHeld(store Updater, key, module string, pins map[string]
|
||||
}
|
||||
a := entry.Artifacts[j]
|
||||
st.Outcome, st.Why, st.Started = seat.StepResultOutcomeRunning, "", &now
|
||||
st.Ask = AskID(startOf(p, now), p.Pipeline, module, a.Ref, st.Step)
|
||||
st.Ask = keptAskID(startOf(p, now), p.Pipeline, module, a.Ref, st.Step, kept)
|
||||
ask := Asked{Seat: st.Seat, ID: st.Ask, Ask: stepAsk(p, m, entry, a, language, st.Step, st.Ask, s.Name, now), Toolchain: a.Language, Commit: m.Commit}
|
||||
if a.Package != nil {
|
||||
ask.Package = a.Package.Name
|
||||
@@ -363,6 +370,57 @@ func (s *Starter) AskPinHeld(store Updater, key, module string, pins map[string]
|
||||
}
|
||||
}
|
||||
|
||||
// keptRevisions is the state pipelines' kept-revisions (MoverStore, H-A-285): the catalog revision each mover a same-source
|
||||
// re-pin kept in a pipeline is from (H-A-283, H-A-284 (2)).
|
||||
type keptRevisions interface {
|
||||
KeptRevisions(key string) (map[string]int64, error)
|
||||
UpdateKept(key string, p seat.Pipeline, revision uint64, kept map[string]int64) (uint64, error)
|
||||
}
|
||||
|
||||
// moverRevision is the catalog revision mover module's entry of p is read at (H-A-284 (2)): the one its pipeline kept it at
|
||||
// when a same-source re-pin kept it, else the pipeline's; whose says which, and unread why it is not read when its record
|
||||
// cannot be.
|
||||
// It answers that revision, the kept revision (0 for a mover not kept), whose it is, and why it is not read.
|
||||
func moverRevision(store Updater, p seat.Pipeline, module string) (int64, int64, string, string) {
|
||||
kept, err := keptOfStore(store, p.Pipeline)
|
||||
if err != nil {
|
||||
return p.Revision, 0, "the pipeline's", fmt.Sprintf("the revision %s was kept at in %s cannot be read: %v", module, p.Pipeline, err)
|
||||
}
|
||||
if r := kept[module]; r > 0 {
|
||||
return r, r, "the one the pipeline kept " + module + " at (H-A-284)", ""
|
||||
}
|
||||
return p.Revision, 0, "the pipeline's", ""
|
||||
}
|
||||
|
||||
// keptOfStore is pipeline key's kept-revisions in store (H-A-285); none for a store that keeps none.
|
||||
func keptOfStore(store any, key string) (map[string]int64, error) {
|
||||
ks, ok := store.(keptRevisions)
|
||||
if !ok || key == "" {
|
||||
return nil, nil
|
||||
}
|
||||
kept, err := ks.KeptRevisions(key)
|
||||
if errors.Is(err, ErrNoPipeline) {
|
||||
return nil, nil // a pipeline not written yet keeps none
|
||||
}
|
||||
return kept, err
|
||||
}
|
||||
|
||||
// keptEntries are the entries of branch's catalog revision rev, the one a same-source re-pin kept a mover at, read by its
|
||||
// number (H-A-286): a kept mover is placed and pin-checked from them, never from the branch's held view; false while they
|
||||
// cannot be read, and the mover waits.
|
||||
func (s *Starter) keptEntries(branch string, rev int64) (map[string]catalog.CatalogEntry, bool) {
|
||||
if s.Revision == nil {
|
||||
s.logf("the runner reads no catalog revision, so a mover kept at revision %d of %s waits", rev, branch)
|
||||
return nil, false
|
||||
}
|
||||
half, err := s.Revision(branch, rev)
|
||||
if err != nil || half.Revision != rev {
|
||||
s.logf("revision %d of %s, which a mover is kept at, is not read (%v): the mover waits for it (H-A-286)", rev, branch, err)
|
||||
return nil, false
|
||||
}
|
||||
return half.Entries, true
|
||||
}
|
||||
|
||||
func stepAsk(p seat.Pipeline, m seat.Mover, e catalog.CatalogEntry, a catalog.Artifact, language, step, id, asker string, now time.Time) nodebuildgo.StepAsk {
|
||||
// A step is for its module alone (principle 10, A-447): the fetch always names the module's directory, and the
|
||||
// artifact's named paths in it when the entry has them.
|
||||
@@ -440,7 +498,8 @@ func wantsAsk(p seat.Pipeline, m seat.Mover, id, step string) Asked {
|
||||
// releaseCompositions asks the composition of each mover whose validate ended passed, and ends `not asked` the composition
|
||||
// of each whose validate did not pass, so a manifest the validator refuses is never composed (design 47 H §745). It answers
|
||||
// the asks to put and the indexes of the steps it ended.
|
||||
func releaseCompositions(p *seat.Pipeline, now time.Time) ([]Asked, []int) {
|
||||
// kept is p's kept-revisions: a kept mover's composition id mixes its kept revision in (H-A-286).
|
||||
func releaseCompositions(p *seat.Pipeline, now time.Time, kept map[string]int64) ([]Asked, []int) {
|
||||
var asks []Asked
|
||||
var ended []int
|
||||
for _, m := range p.Movers {
|
||||
@@ -466,7 +525,7 @@ func releaseCompositions(p *seat.Pipeline, now time.Time) ([]Asked, []int) {
|
||||
ended = append(ended, c)
|
||||
continue
|
||||
}
|
||||
s.Ask = AskID(startOf(*p, now), p.Pipeline, m.Module, "", seat.StepResultStepComposition)
|
||||
s.Ask = keptAskID(startOf(*p, now), p.Pipeline, m.Module, "", seat.StepResultStepComposition, kept[m.Module])
|
||||
s.Outcome, s.Started, s.Why = seat.StepResultOutcomeRunning, &now, ""
|
||||
asks = append(asks, wantsAsk(*p, m, s.Ask, wants.StepRunStepComposition))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
|
||||
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
|
||||
)
|
||||
|
||||
// keepSameSource keeps, in the open pipeline of the same source revision that holds it, each mover of the revision half a
|
||||
// re-pin made (design 47 H H-A-283): a revision of the same source moves no mover out of a running or waiting pipeline (as
|
||||
// H-A-223 and H-A-244 (1) move one for a revision of a new source); the pipeline keeps the mover and takes its new
|
||||
// fingerprint, and the revision's own pipeline starts without it. It answers the movers no open pipeline of the source
|
||||
// holds, which the revision's pipeline carries.
|
||||
func (s *Starter) keepSameSource(branch string, half Half, movers []seat.Mover) []seat.Mover {
|
||||
if s.Store == nil || len(movers) == 0 {
|
||||
return movers
|
||||
}
|
||||
pkeys, err := branchKeys(s.Store, branch)
|
||||
if err != nil {
|
||||
s.logf("the pipelines of %s are not listed, so no open pipeline of source %d keeps the movers of revision %d: %v", branch, half.Source, half.Revision, err)
|
||||
return movers
|
||||
}
|
||||
left := movers
|
||||
for _, key := range pkeys {
|
||||
if len(left) == 0 {
|
||||
break
|
||||
}
|
||||
left = s.keepIn(key, half, left)
|
||||
}
|
||||
return left
|
||||
}
|
||||
|
||||
// holdsOpen says whether the pipeline p, not ended and of no run on request, is of revision half's source, older than it, and
|
||||
// still holds mover module as its own.
|
||||
func holdsOpen(p seat.Pipeline, half Half, module string) bool {
|
||||
return (p.Outcome == seat.PipelineOutcomeRunning || p.Outcome == seat.PipelineOutcomeWaiting) && p.Run == "" &&
|
||||
p.Source == half.Source && p.Revision < half.Revision && Moves(p, module) && !slices.Contains(p.Superseded, module)
|
||||
}
|
||||
|
||||
// keepIn keeps in pipeline key each of movers it holds (H-A-283), answering the movers it does not hold. A kept mover whose
|
||||
// fingerprint the re-pin moved takes its new fingerprint and commit, and the pipeline keeps the revision it is from in its
|
||||
// kept-revisions (H-A-285); when its steps were placed, every one of them, open or ended, ends superseded and its steps are
|
||||
// placed again from the revision's entry, the build first (H-A-284 (1)), each under an ask id its kept revision is mixed
|
||||
// into (H-A-286), so no ask of the old fingerprint is kept for the new. One not placed yet is placed when it is due, from
|
||||
// the entries of the revision it is kept at.
|
||||
func (s *Starter) keepIn(key string, half Half, movers []seat.Mover) []seat.Mover {
|
||||
for {
|
||||
p, rev, err := s.Store.Get(key)
|
||||
if err != nil {
|
||||
return movers
|
||||
}
|
||||
var kept, left []seat.Mover
|
||||
for _, m := range movers {
|
||||
if holdsOpen(p, half, m.Module) {
|
||||
kept = append(kept, m)
|
||||
} else {
|
||||
left = append(left, m)
|
||||
}
|
||||
}
|
||||
if len(kept) == 0 {
|
||||
return movers
|
||||
}
|
||||
now := s.now()
|
||||
why := fmt.Sprintf("superseded: the re-pin revision %d of the pipeline's own source %d moved its mover's fingerprint; its steps are placed again (H-A-283, H-A-284)", half.Revision, half.Source)
|
||||
revisions := map[string]int64{}
|
||||
olds := slices.Clone(p.Movers) // the superseded steps are said at the fingerprint they ran for
|
||||
var moved, unregistered []string
|
||||
var ended []seat.StepResult
|
||||
var leave, drop []seat.StepResult
|
||||
var asks []Asked
|
||||
var notAsked []int
|
||||
for _, m := range kept {
|
||||
i := slices.IndexFunc(p.Movers, func(o seat.Mover) bool { return o.Module == m.Module })
|
||||
old := p.Movers[i]
|
||||
if old.Fingerprint == m.Fingerprint && old.Commit == m.Commit {
|
||||
continue
|
||||
}
|
||||
p.Movers[i].Fingerprint, p.Movers[i].Commit = m.Fingerprint, m.Commit
|
||||
revisions[m.Module] = half.Revision
|
||||
moved = append(moved, fmt.Sprintf("%s %s to %s", m.Module, old.Fingerprint, m.Fingerprint))
|
||||
if p.Outcome != seat.PipelineOutcomeRunning || !placed(p, m.Module) {
|
||||
continue
|
||||
}
|
||||
rest := make([]seat.StepResult, 0, len(p.Steps))
|
||||
for _, st := range p.Steps {
|
||||
if st.Module != m.Module {
|
||||
rest = append(rest, st)
|
||||
continue
|
||||
}
|
||||
live := open(st) || st.Outcome == seat.StepResultOutcomeWaiting
|
||||
l, d := supersedeStep(&p, &st, why, now)
|
||||
if live {
|
||||
leave, drop = append(leave, l...), append(drop, d...)
|
||||
}
|
||||
ended = append(ended, st)
|
||||
}
|
||||
p.Steps = rest
|
||||
a, n, unreg := s.placeAgain(&p, p.Movers[i], half, now)
|
||||
asks, notAsked = append(asks, a...), append(notAsked, n...)
|
||||
if unreg {
|
||||
unregistered = append(unregistered, m.Module)
|
||||
}
|
||||
}
|
||||
if len(moved) == 0 {
|
||||
s.logf("%s keeps %d movers of revision %d, of its own source %d, at the fingerprints it holds (H-A-283)", key, len(kept), half.Revision, half.Source)
|
||||
return left
|
||||
}
|
||||
var holderEnded []int
|
||||
if len(asks) > 0 {
|
||||
asks, holderEnded = s.holderless(&p, asks, now)
|
||||
}
|
||||
ks, keeps := s.Store.(keptRevisions)
|
||||
if keeps {
|
||||
_, err = ks.UpdateKept(key, p, rev, revisions)
|
||||
} else {
|
||||
_, err = s.Store.Update(key, p, rev)
|
||||
}
|
||||
if errors.Is(err, ErrChanged) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
s.logf("%s is not written, so the movers revision %d re-pinned stay its own at their old fingerprints: %v", key, half.Revision, err)
|
||||
return left
|
||||
}
|
||||
if !keeps {
|
||||
s.logf("%s keeps no kept-revisions, so the pin check of its re-pinned movers reads the pipeline's revision (H-A-285)", key)
|
||||
}
|
||||
s.logf("%s keeps the movers revision %d of its own source %d re-pinned, %s: %d steps ended superseded, %d asked again (H-A-283, H-A-284)",
|
||||
key, half.Revision, half.Source, strings.Join(moved, ", "), len(ended), len(asks))
|
||||
for _, st := range ended {
|
||||
if s.Say == nil {
|
||||
break
|
||||
}
|
||||
was := p
|
||||
was.Movers = olds
|
||||
if err := s.Say(stepEvent(seat.EventStepEnded, was, st, now)); err != nil {
|
||||
s.logf("step-ended of %s's %s %s, superseded, is not said: %v", key, st.Module, st.Step, err)
|
||||
}
|
||||
}
|
||||
if s.Left != nil {
|
||||
s.Left(key, leave, drop, why)
|
||||
}
|
||||
for _, m := range unregistered {
|
||||
s.logf("%s: %s has no registration yet: its steps wait on its registration, which places them (A-327)", key, m)
|
||||
s.registrationMissing(m, key)
|
||||
}
|
||||
s.sayNotAsked(p, notAsked)
|
||||
if len(holderEnded) > 0 {
|
||||
if err := s.endedAtPlacing(p, holderEnded); err != nil {
|
||||
s.logf("%v", err)
|
||||
}
|
||||
return left
|
||||
}
|
||||
if s.Steps != nil && len(asks) > 0 {
|
||||
if err := s.askSteps(key, asks); err != nil {
|
||||
s.logf("%s: the steps placed again are not all put, they are asked at the next start: %v", key, err)
|
||||
}
|
||||
}
|
||||
return left
|
||||
}
|
||||
}
|
||||
|
||||
// placeAgain places the steps of kept mover m of p from the re-pin revision half's entry (H-A-284 (1)), as a mover is placed
|
||||
// (placeMovers), under ask ids its kept revision is mixed into (H-A-286): it answers the asks to put, the steps placed not asked because a
|
||||
// dependency did not build, and whether m has no registration. A mover not due yet (it waits on a publish) is left
|
||||
// unplaced, placed when the publish is heard.
|
||||
func (s *Starter) placeAgain(p *seat.Pipeline, m seat.Mover, half Half, now time.Time) ([]Asked, []int, bool) {
|
||||
if s.Registration == nil {
|
||||
return nil, nil, false
|
||||
}
|
||||
r, ok := s.Registration(m.Module)
|
||||
if !ok {
|
||||
return nil, nil, true
|
||||
}
|
||||
due, waiting, failed := ready(*p, m.Module, half.Entries)
|
||||
if !due && failed == "" {
|
||||
s.logf("%s: %s waits for %s before its build", p.Pipeline, m.Module, strings.Join(waiting, ", "))
|
||||
return nil, nil, false
|
||||
}
|
||||
steps, asks := place(*p, m, r, half.Entries, now, s.Name, true, half.Revision)
|
||||
supersededWhy(*p, m.Module, half.Entries, steps)
|
||||
var notAsked []int
|
||||
if failed != "" {
|
||||
why := "its dependency " + failed + " did not build"
|
||||
for k := range steps {
|
||||
st := &steps[k]
|
||||
if st.Outcome == seat.StepResultOutcomeBypassed {
|
||||
continue
|
||||
}
|
||||
st.Outcome, st.Why, st.Ask, st.Shared, st.Ended = seat.StepResultOutcomeNotAsked, why, "", nil, &now
|
||||
p.Unlogged = append(p.Unlogged, endEntry(p.Pipeline, *st, now))
|
||||
notAsked = append(notAsked, len(p.Steps)+k)
|
||||
}
|
||||
asks = nil
|
||||
}
|
||||
p.Steps = append(p.Steps, steps...)
|
||||
return asks, notAsked, false
|
||||
}
|
||||
|
||||
// buildAsk is mover m's build step ask under id, of the seat mesh-builds for the mover's own entry only (A-99, A-97): a run on
|
||||
// request's names no source (H-A-162).
|
||||
func buildAsk(p seat.Pipeline, m seat.Mover, id string) Asked {
|
||||
source := p.Source
|
||||
if p.Run != "" {
|
||||
source = 0
|
||||
}
|
||||
return Asked{Seat: builds.Seat, ID: id, Commit: m.Commit, Ask: builds.StepRun{Pipeline: p.Pipeline, Step: builds.StepRunStepBuild, Branch: p.Branch,
|
||||
Revision: p.Revision, Source: source, Entries: []builds.BuildEntry{{Module: m.Module, Commit: m.Commit, Fingerprint: m.Fingerprint}}}}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
|
||||
catalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
||||
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
|
||||
nodebuildgo "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
|
||||
"git.novox.be/novox/mesh-sdk/go/keys"
|
||||
)
|
||||
|
||||
// ticking is a clock that moves a second at every read, so a start and a later re-pin never share a millisecond.
|
||||
func ticking() func() time.Time {
|
||||
at := time.Date(2026, 11, 21, 17, 0, 0, 0, time.UTC)
|
||||
return func() time.Time { at = at.Add(time.Second); return at }
|
||||
}
|
||||
|
||||
// repinFixture is a pipeline main.10 of source 41 moving app at src2:aa, started, with the re-pin revision 11 of the same
|
||||
// source moving app to src2:ab (an entry naming a package with no version yet), and a revision 12 of a new source 42.
|
||||
func repinFixture() (catalog.Registration, map[string]catalog.CatalogEntry, map[string]catalog.CatalogEntry, func(string, int64) (Half, error)) {
|
||||
reg, entries := placeFixture()
|
||||
repinned := map[string]catalog.CatalogEntry{}
|
||||
for k, e := range entries {
|
||||
repinned[k] = e
|
||||
}
|
||||
app := entries["app"]
|
||||
app.Fp = "src2:aa"
|
||||
entries["app"] = app
|
||||
re := app
|
||||
re.Fp, re.Packages = "src2:ab", map[string]string{"git.novox.be/novox/mesh-sdk/go": "v0.1.26", "git.novox.be/novox/x/go": ""}
|
||||
repinned["app"] = re
|
||||
read := func(branch string, revision int64) (Half, error) {
|
||||
switch revision {
|
||||
case 10:
|
||||
return Half{Revision: 10, Source: 41, Entries: entries}, nil
|
||||
case 11:
|
||||
return Half{Revision: 11, Source: 41, Entries: repinned, Call: "release of mesh-sdk 0.1.26",
|
||||
Movers: []catalog.TakeInEntry{{Module: "app", Commit: "c1", Fingerprint: "src2:ab", Repository: "o/app"}}}, nil
|
||||
case 12:
|
||||
return Half{Revision: 12, Source: 42, Entries: repinned, Call: "take-in of 42",
|
||||
Movers: []catalog.TakeInEntry{{Module: "app", Commit: "c2", Fingerprint: "src2:ac", Repository: "o/app"}}}, nil
|
||||
}
|
||||
return Half{}, fmt.Errorf("no revision %d", revision)
|
||||
}
|
||||
return reg, entries, repinned, read
|
||||
}
|
||||
|
||||
func revisionEvent(n int64) catalog.CatalogRevisionEvent {
|
||||
return catalog.CatalogRevisionEvent{Kind: "trunk", Branch: keys.EscapeName("main"), Revision: n, CallKind: "release"}
|
||||
}
|
||||
|
||||
// H-A-283, H-A-284, H-A-285, H-A-286: a re-pin revision of the same source moves no mover out of the running pipeline of that source:
|
||||
// the pipeline keeps it at its new fingerprint, every step of it ends superseded (said at the old fingerprint, its asks
|
||||
// dropped) and is placed again from the re-pin revision's entry under new asks, the build first, still naming the
|
||||
// pipeline's revision; the revision the mover is kept at rides in the record's kept-revisions, where the pin check reads
|
||||
// its entry; the re-pin starts no pipeline. A revision of a new source still starts its own and moves the mover out.
|
||||
func TestASameSourceRepinKeepsTheMoverInItsPipeline(t *testing.T) {
|
||||
reg, entries, _, read := repinFixture()
|
||||
store := &MoverStore{Raw: newMemRaw()}
|
||||
asks := &stepAsks{}
|
||||
var said []seat.StepEvent
|
||||
var left [][]seat.StepResult
|
||||
s := &Starter{Pipelines: store, Store: store, Steps: asks, Name: "the-runner", Now: ticking(), Revision: read,
|
||||
Registration: func(m string) (catalog.Registration, bool) { return reg, m == "app" },
|
||||
Say: func(_ string, body any) error {
|
||||
if ev, ok := body.(seat.StepEvent); ok && ev.Result.Outcome == seat.StepResultOutcomeSuperseded {
|
||||
said = append(said, ev)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Left: func(_ string, leave, drop []seat.StepResult, _ string) { left = append(left, append(leave, drop...)) }}
|
||||
h := &Hearer{Store: store, Say: func(string, any) error { return nil }}
|
||||
s.Supersede = func(newer seat.Pipeline) { h.SupersedeRunning(newer) }
|
||||
key := Key("main", 10)
|
||||
if ok, err := s.Start(Begin{Branch: "main", Source: 41, Revision: 10, Entries: entries,
|
||||
Movers: []seat.Mover{{Module: "app", Commit: "c1", Fingerprint: "src2:aa", Repository: "o/app"}}}); !ok || err != nil {
|
||||
t.Fatalf("start = %v, %v", ok, err)
|
||||
}
|
||||
before, _, _ := store.Get(key)
|
||||
oldAsks := map[string]bool{}
|
||||
for _, st := range before.Steps {
|
||||
if st.Ask != "" {
|
||||
oldAsks[st.Ask] = true
|
||||
}
|
||||
}
|
||||
asks.at, asks.ids, asks.asks = nil, nil, nil
|
||||
ev := revisionEvent
|
||||
if n, err := s.Revised(ev(11), read); n != 0 || err != nil {
|
||||
t.Fatalf("the same-source re-pin started %d pipelines (%v), want none", n, err)
|
||||
}
|
||||
if _, _, err := store.Get(Key("main", 11)); err == nil {
|
||||
t.Fatal("the same-source re-pin wrote a pipeline of its own")
|
||||
}
|
||||
p, _, err := store.Get(key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if m, _ := MoverOf(p, "app"); m.Fingerprint != "src2:ab" || slices.Contains(p.Superseded, "app") || p.Outcome != seat.PipelineOutcomeRunning {
|
||||
t.Fatalf("the kept mover = %+v, superseded %v, outcome %s: want it kept at src2:ab, the pipeline running", m, p.Superseded, p.Outcome)
|
||||
}
|
||||
if len(p.Steps) != len(before.Steps) || p.Steps[0].Step != seat.StepResultStepBuild || p.Steps[0].Outcome != seat.StepResultOutcomeRunning ||
|
||||
p.Steps[0].Fingerprint != "src2:ab" || oldAsks[p.Steps[0].Ask] {
|
||||
t.Fatalf("the steps placed again = %+v, want the build first, running at src2:ab under a new ask", p.Steps)
|
||||
}
|
||||
for _, st := range p.Steps {
|
||||
if st.Outcome == seat.StepResultOutcomeSuperseded || (st.Ask != "" && oldAsks[st.Ask]) {
|
||||
t.Errorf("the step %s %s stands for the old fingerprint: %+v", st.Artifact, st.Step, st)
|
||||
}
|
||||
}
|
||||
// Every old step ended superseded, said at the fingerprint it ran for; the ones open on a build node are dropped.
|
||||
if len(said) != len(before.Steps) || said[0].Fingerprint != "src2:aa" || len(left) != 1 || len(left[0]) == 0 {
|
||||
t.Errorf("said %d superseded steps (of %d), the first at %+v; left %v", len(said), len(before.Steps), said, left)
|
||||
}
|
||||
b, ok := asks.asks[0].(builds.StepRun)
|
||||
if !ok || asks.ids[0] != p.Steps[0].Ask || b.Revision != 10 || b.Source != 41 || len(b.Entries) != 1 || b.Entries[0].Fingerprint != "src2:ab" {
|
||||
t.Fatalf("the build asked again = %+v (%s), want the new fingerprint at the pipeline's revision", asks.asks[0], asks.ids[0])
|
||||
}
|
||||
if kept, err := store.KeptRevisions(key); err != nil || kept["app"] != 11 {
|
||||
t.Errorf("kept-revisions = %v (%v), want app at 11", kept, err)
|
||||
}
|
||||
// The pin check reads the kept mover's entry at the revision it was kept at, never the pipeline's.
|
||||
if n, err := s.AskPinHeld(store, key, "app", map[string]string{"git.novox.be/novox/mesh-sdk/go": "v0.1.26", "git.novox.be/novox/x/go": "v0.1.1"}, read); n == 0 || err != nil {
|
||||
after, _, _ := store.Get(key)
|
||||
t.Fatalf("the held steps asked %d (%v): %+v", n, err, after.Steps)
|
||||
}
|
||||
last := asks.asks[len(asks.asks)-1].(nodebuildgo.StepAsk)
|
||||
if last.Step.Fingerprint != "src2:ab" || last.Step.Fetch.Packages["git.novox.be/novox/x/go"] != "v0.1.1" {
|
||||
t.Errorf("a held step asked = %+v", last.Step)
|
||||
}
|
||||
// A revision of a new source starts its own pipeline and moves the mover out (H-A-223).
|
||||
if n, err := s.Revised(ev(12), read); n != 1 || err != nil {
|
||||
t.Fatalf("a new source's revision started %d (%v)", n, err)
|
||||
}
|
||||
if p, _, _ := store.Get(key); !slices.Contains(p.Superseded, "app") {
|
||||
t.Errorf("the new source's revision left app in %s: %v", key, p.Superseded)
|
||||
}
|
||||
}
|
||||
|
||||
// H-A-286: a kept mover not placed at its keep (its registration arrived later) is placed from the revision it is kept at
|
||||
// while the branch's held view still holds the older revision, under ask ids its kept revision is mixed into; and a restart
|
||||
// (Resume) finds its running steps by those ids and asks them again.
|
||||
func TestAKeptMoverIsPlacedLateAndResumedAtItsKeptRevision(t *testing.T) {
|
||||
reg, entries, _, read := repinFixture()
|
||||
store := &MoverStore{Raw: newMemRaw()}
|
||||
asks := &stepAsks{}
|
||||
registered := false
|
||||
s := &Starter{Pipelines: store, Store: store, Steps: asks, Name: "the-runner", Now: ticking(), Revision: read,
|
||||
Say: func(string, any) error { return nil },
|
||||
Registration: func(m string) (catalog.Registration, bool) { return reg, registered && m == "app" }}
|
||||
key := Key("main", 10)
|
||||
if ok, err := s.Start(Begin{Branch: "main", Source: 41, Revision: 10, Entries: entries,
|
||||
Movers: []seat.Mover{{Module: "app", Commit: "c1", Fingerprint: "src2:aa", Repository: "o/app"}}}); !ok || err != nil {
|
||||
t.Fatalf("start = %v, %v", ok, err)
|
||||
}
|
||||
if n, err := s.Revised(revisionEvent(11), read); n != 0 || err != nil {
|
||||
t.Fatalf("the re-pin started %d (%v)", n, err)
|
||||
}
|
||||
// The registration arrives while the runner's view still holds revision 10.
|
||||
registered = true
|
||||
lagging := func(string) (Half, bool) { return Half{Revision: 10, Source: 41, Entries: entries}, true }
|
||||
if n, err := s.Registered(store, reg, lagging); n != 1 || err != nil {
|
||||
t.Fatalf("the late registration placed in %d pipelines (%v)", n, err)
|
||||
}
|
||||
p, _, err := store.Get(key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var build seat.StepResult
|
||||
held := 0
|
||||
for _, st := range p.Steps {
|
||||
switch {
|
||||
case st.Step == seat.StepResultStepBuild:
|
||||
build = st
|
||||
case pinHeld(st) && strings.HasSuffix(st.Why, "git.novox.be/novox/x/go"):
|
||||
held++
|
||||
}
|
||||
}
|
||||
if want := keptAskID(*p.Started, key, "app", "", seat.StepResultStepBuild, 11); build.Ask != want || build.Fingerprint != "src2:ab" || held == 0 {
|
||||
t.Fatalf("the late placing: build %+v (want ask %s), %d steps held on revision 11's unpinned package: %+v", build, want, held, p.Steps)
|
||||
}
|
||||
// A restart asks the kept mover's running steps again under the same ids.
|
||||
asks.at, asks.ids, asks.asks = nil, nil, nil
|
||||
if n, err := s.Resume(store, "main", Half{Revision: 10, Source: 41, Entries: entries}); n == 0 || err != nil || !slices.Contains(asks.ids, build.Ask) {
|
||||
t.Fatalf("Resume asked %d (%v), ids %v: want the kept build %s again", n, err, asks.ids, build.Ask)
|
||||
}
|
||||
}
|
||||
@@ -165,6 +165,13 @@ type Starter struct {
|
||||
// Supersede takes out of every older running pipeline of newer's branch each mover whose fingerprint newer moved
|
||||
// (H-A-223; Hearer.SupersedeRunning); nil leaves running pipelines as they are.
|
||||
Supersede func(newer seat.Pipeline)
|
||||
// Left takes the steps a same-source re-pin superseded in a pipeline that kept their mover out of the test runs they
|
||||
// read and drops their own asks (H-A-283, H-A-284 (1); Hearer.LeftInPlace); nil leaves them.
|
||||
Left func(key string, leave, drop []seat.StepResult, why string)
|
||||
// Revision reads a catalog revision of a branch by its number through the catalog seat's revision verb: a mover a
|
||||
// same-source re-pin kept is placed from the entries of the revision it is kept at (H-A-286); nil leaves such a mover
|
||||
// waiting.
|
||||
Revision func(branch string, revision int64) (Half, error)
|
||||
// Fills refuses a start while a store of the runner is full (§366); nil refuses none.
|
||||
Fills *Fills
|
||||
// Recovered says whether a commit is named a recovery (§81, §86): its steps are asked on the build seats' stream delivery.
|
||||
@@ -334,6 +341,11 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
var unregistered []string
|
||||
var notAsked []int
|
||||
var waits []seat.Mover
|
||||
kept, err := keptOfStore(s.Store, p.Pipeline)
|
||||
if err != nil {
|
||||
s.logf("the kept-revisions of %s are not read, so its movers are placed as movers not kept: %v", p.Pipeline, err)
|
||||
}
|
||||
all := entries
|
||||
for _, m := range p.Movers {
|
||||
if placed(*p, m.Module) {
|
||||
continue
|
||||
@@ -343,6 +355,13 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
unregistered = append(unregistered, m.Module)
|
||||
continue
|
||||
}
|
||||
// A mover a same-source re-pin kept is placed from the revision it is kept at, its ids its own (H-A-286).
|
||||
entries := all
|
||||
if rev := kept[m.Module]; rev > 0 {
|
||||
if entries, ok = s.keptEntries(p.Branch, rev); !ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
// A mover's steps wait for the publish of each mover it builds on (§746, H-A-83 (2)): placed once each is heard,
|
||||
// ended not asked when one's build ended without passing.
|
||||
due, waiting, failed := ready(*p, m.Module, entries)
|
||||
@@ -351,7 +370,7 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
waits = append(waits, m)
|
||||
continue
|
||||
}
|
||||
steps, a := Place(*p, m, r, entries, now, s.Name)
|
||||
steps, a := place(*p, m, r, entries, now, s.Name, true, kept[m.Module])
|
||||
supersededWhy(*p, m.Module, entries, steps)
|
||||
for _, st := range steps {
|
||||
if pinHeld(st) {
|
||||
@@ -390,13 +409,13 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
}
|
||||
}
|
||||
}
|
||||
if steps, ended := cycled(p, waits, unregistered, reg, entries, now, s.Name); ended {
|
||||
if steps, ended := cycled(p, waits, unregistered, reg, all, now, s.Name); ended {
|
||||
return nil, unregistered, steps, notAsked
|
||||
} else {
|
||||
notAsked = append(notAsked, steps...)
|
||||
}
|
||||
// A mover placed after the validate ended has its composition asked, or not asked, at once (§745).
|
||||
more, _ := releaseCompositions(p, now)
|
||||
more, _ := releaseCompositions(p, now, kept)
|
||||
asks = append(asks, more...)
|
||||
asks, ended := s.holderless(p, asks, now)
|
||||
return asks, unregistered, ended, notAsked
|
||||
@@ -611,13 +630,24 @@ func (s *Starter) Resume(store Updater, branch string, half Half) (int, error) {
|
||||
}
|
||||
}
|
||||
var due []Asked
|
||||
kept, err := keptOfStore(store, key)
|
||||
if err != nil {
|
||||
s.logf("the kept-revisions of %s are not read, so its kept movers' steps are not asked again: %v", key, err)
|
||||
}
|
||||
for _, m := range p.Movers {
|
||||
reg, ok := s.Registration(m.Module)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
_, shared := Place(p, m, reg, half.Entries, now, s.Name)
|
||||
_, unshared := place(p, m, reg, half.Entries, now, s.Name, false)
|
||||
// A kept mover's steps are found by the ids its kept revision gives, from that revision's entries (H-A-286).
|
||||
entries, rev := half.Entries, kept[m.Module]
|
||||
if rev > 0 {
|
||||
if entries, ok = s.keptEntries(p.Branch, rev); !ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
_, shared := place(p, m, reg, entries, now, s.Name, true, rev)
|
||||
_, unshared := place(p, m, reg, entries, now, s.Name, false, rev)
|
||||
for _, a := range shared {
|
||||
if running[a.ID] && !own[a.ID] {
|
||||
due = append(due, a)
|
||||
@@ -1023,6 +1053,12 @@ func (s *Starter) Revised(ev catalog.CatalogRevisionEvent, read func(branch stri
|
||||
for _, e := range half.Movers {
|
||||
movers = append(movers, seat.Mover{Module: e.Module, Commit: e.Commit, Fingerprint: e.Fingerprint, Repository: e.Repository})
|
||||
}
|
||||
// A revision of the same source moves no mover out of the open pipeline of that source holding it: that pipeline keeps
|
||||
// it, and this revision starts no pipeline of its own for it (H-A-283); only a revision of a new source moves movers.
|
||||
if movers = s.keepSameSource(branch, half, movers); len(movers) == 0 {
|
||||
s.logf("the revision %d of %s (%s) moves only movers the open pipelines of its source %d keep: it starts no pipeline (H-A-283)", ev.Revision, branch, ev.Call, half.Source)
|
||||
return 0, nil
|
||||
}
|
||||
movers = Tiers(movers, half.Entries, s.logf)
|
||||
call := half.Call
|
||||
if call == "" {
|
||||
|
||||
@@ -88,6 +88,9 @@ func TestARevisionOfAReleaseStartsOnePipeline(t *testing.T) {
|
||||
return Half{}, fmt.Errorf("branch %q", branch)
|
||||
}
|
||||
r := Half{Revision: revision, Source: 41, Entries: entries, Call: "release of mesh-sdk 0.1.17"}
|
||||
if revision > 10 {
|
||||
r.Source = 41 + revision // a later source's revision: one of the same source keeps its movers in 10's (H-A-283)
|
||||
}
|
||||
if revision != 12 {
|
||||
r.Movers = movers
|
||||
}
|
||||
|
||||
@@ -154,8 +154,9 @@ type Hearer struct {
|
||||
Ager *Ager
|
||||
// Fills says the stores' fill at each step's end (§366); nil says none.
|
||||
Fills *Fills
|
||||
// Widens computes a mover's widens, kept in its value at the pipeline's end (§71, A-207; H-A-51); nil keeps none.
|
||||
Widens func(p seat.Pipeline, module string) []seat.Widening
|
||||
// Widens makes, for one end, the reader of each mover's widens, kept in its value at the pipeline's end (§71, A-207;
|
||||
// H-A-51): made before the end's compare-and-set, its reads shared by every mover and every retry (H-A-289); nil keeps none.
|
||||
Widens func() func(p seat.Pipeline, module string) []seat.Widening
|
||||
// TestRuns is the state test-runs and Clock its bound keys (§725); Runs the settings of its runs; DropRun drops a
|
||||
// run's ask when its run ends unfinished (§119). A nil TestRuns keeps no test run.
|
||||
TestRuns TestRuns
|
||||
@@ -199,6 +200,15 @@ func (h *Hearer) EndReaders(run string, readers []seat.TestRunReader, r seat.Tes
|
||||
return first
|
||||
}
|
||||
|
||||
// kept is pipeline key's kept-revisions (H-A-285, H-A-286); none when they cannot be read, said.
|
||||
func (h *Hearer) kept(key string) map[string]int64 {
|
||||
kept, err := keptOfStore(h.Store, key)
|
||||
if err != nil {
|
||||
h.logf("the kept-revisions of %s are not read, so its kept movers' asks take the ids of movers not kept: %v", key, err)
|
||||
}
|
||||
return kept
|
||||
}
|
||||
|
||||
func (h *Hearer) now() time.Time {
|
||||
if h.Now != nil {
|
||||
return h.Now().UTC()
|
||||
@@ -236,6 +246,7 @@ func (h *Hearer) OnStepEndedPinned(bs StepSeat, subject string, ev StepEnded, sh
|
||||
if ev.Asker != "" && ev.Asker != h.Name {
|
||||
return seat.Pipeline{}, nil
|
||||
}
|
||||
wr := h.widensReads() // made before the compare-and-set, kept for its retries (H-A-289)
|
||||
for {
|
||||
p, rev, err := h.Store.Get(ev.Pipeline)
|
||||
if err != nil {
|
||||
@@ -314,7 +325,7 @@ func (h *Hearer) OnStepEndedPinned(bs StepSeat, subject string, ev StepEnded, sh
|
||||
if s.Step == seat.StepResultStepValidate {
|
||||
readers = append(readers, sameValidate(&p, i, now)...)
|
||||
var notAsked []int
|
||||
due, notAsked = releaseCompositions(&p, now)
|
||||
due, notAsked = releaseCompositions(&p, now, h.kept(ev.Pipeline))
|
||||
readers = append(readers, notAsked...)
|
||||
}
|
||||
from := now
|
||||
@@ -328,7 +339,7 @@ func (h *Hearer) OnStepEndedPinned(bs StepSeat, subject string, ev StepEnded, sh
|
||||
// A mover's build passed is what a kind-3 edge waits for (§746, H-A-83 (2)); one that did not pass ends its
|
||||
// dependents' steps not asked.
|
||||
release := s.Step == seat.StepResultStepBuild && (!stepPassed(*s) || built(&p, s.Module))
|
||||
ended := h.endPipeline(&p, now)
|
||||
ended := h.endPipeline(&p, now, wr)
|
||||
if _, err := h.Store.Update(ev.Pipeline, p, rev); errors.Is(err, ErrChanged) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
@@ -468,6 +479,12 @@ func (h *Hearer) said(p seat.Pipeline, asked []int, ended bool) error {
|
||||
h.Turn(p.Pipeline)
|
||||
}
|
||||
if ended {
|
||||
// The journal says which end it was (H-A-288).
|
||||
if p.Why != "" {
|
||||
h.logf("%s ended %s: %s", p.Pipeline, p.Outcome, p.Why)
|
||||
} else {
|
||||
h.logf("%s ended %s", p.Pipeline, p.Outcome)
|
||||
}
|
||||
h.Failures.Ended(p)
|
||||
if h.RegistrationWaits != nil {
|
||||
h.RegistrationWaits()
|
||||
@@ -484,6 +501,51 @@ func (h *Hearer) said(p seat.Pipeline, asked []int, ended bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EndAtStart judges, at the runner's start pass, the end of every running pipeline nothing of which is still open (H-A-288
|
||||
// (c)): one whose last mover left or whose last open step ended while no runner wrote its end ends as at a step's end,
|
||||
// superseded, failed or passed by the end judgement, said, and the next waiting placed. It answers how many it ended.
|
||||
func (h *Hearer) EndAtStart() (int, error) {
|
||||
pkeys, err := allKeys(h.Store)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("the pipelines are not listed: %w", err)
|
||||
}
|
||||
n := 0
|
||||
var first error
|
||||
for _, key := range pkeys {
|
||||
ended, err := h.endIfNothingOpen(key)
|
||||
if err != nil && first == nil {
|
||||
first = err
|
||||
}
|
||||
if ended {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n, first
|
||||
}
|
||||
|
||||
// endIfNothingOpen ends the running pipeline key when nothing of it is still open (H-A-288), its reads made before the
|
||||
// compare-and-set (H-A-289); true when it ended.
|
||||
func (h *Hearer) endIfNothingOpen(key string) (bool, error) {
|
||||
wr := h.widensReads()
|
||||
for {
|
||||
p, rev, err := h.Store.Get(key)
|
||||
if err != nil || p.Outcome != seat.PipelineOutcomeRunning {
|
||||
return false, nil
|
||||
}
|
||||
now := h.now()
|
||||
if !h.endPipeline(&p, now, wr) {
|
||||
return false, nil
|
||||
}
|
||||
if _, err := h.Store.Update(key, p, rev); errors.Is(err, ErrChanged) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
return false, fmt.Errorf("pipeline %s cannot be written: %w", key, err)
|
||||
}
|
||||
h.logf("%s had nothing open at the runner's start: its end is written now (H-A-288)", key)
|
||||
return true, h.said(p, nil, true)
|
||||
}
|
||||
}
|
||||
|
||||
// endEntry is the step log's entry of a step's end, with the keys of the kept results it wrote or carried.
|
||||
func endEntry(key string, s seat.StepResult, at time.Time, kept ...string) seat.LogEntry {
|
||||
return seat.LogEntry{Pipeline: key, Module: s.Module, Step: s.Step, Artifact: s.Artifact, What: seat.LogEntryWhatEnded, Outcome: s.Outcome,
|
||||
@@ -720,19 +782,28 @@ func endPipeline(p *seat.Pipeline, now time.Time, unplaced func(seat.Pipeline, s
|
||||
return true
|
||||
}
|
||||
|
||||
// endPipeline is endPipeline with each mover's widens computed into its value at the end (§71, A-207; H-A-51).
|
||||
func (h *Hearer) endPipeline(p *seat.Pipeline, now time.Time) bool {
|
||||
// endPipeline is endPipeline with each mover's widens computed into its value at the end (§71, A-207; H-A-51), by wr, the
|
||||
// reads the caller made before its compare-and-set (H-A-289); nil computes none.
|
||||
func (h *Hearer) endPipeline(p *seat.Pipeline, now time.Time, wr func(seat.Pipeline, string) []seat.Widening) bool {
|
||||
if !endPipeline(p, now, h.Unplaced) {
|
||||
return false
|
||||
}
|
||||
if h.Widens != nil {
|
||||
if wr != nil {
|
||||
for i := range p.Movers {
|
||||
p.Movers[i].Widens = h.Widens(*p, p.Movers[i].Module)
|
||||
p.Movers[i].Widens = wr(*p, p.Movers[i].Module)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// widensReads is the reader of one end's widens, made before its compare-and-set and kept for every retry (H-A-289).
|
||||
func (h *Hearer) widensReads() func(seat.Pipeline, string) []seat.Widening {
|
||||
if h.Widens == nil {
|
||||
return nil
|
||||
}
|
||||
return h.Widens()
|
||||
}
|
||||
|
||||
// EndedAtPlacing says a pipeline its starter ended at placing, a seat with no holder (A-470g, A-470h): the step-ended of each
|
||||
// step of steps, its step log entries appended, the head's finding pipeline-failed (§33), then its pipeline-ended.
|
||||
func (h *Hearer) EndedAtPlacing(p seat.Pipeline, steps []int) error {
|
||||
|
||||
@@ -91,6 +91,7 @@ func (h *Hearer) SupersedeRunning(newer seat.Pipeline) []string {
|
||||
}
|
||||
|
||||
func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
wr := h.widensReads() // made before the compare-and-set, kept for its retries (H-A-289)
|
||||
for {
|
||||
p, rev, err := h.Store.Get(key)
|
||||
if err != nil || p.Outcome != seat.PipelineOutcomeRunning || p.Branch != newer.Branch || p.Run != "" || newer.Run != "" ||
|
||||
@@ -118,18 +119,12 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
if !slices.Contains(moved, st.Module) || (!open(*st) && st.Outcome != seat.StepResultOutcomeWaiting) {
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
case sharedRun(*st) != "" && st.Seat != wants.Seat:
|
||||
leave = append(leave, *st)
|
||||
case st.Ask != "" && BoundSeat(st.Seat):
|
||||
drop = append(drop, *st) // its own ask on a build node: the seat's drop cancels it
|
||||
}
|
||||
st.Outcome, st.Why, st.Ended = seat.StepResultOutcomeSuperseded, why, &now
|
||||
p.Unlogged = append(p.Unlogged, endEntry(key, *st, now))
|
||||
l, d := supersedeStep(&p, st, why, now)
|
||||
leave, drop = append(leave, l...), append(drop, d...)
|
||||
ended = append(ended, i)
|
||||
}
|
||||
p.Superseded = append(p.Superseded, moved...)
|
||||
done := h.endPipeline(&p, now)
|
||||
done := h.endPipeline(&p, now, wr)
|
||||
if _, err := h.Store.Update(key, p, rev); errors.Is(err, ErrChanged) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
@@ -142,20 +137,7 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
h.logf("step-ended of %s's %s %s, superseded, is not said: %v", key, p.Steps[i].Module, p.Steps[i].Step, err)
|
||||
}
|
||||
}
|
||||
for _, st := range leave {
|
||||
h.leaveRun(key, st, "the mover "+st.Module+" left "+key+" for the newer "+newer.Pipeline)
|
||||
}
|
||||
// Its running asks on the build nodes are cancelled through the seat's drop (H-A-223). The seat mesh-builds serves no
|
||||
// drop, so a build ask there runs to its end, which the runner ignores: the step is no longer open.
|
||||
for _, st := range drop {
|
||||
if h.DropRun == nil {
|
||||
h.logf("%s: the ask %s of %s's %s is not dropped: the runner has no drop", key, st.Ask, st.Module, st.Step)
|
||||
continue
|
||||
}
|
||||
if err := h.DropRun(st.Seat, st.Node, st.Ask, why); err != nil {
|
||||
h.logf("%s: the drop of the ask %s of %s's %s is not asked of %s: %v", key, st.Ask, st.Module, st.Step, st.Seat, err)
|
||||
}
|
||||
}
|
||||
h.leaveSteps(key, leave, drop, "the mover %s left "+key+" for the newer "+newer.Pipeline, why)
|
||||
if err := h.said(p, nil, done); err != nil {
|
||||
h.logf("%v", err)
|
||||
}
|
||||
@@ -164,6 +146,45 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// supersedeStep ends the open or waiting step st of p superseded, naming why, with its step log entry: a step reading a test
|
||||
// run is answered to leave it, and one with its own ask on a build node to drop it (H-A-223).
|
||||
func supersedeStep(p *seat.Pipeline, st *seat.StepResult, why string, now time.Time) (leave, drop []seat.StepResult) {
|
||||
switch {
|
||||
case sharedRun(*st) != "" && st.Seat != wants.Seat:
|
||||
leave = append(leave, *st)
|
||||
case st.Ask != "" && BoundSeat(st.Seat):
|
||||
drop = append(drop, *st) // its own ask on a build node: the seat's drop cancels it
|
||||
}
|
||||
st.Outcome, st.Why, st.Ended = seat.StepResultOutcomeSuperseded, why, &now
|
||||
p.Unlogged = append(p.Unlogged, endEntry(p.Pipeline, *st, now))
|
||||
return leave, drop
|
||||
}
|
||||
|
||||
// leaveSteps takes the superseded steps of pipeline key out of the test runs they read (leaving, its %s the step's mover)
|
||||
// and drops their own asks on the build nodes, naming why (H-A-223). The seat mesh-builds serves no drop, so a build ask
|
||||
// there runs to its end, which the runner ignores: the step is no longer open.
|
||||
func (h *Hearer) leaveSteps(key string, leave, drop []seat.StepResult, leaving, why string) {
|
||||
for _, st := range leave {
|
||||
h.leaveRun(key, st, fmt.Sprintf(leaving, st.Module))
|
||||
}
|
||||
for _, st := range drop {
|
||||
if h.DropRun == nil {
|
||||
h.logf("%s: the ask %s of %s's %s is not dropped: the runner has no drop", key, st.Ask, st.Module, st.Step)
|
||||
continue
|
||||
}
|
||||
if err := h.DropRun(st.Seat, st.Node, st.Ask, why); err != nil {
|
||||
h.logf("%s: the drop of the ask %s of %s's %s is not asked of %s: %v", key, st.Ask, st.Module, st.Step, st.Seat, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LeftInPlace takes the steps a same-source re-pin superseded in pipeline key, whose mover it kept (H-A-283, H-A-284 (1)),
|
||||
// out of the test runs they read and drops their own asks, naming why, and appends their step log entries.
|
||||
func (h *Hearer) LeftInPlace(key string, leave, drop []seat.StepResult, why string) {
|
||||
h.leaveSteps(key, leave, drop, "the mover %s of "+key+" was re-pinned and its steps placed again (H-A-284)", why)
|
||||
h.appendUnlogged(key)
|
||||
}
|
||||
|
||||
// supersedeWaiting takes, in each older waiting pipeline of newer's branch, the movers newer also moves out of it (design 47 H
|
||||
// §748, ADR 0682 §7): a waiting pipeline left with no mover ends superseded, its waiting key deleted, saying wait-ended and its
|
||||
// pipeline-ended. newer is a pipeline just written, waiting or placed: a mover a newer revision moves leaves every pipeline not
|
||||
|
||||
@@ -52,6 +52,7 @@ func (v Verbs) record(verb, what, why string) error {
|
||||
func (v Verbs) change(key, event string, record func() error, mutate func(p *seat.Pipeline, now time.Time) (int, error)) (seat.Pipeline, int, error) {
|
||||
h := v.Hearer
|
||||
recorded := false
|
||||
wr := h.widensReads() // made before the compare-and-set, kept for its retries (H-A-289)
|
||||
for {
|
||||
p, rev, err := h.Store.Get(key)
|
||||
if err != nil {
|
||||
@@ -73,7 +74,7 @@ func (v Verbs) change(key, event string, record func() error, mutate func(p *sea
|
||||
if err != nil {
|
||||
return p, i, err
|
||||
}
|
||||
ended := h.endPipeline(&p, now)
|
||||
ended := h.endPipeline(&p, now, wr)
|
||||
if i >= 0 && event == seat.EventStepEnded {
|
||||
p.Unlogged = append(p.Unlogged, endEntry(key, p.Steps[i], now))
|
||||
}
|
||||
@@ -530,9 +531,11 @@ func (v Verbs) passedReader(reader RunReader, run string) bool {
|
||||
// under one id is kept once), saying it is a rerun and by whom. The validate ask is the pipeline's one, naming no mover
|
||||
// (H-A-51): its rerun asks that one ask again; a composition's rerun builds the mover's composition ask (H-A-236).
|
||||
func (v Verbs) askOf(p seat.Pipeline, s seat.StepResult, caller string, now time.Time) (*Asked, error) {
|
||||
id := AskID(now, p.Pipeline, s.Module, s.Artifact, s.Step)
|
||||
// A kept mover's rerun mixes its kept revision into the id (H-A-286).
|
||||
rev := v.keptOf(p.Pipeline)[s.Module]
|
||||
id := keptAskID(now, p.Pipeline, s.Module, s.Artifact, s.Step, rev)
|
||||
if s.Seat == wants.Seat && s.Step == seat.StepResultStepValidate {
|
||||
id = AskID(now, p.Pipeline, "", "", seat.StepResultStepValidate)
|
||||
id = keptAskID(now, p.Pipeline, "", "", seat.StepResultStepValidate, rev)
|
||||
}
|
||||
a, err := v.placedAsk(p, s, id, now)
|
||||
if err != nil {
|
||||
@@ -580,8 +583,15 @@ func (v Verbs) placedAsk(p seat.Pipeline, s seat.StepResult, id string, now time
|
||||
} else {
|
||||
return nil, fmt.Errorf("the catalog half of %s is not held yet: the step is asked when it is", p.Branch)
|
||||
}
|
||||
_, placed := place(p, m, reg, half.Entries, now, v.Starter.Name, false)
|
||||
base := AskID(startOf(p, now), p.Pipeline, m.Module, s.Artifact, s.Step)
|
||||
// A kept mover's step is the one placed from the revision it is kept at, under its kept ids (H-A-286).
|
||||
entries, rev := half.Entries, v.keptOf(p.Pipeline)[m.Module]
|
||||
if rev > 0 {
|
||||
if entries, ok = v.Starter.keptEntries(p.Branch, rev); !ok {
|
||||
return nil, fmt.Errorf("revision %d of %s, which %s is kept at, is not read: the step is asked when it is", rev, p.Branch, m.Module)
|
||||
}
|
||||
}
|
||||
_, placed := place(p, m, reg, entries, now, v.Starter.Name, false, rev)
|
||||
base := keptAskID(startOf(p, now), p.Pipeline, m.Module, s.Artifact, s.Step, rev)
|
||||
for _, a := range placed {
|
||||
if a.ID != base {
|
||||
continue
|
||||
@@ -596,6 +606,14 @@ func (v Verbs) placedAsk(p seat.Pipeline, s seat.StepResult, id string, now time
|
||||
return nil, fmt.Errorf("the %s step of %s is placed no ask now", s.Step, p.Pipeline)
|
||||
}
|
||||
|
||||
// keptOf is pipeline key's kept-revisions (H-A-285); none when they cannot be read, said.
|
||||
func (v Verbs) keptOf(key string) map[string]int64 {
|
||||
if v.Hearer == nil {
|
||||
return nil
|
||||
}
|
||||
return v.Hearer.kept(key)
|
||||
}
|
||||
|
||||
// Run starts a run on request for the caller the bus proved (design 47 G §64; Starter.Run): its pipelines written, its
|
||||
// run-started said, its steps placed when its candidate's revision is heard.
|
||||
func (v Verbs) Run(caller string, in seat.RunInput) (seat.RunAnswer, error) {
|
||||
|
||||
@@ -31,20 +31,87 @@ func (w *Widener) Widens(p seat.Pipeline, module string) []seat.Widening {
|
||||
if w == nil || w.Revision == nil {
|
||||
return nil
|
||||
}
|
||||
return w.Reads()(p, module)
|
||||
}
|
||||
|
||||
// Reads is Widens over reads made once and kept (H-A-289): the two revisions, each serving seat's holder and the grants part's
|
||||
// grants-for are each read at their first need and shared by every mover of an end and every retry of its write, so a retry
|
||||
// rereads only the pipeline's key. One end takes one Reads, made before its compare-and-set.
|
||||
func (w *Widener) Reads() func(p seat.Pipeline, module string) []seat.Widening {
|
||||
if w == nil || w.Revision == nil {
|
||||
return func(seat.Pipeline, string) []seat.Widening { return nil }
|
||||
}
|
||||
r := &endReads{w: w, revisions: map[string]revisionRead{}, holders: map[string]holderRead{}, grants: map[string]grantsRead{}}
|
||||
return r.widens
|
||||
}
|
||||
|
||||
type revisionRead struct {
|
||||
half Half
|
||||
err error
|
||||
}
|
||||
|
||||
type holderRead struct {
|
||||
holder string
|
||||
err error
|
||||
}
|
||||
|
||||
type grantsRead struct {
|
||||
g meshgrants.GrantsFor
|
||||
err error
|
||||
}
|
||||
|
||||
// endReads are the reads of one end, each made at its first need and kept.
|
||||
type endReads struct {
|
||||
w *Widener
|
||||
revisions map[string]revisionRead
|
||||
holders map[string]holderRead
|
||||
grants map[string]grantsRead
|
||||
}
|
||||
|
||||
func (r *endReads) revision(branch string, rev int64) (Half, error) {
|
||||
k := fmt.Sprintf("%s.%d", branch, rev)
|
||||
got, ok := r.revisions[k]
|
||||
if !ok {
|
||||
got.half, got.err = r.w.Revision(branch, rev)
|
||||
r.revisions[k] = got
|
||||
}
|
||||
return got.half, got.err
|
||||
}
|
||||
|
||||
func (r *endReads) holder(s string) (string, error) {
|
||||
got, ok := r.holders[s]
|
||||
if !ok {
|
||||
got.holder, got.err = r.w.Holder(s)
|
||||
r.holders[s] = got
|
||||
}
|
||||
return got.holder, got.err
|
||||
}
|
||||
|
||||
func (r *endReads) grantsFor(branch string, source int64) (meshgrants.GrantsFor, error) {
|
||||
k := fmt.Sprintf("%s.%d", branch, source)
|
||||
got, ok := r.grants[k]
|
||||
if !ok {
|
||||
got.g, got.err = r.w.GrantsFor(branch, source)
|
||||
r.grants[k] = got
|
||||
}
|
||||
return got.g, got.err
|
||||
}
|
||||
|
||||
func (r *endReads) widens(p seat.Pipeline, module string) []seat.Widening {
|
||||
could := func(name, said string) []seat.Widening {
|
||||
return []seat.Widening{{What: seat.WideningWhatCouldNotRun, Name: name, Said: said}}
|
||||
}
|
||||
cand, err := w.Revision(p.Branch, p.Revision)
|
||||
cand, err := r.revision(p.Branch, p.Revision)
|
||||
if err != nil {
|
||||
return could("mesh-catalog", fmt.Sprintf("the candidate's revision %d is not read: %v", p.Revision, err))
|
||||
}
|
||||
newest, err := w.Revision(p.Branch, 0)
|
||||
newest, err := r.revision(p.Branch, 0)
|
||||
if err != nil {
|
||||
return could("mesh-catalog", fmt.Sprintf("the branch's newest revision is not read: %v", err))
|
||||
}
|
||||
var out []seat.Widening
|
||||
for _, s := range servingSeats(p) {
|
||||
holder, err := w.Holder(s)
|
||||
holder, err := r.holder(s)
|
||||
if err != nil {
|
||||
out = append(out, seat.Widening{What: seat.WideningWhatCouldNotRun, Name: s, Said: fmt.Sprintf("the holder of %s is not read: %v", s, err)})
|
||||
continue
|
||||
@@ -57,8 +124,8 @@ func (w *Widener) Widens(p seat.Pipeline, module string) []seat.Widening {
|
||||
}
|
||||
out = append(out, ruleWidens(module, newest.Entries[module], cand.Entries[module])...)
|
||||
out = append(out, credentialWidens(module, newest.Entries[module], cand.Entries[module])...)
|
||||
if w.GrantsFor != nil {
|
||||
g, err := w.GrantsFor(p.Branch, p.Source)
|
||||
if r.w.GrantsFor != nil {
|
||||
g, err := r.grantsFor(p.Branch, p.Source)
|
||||
switch {
|
||||
case err != nil:
|
||||
out = append(out, seat.Widening{What: seat.WideningWhatCouldNotRun, Name: "mesh-grants", Said: err.Error()})
|
||||
|
||||
@@ -88,17 +88,19 @@ func TestWidensIsTheCandidateAgainstTheNewest(t *testing.T) {
|
||||
|
||||
// A pipeline's end keeps each mover's widens in its value, whether or not anything widens (design 47 G §71, A-207; H H-A-51).
|
||||
func TestAnEndKeepsEachMoversWidens(t *testing.T) {
|
||||
h := &Hearer{Widens: func(p seat.Pipeline, module string) []seat.Widening {
|
||||
return []seat.Widening{{What: seat.WideningWhatGrant, Name: module + " s v"}}
|
||||
h := &Hearer{Widens: func() func(seat.Pipeline, string) []seat.Widening {
|
||||
return func(p seat.Pipeline, module string) []seat.Widening {
|
||||
return []seat.Widening{{What: seat.WideningWhatGrant, Name: module + " s v"}}
|
||||
}
|
||||
}}
|
||||
p := seat.Pipeline{Outcome: seat.PipelineOutcomeRunning, Movers: []seat.Mover{{Module: "app"}, {Module: "lib"}},
|
||||
Steps: []seat.StepResult{{Module: "app", Step: "build", Outcome: "passed"}, {Module: "lib", Step: "build", Outcome: "passed"}}}
|
||||
if !h.endPipeline(&p, time.Unix(1, 0)) || len(p.Movers[0].Widens) != 1 || p.Movers[0].Widens[0].Name != "app s v" || p.Movers[1].Widens[0].Name != "lib s v" {
|
||||
if !h.endPipeline(&p, time.Unix(1, 0), h.widensReads()) || len(p.Movers[0].Widens) != 1 || p.Movers[0].Widens[0].Name != "app s v" || p.Movers[1].Widens[0].Name != "lib s v" {
|
||||
t.Errorf("the ended movers = %+v", p.Movers)
|
||||
}
|
||||
h.Widens = nil
|
||||
q := seat.Pipeline{Outcome: seat.PipelineOutcomeRunning, Movers: []seat.Mover{{Module: "app"}}, Steps: []seat.StepResult{{Module: "app", Step: "build", Outcome: "passed"}}}
|
||||
if !h.endPipeline(&q, time.Unix(1, 0)) || len(q.Movers[0].Widens) != 0 {
|
||||
if !h.endPipeline(&q, time.Unix(1, 0), h.widensReads()) || len(q.Movers[0].Widens) != 0 {
|
||||
t.Errorf("a runner with no widener kept %v", q.Movers[0].Widens)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user