From 344b6beb8d4652e923fe710740250ec96a329181 Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 09:36:11 +0000 Subject: [PATCH] Give the judge fixtures mesh-sdk's validator and drop the tests of a validator judge (issue 1391) The judge fixtures vendor mesh-sdk's validate package, as the controller does; the test of the judge built with a node-engine change's own validator goes with that judge; the replay of issue 867 no longer has the controller change need a validator word of the node-engine's. --- cmd/mesh-controller/replay867_test.go | 23 +++++++------- internal/builder/judge_build_test.go | 44 +++------------------------ 2 files changed, 15 insertions(+), 52 deletions(-) diff --git a/cmd/mesh-controller/replay867_test.go b/cmd/mesh-controller/replay867_test.go index 12d1e640..d316075c 100644 --- a/cmd/mesh-controller/replay867_test.go +++ b/cmd/mesh-controller/replay867_test.go @@ -28,10 +28,10 @@ import ( // TestReplay867 is the replay of novox/hq issue 867, written with only what the controller and the build seat had // before the fix, so mesh-lab's prover can lay it over the commit before. A mesh-host change (#114) and a -// mesh-controller change (#346) of one delivery group need each other: the node-engine change's own check reads the -// controller's lock beside it, which only the controller change brings; the controller change builds only with the -// validator word only the node-engine change brings. Each was read beside the other's repository at the commit the mesh -// runs, which holds neither change, so neither could pass its own merge check — and the pair could not merge. +// mesh-controller change (#346) of one delivery group: the node-engine change's own check reads the controller's lock +// beside it, which only the controller change brings. It was read beside the other's repository at the commit the mesh +// runs, which holds neither change, so the node-engine change could not pass its own merge check. (The controller +// change once needed the node-engine's validator word too; the validator is mesh-sdk's now, issue 1391.) // // It runs the whole path: the forge announces each pull request (following.PullUpdated), the controller asks // mesh-delivery which pull requests the group holds, the ask is queued for the build seat, and the build seat's check @@ -104,10 +104,9 @@ func r867Commit(t *testing.T, dir string, files map[string]string) string { // r867Controller is a controller whose judge says who it is and the validator word it was built with. func r867Controller(who, extra string) map[string]string { return map[string]string{ - "go.mod": "module example.org/judge\n\ngo 1.22\n\nrequire github.com/novox/mesh-host v0.0.0\n", - "vendor/modules.txt": "# github.com/novox/mesh-host v0.0.0\n## explicit; go 1.22\ngithub.com/novox/mesh-host/validate\n", - "vendor/github.com/novox/mesh-host/validate/v.go": "package validate\n\nconst Word = \"the vendored validator\"\n", - "vendor/github.com/novox/mesh-host/internal/declaration/d.go": "package declaration\n", + "go.mod": "module example.org/judge\n\ngo 1.22\n\nrequire git.novox.be/novox/mesh-sdk/go v0.0.0\n", + "vendor/modules.txt": "# git.novox.be/novox/mesh-sdk/go v0.0.0\n## explicit; go 1.22\ngit.novox.be/novox/mesh-sdk/go/validate\n", + "vendor/git.novox.be/novox/mesh-sdk/go/validate/v.go": "package validate\n\nconst Word = \"the vendored validator\"\n", "cmd/mesh-controller/main.go": `package main import ( @@ -161,12 +160,12 @@ func theGroupOfIssue867Into(t *testing.T, base string) *theIssue867 { } // The two pull requests of one group, feat/867. r867Git(t, controller, "checkout", "--quiet", "-b", "feat/867", base) - change := r867Controller("the controller", "+validate.More") + change := r867Controller("the controller", "") change["lock.txt"] = "foundation: new\n" r.controllerHead = r867Commit(t, controller, change) r867Git(t, controller, "checkout", "--quiet", "main") r867Git(t, host, "checkout", "--quiet", "-b", "feat/867", base) - r.hostHead = r867Commit(t, host, map[string]string{"validate/more.go": "package validate\n\nconst More = \" and more\"\n"}) + r.hostHead = r867Commit(t, host, map[string]string{"notes.txt": "the node-engine change\n"}) r867Git(t, host, "checkout", "--quiet", "main") followed := func(string) string { return "main" } @@ -217,7 +216,7 @@ func (r *theIssue867) checked(t *testing.T, repo string, number int, head string servingBus.Store(js) t.Cleanup(func() { servingBus.Store(nil) }) p := link.PullUpdated{Owner: "novox", Repo: repo, Number: number, Base: "main", Head: "feat/867", Commit: head, - Paths: []string{"lock.txt", "validate/more.go", "cmd/mesh-controller/main.go"}, ModuleDirsSaid: true, + Paths: []string{"lock.txt", "notes.txt", "cmd/mesh-controller/main.go"}, ModuleDirsSaid: true, MergeCheck: true, MergeCheckSaid: true} if recheck { // As `delivery check --members ` builds it from mesh-delivery's member: no head branch name. @@ -350,7 +349,7 @@ func TestTheRecheckVerbAsksMeshDeliveryOnABusOfItsOwn(t *testing.T) { } t.Cleanup(func() { _ = sub.Unsubscribe() }) member := `[{"id":"novox/mesh-host@` + r.hostHead[:12] + `","repository":"novox/mesh-host","base":"main","head":"` + - r.hostHead + `","number":114,"paths":["validate/more.go"],"module_dirs_said":true}]` + r.hostHead + `","number":114,"paths":["notes.txt"],"module_dirs_said":true}]` if err := deliveryCommand(t.Context(), []string{"check", "--members", member}); err != nil { t.Fatal(err) } diff --git a/internal/builder/judge_build_test.go b/internal/builder/judge_build_test.go index b0d9a3a6..b4cb2c64 100644 --- a/internal/builder/judge_build_test.go +++ b/internal/builder/judge_build_test.go @@ -62,14 +62,13 @@ func aRepositoryWithARelease(t *testing.T, mainFiles, releaseFiles map[string]st return dir, main, head } -// aJudgeOf is a controller that judges as told: its gate passes, saying who it is and the word of the node-engine +// aJudgeOf is a controller that judges as told: its gate passes, saying who it is and the word of the mesh-sdk // validator it vendors — the one it was built with. func aJudgeOf(who string) map[string]string { return map[string]string{ - "go.mod": "module example.org/judge\n\ngo 1.22\n\nrequire github.com/novox/mesh-host v0.0.0\n", - "vendor/modules.txt": "# github.com/novox/mesh-host v0.0.0\n## explicit; go 1.22\ngithub.com/novox/mesh-host/validate\n", - "vendor/github.com/novox/mesh-host/validate/v.go": "package validate\n\nconst Word = \"the vendored validator\"\n", - "vendor/github.com/novox/mesh-host/internal/declaration/d.go": "package declaration\n", + "go.mod": "module example.org/judge\n\ngo 1.22\n\nrequire git.novox.be/novox/mesh-sdk/go v0.0.0\n", + "vendor/modules.txt": "# git.novox.be/novox/mesh-sdk/go v0.0.0\n## explicit; go 1.22\ngit.novox.be/novox/mesh-sdk/go/validate\n", + "vendor/git.novox.be/novox/mesh-sdk/go/validate/v.go": "package validate\n\nconst Word = \"the vendored validator\"\n", "cmd/mesh-controller/main.go": `package main import ( @@ -281,41 +280,6 @@ func TestAHookPlantedInTheWorkspaceDoesNotRunDuringTheJudgesBuild(t *testing.T) } } -// The same for the judge built with a node-engine change's own validator. -func TestAHookPlantedInTheWorkspaceDoesNotRunDuringTheValidatorJudgesBuild(t *testing.T) { - aRuntimeThatBuildsTheJudge(t) - homes := filepath.Join(t.TempDir(), "homes") - t.Setenv("JUDGE_HOMES", homes) - registry := aFactsRegistry(t) - workspace, ran := aPlantedWorkspace(t) - beside, _, _, _ := theReleasedMesh(t) - delete(beside, "mesh-host") - files := aHostSaying("the release branch's validator") - files["module.json"] = `{"module":"mesh-host"}` - files[CheckScript] = "git status >/dev/null 2>&1; true\n" - host, head := aPullRequestInto(t, files, releaseBranch, aHostSaying("this change's validator")) - v, err := Check(t.Context(), Command, CheckSpec{ID: "check-704-planted-validator", Repository: host, Ref: head, - Owner: "novox", Repo: "mesh-host", Number: 111, Base: releaseBranch, Judge: "validator", - JudgeCache: t.TempDir(), Paths: []string{"validate/v.go"}, Modules: []string{"mesh-host"}, Beside: beside, - Toolchain: "golang"}, workspace, registry, GitCredential{}, nil) - if err != nil { - t.Fatal(err) - } - if v.Gate == nil || !strings.HasSuffix(v.Gate.Summary, "controller with this change's validator") { - t.Fatalf("a node-engine change was not judged by the controller with its own "+ - "validator: %+v\n%s", v.Gate, v.Report) - } - if body, _ := os.ReadFile(ran); !strings.Contains(string(body), "/check/mesh-host") { - t.Fatalf("the planted hook never ran, so this test proves nothing: %q", body) - } - if said := judgeRanTheHook(t, ran); said != "" { - t.Fatalf("the hook planted in the workspace ran during a judge's build:\n%s", said) - } - if body, _ := os.ReadFile(homes); strings.Count(string(body), "\n") != 2 || strings.Contains(string(body), workspace) { - t.Fatalf("the judges were not both built with a HOME outside the workspace: %q", body) - } -} - // **Judges are built warm and where no pull request reaches** (ADR 0358 §6): every judge build uses the judge cache's // one Go cache, kept between checks; its home is made fresh under the judge cache and removed after; nothing is left in // a temporary directory of the host; and no container a check runs for the pull request mounts the judge cache.