Node-engine: a builder's build, its keys and codec come from the builder's builds package (ADR 0634 §1, §4; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 15:44:31 +01:00
parent 10852161c9
commit 4bfa94dfef
17 changed files with 143 additions and 144 deletions
+7 -8
View File
@@ -9,6 +9,7 @@ import (
"git.novox.be/novox/mesh-contracts/placement/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"github.com/novox/mesh-host/internal/buckets"
"github.com/novox/mesh-host/internal/buckets/bucketstest"
engcomp "github.com/novox/mesh-host/internal/compositions"
@@ -18,8 +19,6 @@ import (
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/delivery"
"github.com/novox/mesh-host/internal/agent"
)
@@ -105,7 +104,7 @@ func TestTheNodePublishesItsCompositions(t *testing.T) {
b.put(t, buckets.Modules, "oldie", omod)
b.put(t, buckets.Wants, "want.n1.lemurs", want)
b.put(t, buckets.Wants, "want.n1.node", nodeWant)
for _, bucket := range []string{buckets.Wants, buckets.Placement, buckets.Have, buckets.Modules, ResolvedBucket, delivery.BuilderBuildsBucket} {
for _, bucket := range []string{buckets.Wants, buckets.Placement, buckets.Have, buckets.Modules, ResolvedBucket, builds.BuilderBuildsBucket} {
b.send(bucket, agent.Update{Caught: true})
}
for u := next(t, out); !u.Caught; u = next(t, out) {
@@ -147,17 +146,17 @@ func TestTheNodePublishesItsCompositions(t *testing.T) {
t.Errorf("a pass that changed nothing wrote %v", got[2:])
}
// oldie's trunk build is done: its key at that build is written once, though no want names it.
build, _ := delivery.EncodeBuilderBuild(delivery.BuilderBuild{State: delivery.BuildDone, Manifest: odigest})
bkey, _ := delivery.BuilderBuildKey("oldie", ofp)
build, _ := builds.EncodeBuilderBuild(builds.BuilderBuild{State: builds.BuildDone, Manifest: odigest})
bkey, _ := builds.BuilderBuildKey("oldie", ofp)
b.mu.Lock()
b.kv[delivery.BuilderBuildsBucket+"/"+bkey] = build
b.kv[builds.BuilderBuildsBucket+"/"+bkey] = build
b.mu.Unlock()
b.put(t, delivery.BuilderBuildsBucket, bkey, build)
b.put(t, builds.BuilderBuildsBucket, bkey, build)
got := waitFor("oldie's done build", func(got []string) bool { return len(got) >= 3 })
if got[2] != oldieKey {
t.Errorf("the done build of oldie wrote %v, want %s", got[2:], oldieKey)
}
b.put(t, delivery.BuilderBuildsBucket, bkey, build)
b.put(t, builds.BuilderBuildsBucket, bkey, build)
time.Sleep(100 * time.Millisecond)
if got := state.written(); len(got) != 3 {
t.Errorf("the same build landing again wrote %v", got[3:])