composer: one search for culprits, inside the node-engine's composition, bounded by blame_tries (G-24 H2 review r1)

ComposeSent no longer runs the node-engine's own culprit search (fixed at eight modules), and the composer's
own loop, which reran that search at every try, is gone: ComposeSent holds the case's changed modules on the
machine one at a time, one composition each, at most blame_tries, and blames the first whose hold ends the
problem; past the bound the untried are named. Without blame_tries there is no search. A module the node
holds composing without the change is held as there, and two owners of one path are blamed outside the search.

Builds: design 47 G §721, A-468i, A-468l, A-469j, A-469k, A-470c
This commit is contained in:
2026-11-17 13:03:15 +01:00
parent c5f76cb974
commit b4bf772de4
5 changed files with 96 additions and 76 deletions
+8 -5
View File
@@ -185,7 +185,7 @@ func TestTheCommandWritesOneVerdictPerManifestAndMachine(t *testing.T) {
}{
// G-24 H-AC1: a fixture module whose manifest is refused on the machine is blamed by name.
{"a module the change refuses is blamed by name", map[string]string{"app": file("app", "/var/lib/app/env", `N=${secret:repository}\\n`)},
[]string{"app"}, &compose.ComposedHow{Node: "a", Builds: map[string]string{}}, 0, []blame{{Module: "app", Problem: "repository"}}},
[]string{"app"}, &compose.ComposedHow{Node: "a", Builds: map[string]string{}}, 20, []blame{{Module: "app", Problem: "repository"}}},
// Held composing without the change (HeldBefore): left out of blamed.
{"a module held before the change is not blamed", map[string]string{"app": file("app", "/var/lib/app/env", `N=${secret:repository}\\n`)},
[]string{"app"}, &compose.ComposedHow{Node: "a", Builds: map[string]string{}, HeldBefore: map[string]string{"app": "held"}}, 0, []blame{}},
@@ -200,17 +200,20 @@ func TestTheCommandWritesOneVerdictPerManifestAndMachine(t *testing.T) {
// G-24 H-AC5: a machine that fails with no module held is searched over the changed modules placed on it (here every
// one, the input naming no manifest its builds were made of, A-469k), in assignment order; the search ends at the
// first whose hold ends the problem, so m3 is never tried.
{"the search ends at the first module whose hold ends the problem", search, []string{"m1", "m2", "m3"}, nil, 20,
{"the search ends at the first module whose hold ends the problem", search, []string{"m1", "m2", "m3"}, &compose.ComposedHow{Node: "a"}, 20,
[]blame{{Module: "m2", Problem: "repository"}}},
// A module whose case manifest is the one its build was made of is not changed (A-469k), so never held: m2's
// problem is then no changed module's, and none is blamed.
{"a module its build was made of is not tried", search, []string{"m1", "m2", "m3"},
&compose.ComposedHow{Node: "b", Manifests: map[string]string{"m2": digest(t, search["m2"])}}, 20, []blame{}},
&compose.ComposedHow{Node: "a", Manifests: map[string]string{"m2": digest(t, search["m2"])}}, 20, []blame{}},
// G-24 H-AC4: past the request's blame_tries the modules not yet tried are named so.
{"past blame_tries the untried are named", search, []string{"m1", "m2", "m3"}, nil, 1,
{"past blame_tries the untried are named", search, []string{"m1", "m2", "m3"}, &compose.ComposedHow{Node: "a"}, 1,
[]blame{{Module: "m2", Problem: composer.NotTried}, {Module: "m3", Problem: composer.NotTried}}},
// A-468i: a request with no blame_tries gets no search; the machine fails on the node's own account (H-AC3).
{"a request with no blame_tries is not searched", search, []string{"m1", "m2", "m3"}, nil, 0, []blame{}},
{"a request with no blame_tries is not searched", search, []string{"m1", "m2", "m3"}, &compose.ComposedHow{Node: "a"}, 0, []blame{}},
// A-469j: one search, the composer's, inside the node-engine's composition (ComposeSent): an input that says not how
// its node composes is composed without one, so its failure is the node's own.
{"a node that says not how it composes is not searched", search, []string{"m1", "m2", "m3"}, nil, 20, []blame{}},
} {
t.Run(row.name, func(t *testing.T) {
r := composer.Request{V: composer.Version, Depth: composer.DepthCompose, Machines: []string{"a"}, Seats: seats(t), BlameTries: row.tries,