P13 testruns-placed-cause: the runner's catalog view tells a revision taken in whole as well as a changed entry, so a newer revision with the same entries places the pipeline that waited for it
WireCatalogProcess takes held beside changed, set before the first ask; the runner advances its waiting pipelines from it as from changed. The test-runs whole test answers the view's ask of revision 2 late. Builds: design 47 H2 H-A-747 (DQ-56, H-A-717), A-448
This commit is contained in:
@@ -108,13 +108,15 @@ func WireCatalog(r *views.Reader, call Call, branch string, changed func(module
|
||||
|
||||
// WireCatalogProcess is WireCatalog for a process's views.ProcessReader: its picture
|
||||
// (`mesh-catalog_catalog-revisions.<branch>`) reads the half as a read-only bucket, and the seat's event catalog-revision
|
||||
// on the module's durable consumer goes to Hear.
|
||||
func WireCatalogProcess(r *views.ProcessReader, call Call, branch string, changed func(module string, entry json.RawMessage, deleted bool, at time.Time)) (*Catalog, *views.Picture, error) {
|
||||
// on the module's durable consumer goes to Hear. held is told each revision the view takes in whole, whether or not an entry
|
||||
// changed, as Catalog.Held is (design 47 H2 H-A-747); it is set before the first ask. A nil held tells nothing.
|
||||
func WireCatalogProcess(r *views.ProcessReader, call Call, branch string, changed func(module string, entry json.RawMessage, deleted bool, at time.Time), held func(seat.CatalogRevision)) (*Catalog, *views.Picture, error) {
|
||||
c, err := NewCatalog(call, branch)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
c.Follower.Changed = changed
|
||||
c.Held = held
|
||||
p, err := r.Adopt(c.Follower, seat.Seat, seat.EventCatalogRevision, c.Hear)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
||||
+10
@@ -147,8 +147,12 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) {
|
||||
}
|
||||
var revision atomic.Int64
|
||||
revision.Store(1)
|
||||
var late atomic.Pointer[chan struct{}] // a view's ask of revision 2 answered once this channel is closed
|
||||
if _, err := nc.Subscribe("mesh.seat.mesh-catalog.call.revision.*", func(m *nats.Msg) {
|
||||
r := revision.Load()
|
||||
if h := late.Load(); h != nil && r == 2 {
|
||||
<-*h
|
||||
}
|
||||
raw, _ := json.Marshal(map[string]any{"result": catalog.RevisionAnswer{Revision: &catalog.CatalogRevision{Revision: r, Kind: "trunk", Branch: "main", Source: 2 + r}, Entries: entries}})
|
||||
_ = m.Respond(raw)
|
||||
}); err != nil {
|
||||
@@ -545,10 +549,16 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) {
|
||||
}
|
||||
|
||||
// A second revision with the same digests asks its own runs, so a failed test runs again (§724).
|
||||
// design 47 H2 H-A-747 (DQ-56): the view's ask of revision 2, whose entries equal revision 1's, is answered late, after the
|
||||
// take-in made main.2 with no step: no entry changes, and the view holding revision 2 alone places it.
|
||||
revision.Store(2)
|
||||
answered := make(chan struct{})
|
||||
late.Store(&answered)
|
||||
publish(catalog.SubjectCatalogRevision("main"), catalog.CatalogRevisionEvent{V: 1, Revision: 2, Kind: "trunk", Branch: "main", Source: 4})
|
||||
const p4 = "main.2"
|
||||
takeIn("app", "c1", "src2:aa", 4, 2)
|
||||
waitFor(t, ctx, logs, func() bool { return strings.Contains(logs.String(), "main.2 starts with no step") })
|
||||
close(answered)
|
||||
placed(p4)
|
||||
run4, r4 := runOfStep(p4, "app:program", "integration")
|
||||
if !strings.HasPrefix(run4, "main.2.") || r4.Ask == integ.Ask {
|
||||
|
||||
@@ -132,7 +132,9 @@ func startViews(ctx context.Context, js jetstream.JetStream, conn *nats.Conn, cr
|
||||
// is picked up as readiness is: its pipelines started with no steps are placed then (A-327, A-336).
|
||||
var wired atomic.Pointer[meshcatalogclient.Catalog]
|
||||
var ready pipeline.Readiness
|
||||
c, _, err := meshcatalogclient.WireCatalogProcess(reader, call, branch, func(string, json.RawMessage, bool, time.Time) {
|
||||
// A newer revision whose entries equal the one before changes no key, so the follower's Changed never tells it: the view
|
||||
// holding it is told by Held as well (design 47 H2 H-A-747, DQ-56).
|
||||
observe := func() {
|
||||
c := wired.Load()
|
||||
if c == nil || onReady == nil {
|
||||
return
|
||||
@@ -148,7 +150,9 @@ func startViews(ctx context.Context, js jetstream.JetStream, conn *nats.Conn, cr
|
||||
go onAdvance(branch)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
c, _, err := meshcatalogclient.WireCatalogProcess(reader, call, branch, func(string, json.RawMessage, bool, time.Time) { observe() },
|
||||
func(catalog.CatalogRevision) { observe() })
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user