composer: a build that can never be made is blamed, not a reason to judge no machine (G-24 H3)
A module awaited on a machine whose revision gives it no fingerprint (the case's none) is held as its node-engine holds it, the machine judged from that composition, and the module blamed with the revision's none words, so only its own pipelines fail. An awaited build with a fingerprint keeps the machine not judged. Builds: design 47 G §721, §722, A-470j, A-470k
This commit is contained in:
@@ -238,10 +238,18 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
}
|
||||
cv.Machines = map[string]Machine{}
|
||||
for _, node := range r.Machines {
|
||||
// A module awaited on node whose build can never be made, the revision giving it no fingerprint (Case.None), does
|
||||
// not leave the machine not judged: it is held as its node-engine holds it, the machine judged from that
|
||||
// composition, and the module blamed with the revision's none words (design 47 G A-470j, A-470k). Each other
|
||||
// awaited build keeps the machine not judged, as below.
|
||||
never, pending := neverOn(in, node, awaited, c.None)
|
||||
at := in // the input m is composed from
|
||||
if len(never) > 0 {
|
||||
at = heldAgain(in, held, never)
|
||||
}
|
||||
m := machine(at, node, depth, r.Declarations)
|
||||
problem := problemOf(m) // what the search for culprits holds a module against, before any words are added
|
||||
if words := awaitedOn(in, node, awaited); words != "" {
|
||||
if words := awaitedOn(at, node, pending); words != "" {
|
||||
// Composed without the build it runs at: named per node and module, never a silent pass (issue 1921). The
|
||||
// machine is then not judged, as for a node whose running state its engine does not send (ADR 0593 §9). Where
|
||||
// it does not compose without that build (a tool runner's bundle), it is composed with the module held as its
|
||||
@@ -251,7 +259,7 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
// shanks).
|
||||
how := "composed from the change's manifest without its build: "
|
||||
if !m.Composes && m.NotJudged == "" {
|
||||
lifted := heldAgain(in, held, awaited)
|
||||
lifted := heldAgain(at, held, pending)
|
||||
switch again := machine(lifted, node, depth, r.Declarations); {
|
||||
case again.Composes:
|
||||
m, how = again, "composed with it held as its node-engine holds it, since it does not compose without its build: "
|
||||
@@ -266,6 +274,9 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
m.Reason += "; " + words
|
||||
}
|
||||
}
|
||||
if len(never) > 0 && m.NotJudged == "" {
|
||||
m = blameNever(m, never, c.None) // after the awaited words, which judge it again where it does not compose
|
||||
}
|
||||
// A machine that does not compose with no module held is searched for the module whose hold ends its problem, bounded
|
||||
// by the request's blame_tries; a request with none gets no search (design 47 G §721; A-468i, A-469j).
|
||||
if !m.Composes && m.NotJudged == "" && len(m.Blamed) == 0 && r.BlameTries > 0 {
|
||||
@@ -428,6 +439,48 @@ func heldAgain(in, held compose.Input, awaited map[string]string) compose.Input
|
||||
return in
|
||||
}
|
||||
|
||||
// neverOn splits the modules overrule lifted with their build awaited: never is each placed on node whose build can never
|
||||
// be made, the case naming it in None (the revision gives it no fingerprint), with its awaited words; pending is awaited
|
||||
// without them (design 47 G A-470j, A-470k).
|
||||
func neverOn(in compose.Input, node string, awaited, none map[string]string) (never, pending map[string]string) {
|
||||
pending = awaited
|
||||
for _, mod := range assignedOn(in, node) {
|
||||
if _, unbuildable := none[mod]; !unbuildable || awaited[mod] == "" {
|
||||
continue
|
||||
}
|
||||
if never == nil {
|
||||
never, pending = map[string]string{}, maps.Clone(awaited)
|
||||
}
|
||||
never[mod] = awaited[mod]
|
||||
delete(pending, mod)
|
||||
}
|
||||
return never, pending
|
||||
}
|
||||
|
||||
// blameNever is m judged with each of never held: it composes with none of them, so it does not compose, says why, and
|
||||
// blames each with the revision's none words, in place of any problem its composition gave it (design 47 G §721, A-470j).
|
||||
func blameNever(m Machine, never, none map[string]string) Machine {
|
||||
mods := slices.Sorted(maps.Keys(never))
|
||||
var said []string
|
||||
for _, mod := range mods {
|
||||
said = append(said, mod+" ("+none[mod]+")")
|
||||
}
|
||||
words := "composed with it held as its node-engine holds it, since its build can never be made: " + strings.Join(said, ", ")
|
||||
if m.Composes {
|
||||
m.Composes, m.Reason = false, words
|
||||
} else {
|
||||
m.Reason += "; " + words
|
||||
}
|
||||
for _, mod := range mods {
|
||||
if i := slices.IndexFunc(m.Blamed, func(b blame) bool { return b.Module == mod }); i >= 0 {
|
||||
m.Blamed[i].Problem = none[mod]
|
||||
continue
|
||||
}
|
||||
m.Blamed = append(m.Blamed, blame{Module: mod, Problem: none[mod]})
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// awaitedOn is the words of each module placed on node that is composed without its build (overrule), joined, sorted.
|
||||
func awaitedOn(in compose.Input, node string, awaited map[string]string) string {
|
||||
var out []string
|
||||
|
||||
@@ -324,20 +324,27 @@ func TestARequestItCannotRunIsRefused(t *testing.T) {
|
||||
name, raw, digest string
|
||||
words string // in NotJudged, its build's paths not declared; "" composes at its build
|
||||
beside string // a module the change refuses on the same node: words are then in the refusal
|
||||
none string // the revision's none words for app (Case.None): judged held, app blamed with them
|
||||
}{
|
||||
{"the digest of the case's manifest", plain, same, "", ""},
|
||||
{"another digest, the same contract", plain, strings.Repeat("b", 64), "of another manifest than the change's (its build was made of the manifest " + strings.Repeat("b", 64), ""},
|
||||
{"no digest, the same contract", plain, "", "", ""},
|
||||
{"the digest of the case's manifest", plain, same, "", "", ""},
|
||||
{"another digest, the same contract", plain, strings.Repeat("b", 64), "of another manifest than the change's (its build was made of the manifest " + strings.Repeat("b", 64), "", ""},
|
||||
{"no digest, the same contract", plain, "", "", "", ""},
|
||||
{"no digest, another contract", strings.Replace(plain, `"version": "1"`, `"version": "2"`, 1), "",
|
||||
"app is composed by the running node-engine at its build fp1, of another manifest than the change's (its node-engine names no manifest", ""},
|
||||
"app is composed by the running node-engine at its build fp1, of another manifest than the change's (its node-engine names no manifest", "", ""},
|
||||
{"a tool runner, its bundle awaited", runner, "",
|
||||
"composed with it held as its node-engine holds it, since it does not compose without its build: app is composed by the running node-engine at its build fp1", ""},
|
||||
"composed with it held as its node-engine holds it, since it does not compose without its build: app is composed by the running node-engine at its build fp1", "", ""},
|
||||
// The group check of c5d32074c945, shanks: the change refused lab there, and the words were those of the
|
||||
// composition from the change's manifests unbuilt ("mesh-build-go runs as its own account and its build
|
||||
// produced no bundle to serve"), not of the one with them held, so the lift's own refusals failed the node.
|
||||
{"a tool runner awaited beside a module the change refuses", runner, "",
|
||||
"refused with it held as its node-engine holds it, since it does not compose without its build: app is composed by the running node-engine at its build fp1",
|
||||
`{"module": "office", "version": "1", "resources": [{"id": "c", "type": "file", "path": "/etc/office.conf", "template": "x"}]}`},
|
||||
`{"module": "office", "version": "1", "resources": [{"id": "c", "type": "file", "path": "/etc/office.conf", "template": "x"}]}`, ""},
|
||||
// G-24 H3 (A-470j, A-470k; live at revision 449, lidarr, radarr and gitea): a build the revision gives no
|
||||
// fingerprint can never be made, so it does not leave the machine not judged: the machine is judged held, and
|
||||
// app is blamed with the revision's none words. An awaited build the case does not name so stays not judged
|
||||
// (the rows above).
|
||||
{"a build that can never be made, its machine judged held", plain, strings.Repeat("b", 64), "", "", "builders disagree: node 22 and node 24"},
|
||||
{"a tool runner whose bundle can never be made", runner, "", "", "", "no build module"},
|
||||
} {
|
||||
in := compose.Input{Catalogue: map[string]catalogue.Manifest{"app": built}, Nodes: []compose.Node{{Name: "a", Assigned: []string{"app"}}},
|
||||
ComposedHow: &compose.ComposedHow{Node: "a", Builds: map[string]string{"app": "fp1"}}}
|
||||
@@ -345,16 +352,27 @@ func TestARequestItCannotRunIsRefused(t *testing.T) {
|
||||
in.ComposedHow.Manifests = map[string]string{"app": row.digest}
|
||||
}
|
||||
manifests := map[string]Manifest{"app": {Raw: json.RawMessage(row.raw)}}
|
||||
var none map[string]string
|
||||
if row.none != "" {
|
||||
none = map[string]string{"app": row.none}
|
||||
}
|
||||
if row.beside != "" {
|
||||
manifests["office"] = Manifest{Raw: json.RawMessage(row.beside)}
|
||||
in.Nodes[0].Assigned = append(in.Nodes[0].Assigned, "office")
|
||||
}
|
||||
v, err := Run(withInput(t, Request{V: Version, Machines: []string{"a"}, Depth: DepthCompose, Declarations: true,
|
||||
Cases: []Case{{Name: "change", Manifests: manifests}}}, in))
|
||||
Cases: []Case{{Name: "change", Manifests: manifests, None: none}}}, in))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
m := v.Cases[0].Machines["a"]
|
||||
if row.none != "" {
|
||||
if m.NotJudged != "" || m.Composes || len(m.Blamed) != 1 || m.Blamed[0].Module != "app" || m.Blamed[0].Problem != row.none ||
|
||||
!strings.Contains(m.Reason, "its build can never be made") {
|
||||
t.Errorf("%s: machine %+v, want it judged with app held and blamed with %q", row.name, m, row.none)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if row.beside != "" {
|
||||
said := fmt.Sprint(m.Reason, m.Problems, m.Refusals)
|
||||
if m.Composes || m.NotJudged != "" || !strings.Contains(said, "office") || strings.Contains(said, "bundle") || !strings.Contains(m.Reason, row.words) {
|
||||
|
||||
Reference in New Issue
Block a user