assigner: one set of unlisted assignments, carried on the run (H-A-152, H-A-153)

The leaving-out took every assigned module the case's manifests lacked,
while the judgement said only those the watched branches' newest
revisions list nowhere, read again at judgement time. Now the set is read
once from the newest revisions when the run starts, written on the run,
and used for the leaving-out, the finding and every step's judgement and
the resume. The candidate never enters it: a module the change drops
while still assigned stays in and fails the composition as its own
fault. While no newest revision is followed nothing is left out.

Builds: design 47 H H-A-152, H-A-153
This commit is contained in:
2026-11-20 16:51:28 +01:00
parent f053e3b041
commit 0b1ce08985
4 changed files with 68 additions and 24 deletions
@@ -139,7 +139,7 @@ func (r *compositionRun) read(ctx context.Context, module string, keys []string,
runs := r.runs.await(ctx, keys) runs := r.runs.await(ctx, keys)
setPhase(ctx, meshwants.StepProgressEventPhaseReport) setPhase(ctx, meshwants.StepProgressEventPhaseReport)
for _, key := range keys { for _, key := range keys {
ends = append(ends, judgeRun(module, runs[key], r.unlistedOn(runs[key].Machine))) ends = append(ends, judgeRun(module, runs[key]))
} }
out := outcomeOf(ends) out := outcomeOf(ends)
out.Shared = r.runs.sharedOf(keys, runs) out.Shared = r.runs.sharedOf(keys, runs)
@@ -248,6 +248,21 @@ func (r *compositionRun) start(ctx context.Context, key string, run meshwants.Co
r.logf("the composition run %s is not ended: %v", key, err) r.logf("the composition run %s is not ended: %v", key, err)
} }
} }
// The one set of unlisted assignments, read once at the run's start and carried on the run to the leaving-out, the finding and
// every step's judgement, the resume's too (design 47 H-A-152, H-A-153).
unlisted := r.unlistedOn(node)
if len(unlisted) > 0 {
if _, _, err := r.runs.change(key, func(c *meshwants.CompositionRun) bool {
if c.Ask != ask || c.Ended != nil {
return false
}
c.Unlisted = unlisted
return true
}); err != nil {
end(node + ": the run's unlisted assignments are not written: " + err.Error())
return
}
}
if err := prep.get(ctx); err != nil { if err := prep.get(ctx); err != nil {
end(node + ": " + err.Error()) end(node + ": " + err.Error())
return return
@@ -263,7 +278,7 @@ func (r *compositionRun) start(ctx context.Context, key string, run meshwants.Co
return return
} }
cs := composer.Case{Name: changeCase, Manifests: prep.manifests, None: prep.none} cs := composer.Case{Name: changeCase, Manifests: prep.manifests, None: prep.none}
if left, err := r.leftOut(node, prep.manifests); err != nil { if left, err := r.leftOut(node, unlisted); err != nil {
end(node + ": " + err.Error()) end(node + ": " + err.Error())
return return
} else if left != nil { } else if left != nil {
@@ -316,12 +331,13 @@ const notTried = "not tried: the search reached its bound"
// it, on the node's own account; a verdict with no `blamed` (a composer before §721) is judged as before, with the warning "the // it, on the node's own account; a verdict with no `blamed` (a composer before §721) is judged as before, with the warning "the
// composer names no culprits"; otherwise the machine passes, with a warning for each other module blamed there. // composer names no culprits"; otherwise the machine passes, with a warning for each other module blamed there.
// //
// unlisted are the modules the machine is assigned that none of their watched branches lists, left out of its composition: each is // The run's unlisted are the modules the machine is assigned that no watched branch's newest revision lists, left out of its
// said on every path, in the machine's failed or could-not-run words where one is set, else as a warning, never the machine's // composition, as the run's start read them (H-A-152, H-A-153): each is said on every path, in the machine's failed or
// failure and never dropped in silence (H-A-143, H-A-144, H-A-148). // could-not-run words where one is set, else as a warning, never the machine's failure and never dropped in silence (H-A-143,
func judgeRun(module string, run meshwants.CompositionRun, unlisted []string) machineEnd { // H-A-144, H-A-148).
func judgeRun(module string, run meshwants.CompositionRun) machineEnd {
end := judgeVerdict(module, run) end := judgeVerdict(module, run)
for _, u := range unlisted { for _, u := range run.Unlisted {
said := run.Machine + " is assigned " + u + ", which no watched branch lists (H-A-143)" said := run.Machine + " is assigned " + u + ", which no watched branch lists (H-A-143)"
switch { switch {
case end.failed != "": case end.failed != "":
@@ -594,16 +610,23 @@ func acrossBranches(step meshwants.StepRun, candidate mcc.Half, newest map[strin
return out return out
} }
// unlistedOn is the modules the assignments place on node that the newest revision of none of their watched branches lists, a // unlistedOn is the one set of unlisted assignments of node (H-A-152): the modules the assignments place there that the newest
// module with no watched branches among them (H-A-143, H-A-144), by name. // revision of none of their watched branches lists, a module with no watched branches among them (H-A-143, H-A-144), by name.
// The candidate never enters it, so a module the change drops while still assigned stays in the composition and fails it as the
// change's own fault (ADR 0578 §2). Where the newest revisions are not followed yet nothing is unlisted: none while no branch's
// newest is held, and not a module one of whose watched branches' newest is not held yet.
func (r *compositionRun) unlistedOn(node string) []string { func (r *compositionRun) unlistedOn(node string) []string {
if r.assigned == nil || r.newest == nil || r.watched == nil { if r.assigned == nil || r.newest == nil || r.watched == nil {
return nil return nil
} }
newest := r.newest() newest := r.newest()
if len(newest) == 0 {
return nil
}
var out []string var out []string
for _, m := range r.assigned(node) { for _, m := range r.assigned(node) {
if !listedOn(newest, r.watched(m), m) { watched := r.watched(m)
if !listedOn(newest, watched, m) && !slices.ContainsFunc(watched, func(b string) bool { _, held := newest[b]; return !held }) {
out = append(out, m) out = append(out, m)
} }
} }
@@ -611,12 +634,12 @@ func (r *compositionRun) unlistedOn(node string) []string {
return slices.Compact(out) return slices.Compact(out)
} }
// leftOut is the case's assignments of node with each module the case's manifests do not hold (none of its watched branches lists // leftOut is the case's assignments of node with each module of the run's unlisted set left out, or nil where none is (the case
// it) left out, or nil where none is (the case then composes the input's): a stale assignment is a fault of the assignments, not of // then composes the input's): a stale assignment is a fault of the assignments, not of the change judged, so it is left out of the
// the change judged, so it is left out of the composition, said in the journal and, at the judgement, as unlisted (design 47 // composition, said in the journal, raised as assignment-unlisted and, at the judgement, said as unlisted from the same set
// H-A-148, H-A-143; ADR 0578 §2). // (design 47 H-A-148, H-A-149, H-A-152, H-A-143; ADR 0578 §2).
func (r *compositionRun) leftOut(node string, manifests map[string]composer.Manifest) (map[string]json.RawMessage, error) { func (r *compositionRun) leftOut(node string, set []string) (map[string]json.RawMessage, error) {
if r.assignment == nil { if r.assignment == nil || len(set) == 0 {
return nil, nil return nil, nil
} }
a, ok := r.assignment(node) a, ok := r.assignment(node)
@@ -625,7 +648,7 @@ func (r *compositionRun) leftOut(node string, manifests map[string]composer.Mani
} }
var unlisted []string var unlisted []string
for _, m := range a.Modules { for _, m := range a.Modules {
if _, held := manifests[m.Module]; !held { if slices.Contains(set, m.Module) {
unlisted = append(unlisted, m.Module) unlisted = append(unlisted, m.Module)
} }
} }
@@ -293,17 +293,32 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
} }
// A stale assignment is left out of the case's assignments as well, said, and the machine composes; a listed module stays in // A stale assignment is left out of the case's assignments as well, said, and the machine composes; a listed module stays in
// (H-A-148, ADR 0578 §2). // (H-A-148, ADR 0578 §2). The one set is the watched branches' newest revisions', carried on the run (H-A-152, H-A-153): a module
// the candidate drops while the newest still lists it stays in, the change's own fault, and while no newest revision is followed
// nothing is left out.
dropsWeb := func() map[string]mcc.Half {
h := across.r.newest()
h["main"] = mcc.Half{Revision: meshcatalog.CatalogRevision{Branch: "main", Revision: 6},
Entries: map[string]meshcatalog.CatalogEntry{"m": {Module: "m", Manifest: map[string]any{"module": "m"}},
"web": {Module: "web", Fp: "w1", Manifest: map[string]any{"module": "web"}}}}
return h
}
for _, tc := range []struct { for _, tc := range []struct {
name string name string
assigned []string assigned []string
want []string // the case's modules of ace; nil: the input's assignments newest func() map[string]mcc.Half // nil: across's
want []string // the case's modules of ace; nil: the input's assignments
}{ }{
{"a stale assignment left out and said, the machine composes", []string{"m", "f1-circuits", "checker"}, []string{"m", "f1-circuits"}}, {"a stale assignment left out and said, the machine composes", []string{"m", "f1-circuits", "checker"}, nil, []string{"m", "f1-circuits"}},
{"listed modules alone: the input's assignments", []string{"m", "f1-circuits"}, nil}, {"listed modules alone: the input's assignments", []string{"m", "f1-circuits"}, nil, nil},
{"a module the candidate drops, the newest lists: kept", []string{"m", "f1-circuits", "web"}, dropsWeb, nil},
{"no newest revision followed: nothing left out", []string{"m", "checker"}, func() map[string]mcc.Half { return map[string]mcc.Half{} }, nil},
} { } {
left := newRunStand(t, "src2:e1", "src2:e1", "d1") left := newRunStand(t, "src2:e1", "src2:e1", "d1")
left.r.newest, left.r.watched = across.r.newest, across.r.watched left.r.newest, left.r.watched = across.r.newest, across.r.watched
if tc.newest != nil {
left.r.newest = tc.newest
}
left.r.assigned = func(string) []string { return tc.assigned } left.r.assigned = func(string) []string { return tc.assigned }
left.r.assignment = func(node string) (mma.Assignments, bool) { left.r.assignment = func(node string) (mma.Assignments, bool) {
a := mma.Assignments{Node: node} a := mma.Assignments{Node: node}
@@ -327,6 +342,10 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
if out.Outcome != meshwants.StepEndedOutcomePassed || (tc.want != nil) != slices.Contains(out.Warnings, said) { if out.Outcome != meshwants.StepEndedOutcomePassed || (tc.want != nil) != slices.Contains(out.Warnings, said) {
t.Errorf("%s: the step came to %+v", tc.name, out) t.Errorf("%s: the step came to %+v", tc.name, out)
} }
if run, _, _, _ := left.runs.read(runKeyOf("main.7", "ace")); (tc.want != nil) != slices.Equal(run.Unlisted, []string{"checker"}) ||
(tc.want == nil && run.Unlisted != nil) {
t.Errorf("%s: the run carries the unlisted %v", tc.name, run.Unlisted)
}
raw, ok := left.requests["ace"].Cases[0].Assignments["ace"] raw, ok := left.requests["ace"].Cases[0].Assignments["ace"]
if tc.want == nil { if tc.want == nil {
if ok { if ok {
@@ -549,7 +568,9 @@ func TestAMachineIsJudgedByTheModulesItBlames(t *testing.T) {
[]string{"ace is assigned photos, which no watched branch lists (H-A-143)"}, []string{"photos"}}, []string{"ace is assigned photos, which no watched branch lists (H-A-143)"}, []string{"photos"}},
} { } {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
e := judgeRun(tc.module, tc.run, tc.unlisted) run := tc.run
run.Unlisted = tc.unlisted // the set the run's start wrote (H-A-153)
e := judgeRun(tc.module, run)
if e.failed != tc.failed || e.couldNot != tc.couldNo || !slices.Equal(e.warnings, tc.warnings) { if e.failed != tc.failed || e.couldNot != tc.couldNo || !slices.Equal(e.warnings, tc.warnings) {
t.Errorf("judged %+v, want failed %q, could not run %q, warnings %q", e, tc.failed, tc.couldNo, tc.warnings) t.Errorf("judged %+v, want failed %q, could not run %q, warnings %q", e, tc.failed, tc.couldNo, tc.warnings)
} }
@@ -818,7 +818,7 @@ func (r *compositionRuns) leave(pipeline string, stop func(ids []string)) ([]str
// passedOn is whether the step of module passed on the machine of an ended run (§722): neither failed nor could not run there. // passedOn is whether the step of module passed on the machine of an ended run (§722): neither failed nor could not run there.
func passedOn(module string, run meshwants.CompositionRun) bool { func passedOn(module string, run meshwants.CompositionRun) bool {
e := judgeRun(module, run, nil) // the unlisted modules change only the words, never whether it passed e := judgeVerdict(module, run) // the unlisted modules change only the words, never whether it passed
return e.failed == "" && e.couldNot == "" return e.failed == "" && e.couldNot == ""
} }
@@ -416,7 +416,7 @@ func TestACompositionRunsBoundTimesOwedProgress(t *testing.T) {
len(*drops) != 1 || !strings.HasPrefix((*drops)[0], "run-1: ") { len(*drops) != 1 || !strings.HasPrefix((*drops)[0], "run-1: ") {
t.Fatalf("past the bound: %+v, drops %v", run, *drops) t.Fatalf("past the bound: %+v, drops %v", run, *drops)
} }
if got := judgeRun("a", run, nil); got.couldNot != run.Said { if got := judgeRun("a", run); got.couldNot != run.Said {
t.Errorf("a reader of the run past its bound: %+v", got) t.Errorf("a reader of the run past its bound: %+v", got)
} }
late := buildstep.StepEnded{Ask: "run-1", Asker: runAsker, Outcome: buildstep.OutcomePassed, Output: "{}"} late := buildstep.StepEnded{Ask: "run-1", Asker: runAsker, Outcome: buildstep.OutcomePassed, Output: "{}"}