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:
@@ -247,8 +247,11 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
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
|
||||
// The one search for culprits runs inside the node-engine's composition (frombus.ComposeSent), over the case's
|
||||
// changed modules on node, bounded by the request's blame_tries; a request with none gets no search (design 47 G
|
||||
// §721; A-468i, A-469j, A-469k).
|
||||
search := frombus.Search{Changed: changedOn(in, node, c, held.ComposedHow), Tries: r.BlameTries}
|
||||
m := machine(at, node, depth, r.Declarations, search)
|
||||
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
|
||||
@@ -260,11 +263,11 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
how := "composed from the change's manifest without its build: "
|
||||
if !m.Composes && m.NotJudged == "" {
|
||||
lifted := heldAgain(at, held, pending)
|
||||
switch again := machine(lifted, node, depth, r.Declarations); {
|
||||
switch again := machine(lifted, node, depth, r.Declarations, search); {
|
||||
case again.Composes:
|
||||
m, how = again, "composed with it held as its node-engine holds it, since it does not compose without its build: "
|
||||
case again.NotJudged == "":
|
||||
m, how, at, problem = again, "refused with it held as its node-engine holds it, since it does not compose without its build: ", lifted, problemOf(again)
|
||||
m, how = again, "refused with it held as its node-engine holds it, since it does not compose without its build: "
|
||||
}
|
||||
}
|
||||
words = how + words
|
||||
@@ -277,11 +280,6 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) {
|
||||
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 {
|
||||
m.Blamed = culprits(at, held, node, depth, r.Declarations, changedOn(at, node, c, held.ComposedHow), r.BlameTries, problem)
|
||||
}
|
||||
if m.Blamed == nil {
|
||||
m.Blamed = []blame{} // always written, so a verdict blaming none is told from an old composer's (A-469h)
|
||||
}
|
||||
@@ -518,7 +516,7 @@ func HoldingsOf(shelf map[string]catalogue.Manifest, nodes []compose.Node) []cat
|
||||
return out
|
||||
}
|
||||
|
||||
func machine(in compose.Input, node, depth string, declarations bool) Machine {
|
||||
func machine(in compose.Input, node, depth string, declarations bool, search frombus.Search) Machine {
|
||||
if depth == DepthResolve {
|
||||
if _, err := compose.Resolve(in, node); err != nil {
|
||||
return Machine{Reason: err.Error(), Blamed: ownedTwice(err)}
|
||||
@@ -528,7 +526,7 @@ func machine(in compose.Input, node, depth string, declarations bool) Machine {
|
||||
// Composed as the node-engine composes it, when its input says how (compose.Input.ComposedHow, issue 774): the same
|
||||
// path, at the same builds, a module folded in its own composition kept as it runs.
|
||||
if !declarations {
|
||||
if _, how, err := frombus.ComposeSent(in, node); how {
|
||||
if _, how, err := frombus.ComposeSent(in, node, search); how {
|
||||
if err != nil {
|
||||
m := Machine{Reason: err.Error()}
|
||||
var refuses *frombus.Refuses
|
||||
@@ -564,31 +562,7 @@ func machine(in compose.Input, node, depth string, declarations bool) Machine {
|
||||
}
|
||||
|
||||
// NotTried is the problem of a changed module the search for culprits did not hold, its bound reached (design 47 G §721).
|
||||
const NotTried = "not tried: the search reached its bound"
|
||||
|
||||
// triedHeld is the words a module is held with while the search for culprits tries it.
|
||||
const triedHeld = "held by the composer's search for the module the machine's problem is of"
|
||||
|
||||
// culprits holds each of changed on node, one at a time, as its node-engine holds a module (heldAgain), each try
|
||||
// composing once more, and blames the first whose hold ends problem: the try composes, or fails otherwise, as culprit
|
||||
// blames a stub (frombus). At most tries tries; past them each module not yet tried is named NotTried (design 47 G §721).
|
||||
// None ends it: no module is blamed, and the machine fails on the node's own account.
|
||||
func culprits(in, held compose.Input, node, depth string, declarations bool, changed []string, tries int, problem string) []blame {
|
||||
for i, mod := range changed {
|
||||
if i == tries {
|
||||
var out []blame
|
||||
for _, untried := range changed[i:] {
|
||||
out = append(out, blame{Module: untried, Problem: NotTried})
|
||||
}
|
||||
return out
|
||||
}
|
||||
try := machine(heldAgain(in, held, map[string]string{mod: triedHeld}), node, depth, declarations)
|
||||
if try.NotJudged == "" && (try.Composes || problemOf(try) != problem) {
|
||||
return []blame{{Module: mod, Problem: problem}}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
const NotTried = frombus.NotTried
|
||||
|
||||
// problemOf is a machine's problem in words: why it does not compose, with what the validator refuses.
|
||||
func problemOf(m Machine) string {
|
||||
|
||||
Reference in New Issue
Block a user