From bf204f90f389d341d5cd1058d3583c4c920b2fdc Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 1 Oct 2026 14:05:57 +0200 Subject: [PATCH] The console's build tool has the command's three shapes: a repository, a base (--on), everything behind Rebuilding the forty-three modules that stand on the runtime image took forty-three tool calls because the seat verb only knew a repository. `on` rebuilds every module built on a base, `behind` rebuilds what is older than its source, both asked and not waited for, the daemon taking each result in (issue 176). Nothing is required any more; a build naming nothing is refused by the command's usage. --- cmd/mesh-controller/seatverbs.go | 9 +++++++++ cmd/mesh-controller/seatverbs_test.go | 16 ++++++++++++++++ internal/catalogue/verbs.go | 4 +++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cmd/mesh-controller/seatverbs.go b/cmd/mesh-controller/seatverbs.go index 3b3c608..e7d3cfb 100644 --- a/cmd/mesh-controller/seatverbs.go +++ b/cmd/mesh-controller/seatverbs.go @@ -102,6 +102,15 @@ func argvFor(verb string, args map[string]any) ([]string, error) { // the answer the caller needs. return []string{"rotate"}, nil case "build": + // Three shapes, as the command has them: a repository, a base every module built on it + // is rebuilt from (`--on`), or everything behind its source (`--behind`). Asked, not + // waited for, the same as a single build. + if on := str("on"); on != "" { + return []string{"build", "--on", on, "--wait", "0"}, nil + } + if b := str("behind"); b != "" && b != "no" && b != "false" { + return []string{"build", "--behind", "--wait", "0"}, nil + } if err := need("repository"); err != nil { return nil, err } diff --git a/cmd/mesh-controller/seatverbs_test.go b/cmd/mesh-controller/seatverbs_test.go index 44365e3..38f8f40 100644 --- a/cmd/mesh-controller/seatverbs_test.go +++ b/cmd/mesh-controller/seatverbs_test.go @@ -139,3 +139,19 @@ func TestAJSONVerbsAnswerIsItsStandardOutput(t *testing.T) { t.Fatalf("stderr and stdout are both what the command said: %s", answer.Output) } } + +// The build tool has the command's three shapes (ADR 0157's follow-up, 2026-10-01): a repository, a +// base whose dependents are rebuilt, or everything behind its source — each asked, not waited for. +func TestTheBuildToolRebuildsWhatStandsOnABase(t *testing.T) { + argv, _ := argvFor("build", map[string]any{"on": "mesh-tools"}) + if strings.Join(argv, " ") != "build --on mesh-tools --wait 0" { + t.Fatalf("a base: %v", argv) + } + argv, _ = argvFor("build", map[string]any{"behind": "yes"}) + if strings.Join(argv, " ") != "build --behind --wait 0" { + t.Fatalf("behind: %v", argv) + } + if _, err := argvFor("build", map[string]any{}); err == nil { + t.Fatal("a build naming nothing was accepted") + } +} diff --git a/internal/catalogue/verbs.go b/internal/catalogue/verbs.go index 2ad3907..82eda90 100644 --- a/internal/catalogue/verbs.go +++ b/internal/catalogue/verbs.go @@ -113,10 +113,12 @@ var ControllerVerbs = []Verb{ {Name: "build", Description: "Have the build machine build a repository. Answers at once with the build's id: " + "`builds` with that id follows it line by line, and the module is registered when the outcome comes.", Input: schema(map[string]string{ + "on": "instead of a repository: a module whose artifacts others stand on; every module built on it is rebuilt (the rebuild a changed base needs)", + "behind": "instead of a repository: \"yes\" rebuilds every module the mesh holds older than its source has", "repository": "the repository's URL, or its path on the forge holding the git seat (owner/name)", "path": "the module's directory inside it (optional)", "ref": "the branch, tag or commit to build (optional)", - }, []string{"repository"})}, + }, nil)}, } // schema is a JSON schema for an object of string properties, which is every argument the verbs