From d006132c2a54881c20c5ac80407b047fd0c6ae05 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 20:37:32 +0100 Subject: [PATCH] A-476 (b): the watchman and the view no longer name an indexer build a revision waits for A pending revision now holds a lost or unread message or a refusal; the watchman's finding and the view's wait say so, the take-in event no longer requires WaitsFor (old values still decode), and the hand take-in comment loses the build. Builds: design 47 G A-476 (b) --- .../mesh-delivery-indexer/internal/index/pending.go | 2 +- modules/mesh-delivery-indexer/takein/takein.go | 4 ++-- .../cmd/mesh-delivery-view-tools/tiers_rows_test.go | 2 +- modules/mesh-delivery-view/internal/view/tiers.go | 2 +- .../cmd/mesh-delivery-watchman/main_test.go | 2 +- .../internal/watch/findings_test.go | 12 ++++++------ .../mesh-delivery-watchman/internal/watch/takein.go | 7 ++----- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/modules/mesh-delivery-indexer/internal/index/pending.go b/modules/mesh-delivery-indexer/internal/index/pending.go index afddbe4d..fe930595 100644 --- a/modules/mesh-delivery-indexer/internal/index/pending.go +++ b/modules/mesh-delivery-indexer/internal/index/pending.go @@ -1320,7 +1320,7 @@ func waitOf(entries []PendingEntry, what, behind string) takein.PendingWait { // TakeInPendingByHand is the hand take-in (indexer_take_in_pending, ADR 0633 §5, A-476, principle 4): the pending revision (its // m. key) or the group gathered so far (its g. key) is taken in now with this indexer and its judge, -// whatever build it names, for when the group's end never comes. by and why are +// for a revision whose message is unread or lost or held for room, or a group whose end never comes. by and why are // said in the journal and on the take-in.taken event. What waited behind it is evaluated again after. func (ix *Indexer) TakeInPendingByHand(ctx context.Context, key, by, why string) TakenIn { r := TakenIn{Module: key} diff --git a/modules/mesh-delivery-indexer/takein/takein.go b/modules/mesh-delivery-indexer/takein/takein.go index 70b24218..351635cf 100644 --- a/modules/mesh-delivery-indexer/takein/takein.go +++ b/modules/mesh-delivery-indexer/takein/takein.go @@ -177,8 +177,8 @@ func (t TakeIn) check() error { if !strings.HasPrefix(t.Key, "m.") { return fmt.Errorf("delivery: a revision's take-in key is its oldest merge's m., not %q", t.Key) } - if t.Kind == TakeInPending && t.WaitsFor == "" && len(t.Lost) == 0 && t.Refused == "" { - return fmt.Errorf("delivery: a pending revision %s names the indexer build it waits for, the merges it lost or its refusal", t.Key) + if t.Kind == TakeInPending && len(t.Lost) == 0 && t.Refused == "" { + return fmt.Errorf("delivery: a pending revision %s names the merges it lost or its refusal", t.Key) } case TakeInGroup: if t.Group == "" { diff --git a/modules/mesh-delivery-view/cmd/mesh-delivery-view-tools/tiers_rows_test.go b/modules/mesh-delivery-view/cmd/mesh-delivery-view-tools/tiers_rows_test.go index 8b0057c9..8a497a16 100644 --- a/modules/mesh-delivery-view/cmd/mesh-delivery-view-tools/tiers_rows_test.go +++ b/modules/mesh-delivery-view/cmd/mesh-delivery-view-tools/tiers_rows_test.go @@ -108,7 +108,7 @@ func tiersToolSaysEachModulesWait(t *testing.T) { t.Fatalf("view_tiers with waits = %+v, %v", out, err) } web = held.Tiers[1][0] - if last := web.Waits[len(web.Waits)-1]; last.Step != view.TakeInStep || !last.Since.Equal(heldSince) || !strings.Contains(last.Words, "src2:abc") { + if last := web.Waits[len(web.Waits)-1]; last.Step != view.TakeInStep || !last.Since.Equal(heldSince) || !strings.Contains(last.Words, "unread or lost") { t.Errorf("web = %+v, want its last wait on the edge take-in since %s", web, heldSince) } if lib := held.Tiers[0][1]; lib.Module != "lib" || lib.Waits[len(lib.Waits)-1].Step != view.TakeInStep || !strings.Contains(lib.Waits[len(lib.Waits)-1].Words, "group feat") { diff --git a/modules/mesh-delivery-view/internal/view/tiers.go b/modules/mesh-delivery-view/internal/view/tiers.go index 1d98db2b..721b5da9 100644 --- a/modules/mesh-delivery-view/internal/view/tiers.go +++ b/modules/mesh-delivery-view/internal/view/tiers.go @@ -219,7 +219,7 @@ func (r Reader) heldBack(out *Tiers) (map[string]TierWait, []string) { return held, nil } for _, w := range a.Waits { - words := "the indexer holds back " + w.Key + ", which waits for the indexer build " + w.WaitsFor + words := "the indexer holds back " + w.Key + " (its message is unread or lost, or it is held for room)" if w.What == takein.TakeInGroup { words = "the indexer gathers the group " + w.Group + " and its end has not come" } else if w.Behind != "" { diff --git a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/main_test.go b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/main_test.go index 75f1ff81..3843658f 100644 --- a/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/main_test.go +++ b/modules/mesh-delivery-watchman/cmd/mesh-delivery-watchman/main_test.go @@ -132,7 +132,7 @@ func TestRunNeedsItsCredential(t *testing.T) { // 1135/AC6 } out.findings[old.Key()] = true w.SeedFinding(old.Key(), value) - body, err := takein.EncodeTakeIn(takein.TakeIn{Kind: takein.TakeInPending, Key: "m.00000000000000000043", What: takein.TakeInRevision, Since: time.Now(), WaitsFor: "src2:x", + body, err := takein.EncodeTakeIn(takein.TakeIn{Kind: takein.TakeInPending, Key: "m.00000000000000000043", What: takein.TakeInRevision, Since: time.Now(), Lost: []string{"m.00000000000000000043"}, Merges: []takein.Merge{{Repository: "novox/a", Number: 1, Merge: "c0ffee"}}}) if err != nil { t.Fatal(err) diff --git a/modules/mesh-delivery-watchman/internal/watch/findings_test.go b/modules/mesh-delivery-watchman/internal/watch/findings_test.go index 9e292509..896c8807 100644 --- a/modules/mesh-delivery-watchman/internal/watch/findings_test.go +++ b/modules/mesh-delivery-watchman/internal/watch/findings_test.go @@ -136,27 +136,27 @@ func TestTheWatchmansFindings(t *testing.T) { // began ten minutes ago, and the indexer still holds it. since := c.t.Add(-10 * time.Minute) w.SeedTakeIn(takein.PendingAnswer{Waits: []takein.PendingWait{{Key: revKey, What: takein.TakeInRevision, Keys: []string{revKey}, - Merges: []takein.Merge{{Repository: "novox/a", Number: 1, Merge: "c0ffee"}}, WaitsFor: "src2:x", Since: since}}}) + Merges: []takein.Merge{{Repository: "novox/a", Number: 1, Merge: "c0ffee"}}, Lost: []string{"m.00000000000000000042"}, Since: since}}}) w.TakeInCaughtUp() if len(o.findings) != 0 || o.ttls[signalKey("take-in", revKey)] != TakeInRevisionBound-10*time.Minute { t.Fatalf("within its bound: findings %v, ttl %v; want none yet and the rest of the bound", o.findings, o.ttls[signalKey("take-in", revKey)]) } expire(w, c, signalKey("take-in", revKey), TakeInRevisionBound-10*time.Minute) }, map[string]string{FindingKey(ScopeDelivery, revKey, KindTakeInWaits): Warning}}, - {"ADR 0633 §1 (issue 1921): a merge held because the indexer cannot learn its own build is raised past the revision bound from its since, naming why", func(t *testing.T, w *Watchman, o *fakeOut, c *clock) { + {"ADR 0633 §1 (issue 1921): (A-476 b) a revision held because its message is lost or unread is raised past the revision bound from its since, naming why", func(t *testing.T, w *Watchman, o *fakeOut, c *clock) { w.TakeInCaughtUp() body, err := takein.EncodeTakeIn(takein.TakeIn{Kind: takein.TakeInPending, Key: revKey, What: takein.TakeInRevision, Since: c.t, - Merges: []takein.Merge{{Repository: "novox/a", Number: 1, Merge: "c0ffee"}}, Unknown: "the engine does not answer"}) + Merges: []takein.Merge{{Repository: "novox/a", Number: 1, Merge: "c0ffee"}}, Lost: []string{revKey}}) if err != nil { t.Fatal(err) } w.TakeIn(takeInEvent(t, takein.TakeInPending, revKey), body) if o.ttls[signalKey("take-in", revKey)] != TakeInRevisionBound || len(o.findings) != 0 { - t.Fatalf("an unknown own build: ttls %v, findings %v", o.ttls, o.findings) + t.Fatalf("a lost message: ttls %v, findings %v", o.ttls, o.findings) } expire(w, c, signalKey("take-in", revKey), TakeInRevisionBound) for _, f := range o.findings { - if !strings.Contains(f.Summary, "cannot learn the build it runs") { + if !strings.Contains(f.Summary, "lost or unread") { t.Errorf("finding %q does not say why", f.Summary) } } @@ -573,7 +573,7 @@ func takeInBody(t *testing.T, kind, key string, since time.Time) []byte { if key[0] == 'g' { body.What, body.Group = takein.TakeInGroup, "feat/take-in" } else if kind == takein.TakeInPending { - body.WaitsFor = "src2:abc" + body.Lost = []string{key} } b, err := takein.EncodeTakeIn(body) if err != nil { diff --git a/modules/mesh-delivery-watchman/internal/watch/takein.go b/modules/mesh-delivery-watchman/internal/watch/takein.go index 9120b322..e534ac6c 100644 --- a/modules/mesh-delivery-watchman/internal/watch/takein.go +++ b/modules/mesh-delivery-watchman/internal/watch/takein.go @@ -135,10 +135,7 @@ func (w *Watchman) takeIn(kind, key string, t takein.TakeIn) { w.unfind(finding) return } - bound, what := TakeInRevisionBound, "a source revision waits for the indexer build "+t.WaitsFor - if t.Unknown != "" { - what = "a source revision is held because the indexer cannot learn the build it runs (" + t.Unknown + ")" - } + bound, what := TakeInRevisionBound, "a source revision is held (a message lost or unread, no room for it, or its refusal)" if t.What == takein.TakeInGroup { bound, what = TakeInGroupBound, "a delivery group is gathered and its end has not come" } @@ -152,7 +149,7 @@ func (w *Watchman) takeIn(kind, key string, t takein.TakeIn) { Headline: "A merged change is held back by the indexer", Explanation: "The indexer holds " + what + " and has not taken it in within " + bound.String() + ", so what the merge changes does " + "not reach the machines.", - Needs: "the indexer build it waits for to run, or the take-in by hand (indexer_take_in_pending), or a drop (indexer_drop_pending)"} + Needs: "the take-in by hand (indexer_take_in_pending), or a drop (indexer_drop_pending)"} left := bound - w.now().Sub(t.Since) w.unfind(finding) w.unsignal(takeInRow, key)