From 4c98841d2ab3c2546f5779cd0e89638c3f3f909f Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 23 Oct 2026 15:41:57 +0200 Subject: [PATCH] Judge a repository the mesh knows no module of with both build modules, so mesh-lab's nested Go modules and its npm test both run (issue 1887 A12) --- .../cmd/mesh-delivery-checker/judge.go | 15 +++++++++++-- .../cmd/mesh-delivery-checker/judge_test.go | 6 +++-- .../internal/check/pins_test.go | 22 +++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge.go index ed8ff96..7db6c2b 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge.go @@ -142,17 +142,28 @@ func (r *repoModules) PackagePaths(repository string) []string { return out } -// BuildModules are the build modules that judge a repository, sorted. +// BuildModules are the build modules that judge a repository, sorted: the Go build module always, and the Node build +// module when a module of the repository builds TypeScript. A repository of which the mesh knows no module (mesh-lab, hq) +// is judged by both, each finding its own directories in the tree (go.mod files; package.json files), so a repository +// with tests in either language and no manifest is judged whole (issue 1887 A12). func (r *repoModules) BuildModules(repository string) []string { out := []string{buildrun.GoBuildModule} r.mu.Lock() defer r.mu.Unlock() + known := false for module, repo := range r.repoOf { - if repo == repository && r.langs[r.typed[module]]["typescript"] { + if repo != repository { + continue + } + known = true + if r.langs[r.typed[module]]["typescript"] { out = append(out, buildrun.NodeBuildModule) break } } + if !known { + out = append(out, buildrun.NodeBuildModule) + } sort.Strings(out) return out } diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go index 8afa3c1..126b348 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go @@ -69,8 +69,10 @@ func TestARepositoryWithATypeScriptModuleIsJudgedByTheNodeBuildModuleToo(t *test if got := r.CommitOf("mesh-delivery-checker"); got != strings.Repeat("a", 40) || r.CommitOf("gone") != "" { t.Errorf("the commit the mesh runs = %q", got) } - if got := r.BuildModules("novox/mesh-sdk"); strings.Join(got, ",") != buildrun.GoBuildModule { - t.Errorf("a repository with no module: %v, want the Go build module", got) + // 1887/A12: a repository with no module the mesh knows (mesh-lab: nested go.mod files and a root package.json) is + // judged by both build modules. + if got := r.BuildModules("novox/mesh-lab"); strings.Join(got, ",") != buildrun.GoBuildModule+","+buildrun.NodeBuildModule { + t.Errorf("a repository with no module: %v, want both build modules", got) } } diff --git a/modules/mesh-delivery-checker/internal/check/pins_test.go b/modules/mesh-delivery-checker/internal/check/pins_test.go index dabdfe3..9d0c6bb 100644 --- a/modules/mesh-delivery-checker/internal/check/pins_test.go +++ b/modules/mesh-delivery-checker/internal/check/pins_test.go @@ -291,3 +291,25 @@ func TestACatalogueChangeHasTheCatalogueBesideItAtItsTrunk(t *testing.T) { t.Errorf("mesh-sdk is no longer beside a catalogue change: %v", got) } } + +// 1887/A12: a mesh-lab head gets a check: with its trunk known it is judged like any repository, its Go fetch finding +// the nested modules itself. +func TestAMeshLabHeadGetsACheck(t *testing.T) { + const lab = "novox/mesh-lab" + raw := candidateOf(t, "fix/x", pullOf(lab, 3, head1)) + c, err := delivery.DecodeCandidate(raw) + if err != nil { + t.Fatal(err) + } + cs := CaseOf(c, map[string]string{lab: trunkA}) + if cs == nil || len(cs.Pulls) != 1 || cs.Pulls[0].Repository != lab || len(cs.Left) != 0 { + t.Fatalf("the case = %+v, want mesh-lab#3 judged", cs) + } + b := newBench(t) + if v := b.judge(t, cs).Verdict; v.State != delivery.VerdictPass { + t.Fatalf("verdict = %+v", v) + } + if fetched := b.steps.tool("fetch"); len(fetched) == 0 || fetched[0].args["repository"] != lab { + t.Fatalf("mesh-lab was not fetched: %+v", fetched) + } +}