assigner: a composition run's request names the revision's modules with no fingerprint (A-470j)
A module whose build can never be made left its machine not judged, so every step of the candidate could not run; the case now carries none, the revision's words for each module it gives no fingerprint, for the composer to blame that module alone. Builds: design 47 G §721, §722; A-470j, A-470k
This commit is contained in:
@@ -225,6 +225,7 @@ type runPrep struct {
|
||||
seats []json.RawMessage
|
||||
manifests map[string]composer.Manifest
|
||||
verdicts map[string]json.RawMessage
|
||||
none map[string]string
|
||||
programOf func(node string) (buildstep.RunProgram, string, error)
|
||||
err error
|
||||
}
|
||||
@@ -239,7 +240,7 @@ func (p *runPrep) get(ctx context.Context) error {
|
||||
if p.seats, p.err = p.r.seats(ctx, half.Revision.Definitions); p.err != nil {
|
||||
return
|
||||
}
|
||||
if p.manifests, p.verdicts, p.err = caseOf(half); p.err != nil {
|
||||
if p.manifests, p.verdicts, p.none, p.err = caseOf(half); p.err != nil {
|
||||
return
|
||||
}
|
||||
p.programOf, p.err = p.r.programs(ctx, half)
|
||||
@@ -271,7 +272,7 @@ func (r *compositionRun) start(ctx context.Context, key string, run meshwants.Co
|
||||
return
|
||||
}
|
||||
req := composer.Request{V: composer.Version, Input: in.Body, Depth: composer.DepthCompose, Machines: []string{node},
|
||||
Cases: []composer.Case{{Name: changeCase, Manifests: prep.manifests, Verdicts: prep.verdicts}}, Seats: prep.seats,
|
||||
Cases: []composer.Case{{Name: changeCase, Manifests: prep.manifests, Verdicts: prep.verdicts, None: prep.none}}, Seats: prep.seats,
|
||||
BlameTries: r.runs.set.blameTries} // the composer's bound of its search for culprits (§721, A-466r)
|
||||
raw, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
@@ -506,20 +507,28 @@ func (r *compositionRun) seatAt(ctx context.Context, seat, digest string) (json.
|
||||
return def, nil
|
||||
}
|
||||
|
||||
// caseOf is the case's manifests and verdicts from the revision's entries: each manifest whole, and the verdict of each one not
|
||||
// accepted (a module without one is accepted).
|
||||
func caseOf(half mcc.Half) (map[string]composer.Manifest, map[string]json.RawMessage, error) {
|
||||
// caseOf is the case's manifests, verdicts and none from the revision's entries: each manifest whole, the verdict of each one not
|
||||
// accepted (a module without one is accepted), and the revision's none words of each module it gives no fingerprint, whose
|
||||
// build can never be made (design 47 G A-470j, A-470k).
|
||||
func caseOf(half mcc.Half) (map[string]composer.Manifest, map[string]json.RawMessage, map[string]string, error) {
|
||||
manifests := map[string]composer.Manifest{}
|
||||
verdicts := map[string]json.RawMessage{}
|
||||
var none map[string]string
|
||||
for name, e := range half.Entries {
|
||||
if len(e.Manifest) == 0 {
|
||||
continue
|
||||
}
|
||||
raw, err := json.Marshal(e.Manifest)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("the manifest of %s cannot be encoded: %w", name, err)
|
||||
return nil, nil, nil, fmt.Errorf("the manifest of %s cannot be encoded: %w", name, err)
|
||||
}
|
||||
manifests[name] = composer.Manifest{Raw: raw}
|
||||
if e.Fp == "" && e.None != "" {
|
||||
if none == nil {
|
||||
none = map[string]string{}
|
||||
}
|
||||
none[name] = e.None
|
||||
}
|
||||
if e.Verdict == "" || e.Verdict == mcc.VerdictAccepted {
|
||||
continue
|
||||
}
|
||||
@@ -532,11 +541,11 @@ func caseOf(half mcc.Half) (map[string]composer.Manifest, map[string]json.RawMes
|
||||
}
|
||||
raw, err = json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
verdicts[name] = raw
|
||||
}
|
||||
return manifests, verdicts, nil
|
||||
return manifests, verdicts, none, nil
|
||||
}
|
||||
|
||||
// nodeEngineEntry is the entry of the module that claims the seat node-engine, or false.
|
||||
|
||||
@@ -57,7 +57,8 @@ func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) *
|
||||
"": {Revision: &meshcatalog.CatalogRevision{Revision: 7, Branch: "main", Definitions: []meshcatalog.CatalogRevisionDefinitionsItem{{Seat: "s1", Digest: "d1"}}},
|
||||
Entries: []meshcatalog.CatalogEntry{engine(revisionEngine, revisionCommit), {Module: "bad", Verdict: mcc.VerdictRefused, Inputs: &meshcatalog.EntryInputs{Problems: []string{"no seat x"}},
|
||||
Manifest: map[string]any{"module": "bad"}}}, Next: "bad"},
|
||||
"bad": {Revision: &meshcatalog.CatalogRevision{Revision: 7}, Entries: []meshcatalog.CatalogEntry{{Module: "m", Verdict: mcc.VerdictAccepted, Manifest: map[string]any{"module": "m"}}}},
|
||||
"bad": {Revision: &meshcatalog.CatalogRevision{Revision: 7}, Entries: []meshcatalog.CatalogEntry{{Module: "m", Verdict: mcc.VerdictAccepted, Manifest: map[string]any{"module": "m"}},
|
||||
{Module: "lidarr", None: "builders disagree: node", Manifest: map[string]any{"module": "lidarr"}}}}, // no fingerprint (A-470j)
|
||||
}
|
||||
call := func(key string, body any) (json.RawMessage, error) {
|
||||
raw, _ := json.Marshal(body)
|
||||
@@ -185,7 +186,7 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
|
||||
t.Errorf("the request of ace %+v", req)
|
||||
}
|
||||
c := req.Cases[0]
|
||||
if string(c.Manifests["m"].Raw) != `{"module":"m"}` || len(c.Manifests) != 3 || len(c.Verdicts) != 1 || !strings.Contains(string(c.Verdicts["bad"]), `"refused"`) ||
|
||||
if string(c.Manifests["m"].Raw) != `{"module":"m"}` || len(c.Manifests) != 4 || len(c.None) != 1 || c.None["lidarr"] != "builders disagree: node" || len(c.Verdicts) != 1 || !strings.Contains(string(c.Verdicts["bad"]), `"refused"`) ||
|
||||
!strings.Contains(string(c.Verdicts["bad"]), "no seat x") {
|
||||
t.Errorf("the case %+v %s", c.Manifests, c.Verdicts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user