Ask build-agent for itself and its toolchain images, never a builder key (ADR 0520, issue 1851)

The builder writes no key of build-agent or of the toolchain bases its
builds stand on, so a walk moving one would hold its tier for ever.
Until R4g they are build-agent's own, as the builder's module is; the
bases are read from the toolchains, not copied.
This commit is contained in:
2026-10-22 21:06:33 +02:00
parent 93fc2f48a1
commit 9713ceb84d
3 changed files with 81 additions and 5 deletions
+18 -5
View File
@@ -8,6 +8,8 @@ import (
"time"
sdkdelivery "git.novox.be/novox/mesh-sdk/go/delivery"
"github.com/novox/mesh-controller/internal/builder"
"github.com/novox/mesh-controller/internal/builderkeys"
"github.com/novox/mesh-controller/internal/inventory"
)
@@ -22,13 +24,24 @@ import (
// yet, or waiting for a reference, holds the tier and says so; a failed key fails the walk in the builder's own words.
// **No timer**: the builder's and the indexer's writes wake the look (builderkeys.Watch, watchNewModules).
// isBuildersOwn says a module is the builder's own: the one module build-agent still builds, asked on a merge, until R4g
// (ADR 0453 §5, ADR 0498 §7).
// isBuildersOwn says a module is build-agent's own: asked of build-agent on a merge and taken from its build record, never
// from the builder's key, until R4g (ADR 0453 §5, ADR 0498 §7, ADR 0520). They are the builder's module, build-agent itself
// (its image's context is another repository's) and the toolchain images build-agent's builds stand on
// (builder.Bases): the builder writes no key of any of them, and a walk waiting for one would hold its tier for ever.
func isBuildersOwn(module string) bool { return buildersOwn(module) }
// buildersOwn is isBuildersOwn's rule: a variable only so a test of the one ask left (its bus waits, its plan key) may
// name modules of its own as the builder's.
var buildersOwn = func(module string) bool { return module == sdkdelivery.BuilderModule }
// buildAgentsOwn are those modules: the builder's, build-agent's and every toolchain's base, read from the toolchains.
var buildAgentsOwn = func() map[string]bool {
own := map[string]bool{sdkdelivery.BuilderModule: true, builder.AgentModule: true}
for _, b := range builder.Bases() {
own[b] = true
}
return own
}()
// buildersOwn is isBuildersOwn's rule: a variable only so a test of the asks left (their bus waits, their plan key) may
// name modules of its own as build-agent's.
var buildersOwn = func(module string) bool { return buildAgentsOwn[module] }
// planKeyReads is what a walk reads of the indexer and the builder (builderkeys.Reader, or a test's).
type planKeyReads interface {