From 51df346a2345afd5dc33a18d378a28c9f58598bc Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 05:34:39 +0100 Subject: [PATCH] BG12, BLD16: the Go build module's finding names the module as the runtime does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit compose.go no longer fixes its own name "mesh-build-go": the finding's module is MESH_MODULE. Builds: design 47 G §7, §368, §583 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-build-go/cmd/mesh-build-go/compose.go | 15 ++++++++------- .../cmd/mesh-build-go/compose_name_test.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 modules/mesh-build-go/cmd/mesh-build-go/compose_name_test.go diff --git a/modules/mesh-build-go/cmd/mesh-build-go/compose.go b/modules/mesh-build-go/cmd/mesh-build-go/compose.go index 08d622fe4..a528d8590 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/compose.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/compose.go @@ -38,8 +38,9 @@ import ( // module invokes it, module.json invokes). A manifest by its digest never changes and a compose ask is rare, so the // module asks for the one key it needs when it needs it, and keeps no picture of the indexer's whole state (ADR 0615). // indexerModule is the module that holds the seat mesh-catalog, whose manifests state a compose ask reads. -// findingsModule is the module whose findings these are. -const findingsModule = "mesh-build-go" +// findingsModule is the module whose findings these are: this one, by the name the runtime gives it (design 47 G §7: no +// fixed module name in a build module's code). +func findingsModule() string { return os.Getenv("MESH_MODULE") } const indexerModule = "mesh-delivery-indexer" @@ -108,18 +109,18 @@ func (noFindings) Clear(context.Context, string, string, string, string) error { // unansweredManifest is the finding of an ask the indexer did not answer, laid out as mesh-sdk lays out a views reader's // first-view-unanswered (design 47 G §687, A-28): the id is the view's name, escaped as a key's name is. func unansweredManifest(err string, asked, at time.Time) seat.Finding { - id := keys.EscapeName(findingsModule + "." + indexerModule + ".manifests") + id := keys.EscapeName(findingsModule() + "." + indexerModule + ".manifests") return seat.Finding{Kind: views.UnansweredKind, Scope: "module", ID: id, Severity: seat.FindingSeverityWarning, Source: "views", - Subject: seat.Subject{Scope: "module", ID: findingsModule, Machine: os.Getenv("MESH_NODE")}, - Summary: fmt.Sprintf("%s has no first view of %s's manifests: %s has not answered since %s (%s)", findingsModule, indexerModule, ManifestsTool, + Subject: seat.Subject{Scope: "module", ID: findingsModule(), Machine: os.Getenv("MESH_NODE")}, + Summary: fmt.Sprintf("%s has no first view of %s's manifests: %s has not answered since %s (%s)", findingsModule(), indexerModule, ManifestsTool, asked.Format(time.RFC3339), strings.TrimSpace(err)), - Headline: fmt.Sprintf("%s waits for %s", findingsModule, indexerModule), At: at.UTC()} + Headline: fmt.Sprintf("%s waits for %s", findingsModule(), indexerModule), At: at.UTC()} } // newFindingsWriter is this module's finding writer: it states the finding of askManifest and observes none of its own. func newFindingsWriter() (*views.Writer[seat.Finding, seat.FindingCleared, seat.FindingsStated, seat.FindingsAskedEvent], error) { return views.NewStdioWriter(views.WriterConfig[seat.Finding, seat.FindingCleared, seat.FindingsStated, seat.FindingsAskedEvent]{ - Asked: seat.SubjectFindingsAsked, Module: findingsModule, State: stdio.State("findings"), + Asked: seat.SubjectFindingsAsked, Module: findingsModule(), State: stdio.State("findings"), Observe: func(context.Context) (views.Observed[seat.Finding], error) { return views.Observed[seat.Finding]{}, nil }}) diff --git a/modules/mesh-build-go/cmd/mesh-build-go/compose_name_test.go b/modules/mesh-build-go/cmd/mesh-build-go/compose_name_test.go new file mode 100644 index 000000000..0ebc84abb --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/compose_name_test.go @@ -0,0 +1,15 @@ +package main + +import ( + "testing" + "time" +) + +// Design 47 G §7 (BG12, BLD16): the finding names the module as the runtime does, never a fixed name. +func TestUnansweredManifestNamesTheModuleTheRuntimeNames(t *testing.T) { + t.Setenv("MESH_MODULE", "mesh-build-go-renamed") + f := unansweredManifest("no answer", time.Unix(0, 0), time.Unix(60, 0)) + if f.Subject.ID != "mesh-build-go-renamed" || f.Headline != "mesh-build-go-renamed waits for "+indexerModule { + t.Fatalf("the finding names %q, %q", f.Subject.ID, f.Headline) + } +}