composer: a machine's verdict names the modules it blames (G-24 H1)

The assigner fails only the composition steps of the modules a machine blames, so the composer names them: the modules
the change refuses that the node held neither in its read nor composing without the change, answered structured by
ComposeSent, and both owners of a path two modules own, from the resolution's pairs. Blamed is always written, so a
verdict blaming none is told from an old composer's. The two request-file tests are one, for the test budget.

Builds: design 47 G §721, §733; A-468h, A-468l, A-469h, A-469j
This commit is contained in:
2026-11-17 11:19:54 +01:00
parent d0b208b668
commit 06781d4dbc
6 changed files with 215 additions and 30 deletions
+28 -4
View File
@@ -20,7 +20,19 @@ func heldKey(claim, kind string) string {
//
// Every reason at once rather than the first, and each says what to do about it. A person
// resolving these fixes them in one pass or in four.
type Refusal struct{ Problems []string }
type Refusal struct {
Problems []string
// OwnedTwice is each path two modules both own among Problems, as a pair: a composer blames both owners with the
// path, never by the words (design 47 G §721; A-468l).
OwnedTwice []OwnedTwice
}
// OwnedTwice is one path two modules both declare as their own (checkResources), the module that declared it first
// first.
type OwnedTwice struct {
Path string
Modules [2]string
}
func (r *Refusal) Error() string {
return "these assignments cannot be applied:\n - " + strings.Join(r.Problems, "\n - ")
@@ -616,7 +628,8 @@ func resolve(catalogue map[string]mcat.Manifest, assigned []string, node mcat.No
// Listed after the holding: an optional consumer of a requirement nothing answers is left absent there (ADR 0330 §3, §7).
resolution.Absent = absentOf(absent, order, catalogue)
problems = append(problems, unheld...)
problems = append(problems, checkResources(resolution.Modules)...)
owned, twice := resourceProblems(resolution.Modules)
problems = append(problems, owned...)
resolution.Claims = claims
// Judged over the closure — what this node will actually run — so a holder pulled in by a
@@ -641,7 +654,7 @@ func resolve(catalogue map[string]mcat.Manifest, assigned []string, node mcat.No
problems = append(problems, why)
}
sort.Strings(problems)
return mcat.Resolution{}, nil, &Refusal{Problems: problems}
return mcat.Resolution{}, nil, &Refusal{Problems: problems, OwnedTwice: twice}
}
return resolution, held, nil
}
@@ -910,6 +923,13 @@ func canonicalSeat(name string) string {
// resolves with no refusal. What is refused is the contradiction — a path one module owns and
// another merely accesses — because shared data is the operator's and nobody's to own.
func checkResources(modules []mcat.Manifest) []string {
problems, _ := resourceProblems(modules)
return problems
}
// resourceProblems is checkResources' problems, with each path two modules both own as a pair beside its words.
func resourceProblems(modules []mcat.Manifest) ([]string, []OwnedTwice) {
var twice []OwnedTwice
// Judged as the machine composes them: where the node-resolver holder writes the resolver file, the
// uplink holder's rendering of it is not composed, so it is not a second owner (novox/hq ADR 0247).
modules = steppedBack(modules)
@@ -987,6 +1007,9 @@ func checkResources(modules []mcat.Manifest) []string {
if other, taken := owner[key]; taken && other != m.Module {
problems = append(problems, fmt.Sprintf(
"%s and %s both declare the %s %q", other, m.Module, field, value))
if field == "path" {
twice = append(twice, OwnedTwice{Path: value, Modules: [2]string{other, m.Module}})
}
}
owner[key] = m.Module
if field == "path" {
@@ -1007,6 +1030,7 @@ func checkResources(modules []mcat.Manifest) []string {
if other, taken := owner[key]; taken && other != m.Module {
problems = append(problems, fmt.Sprintf(
"%s and %s both declare the path %q", other, m.Module, fact.Path))
twice = append(twice, OwnedTwice{Path: fact.Path, Modules: [2]string{other, m.Module}})
}
owner[key] = m.Module
ownedPath[fact.Path] = m.Module
@@ -1042,7 +1066,7 @@ func checkResources(modules []mcat.Manifest) []string {
}
}
}
return problems
return problems, twice
}
// meshNetwork is what to assign to a machine that needs to reach another one.