From 024c137b949da99e794b6ee4669c577eff38eac7 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 22:00:31 +0100 Subject: [PATCH] T2 assigner: an empty pin of a run's entry is filled from mesh-builds.published (issue 1984) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The composer's and the validator's run asks go straight to the Go build seat, never through the builder, and pinsOfEntry dropped a pin the entry names with no version, so the build module refused at once with words that blame the builder. Now each empty pin is filled by asking the seat mesh-builds' verb published of the package's publisher in the step's catalog revision; the version it answers is the pin. No run ask is put with a pin left out: a build not yet published, or a package no build of the revision publishes, ends the run could not run naming the package and the entry (the wait for the publish comes with T3). The assigner requires the meshbuilds contract module and its manifest invokes seat:mesh-builds.published (TestManifest holds it). Tests: TestTheCompositionStepRunsOneAskPerMachine (its stand's revision holds x's publisher; rows "not published" and "no publisher") for 1984/AC9; TestTheValidateStepRefusesAManifestProblemAndACycle, revision 13, for 1984/AC10. Builds: design 47 H2 H-A-628 (2), (5) (hq cea6404c); D4 H-A-192; D5 H-A-204; D7 G §718, A-252, A-451; D8 H §745; D9 H-A-326, H-A-328 --- .../mesh-delivery-assigner/compositionrun.go | 119 ++++++++++++++++-- .../compositionrun_test.go | 52 +++++++- .../mesh-delivery-assigner/validatestep.go | 11 +- .../validatestep_test.go | 20 +++ modules/mesh-delivery-assigner/go.mod | 1 + .../mesh-delivery-assigner/manifest_test.go | 1 + modules/mesh-delivery-assigner/module.json | 1 + 7 files changed, 186 insertions(+), 19 deletions(-) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go index 2188cd04a..0d9114d14 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go @@ -17,6 +17,7 @@ import ( mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" ne "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" + builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds" meshcatalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" @@ -46,6 +47,9 @@ const ( // entryVerbKey and seatDefinitionsKey are the mesh-catalog seat verbs the step reads. entryVerbKey = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbEntry seatDefinitionsKey = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbSeatDefinitions + // publishedVerbKey is the build seat's read of whether a package built at a fingerprint is published, what fills a run's + // empty pin (design 47 H-A-328, H2 H-A-628 (2)). + publishedVerbKey = "seat:" + builds.Seat + "." + builds.VerbPublished ) // compositionRun runs a composition step. @@ -221,7 +225,10 @@ type runPrep struct { manifests map[string]composer.Manifest none map[string]string programOf func(node string) (buildstep.RunProgram, string, map[string]string, error) - err error + // publishers are the publishers of each package in the step's catalog revision, what an empty pin is filled from + // (H-A-628 (2)). + publishers map[string]packagePublisher + err error } func (p *runPrep) get(ctx context.Context) error { @@ -231,6 +238,7 @@ func (p *runPrep) get(ctx context.Context) error { p.err = errors.New("the step's catalog revision is not read: " + err.Error()) return } + p.publishers = publishersOf(half.Entries) // the step's own revision, before any branch's entry is laid over it if p.r.newest != nil && p.r.watched != nil { half = acrossBranches(p.step, half, p.r.newest(), p.r.watched) } @@ -283,6 +291,15 @@ func (r *compositionRun) start(ctx context.Context, key string, run meshwants.Co end(node + ": " + err.Error()) return } + pins, waiting, err := r.filledPins(ctx, "the node-engine's entry "+engineFp, pins, prep.publishers) + if err != nil { + end(node + ": " + err.Error()) + return + } + if len(waiting) > 0 { + end(node + ": " + unpublishedSaid(waiting)) + return + } cs := composer.Case{Name: changeCase, Manifests: prep.manifests, None: prep.none} if left, err := r.leftOut(node, unlisted); err != nil { end(node + ": " + err.Error()) @@ -322,7 +339,7 @@ func (r *compositionRun) start(ctx context.Context, key string, run meshwants.Co } a := buildstep.StepAsk{ID: ask, Kind: buildstep.AskCheck, Language: buildstep.AskGo, Asker: runAsker, At: r.now().UTC(), Run: &buildstep.RunJob{Program: program, Heads: []buildstep.RunHead{}, Input: ref, Reader: "the composition of " + node + " by the node-engine at " + program.Commit}, - Packages: pins} // the composer is built against its entry's pins, as every build (H-A-203, H-A-192) + Packages: pins} // the composer is built against its entry's pins, each empty one filled (H-A-203, H-A-192, H-A-628 (2)) if err := r.put(ctx, a); err != nil { end(node + ": its run ask " + ask + " is not put: " + err.Error()) } @@ -737,22 +754,100 @@ func programOfEntry(e meshcatalog.CatalogEntry) (buildstep.RunProgram, error) { return buildstep.RunProgram{Repository: e.Repository, Commit: e.Commit, Dir: dir, Package: composer.Package}, nil } -// pinsOfEntry are the mesh packages' versions an entry pins, the ones it names with a version (H-A-203, H-A-183): the pins -// a run's program is built against, in the form the entry keeps and the builder sends. nil when it pins none. +// pinsOfEntry are the mesh packages' versions an entry names (H-A-203, H-A-183, H-A-204): the pins a run's program is built +// against, in the form the entry keeps and the builder sends, a package it names with no version kept with an empty one, +// never left out, for filledPins to fill (H-A-628 (5)). nil when it names none. func pinsOfEntry(e meshcatalog.CatalogEntry) map[string]string { - var out map[string]string - for path, version := range e.Packages { - if version == "" { - continue + if len(e.Packages) == 0 { + return nil + } + return maps.Clone(e.Packages) +} + +// packagePublisher is the build of a catalog revision that publishes a package: its module, the package's artifact reference +// (:) and the build's fingerprint, what the seat mesh-builds' published is asked of (H-A-328, H-A-628 (2)). +type packagePublisher struct { + module, artifact, fingerprint string +} + +// publishersOf are the publishers of each package the entries of a catalog revision publish, by package name. +func publishersOf(entries map[string]meshcatalog.CatalogEntry) map[string]packagePublisher { + out := map[string]packagePublisher{} + for _, e := range entries { + for _, a := range e.Artifacts { + if a.Package != nil && a.Package.Name != "" && e.Fp != "" { + out[a.Package.Name] = packagePublisher{module: e.Module, artifact: a.Ref, fingerprint: e.Fp} + } } - if out == nil { - out = map[string]string{} - } - out[path] = version } return out } +// unpublished is a package an entry names with no version whose publisher's build in the step's revision is not published. +type unpublished struct { + path string + by packagePublisher +} + +// unpublishedSaid names each package of waiting and the build it waits for. +func unpublishedSaid(waiting []unpublished) string { + var said []string + for _, u := range waiting { + said = append(said, fmt.Sprintf("package %s has no published version: the build of %s at %s (%s) is not published", u.path, u.by.module, u.by.fingerprint, u.by.artifact)) + } + return strings.Join(said, "; ") +} + +// filledPins fills each empty pin of pins, which the entry what names, from the seat mesh-builds' verb published, asked of the +// package's publisher in the step's catalog revision: the version it answers is the pin, never one the assigner computes +// (design 47 H2 H-A-628 (2), H-A-328, H-A-192). It answers the pins with every one it could fill, the packages whose +// publisher's build is not published yet, or an error naming the package, the entry and why it has no version (H-A-628 (5)). +// pins itself is left as it is: one entry's pins serve every machine's run. +func (r *compositionRun) filledPins(ctx context.Context, what string, pins map[string]string, publishers map[string]packagePublisher) (map[string]string, []unpublished, error) { + pins = maps.Clone(pins) + var waiting []unpublished + for _, path := range slices.Sorted(maps.Keys(pins)) { + if pins[path] != "" { + continue + } + by, ok := publishers[path] + if !ok { + return nil, nil, fmt.Errorf("package %s has no version in %s, and no build of the step's catalog revision publishes it", path, what) + } + v, published, err := r.publishedOf(ctx, by) + if err != nil { + return nil, nil, fmt.Errorf("package %s has no version in %s, and whether the build of %s at %s publishes it is not read: %w", path, what, by.module, by.fingerprint, err) + } + if !published { + waiting = append(waiting, unpublished{path: path, by: by}) + continue + } + pins[path] = v + r.logf("package %s, named with no version in %s, is pinned at %s: the build of %s at %s published it (mesh-builds' published, H-A-628)", path, what, v, by.module, by.fingerprint) + } + return pins, waiting, nil +} + +// publishedOf asks the seat mesh-builds' verb published whether by's build is published, answering the pin it is published at +// (vMAJOR.MINOR.PATCH, spec S9) when it is. +func (r *compositionRun) publishedOf(ctx context.Context, by packagePublisher) (string, bool, error) { + body, said, err := r.callRetry(ctx, publishedVerbKey, builds.PublishedInput{Module: by.module, Artifact: by.artifact, Fingerprint: by.fingerprint}) + if err != nil || body == nil { + return "", false, unreadErr(builds.VerbPublished+" did not answer", err, said) + } + a, _, err := builds.DecodePublishedAnswer(body) + if err != nil { + return "", false, fmt.Errorf("%s answered what does not read: %w", builds.VerbPublished, err) + } + if !a.Published { + return "", false, nil + } + if a.Version == "" { + return "", false, fmt.Errorf("%s answered published with no version", builds.VerbPublished) + } + return "v" + a.Version, true, nil +} + // programs answers, per machine, the composer its run builds and the node-engine fingerprint it was chosen from (A-226, A-243, // A-252, §719): where the revision's node-engine entry differs from the trunk's, that build for every machine; else the build the // machine's node-engine runs, as its `running` says, its entry read through mesh-catalog's `entry`; a machine whose node-engine's diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go index 2d94118fc..a21c45bc0 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go @@ -17,6 +17,7 @@ import ( ne "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" + builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds" meshcatalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" @@ -48,10 +49,16 @@ type runStand struct { listFault error // verdict, when set, is the composer's verdict of a machine (by node), else the stand's own. verdict func(node string) (composer.Machine, bool) + // publishedAt is the version mesh-builds' published answers for a build fingerprint, none (not published) when absent; + // published are the asks it was given (H-A-628 (2)). + publishedAt map[string]string + published []builds.PublishedInput + // noPublisher: the revision holds no build publishing x/go. + noPublisher bool } func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) *runStand { - s := &runStand{asks: map[string]buildstep.StepAsk{}, requests: map[string]composer.Request{}} + s := &runStand{asks: map[string]buildstep.StepAsk{}, requests: map[string]composer.Request{}, publishedAt: map[string]string{"src2:x1": "0.1.9"}} engine := func(fp, commit string) meshcatalog.CatalogEntry { return meshcatalog.CatalogEntry{Module: "engine", Fp: fp, Repository: "novox/mesh-host", Commit: commit, Path: ".", Serves: []string{ne.Seat + ".composition"}, Manifest: map[string]any{"module": "engine"}, Packages: map[string]string{"git.novox.be/novox/mesh-sdk/go": "v0.1.25-" + fp, "git.novox.be/novox/x/go": ""}} @@ -65,7 +72,9 @@ func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) * 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"}}, - {Module: "lidarr", None: "builders disagree: node", Manifest: map[string]any{"module": "lidarr"}}}}, // no fingerprint (A-470j) + {Module: "lidarr", None: "builders disagree: node", Manifest: map[string]any{"module": "lidarr"}}, // no fingerprint (A-470j) + // x publishes the package the node-engine names with no version (H-A-628 (2)); no manifest, so the case holds none of it. + {Module: "x", Fp: "src2:x1", Artifacts: []meshcatalog.Artifact{{Ref: "x:go", Language: "go", Package: &meshcatalog.ArtifactPackage{Ecosystem: "go", Name: "git.novox.be/novox/x/go"}}}}}}, } call := func(key string, body any) (json.RawMessage, error) { raw, _ := json.Marshal(body) @@ -77,6 +86,9 @@ func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) * return nil, errors.New("asked another revision") } page := pages[in.After] + if s.noPublisher { + page.Entries = slices.DeleteFunc(slices.Clone(page.Entries), func(e meshcatalog.CatalogEntry) bool { return e.Module == "x" }) + } if s.noDefinitions && page.Revision != nil { rev := *page.Revision rev.Definitions = nil @@ -101,6 +113,14 @@ func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) * s.mu.Unlock() commit := map[string]string{"src2:e1": commitE1, "src2:e2": commitE2}[in.Fingerprint] return json.Marshal(meshcatalog.EntryAnswer{Entry: engine(in.Fingerprint, commit)}) + case publishedVerbKey: + var in builds.PublishedInput + _ = json.Unmarshal(raw, &in) + s.mu.Lock() + s.published = append(s.published, in) + v, ok := s.publishedAt[in.Fingerprint] + s.mu.Unlock() + return json.Marshal(builds.PublishedAnswer{Published: ok, Version: v}) } return nil, errors.New("no such verb " + key) } @@ -187,11 +207,31 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) { if s.asks["g14"].Run.Program.Commit != commitE2 { t.Errorf("g14's composer is built at %s, want the build its node-engine runs", s.asks["g14"].Run.Program.Commit) } - // Each composer is built against the pins of the node-engine entry it is built from, a pin with no version left out - // (H-A-203, H-A-192). + // Each composer is built against the pins of the node-engine entry it is built from (H-A-203, H-A-192); 1984/AC9: the one + // it names with no version is filled from mesh-builds' published of its publisher's build in the step's revision, at the + // version that answers, never left out (H-A-628 (2), (5)). for node, fp := range map[string]string{"ace": "src2:e1", "g14": "src2:e2"} { - if got := s.asks[node].Packages; len(got) != 1 || got["git.novox.be/novox/mesh-sdk/go"] != "v0.1.25-"+fp { - t.Errorf("%s's composer is built against the pins %v; want its entry's", node, got) + if got := s.asks[node].Packages; len(got) != 2 || got["git.novox.be/novox/mesh-sdk/go"] != "v0.1.25-"+fp || got["git.novox.be/novox/x/go"] != "v0.1.9" { + t.Errorf("%s's composer is built against the pins %v; want its entry's, x/go at v0.1.9 from published", node, got) + } + } + if len(s.published) == 0 || s.published[0] != (builds.PublishedInput{Module: "x", Artifact: "x:go", Fingerprint: "src2:x1"}) { + t.Errorf("published was asked %+v, want x's build of x:go at src2:x1 in the step's revision", s.published) + } + // 1984/AC9: no run ask is put with a pin left out: x's build not published, or no build of the revision publishing x/go, + // ends the run could not run naming the package and the entry, never the builder (H-A-628 (5)). + for name, c := range map[string]struct { + stand func(*runStand) + said string + }{ + "not published": {func(s *runStand) { s.publishedAt = nil }, "package git.novox.be/novox/x/go has no published version: the build of x at src2:x1 (x:go) is not published"}, + "no publisher": {func(s *runStand) { s.publishedAt = nil; s.noPublisher = true }, "package git.novox.be/novox/x/go has no version in the node-engine's entry src2:e1, and no build of the step's catalog revision publishes it"}, + } { + u := newRunStand(t, "src2:e1", "src2:e1", "d1") + c.stand(u) + if out := u.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(out.Said, c.said) || + strings.Contains(out.Said, "the builder pins or waits") || len(u.asks) != 0 { + t.Errorf("%s: the step came to %+v with %d run asks put, want could not run saying %q and none put", name, out, len(u.asks), c.said) } } if req.Depth != composer.DepthCompose || req.BlameTries != 20 || len(req.Machines) != 1 || req.Machines[0] != "ace" || len(req.Cases) != 1 || req.Cases[0].Name != changeCase || diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep.go index c513565f1..54a609a12 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep.go @@ -288,6 +288,15 @@ func (r *compositionRun) startValidate(ctx context.Context, key string, run mesh return } program.Package = validatorPackage + pins, waiting, err := r.filledPins(ctx, "the manifest validator's entry "+entry.Fp, pinsOfEntry(entry), publishersOf(half.Entries)) + if err != nil { + couldNot(err.Error()) + return + } + if len(waiting) > 0 { + couldNot(unpublishedSaid(waiting)) + return + } seats, list, err := r.validateSeats(ctx, ask, half.Revision.Definitions) if err != nil { couldNot(err.Error()) @@ -334,7 +343,7 @@ func (r *compositionRun) startValidate(ctx context.Context, key string, run mesh } a := buildstep.StepAsk{ID: ask, Kind: buildstep.AskCheck, Language: buildstep.AskGo, Asker: runAsker, At: r.now().UTC(), Run: &buildstep.RunJob{Program: program, Heads: []buildstep.RunHead{}, Input: ref, Reader: "the manifest validator of " + step.Pipeline + " at " + program.Commit}, - Packages: pinsOfEntry(entry)} // the validator is built against its entry's pins at the step's revision (H-A-203, H-A-192, H-A-205) + Packages: pins} // the validator is built against its entry's pins at the step's revision, each empty one filled (H-A-203, H-A-192, H-A-205, H-A-628 (2)) if err := r.put(ctx, a); err != nil { couldNot("its run ask " + ask + " is not put: " + err.Error()) } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep_test.go index cbe180e69..867f60cbb 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/validatestep_test.go @@ -12,6 +12,7 @@ import ( "time" mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" + builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds" meshcatalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" @@ -32,6 +33,8 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) { indexer := meshcatalog.CatalogEntry{Module: "indexer", Repository: "novox/mesh-delivery", Commit: commitE3, Path: "modules/mesh-delivery-indexer", Fp: "src2:ix", Serves: []string{"seat:" + meshcatalog.Seat + ".revision"}, Manifest: map[string]any{"module": "indexer"}, ManifestDigest: "d-ix", Packages: map[string]string{"git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient": "v0.1.4"}} + unpinned := indexer + unpinned.Packages = map[string]string{"git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient": "v0.1.4", "git.novox.be/novox/mesh-sdk/go": ""} entry := func(module, digest string, edges ...meshcatalog.Edge) meshcatalog.CatalogEntry { return meshcatalog.CatalogEntry{Module: module, Manifest: map[string]any{"module": module, "d": digest}, ManifestDigest: digest, Edges: edges} } @@ -41,6 +44,9 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) { 9: {indexer, entry("a", "d-a", meshcatalog.Edge{From: "a:x", To: "b:y", Kind: 3}, meshcatalog.Edge{From: "b:y", To: "a:x", Kind: 3}), entry("b", "d-b")}, 3: {indexer}, 12: {indexer, entry("web", "d-web-2"), entry("db", "d-db")}, + // 1984/AC10: the validator's entry names mesh-sdk/go with no version, and mesh-sdk's build in the revision publishes it. + 13: {unpinned, entry("web", "d-web-2"), entry("db", "d-db"), {Module: "mesh-sdk", Fp: "src2:sdk1", + Artifacts: []meshcatalog.Artifact{{Ref: "mesh-sdk:go", Language: "go", Package: &meshcatalog.ArtifactPackage{Ecosystem: "go", Name: "git.novox.be/novox/mesh-sdk/go"}}}}}, } // base is the newest kept revision below n, as the take-in names it; none below the first. Revision 12 names 7 with 8 to 11 // never kept, so a case before read as the number minus one could not run (H-A-154). @@ -74,6 +80,13 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) { Definitions: defs}, Entries: entries}) case seatDefinitionsKey: return json.Marshal(meshcatalog.SeatDefinitionsAnswer{Found: true, Entry: &meshcatalog.SeatDefinitionsAnswerEntry{Seat: "s1", Digest: "sd", Definition: map[string]any{"seat": "s1"}}}) + case publishedVerbKey: + var in builds.PublishedInput + _ = json.Unmarshal(raw, &in) + if in != (builds.PublishedInput{Module: "mesh-sdk", Artifact: "mesh-sdk:go", Fingerprint: "src2:sdk1"}) { + return nil, errors.New("published asked of another build") + } + return json.Marshal(builds.PublishedAnswer{Published: true, Version: "0.1.36"}) } return nil, errors.New("no such verb " + key) } @@ -217,4 +230,11 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) { } else if web := requests[2].Cases[1].Manifests["web"]; len(requests[2].Cases[1].Manifests) != 3 || !strings.Contains(string(web.Raw), "d-web-2") { t.Errorf("the case before of revision 12 is %+v, want base 7's manifests", requests[2].Cases[1].Manifests) } + // 1984/AC10 (H-A-628 (2), (5)): the validator's pin with no version is filled from mesh-builds' published of its publisher's + // build in the step's revision, never left out. + if o := r.validate(ctx, "ask-unpinned", step("web", 13)); o.Outcome != meshwants.StepEndedOutcomeFailed || len(asks) != 4 { + t.Errorf("a validator entry with an empty pin ended %+v (%d validator asks), want it judged", o, len(asks)) + } else if got := asks[3].Packages; len(got) != 2 || got["git.novox.be/novox/mesh-sdk/go"] != "v0.1.36" || got["git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"] != "v0.1.4" { + t.Errorf("the validator is built against the pins %v; want mesh-sdk/go at v0.1.36 from published beside its entry's", got) + } } diff --git a/modules/mesh-delivery-assigner/go.mod b/modules/mesh-delivery-assigner/go.mod index f28e78db2..135a432f3 100644 --- a/modules/mesh-delivery-assigner/go.mod +++ b/modules/mesh-delivery-assigner/go.mod @@ -8,6 +8,7 @@ require ( git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshhandacts v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient v0.0.0-00010101000000-000000000000 + git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-sdk/go v0.0.0-00010101000000-000000000000 github.com/nats-io/nats-server/v2 v2.11.17 diff --git a/modules/mesh-delivery-assigner/manifest_test.go b/modules/mesh-delivery-assigner/manifest_test.go index c119e8b37..bf784b1f1 100644 --- a/modules/mesh-delivery-assigner/manifest_test.go +++ b/modules/mesh-delivery-assigner/manifest_test.go @@ -158,6 +158,7 @@ func TestManifest(t *testing.T) { } if want := []string{"mesh-delivery-indexer.manifests", "mesh-delivery-indexer.modules", buckets.TellerModule + "." + buckets.AnswersReadTool, // A-175, A-178: the teller's answers' first view + "seat:mesh-builds.published", // design 47 H2 H-A-628 (2), H-A-328: a run's empty pin filled from its publisher's build (1984/AC9, AC10) "seat:mesh-catalog.entry", "seat:mesh-catalog.registrations", "seat:mesh-catalog.revision", "seat:mesh-catalog.seat-definitions", // ADR 0636 §4: the seat list "seat:mesh-catalog.seat-list", // design 47 H2 H-A-443: the validate step's trunk seat list, in chunks "seat:mesh-conditions.conditions", // design 47 G §706: the conditions read at each judging of an outside wait diff --git a/modules/mesh-delivery-assigner/module.json b/modules/mesh-delivery-assigner/module.json index 1bd9bbdfe..b5974c67e 100644 --- a/modules/mesh-delivery-assigner/module.json +++ b/modules/mesh-delivery-assigner/module.json @@ -69,6 +69,7 @@ "mesh-delivery-indexer.manifests", "mesh-delivery-indexer.modules", "mesh-delivery-teller.teller_read_answers", + "seat:mesh-builds.published", "seat:mesh-catalog.entry", "seat:mesh-catalog.registrations", {"verb": "seat:mesh-catalog.revision", "fields": ["none-yet"]},