BG12, BLD16: the Go build module's finding names the module as the runtime does

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
This commit is contained in:
2026-11-12 05:34:39 +01:00
parent c1008aeedf
commit 51df346a23
2 changed files with 23 additions and 7 deletions
@@ -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
}})
@@ -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)
}
}