From 1b9f9355b51a6289eeb5d8259475eb1df8f40888 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 00:39:39 +0100 Subject: [PATCH 1/9] Node-engine: a hold of the composition carries its wait, step compose (A-453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A module not composed for want of its entry (entry-asked, entry-missing) and a want whose parts differ write their have with a Wait of step compose and that reason, as the kept data's holds do; the hold for a failed backup carries none. Builds: design 47 G A-453 (ADR 0539 §16, §541) --- internal/agent/agent.go | 13 +++++++++++-- internal/agent/agent_test.go | 19 +++++++++++++------ internal/agent/parts.go | 8 ++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index 411b2ad2..2a2456c0 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -660,13 +660,16 @@ func (a *Agent) NotComposedEach(ctx context.Context, why string, held map[string a.notComposed[module] = mark a.mu.Unlock() phase, detail := string(nodeengineclient.PhaseFailed), NotComposedDetail+why + var wait *nodeengine.Wait if heldForEntry(why) { // The entry its want names is not held: the phase held, its detail opening entry-asked: or entry-missing: and // naming the fingerprint (design 47 G section 421). phase, detail = string(nodeengineclient.PhaseHeld), why + // The hold says what it waits on, as every hold but a failed backup does (design 47 G A-453, section 541). + wait = a.composeWait(strings.TrimSuffix(heldReason(why), ":"), why) } a.writeHave(ctx, Have{Module: module, FP: mark.prior.FP, Composed: mark.prior.Composed, Sealed: mark.prior.Sealed, - Phase: phase, Detail: detail}) + Phase: phase, Detail: detail, Wait: wait}) } } @@ -678,6 +681,12 @@ func (a *Agent) NotComposedEach(ctx context.Context, why string, held map[string // module since its start: held by a failed backup, waiting for a yes, not composed) keeps what the module's last have // said runs, its fingerprint, digest and sealed values, rather than a have naming nothing: what runs is not lost, and // the boxes the composer reuses after a restart stay (review of L2, rounds 2 and 3). +// composeWait is the wait a hold of the composition carries in its have: step compose, with its reason and its words (design 47 G +// A-453, section 541). Only a hold for a failed backup carries none. +func (a *Agent) composeWait(reason, words string) *nodeengine.Wait { + return &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: reason, Since: a.now(), Words: words} +} + func (a *Agent) writeHave(ctx context.Context, h Have) { if h.Module != NodeModule { a.mu.Lock() @@ -1634,7 +1643,7 @@ func (a *Agent) apply(ctx context.Context, module string, w wantNow, comp compNo } a.env.Say(fmt.Sprintf("%s is held: %s", module, words)) a.writeHave(ctx, Have{Module: module, FP: prev.Fp, Composed: prev.Composed, Phase: string(nodeengineclient.PhaseHeld), - Detail: words}) + Detail: words, Wait: a.composeWait("parts-differ", words)}) return } diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index d592dd83..9ad87282 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -357,8 +357,9 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) { if got := len(b.appliedList()) - before; (got == 1) != row.applies { t.Fatalf("parts %q: applied %d times, want applies=%v", row.name, got, row.applies) } - if h := b.haves.last("web"); !row.applies && (h.Phase != string(nodeengineclient.PhaseHeld) || h.Detail != row.detail) { - t.Fatalf("parts %q: the have is %s %q, want held %q", row.name, h.Phase, h.Detail, row.detail) + if h := b.haves.last("web"); !row.applies && (h.Phase != string(nodeengineclient.PhaseHeld) || h.Detail != row.detail || + h.Wait == nil || h.Wait.Step != nodeengine.WaitStepCompose || h.Wait.Reason != "parts-differ" || h.Wait.Words != row.detail) { + t.Fatalf("parts %q: the have is %s %q wait %+v, want held %q waiting on parts-differ (A-453)", row.name, h.Phase, h.Detail, h.Wait, row.detail) } } // A container's digest is the one after its image's @. @@ -754,7 +755,8 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) { }) eventually(t, "the have does not say held", func() bool { h := b.haves.last("db") - return h.Phase == string(nodeengineclient.PhaseHeld) && strings.Contains(h.Detail, "repository is locked") && h.FP == fp1 + // A hold for a failed backup carries no wait: the operator is asked about it (A-453). + return h.Phase == string(nodeengineclient.PhaseHeld) && strings.Contains(h.Detail, "repository is locked") && h.FP == fp1 && h.Wait == nil }) if got := b.appliedList(); len(got) != 0 { t.Fatalf("something was applied behind a failed backup: %v", got) @@ -1784,9 +1786,14 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes( } // Design 47 G §421: a module whose want's entry the catalog half holds none of is the phase held, its detail opening // entry-missing: and naming the fingerprint; composed again, its have is what it runs. - b.ag.NotComposedEach(context.Background(), "", map[string]string{"idle": EntryMissing + " the catalog half holds no entry of the build src2:x"}) - if h := b.haves.last("idle"); h.Phase != string(nodeengineclient.PhaseHeld) || h.Composed != idleDig || h.Detail != EntryMissing+" the catalog half holds no entry of the build src2:x" { - t.Errorf("idle's have while its entry is missing: %+v", h) + // A-453: the hold carries its wait, step compose with the reason, as every hold but a failed backup does. + for _, row := range []struct{ opening, reason string }{{EntryMissing, "entry-missing"}, {EntryAsked, "entry-asked"}} { + words := row.opening + " the catalog half holds no entry of the build src2:x" + b.ag.NotComposedEach(context.Background(), "", map[string]string{"idle": words}) + if h := b.haves.last("idle"); h.Phase != string(nodeengineclient.PhaseHeld) || h.Composed != idleDig || h.Detail != words || + h.Wait == nil || h.Wait.Step != nodeengine.WaitStepCompose || h.Wait.Reason != row.reason || h.Wait.Words != words || h.Wait.Since.IsZero() { + t.Errorf("idle's have while its entry is %s: %+v", row.reason, h) + } } b.ag.NotComposedEach(context.Background(), "", nil) if h := b.haves.last("idle"); h.Phase != string(nodeengineclient.PhaseRunning) || h.Composed != idleDig { diff --git a/internal/agent/parts.go b/internal/agent/parts.go index 222808de..1da96058 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -31,6 +31,14 @@ func judgedAgain(why string) bool { } // heldForEntry says whether why is a hold for the entry a want names. +// heldReason is the opening of a detail held for an entry: EntryAsked or EntryMissing. +func heldReason(why string) string { + if strings.HasPrefix(why, EntryAsked) { + return EntryAsked + } + return EntryMissing +} + func heldForEntry(why string) bool { return strings.HasPrefix(why, EntryAsked) || strings.HasPrefix(why, EntryMissing) } -- 2.54.0 From dbb77efab13f7139b799dd80de8c58cffd99c7c0 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 00:48:46 +0100 Subject: [PATCH 2/9] Node-engine: only an image the mesh built is a part of a want (A-454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A container's image counts as fetched for the parts check only when the composition names the seat it came through; an upstream image its manifest pins by digest is no part and is never 'fetched and not in the want's parts'. Builds: design 47 G A-454 (§421's parts check, A-432) --- internal/agent/agent_test.go | 10 +++++++++- internal/agent/parts.go | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index 9ad87282..548ddff4 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -363,10 +363,18 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) { } } // A container's digest is the one after its image's @. - container := json.RawMessage(`{"id":"web.c","type":"container","name":"web-c","image":"store/web@` + d3 + `","module":"web"}`) + container := json.RawMessage(`{"id":"web.c","type":"container","name":"web-c","image":"store/web@` + d3 + `","image-seat":"mesh-artifact-store","image-holder":"n1","module":"web"}`) if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container}); got != "" { t.Fatalf("a container whose digest is in the parts differs: %q", got) } + // A-454: an image the manifest pins from outside, by its digest, is no part of the want's parts, and a mesh-built one still is. + upstream := json.RawMessage(`{"id":"web.u","type":"container","name":"web-u","image":"registry@` + d2 + `","module":"web"}`) + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, upstream}); got != "" { + t.Fatalf("an upstream image pinned by its digest is a part: %q", got) + } + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{upstream}); !strings.Contains(got, "in the want's parts and not fetched: "+d3) || strings.Contains(got, d2) { + t.Fatalf("with only an upstream image the mesh-built one is not missing, or the upstream one is named: %q", got) + } // A-432: a runtime of its own runs the tool runner's program, which the module's parts do not name. ownRuntime := json.RawMessage(`{"id":"web.own-runtime","type":"process","name":"web-runtime","source":"store/node-tools","digest":"` + d1 + `","run":["./node-tools"],"module":"web"}`) if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, ownRuntime}); got != "" { diff --git a/internal/agent/parts.go b/internal/agent/parts.go index 1da96058..f5f0482c 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -69,6 +69,11 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin fetched[res.Digest] = true } case *declaration.Container: + // Only an image the mesh built is a part: the composition names the seat it came through (the artifact store or a + // registry seat) beside it. An image the manifest pins from outside, by its digest, is no part (design 47 G A-454). + if res.ImageSeat == "" { + continue + } if strings.HasPrefix(res.Image, "sha256:") { fetched[res.Image] = true } else if _, digest, ok := strings.Cut(res.Image, "@"); ok { -- 2.54.0 From 0a43489a74928b456a09d74de5d77f33e6696212 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 00:49:44 +0100 Subject: [PATCH 3/9] Node-engine: an upstream copy served through the registry seat is no part of a want (A-454) Builds: design 47 G A-454 --- internal/agent/agent_test.go | 5 +++++ internal/agent/parts.go | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index 548ddff4..c6b39f38 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -372,6 +372,11 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) { if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, upstream}); got != "" { t.Fatalf("an upstream image pinned by its digest is a part: %q", got) } + // And neither is the registry seat's copy of an upstream image, though it is routed through the seat. + mirrored := json.RawMessage(`{"id":"web.m","type":"container","name":"web-m","image":"store:5000/upstream/docker.io/library/registry@` + d1 + `","image-seat":"container-image-registry","image-holder":"n1","module":"web"}`) + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, mirrored}); got != "" { + t.Fatalf("an upstream copy served through the registry seat is a part: %q", got) + } if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{upstream}); !strings.Contains(got, "in the want's parts and not fetched: "+d3) || strings.Contains(got, d2) { t.Fatalf("with only an upstream image the mesh-built one is not missing, or the upstream one is named: %q", got) } diff --git a/internal/agent/parts.go b/internal/agent/parts.go index f5f0482c..526903fc 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -6,6 +6,7 @@ import ( "sort" "strings" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/containerimageregistryclient/reference" "git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/declaration" ) @@ -43,6 +44,17 @@ func heldForEntry(why string) bool { return strings.HasPrefix(why, EntryAsked) || strings.HasPrefix(why, EntryMissing) } +// upstreamCopy is whether a routed image is the registry seat's copy of an upstream image, `
/upstream//@`: +// the mesh mirrors it, but it built nothing, so it is no part of a want (design 47 G A-454). +func upstreamCopy(image string) bool { + _, path, ok := strings.Cut(image, "/") + if !ok { + return false + } + _, _, upstream := reference.InUpstream(path) + return upstream +} + // partsDifference checks a want's `parts` against the digests of the archive, process and container resources of the // composition, which are the digests the apply fetches and checks (design 47 G section 524). A want with no `parts` (an // assigner of before G, or a node whose record does not state `want-parts`) is applied as today: it returns "". With @@ -71,7 +83,7 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin case *declaration.Container: // Only an image the mesh built is a part: the composition names the seat it came through (the artifact store or a // registry seat) beside it. An image the manifest pins from outside, by its digest, is no part (design 47 G A-454). - if res.ImageSeat == "" { + if res.ImageSeat == "" || upstreamCopy(res.Image) { continue } if strings.HasPrefix(res.Image, "sha256:") { -- 2.54.0 From 5b4484efd8b437e47c46dc1d29878b67a09a83e4 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:00:57 +0100 Subject: [PATCH 4/9] Node-engine: a hold after an interrupted backup waits as the others do (A-453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G A-453 (§541) --- internal/agent/agent.go | 21 +++++++++++++-------- internal/agent/agent_test.go | 5 +++-- internal/agent/parts.go | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index 2a2456c0..a83ace65 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -673,6 +673,12 @@ func (a *Agent) NotComposedEach(ctx context.Context, why string, held map[string } } +// composeWait is the wait a hold of the composition carries in its have: step compose, with its reason and its words (design 47 G +// A-453, section 541). Only a hold for a failed backup carries none. +func (a *Agent) composeWait(reason, words string) *nodeengine.Wait { + return &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: reason, Since: a.now(), Words: words} +} + // writeHave writes a module's have (the node's own key for NodeModule); on a node composing its own, with the sealed // values of the composition it names when the caller gave none (Have.Sealed): those of the composition the agent applied or holds at that digest, else // those the module's last have said at that digest. @@ -681,12 +687,6 @@ func (a *Agent) NotComposedEach(ctx context.Context, why string, held map[string // module since its start: held by a failed backup, waiting for a yes, not composed) keeps what the module's last have // said runs, its fingerprint, digest and sealed values, rather than a have naming nothing: what runs is not lost, and // the boxes the composer reuses after a restart stay (review of L2, rounds 2 and 3). -// composeWait is the wait a hold of the composition carries in its have: step compose, with its reason and its words (design 47 G -// A-453, section 541). Only a hold for a failed backup carries none. -func (a *Agent) composeWait(reason, words string) *nodeengine.Wait { - return &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: reason, Since: a.now(), Words: words} -} - func (a *Agent) writeHave(ctx context.Context, h Have) { if h.Module != NodeModule { a.mu.Lock() @@ -1680,9 +1680,14 @@ func (a *Agent) apply(ctx context.Context, module string, w wantNow, comp compNo a.mu.Lock() a.attempt[module] = attempt{FP: fp, Composed: dig, WantRev: w.Rev, CompRev: comp.Rev, Held: true, AnsweredRev: w.Rev} a.mu.Unlock() - // It keeps running what it has: the have says what it holds and why it waits. + // It keeps running what it has: the have says what it holds and why it waits. A backup interrupted is no failure of it, so + // its hold waits as kept.go's do, with the words as the reason; only a failed backup carries no wait (A-453). + var wait *nodeengine.Wait + if words == BackupInterrupted { + wait = a.composeWait(words, words) + } a.writeHave(ctx, Have{Module: module, FP: prev.Fp, Composed: prev.Composed, Phase: string(nodeengineclient.PhaseHeld), - Detail: words}) + Detail: words, Wait: wait}) return } } diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index c6b39f38..55cc0f87 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -828,8 +828,9 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) { stopI := ib.run() <-began stopI() - if h := ib.haves.last("db"); h.Phase != string(nodeengineclient.PhaseHeld) || h.FP != fp1 || h.Composed != dig1 || h.Detail != BackupInterrupted { - t.Errorf("held after an interrupted backup: %+v", h) + if h := ib.haves.last("db"); h.Phase != string(nodeengineclient.PhaseHeld) || h.FP != fp1 || h.Composed != dig1 || h.Detail != BackupInterrupted || + h.Wait == nil || h.Wait.Step != nodeengine.WaitStepCompose || h.Wait.Reason != BackupInterrupted { + t.Errorf("held after an interrupted backup, with its wait (A-453): %+v", h) } // At a start: a backup the node agent's own stop interrupted (postgres on novox, 2026-10-31) is no failure, so it is diff --git a/internal/agent/parts.go b/internal/agent/parts.go index 526903fc..d8792873 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -31,7 +31,6 @@ func judgedAgain(why string) bool { return strings.HasPrefix(why, PartsDiffer) || heldForEntry(why) } -// heldForEntry says whether why is a hold for the entry a want names. // heldReason is the opening of a detail held for an entry: EntryAsked or EntryMissing. func heldReason(why string) string { if strings.HasPrefix(why, EntryAsked) { @@ -40,6 +39,7 @@ func heldReason(why string) string { return EntryMissing } +// heldForEntry says whether why is a hold for the entry a want names. func heldForEntry(why string) bool { return strings.HasPrefix(why, EntryAsked) || strings.HasPrefix(why, EntryMissing) } -- 2.54.0 From 523ad97e280b5483961dd85e9f45c692dcc08a32 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:06:57 +0100 Subject: [PATCH 5/9] Node-engine: a digest the want's parts name always counts as fetched (A-454a) Builds: design 47 G A-454a --- internal/agent/agent_test.go | 8 ++++++++ internal/agent/parts.go | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index 55cc0f87..8ea01aa6 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -380,6 +380,14 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) { if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{upstream}); !strings.Contains(got, "in the want's parts and not fetched: "+d3) || strings.Contains(got, d2) { t.Fatalf("with only an upstream image the mesh-built one is not missing, or the upstream one is named: %q", got) } + // A-454a: a mesh-built image whose seat holder is not on record carries no image-seat; its digest is in the parts, so it is fetched. + noSeat := json.RawMessage(`{"id":"web.n","type":"container","name":"web-n","image":"store/web@` + d3 + `","module":"web"}`) + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{noSeat}); got != "" { + t.Fatalf("a mesh-built image with no image-seat, named by the parts, is not fetched: %q", got) + } + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{noSeat, upstream}); got != "" { + t.Fatalf("an upstream image beside it is a part: %q", got) + } // A-432: a runtime of its own runs the tool runner's program, which the module's parts do not name. ownRuntime := json.RawMessage(`{"id":"web.own-runtime","type":"process","name":"web-runtime","source":"store/node-tools","digest":"` + d1 + `","run":["./node-tools"],"module":"web"}`) if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, ownRuntime}); got != "" { diff --git a/internal/agent/parts.go b/internal/agent/parts.go index d8792873..5d19152b 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -64,6 +64,10 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin if len(parts) == 0 { return "" } + inParts := map[string]bool{} + for _, d := range parts { + inParts[d] = true + } fetched := map[string]bool{} for _, raw := range resources { r, err := declaration.ParseResource(raw) @@ -81,16 +85,22 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin fetched[res.Digest] = true } case *declaration.Container: - // Only an image the mesh built is a part: the composition names the seat it came through (the artifact store or a - // registry seat) beside it. An image the manifest pins from outside, by its digest, is no part (design 47 G A-454). - if res.ImageSeat == "" || upstreamCopy(res.Image) { + // A digest the want's parts name always counts as fetched, whatever marks the resource carries; one they do not + // name counts only when it is the mesh's own: an image the manifest pins from outside, or the registry seat's + // copy of an upstream image, is no part (design 47 G A-454, A-454a). + digest := "" + if strings.HasPrefix(res.Image, "sha256:") { + digest = res.Image + } else if _, d, ok := strings.Cut(res.Image, "@"); ok { + digest = d + } + if digest == "" { continue } - if strings.HasPrefix(res.Image, "sha256:") { - fetched[res.Image] = true - } else if _, digest, ok := strings.Cut(res.Image, "@"); ok { - fetched[digest] = true + if !inParts[digest] && (res.ImageSeat == "" || upstreamCopy(res.Image)) { + continue } + fetched[digest] = true } } named := map[string]bool{} -- 2.54.0 From b132653fc07f23c25942566eaf8444fa9b19da1e Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:10:49 +0100 Subject: [PATCH 6/9] Compose: an artifact store with no known address holds the modules that fetch from it, not the node (A-461, second part) Builds: design 47 G A-461 (second sentence; the first, laying another node's module from its want's entry, waits on a lead answer) --- internal/compose/render.go | 10 ++++++++++ internal/compose/rendering.go | 31 +++++++++++++++++++++++++++++- internal/compose/rendering_test.go | 18 +++++++++++++++-- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/internal/compose/render.go b/internal/compose/render.go index 09d9b7be..194c3da2 100644 --- a/internal/compose/render.go +++ b/internal/compose/render.go @@ -125,6 +125,16 @@ func (c *composer) render(nodeName string, mode Mode) (Rendered, error) { } } + // A module that fetches from an artifact store with no known address waits for it; the machine composes the rest (A-461). + for module, why := range placed.storeHeld { + if r.NotPlaced == nil { + r.NotPlaced = map[string]string{} + } + if _, said := r.NotPlaced[module]; !said { + r.NotPlaced[module] = why + } + } + // And a certificate for this machine's name inside the mesh, when anything on it asks. for _, m := range plan.Modules { if m.Certificate == nil { diff --git a/internal/compose/rendering.go b/internal/compose/rendering.go index 4bdd41c5..a4cf400e 100644 --- a/internal/compose/rendering.go +++ b/internal/compose/rendering.go @@ -10,6 +10,7 @@ import ( "git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay" "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-host/internal/compose/resolution" + "github.com/novox/mesh-host/internal/registryforms" ) // The contracts of the node-engine's statement that gate what a machine is sent, as the controller's link package names them @@ -41,6 +42,8 @@ type Placed struct { // manifest's own number as the Reading mode composes them, and never invented. The controller's adapter allocates and // composes again. ForeseenPorts []string + // storeHeld are the modules left out of the declaration because the artifact store has no known address, and why (A-461). + storeHeld map[string]string } // Places composes the place half of the rendering for a node (the controller's renderingFor in the Reading and Foreseeing modes, @@ -92,9 +95,12 @@ func (c *composer) places(nodeName string, resolved Resolved) (Placed, error) { r.MeshRange = c.overlayRange() // The artifact store as this node reaches it now, with what the mesh has built. + // Where no address is known (the holder opens no listen to the mesh, or two), only the modules that fetch from the store + // wait, with the words of an unanswered requirement; the node composes the rest (design 47 G A-461, A-452). store, err := c.artifactStoreAddress(nodeName) if err != nil { - return out, err + out.storeHeld = modulesNeedingTheStore(plan.Modules, err) + store = "" } r.ArtifactStore = store r.Built = make(map[string]bool, len(c.in.Built)) @@ -327,6 +333,29 @@ func (c *composer) namesInTheMesh() map[string]string { return out } +// modulesNeedingTheStore are the modules with a resource whose image or source is a kept reference into the artifact store, each +// with why it waits: nothing provides the store's address (A-461). +func modulesNeedingTheStore(modules []catalogue.Manifest, why error) map[string]string { + out := map[string]string{} + for _, m := range modules { + for _, res := range m.Resources { + needs := false + for _, key := range []string{"image", "source"} { + if written, ok := res[key].(string); ok { + if _, kept := registryforms.Forms.InArtifactStore(written); kept { + needs = true + } + } + } + if needs { + out[m.Module] = fmt.Sprintf("nothing provides %q, wanted by %s: %v", "the artifact store's address", m.Module, why) + break + } + } + } + return out +} + // StoreSeat is the seat whose holder is the artifact store (novox/hq ADR 0632 §1): the store's address is that holder's // listen open to the mesh, on the machine assignment puts it on. The provision artifact-store it was found by before is // retired; no module serves it. diff --git a/internal/compose/rendering_test.go b/internal/compose/rendering_test.go index 78d7a793..806c8c7f 100644 --- a/internal/compose/rendering_test.go +++ b/internal/compose/rendering_test.go @@ -351,8 +351,22 @@ func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) { m := in.Catalogue["registry"] m.Listens = append(m.Listens, catalogue.Listening{Name: "other", Port: 5300, From: catalogue.FromMesh}) in.Catalogue["registry"] = m - if _, err := Places(in, "laptop"); err == nil || !strings.Contains(err.Error(), "opens registry (5000), other (5300) to the mesh") { - t.Errorf("a holder opening two listens to the mesh: %v", err) + // A-461: a store with no known address (two listens open to the mesh, so none is a guess) costs the modules that fetch from + // it, not the node: those wait with the words of an unanswered requirement, and the node composes the rest. + in.Catalogue["app"] = catalogue.Manifest{Module: "app", Version: "1", + Resources: []map[string]any{{"id": "c", "type": "container", "name": "app", "image": "artifact-store://app/c@sha256:" + strings.Repeat("a", 64)}}} + in.Catalogue["plain"] = catalogue.Manifest{Module: "plain", Version: "1"} + laptop := nodeOf(t, &in, "laptop") + laptop.Assigned = append(laptop.Assigned, "app", "plain") + got, err := Render(in, "laptop", Reading) + if err != nil { + t.Fatalf("a holder opening two listens to the mesh refuses the whole node: %v", err) + } + if why := got.Rendering.NotPlaced["app"]; !strings.Contains(why, "nothing provides") || !strings.Contains(why, "opens registry (5000), other (5300) to the mesh") { + t.Errorf("the module that fetches from the store waits with %q", why) + } + if why, held := got.Rendering.NotPlaced["plain"]; held { + t.Errorf("a module that fetches nothing from the store waits: %q", why) } } -- 2.54.0 From cbed32524a2b117ab3221148f58cbdcf2f5c676c Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:12:37 +0100 Subject: [PATCH 7/9] Selfcompose: another node's module whose running build has no entry is laid from its placed build's entry (A-461, A-461a) Builds: design 47 G A-461 (first sentence), A-461a --- internal/selfcompose/entries.go | 36 ++++++++++++++++++++---- internal/selfcompose/entries_test.go | 42 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/internal/selfcompose/entries.go b/internal/selfcompose/entries.go index 3fd3ad88..b5aec51a 100644 --- a/internal/selfcompose/entries.go +++ b/internal/selfcompose/entries.go @@ -274,13 +274,19 @@ func (c *Composer) wantedBuilds() map[string]bool { } } } - for _, mods := range c.heard { - for _, run := range mods { + for node, mods := range c.heard { + for module, run := range mods { if !run.stopped && strings.HasPrefix(run.fingerprint, meshcatalogclient.SourcePrefix2) { if _, named := out[run.fingerprint]; !named { out[run.fingerprint] = false } } + // The build the assignment places for another node's module stands for its want where the running build has no entry (A-461). + if built := c.placedBuild(node, module); !run.stopped && built != "" && strings.HasPrefix(built, meshcatalogclient.SourcePrefix2) { + if _, named := out[built]; !named { + out[built] = false + } + } } } // The build each module runs here, as the node's own record of it says: its entry, kept in the composition state, stays held @@ -372,15 +378,15 @@ func (c *Composer) layModules() { c.mu.Lock() defer c.mu.Unlock() modules := map[string]meshcatalog.ModulesByModuleValue{} - lay := func(module, fp string) { + lay := func(module, fp string) bool { k, ok := c.keptEnt[fp] if !ok || k.entry.Module == "" { - return + return false } e := k.entry digest, raw, err := entryManifest(e) if err != nil { - return + return false } m := meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: digest, Repository: e.Repository, Commit: e.Commit, Path: e.Path, Needs: e.Needs, Packages: e.Packages, Verdict: e.Verdict} @@ -389,6 +395,7 @@ func (c *Composer) layModules() { } modules[module] = m c.manifests[digest] = raw + return true } nodes := make([]string, 0, len(c.heard)) for node := range c.heard { @@ -398,7 +405,13 @@ func (c *Composer) layModules() { for _, node := range nodes { for module, run := range c.heard[node] { if !run.stopped && run.fingerprint != "" { - lay(module, run.fingerprint) + // Where the running build has no entry, the module is laid from the entry of the build the assignment places + // for that node, the mesh's truth of what it runs there (A-461); with neither it stays name-only below. + if !lay(module, run.fingerprint) { + if built := c.placedBuild(node, module); built != "" && built != run.fingerprint { + lay(module, built) + } + } } } } @@ -443,6 +456,17 @@ func (c *Composer) layModules() { c.modules = modules } +// placedBuild is the build the assignment places for module on node (c.mu held): empty where none is held or it names none (the +// newest delivered of the branch, which the composer cannot name). +func (c *Composer) placedBuild(node, module string) string { + for _, pm := range c.assignments[node].Modules { + if pm.Module == module { + return pm.Build + } + } + return "" +} + // entryManifest is an entry's manifest as a reader takes it, with its digest: the one the indexer set at take-in, or, where it set // none, the digest of the manifest's bytes. func entryManifest(e meshcatalog.CatalogEntry) (digest string, raw []byte, err error) { diff --git a/internal/selfcompose/entries_test.go b/internal/selfcompose/entries_test.go index e43f1f02..1de8ec1d 100644 --- a/internal/selfcompose/entries_test.go +++ b/internal/selfcompose/entries_test.go @@ -342,3 +342,45 @@ func TestRunningBuildEntryKeptAndHandedAgain(t *testing.T) { t.Error("an entry of the running build was answered, and the composition was not handed again") } } + +// A-461: another node's module whose running build has no entry is laid from the entry of the build the assignment places for it +// on that node; where neither has one, it stays as its name alone. +func TestAnotherNodesModuleIsLaidFromItsPlacedBuildWhenItsRunningBuildHasNoEntry(t *testing.T) { + running := meshcatalogclient.SourcePrefix2 + strings.Repeat("1", 64) + placed := meshcatalogclient.SourcePrefix2 + strings.Repeat("2", 64) + body := `{"module":"distribution","version":"2"}` + for _, tc := range []struct { + name string + build string + holds bool + laid bool + }{ + {"placed build has an entry", placed, true, true}, + {"neither build has an entry", placed, false, false}, + {"placement names no build", "", false, false}, + } { + t.Run(tc.name, func(t *testing.T) { + env := newFakeBus().env() + env.Node = "n1" + c := New(env) + c.mu.Lock() + c.assignments["n2"] = meshmoduleassigner.Assignments{Node: "n2", Modules: []meshmoduleassigner.PlacedModule{{Module: "distribution", Build: tc.build}}} + c.heard = map[string]map[string]heardRun{"n2": {"distribution": {fingerprint: running}}} + c.mu.Unlock() + if tc.holds { + c.holdEntry(t, "distribution", placed, body) + } + if _, asked := c.wantedBuilds()[placed]; asked != (tc.build != "") { + t.Errorf("the placed build asked = %v, want %v", asked, tc.build != "") + } + c.layModules() + c.mu.Lock() + m, ok := c.modules["distribution"] + raw := c.manifests[m.Manifest] + c.mu.Unlock() + if got := ok && strings.Contains(string(raw), `"version":"2"`); got != tc.laid { + t.Errorf("laid from the placed build = %v, want %v (%+v %s)", got, tc.laid, m, raw) + } + }) + } +} -- 2.54.0 From bb285f9c1b86adb0086dccad63ab4ba6fe987098 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:19:21 +0100 Subject: [PATCH 8/9] Selfcompose, compose: the trunk build stands where a placement names none; the fallback is another node's only; only the store listen refusal holds fetchers (A-461b) Builds: design 47 G A-461b --- internal/compose/rendering.go | 22 +++++-- internal/selfcompose/entries.go | 98 +++++++++++++++++++++------- internal/selfcompose/entries_test.go | 44 +++++++------ internal/selfcompose/selfcompose.go | 8 ++- 4 files changed, 122 insertions(+), 50 deletions(-) diff --git a/internal/compose/rendering.go b/internal/compose/rendering.go index a4cf400e..4dfb2ed6 100644 --- a/internal/compose/rendering.go +++ b/internal/compose/rendering.go @@ -98,9 +98,14 @@ func (c *composer) places(nodeName string, resolved Resolved) (Placed, error) { // Where no address is known (the holder opens no listen to the mesh, or two), only the modules that fetch from the store // wait, with the words of an unanswered requirement; the node composes the rest (design 47 G A-461, A-452). store, err := c.artifactStoreAddress(nodeName) - if err != nil { + var noAddress *storeListenError + if errors.As(err, &noAddress) { + // Only the store holder's listen refusal holds its fetchers; any other error still refuses the node (A-461b). out.storeHeld = modulesNeedingTheStore(plan.Modules, err) - store = "" + store, err = "", nil + } + if err != nil { + return out, err } r.ArtifactStore = store r.Built = make(map[string]bool, len(c.in.Built)) @@ -392,6 +397,11 @@ func (c *composer) storeHolders() map[string]catalogue.Manifest { return out } +// storeListenError is the refusal of a holder that opens no listen to the mesh, or two: the store has no address (A-461). +type storeListenError struct{ said string } + +func (e *storeListenError) Error() string { return e.said } + // storeListen is the store holder's listen every machine pulls from: its one listen open to the mesh. A holder opening // none, or more than one, says no address, by name: which of two ports is the store is no guess the composer makes. func storeListen(m catalogue.Manifest) (catalogue.Listening, error) { @@ -405,15 +415,15 @@ func storeListen(m catalogue.Manifest) (catalogue.Listening, error) { case 1: return open[0], nil case 0: - return catalogue.Listening{}, fmt.Errorf("%s holds %s and opens no tcp listen to the mesh: the artifact store has no "+ - "address (novox/hq ADR 0632 §1)", m.Module, StoreSeat) + return catalogue.Listening{}, &storeListenError{fmt.Sprintf("%s holds %s and opens no tcp listen to the mesh: the artifact store has no "+ + "address (novox/hq ADR 0632 §1)", m.Module, StoreSeat)} } var said []string for _, l := range open { said = append(said, fmt.Sprintf("%s (%d)", l.Name, l.Port)) } - return catalogue.Listening{}, fmt.Errorf("%s holds %s and opens %s to the mesh: the artifact store's address is its one "+ - "listen open to the mesh (novox/hq ADR 0632 §1)", m.Module, StoreSeat, strings.Join(said, ", ")) + return catalogue.Listening{}, &storeListenError{fmt.Sprintf("%s holds %s and opens %s to the mesh: the artifact store's address is its one "+ + "listen open to the mesh (novox/hq ADR 0632 §1)", m.Module, StoreSeat, strings.Join(said, ", "))} } // artifactStoreOnNetwork is the machine on this network that holds the store's seat, and the port that machine put the diff --git a/internal/selfcompose/entries.go b/internal/selfcompose/entries.go index b5aec51a..c5eb2705 100644 --- a/internal/selfcompose/entries.go +++ b/internal/selfcompose/entries.go @@ -282,7 +282,7 @@ func (c *Composer) wantedBuilds() map[string]bool { } } // The build the assignment places for another node's module stands for its want where the running build has no entry (A-461). - if built := c.placedBuild(node, module); !run.stopped && built != "" && strings.HasPrefix(built, meshcatalogclient.SourcePrefix2) { + if built := c.placedBuild(node, module); c.lacksEntry(node, module, run) && strings.HasPrefix(built, meshcatalogclient.SourcePrefix2) { if _, named := out[built]; !named { out[built] = false } @@ -305,6 +305,7 @@ func (c *Composer) wantedBuilds() map[string]bool { // composes from, and lays the picture frombus reads (c.modules, c.manifests) from the entries it holds. It runs at the start of // each pass. func (c *Composer) syncEntries(ctx context.Context) { + c.askTrunkBuilds() need := c.wantedBuilds() for fp := range need { c.entryOf(fp) @@ -407,7 +408,7 @@ func (c *Composer) layModules() { if !run.stopped && run.fingerprint != "" { // Where the running build has no entry, the module is laid from the entry of the build the assignment places // for that node, the mesh's truth of what it runs there (A-461); with neither it stays name-only below. - if !lay(module, run.fingerprint) { + if !lay(module, run.fingerprint) && node != c.env.Node { if built := c.placedBuild(node, module); built != "" && built != run.fingerprint { lay(module, built) } @@ -456,17 +457,60 @@ func (c *Composer) layModules() { c.modules = modules } -// placedBuild is the build the assignment places for module on node (c.mu held): empty where none is held or it names none (the -// newest delivered of the branch, which the composer cannot name). +// placedBuild is the build the assignment places for module on node (c.mu held), the mesh's truth of what it runs there; where the +// placement names none, the module's trunk build as syncEntries asked it (A-461b). Empty where neither is known. func (c *Composer) placedBuild(node, module string) string { for _, pm := range c.assignments[node].Modules { if pm.Module == module { - return pm.Build + if pm.Build != "" { + return pm.Build + } + return c.trunkBuilds[module].fp } } return "" } +// lacksEntry says whether the build another node's module runs has no entry held (c.mu held): the only case the placed build stands +// in (A-461b). It is never so for this node's own modules. +func (c *Composer) lacksEntry(node, module string, run heardRun) bool { + if node == c.env.Node || run.stopped || run.fingerprint == "" { + return false + } + k, ok := c.keptEnt[run.fingerprint] + return !ok || k.entry.Module == "" +} + +// askTrunkBuilds asks, for each module another node runs at a build with no entry and whose placement names no build, the trunk +// build by the seat's verb `module`, once per running build (A-461b). Called before the lock is taken: the verb is a call. +func (c *Composer) askTrunkBuilds() { + type ask struct{ node, module, running string } + var asks []ask + c.mu.Lock() + for node, mods := range c.heard { + for module, run := range mods { + if !c.lacksEntry(node, module, run) { + continue + } + for _, pm := range c.assignments[node].Modules { + if pm.Module == module && pm.Build == "" && c.trunkBuilds[module].running != run.fingerprint { + asks = append(asks, ask{node, module, run.fingerprint}) + } + } + } + } + c.mu.Unlock() + for _, a := range asks { + fp, _ := c.trunkFp(a.module) + c.mu.Lock() + if c.trunkBuilds == nil { + c.trunkBuilds = map[string]trunkBuild{} + } + c.trunkBuilds[a.module] = trunkBuild{running: a.running, fp: fp} + c.mu.Unlock() + } +} + // entryManifest is an entry's manifest as a reader takes it, with its digest: the one the indexer set at take-in, or, where it set // none, the digest of the manifest's bytes. func entryManifest(e meshcatalog.CatalogEntry) (digest string, raw []byte, err error) { @@ -675,30 +719,38 @@ func (c *Composer) syncShadowEntries(ctx context.Context) (pending bool) { // moduleVerb is the seat mesh-catalog's verb `module`: one module's trunk fingerprint and manifest by name. const moduleVerb = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbModule +// trunkFp is the fingerprint of a module's trunk build, by the seat's verb `module`; empty with why where the catalog half gives none. +func (c *Composer) trunkFp(module string) (fp, why string) { + if c.env.Entry == nil { + return "", "this node reads no module of the catalog half" + } + raw, err := c.env.Entry(moduleVerb, meshcatalog.ModuleInput{Module: module}) + if err != nil { + return "", fmt.Sprintf("the catalog half's answer for %s: %v", module, err) + } + answer, said, ok := buscalls.Unwrap(raw) + if !ok { + return "", fmt.Sprintf("the catalog half holds no module %s: %s", module, said) + } + var a meshcatalog.ModuleAnswer + if err := json.Unmarshal(answer, &a); err != nil { + return "", fmt.Sprintf("the catalog half's answer for %s cannot be read: %v", module, err) + } + if a.Module.Fp == "" { + return "", fmt.Sprintf("the catalog half gives %s no fingerprint: %s", module, a.Module.None) + } + return a.Module.Fp, "" +} + // addedModule is the trunk's build of a module an assignment candidate adds to this node when no want here names it yet: the // fingerprint the seat's verb `module` answers, then its entry by the verb `entry` as for a wanted module (design 47 G §421, A-312). // A call, not a watch: nothing of the catalog is kept. It answers the entry when held; otherwise why not: a module with no // fingerprint says the verb's reason, an entry asked says so (its answer wakes the shadow, which composes again). func (c *Composer) addedModule(ctx context.Context, module string) (fp string, entry meshcatalog.CatalogEntry, held, pending bool, why string) { - if c.env.Entry == nil { - return "", entry, false, false, "this node reads no module of the catalog half" + fp, why = c.trunkFp(module) + if fp == "" { + return "", entry, false, false, why } - raw, err := c.env.Entry(moduleVerb, meshcatalog.ModuleInput{Module: module}) - if err != nil { - return "", entry, false, false, fmt.Sprintf("the catalog half's answer for %s: %v", module, err) - } - answer, said, ok := buscalls.Unwrap(raw) - if !ok { - return "", entry, false, false, fmt.Sprintf("the catalog half holds no module %s: %s", module, said) - } - var a meshcatalog.ModuleAnswer - if err := json.Unmarshal(answer, &a); err != nil { - return "", entry, false, false, fmt.Sprintf("the catalog half's answer for %s cannot be read: %v", module, err) - } - if a.Module.Fp == "" { - return "", entry, false, false, fmt.Sprintf("the catalog half gives %s no fingerprint: %s", module, a.Module.None) - } - fp = a.Module.Fp c.mu.Lock() if c.addedFps == nil { c.addedFps = map[string]bool{} diff --git a/internal/selfcompose/entries_test.go b/internal/selfcompose/entries_test.go index 1de8ec1d..30e89a7c 100644 --- a/internal/selfcompose/entries_test.go +++ b/internal/selfcompose/entries_test.go @@ -341,37 +341,43 @@ func TestRunningBuildEntryKeptAndHandedAgain(t *testing.T) { if still { t.Error("an entry of the running build was answered, and the composition was not handed again") } -} -// A-461: another node's module whose running build has no entry is laid from the entry of the build the assignment places for it -// on that node; where neither has one, it stays as its name alone. -func TestAnotherNodesModuleIsLaidFromItsPlacedBuildWhenItsRunningBuildHasNoEntry(t *testing.T) { - running := meshcatalogclient.SourcePrefix2 + strings.Repeat("1", 64) - placed := meshcatalogclient.SourcePrefix2 + strings.Repeat("2", 64) - body := `{"module":"distribution","version":"2"}` + // A-461, A-461a, A-461b: another node's module whose running build has no entry is laid from the entry of the build the assignment + // places for it on that node, or, where the placement names none, of its trunk build; with neither entry it stays as its name + // alone, and this node's own module is never laid from a placement. + placedFp := meshcatalogclient.SourcePrefix2 + strings.Repeat("3", 64) for _, tc := range []struct { - name string - build string - holds bool - laid bool + name string + node string + build, trunk string + holds, laid bool }{ - {"placed build has an entry", placed, true, true}, - {"neither build has an entry", placed, false, false}, - {"placement names no build", "", false, false}, + {"placed build has an entry", "n2", placedFp, "", true, true}, + {"neither build has an entry", "n2", placedFp, "", false, false}, + {"placement names no build, trunk build has an entry", "n2", "", placedFp, true, true}, + {"placement names no build, trunk names none", "n2", "", "", false, false}, + {"this node's own module is not laid from a placement", "n1", placedFp, "", true, false}, } { t.Run(tc.name, func(t *testing.T) { env := newFakeBus().env() env.Node = "n1" + env.Entry = EntryCall(func(_ context.Context, _, verb string, _ any) (json.RawMessage, error) { + if verb == meshcatalog.VerbModule { + return json.Marshal(meshcatalog.ModuleAnswer{Module: meshcatalog.ModuleAnswerModule{Fp: tc.trunk}}) + } + return nil, errors.New("not held") + }) c := New(env) c.mu.Lock() - c.assignments["n2"] = meshmoduleassigner.Assignments{Node: "n2", Modules: []meshmoduleassigner.PlacedModule{{Module: "distribution", Build: tc.build}}} - c.heard = map[string]map[string]heardRun{"n2": {"distribution": {fingerprint: running}}} + c.assignments[tc.node] = meshmoduleassigner.Assignments{Node: tc.node, Modules: []meshmoduleassigner.PlacedModule{{Module: "distribution", Build: tc.build}}} + c.heard = map[string]map[string]heardRun{tc.node: {"distribution": {fingerprint: old}}} c.mu.Unlock() if tc.holds { - c.holdEntry(t, "distribution", placed, body) + c.holdEntry(t, "distribution", placedFp, `{"module":"distribution","version":"2"}`) } - if _, asked := c.wantedBuilds()[placed]; asked != (tc.build != "") { - t.Errorf("the placed build asked = %v, want %v", asked, tc.build != "") + c.askTrunkBuilds() + if _, asked := c.wantedBuilds()[placedFp]; asked != (tc.node == "n2" && (tc.build != "" || tc.trunk != "")) { + t.Errorf("the placed build asked = %v", asked) } c.layModules() c.mu.Lock() diff --git a/internal/selfcompose/selfcompose.go b/internal/selfcompose/selfcompose.go index 7a12747d..994205c4 100644 --- a/internal/selfcompose/selfcompose.go +++ b/internal/selfcompose/selfcompose.go @@ -209,8 +209,10 @@ type Composer struct { addedFps map[string]bool // heard is, by node and module, what each node's event running last said it runs, kept from the seat's stream by this // node's own consumer (NoteRunning), under mu; heardRead is whether the first read of the stream ended (RunningRead). - heard map[string]map[string]heardRun - heardRead bool + heard map[string]map[string]heardRun + // trunkBuilds is, by module, the trunk build asked for another node's module whose placement names none, with the running build it was asked for (A-461b). + trunkBuilds map[string]trunkBuild + heardRead bool // ends is, by module, the last build end naming no branch the builder said of it (NoteBuildEnded), its newest build that // ended, under mu; endsRead is whether the first read of the builder's stream ended (BuildEndsRead) (design 47 G A-293). ends map[string]builds.BuildEnded @@ -2311,6 +2313,8 @@ func (c *Composer) WhyUnmade(module string) string { return c.last.Unmade[module] } +type trunkBuild struct{ running, fp string } + // heardRun is one running event as the composer keeps it, with when it was said. type heardRun struct { at time.Time -- 2.54.0 From 10a6824abe42d5f76fa5e6681e55ac503e304fdc Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 01:21:36 +0100 Subject: [PATCH 9/9] Compose: a fault of finding the store other than its listen refusal still refuses the node, tested (A-461b) Builds: design 47 G A-461b --- internal/compose/rendering_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/compose/rendering_test.go b/internal/compose/rendering_test.go index 806c8c7f..e7bc84e0 100644 --- a/internal/compose/rendering_test.go +++ b/internal/compose/rendering_test.go @@ -368,6 +368,14 @@ func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) { if why, held := got.Rendering.NotPlaced["plain"]; held { t.Errorf("a module that fetches nothing from the store waits: %q", why) } + // A-461b: only the listen refusal holds the store's fetchers; any other fault of finding the store (here the holder's machine is + // on the network as first read but unknown when its assignment is read) still refuses the node. + broken := newComposer(in) + broken.onTheNetwork() + broken.in.Nodes = []Node{*nodeOf(t, &in, "laptop")} + if _, err := broken.places("laptop", Resolved{}); err == nil || !strings.Contains(err.Error(), "reading what anchor is assigned") { + t.Errorf("a fault of finding the store other than its listen refusal did not refuse the node: %v", err) + } } // A zone a module declares is placed where the mesh put it: settled from that node's settings, at the node's private address, on -- 2.54.0