From 2239fb253d5225b38209e1b1f929f1e00806a047 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 3 Nov 2026 14:02:01 +0100 Subject: [PATCH] =?UTF-8?q?Rows=20for=20the=20composer's=20composition=20o?= =?UTF-8?q?f=20today:=20the=20same=20inputs=20give=20the=20running=20diges?= =?UTF-8?q?t,=20a=20changed=20input=20another,=20a=20build=20it=20cannot?= =?UTF-8?q?=20compose=20none=20(ADR=200601=20=C2=A71;=20review=20round=201?= =?UTF-8?q?,=20finding=202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/selfcompose/selfcompose_test.go | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/internal/selfcompose/selfcompose_test.go b/internal/selfcompose/selfcompose_test.go index a9e663a..170a0b3 100644 --- a/internal/selfcompose/selfcompose_test.go +++ b/internal/selfcompose/selfcompose_test.go @@ -268,6 +268,31 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) { b.mu.Unlock() t.Fatalf("handed %v, want %s and %s", got, lemursKey, nodeKey) } + // ADR 0601 ยง1: the module composed today at the build it runs, as the agent compares it with what runs. The same inputs give + // the digest handed; a changed input (here its manifest's service, as a changed setting would change a file) another; a + // build that cannot be composed (no done build or manifest of it: held) gives none. + c.mu.Lock() + handedDig := c.handed[lemursKey] + c.mu.Unlock() + if dig, ok := c.ComposedToday(ctx, "lemurs", fp); !ok || dig != handedDig { + t.Errorf("composed today at the build it runs: %s %v, want %s", dig, ok, handedDig) + } + if dig, ok := c.ComposedToday(ctx, "lemurs", delivery.SourcePrefix2+strings.Repeat("9", 64)); ok { + t.Errorf("a build that cannot be composed was composed today: %s", dig) + } + chgJSON := strings.Replace(lemurs, `"state":"running"`, `"state":"stopped"`, 1) + chgDigest := delivery.ManifestDigest([]byte(chgJSON)) + chgMan, _ := delivery.EncodeManifest(delivery.Manifest{Module: "lemurs", JSON: chgJSON}) + chgKey, _ := delivery.ManifestsKey(chgDigest) + b.mu.Lock() + b.kv[delivery.ManifestsBucket+"/"+chgKey] = chgMan + b.mu.Unlock() + chgMod, _ := delivery.EncodeModule(delivery.Module{FP2: fp, Manifest: chgDigest, Repository: "novox/x", Commit: "c"}) + c.takeModule(agent.Update{Key: "lemurs", Value: chgMod}) + if dig, ok := c.ComposedToday(ctx, "lemurs", fp); !ok || dig == handedDig { + t.Errorf("composed today with a changed input: %s %v, want another digest than %s", dig, ok, handedDig) + } + c.takeModule(agent.Update{Key: "lemurs", Value: mod}) // Issue 1126, the switch made safe: a bus not answering for a moment (a reload of its accounts) is tried again and // refuses nothing; a pass whose run ended refuses nothing either.