M1 check-needs: a package outside every Go artifact's from takes the manifest's own check-needs

The forge module's internal/seatgit whole test needs the Node build seat, and no Go artifact's from holds it, so
nothing named its need and the Go build seat ran it on a node without the Node toolchain. The manifest now says the
need at its top level, read by the Go build module for such packages; gitea declares node-build-node
(review round 1, mesh-catalog, finding on §800; H-A-453 (2)).

Builds: design 47 H2 §800, H-A-453 (2)
This commit is contained in:
2026-11-22 02:27:36 +01:00
parent 30a3e665e0
commit 98da0e0b68
4 changed files with 52 additions and 7 deletions
+3
View File
@@ -3,6 +3,9 @@
"version": "0.1",
"class": "core",
"moved": true,
"check-needs": [
"node-build-node"
],
"requires": [
"postgres-database",
"route",
@@ -61,8 +61,9 @@ const ReadsOutsideMarker = "reads-outside"
// readNeeds is what a package's integration tests need of the node they run on (issue 890; mesh-delivery-sdk
// steprun.AskNeeds): the seats its module's manifest names in `check-needs` on each Go artifact whose path holds the
// package's directory (design 47 H2 §800; H-A-350 DMC-6, H-A-399 (3)), `node-build-node` for tests that read the Node
// build module's installed toolchain. The manifest is the nearest module.json in dir or above it within the tree; nil
// when there is none, or none of its Go artifacts holds dir. The digest reports it (DigestResult.Needs); a check ask
// build module's installed toolchain, and for a package none of its Go artifacts holds, the manifest's own top-level
// `check-needs` (H-A-453 (2)). The manifest is the nearest module.json in dir or above it within the tree; nil when
// there is none, or it names no needs for dir. The digest reports it (DigestResult.Needs); a check ask
// leaves such a package untested on a node that lacks it, and the checker asks it again of a node that has it. The unit
// level is never given anything of the node (ADR 0533 §1), so the field binds the integration level alone.
func readNeeds(tree, dir string) ([]string, error) {
@@ -82,17 +83,25 @@ func readNeeds(tree, dir string) ([]string, error) {
return nil, fmt.Errorf("the manifest %s: %w", filepath.Join(at, "module.json"), err)
}
var needs []string
held := false
if manifest.Build != nil {
for _, a := range manifest.Build.Artifacts {
if a.Language == "go" && len(a.CheckNeeds) > 0 && within(filepath.Join(at, filepath.FromSlash(a.From)), dir) {
for _, n := range a.CheckNeeds {
if !slices.Contains(needs, n) {
needs = append(needs, n)
}
if a.Language != "go" || !within(filepath.Join(at, filepath.FromSlash(a.From)), dir) {
continue
}
held = true
for _, n := range a.CheckNeeds {
if !slices.Contains(needs, n) {
needs = append(needs, n)
}
}
}
}
if !held {
// A package no Go artifact's from holds (the forge module's internal/seatgit) takes the manifest's own
// check-needs (H-A-453 (2)).
needs = slices.Clone(manifest.CheckNeeds)
}
return needs, nil
}
return nil, nil
@@ -365,6 +365,28 @@ func TestAListedReadsOutsideMarkerKeepsTheDigestOfOnlyWhatItLists(t *testing.T)
if n := digests(t, m, LevelUnit).Needs; len(n) != 0 {
t.Errorf("the unit level names needs: %+v", n)
}
// H-A-453 (2): the manifest's own check-needs name the seats of a package no Go artifact's from holds (the forge
// module's internal/seatgit), and never those of a package an artifact holds, which keeps the artifact's.
for _, row := range []struct {
manifest, cNeeds string
}{
{`{"module":"digest","check-needs":["node-build-node"],"build":{"artifacts":[` +
`{"name":"tools","kind":"bundle","language":"go","from":"a","check-needs":["node-build-node"]},` +
`{"name":"other","kind":"bundle","language":"go","from":"c"}]}}`, ""},
{`{"module":"digest","check-needs":["node-build-node"],"build":{"artifacts":[` +
`{"name":"tools","kind":"bundle","language":"go","from":"a","check-needs":["node-build-node"]},` +
`{"name":"code","kind":"bundle","language":"typescript"}]}}`, "node-build-node"},
} {
edit(t, tree, "module.json", row.manifest)
got := map[string]string{}
for _, n := range digests(t, m, LevelIntegration).Needs {
got[n.Package] = strings.Join(n.Needs, ",")
}
if got[a] != "node-build-node" || got[c] != row.cNeeds {
t.Errorf("%s: the integration level's needs = %v, want %s and %s needing %q", row.manifest, got, a, c, row.cNeeds)
}
}
}
// Issue 1935: a catalogue module's packages read ../../module.json and the module's files: a change to them changes the
@@ -7,6 +7,7 @@ import (
"strings"
"testing"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
@@ -157,6 +158,16 @@ func TestGiteaReadsTheBuildModulesKeys(t *testing.T) {
t.Errorf("gitea reads %v, lacks %s", gitea.Reads, want)
}
}
// H-A-453 (2): the forge module's internal/seatgit, which no Go artifact's from holds, takes the manifest's own
// check-needs, so its whole test is asked of a node with the Node build seat and given the Node build module's install.
root, err := filepath.Abs(catalogueRoot)
if err != nil {
t.Fatal(err)
}
if needs, err := readNeeds(root, filepath.Join(root, "modules", "gitea", "internal", "seatgit")); err != nil ||
!slices.Equal(needs, []string{sdkstep.NeedNodeBuildNode}) {
t.Errorf("the forge module's seatgit package needs %v (%v), want %s", needs, err, sdkstep.NeedNodeBuildNode)
}
}
// 1309-S1: every run step runs in bubblewrap, so the module declares its package (the lead's decision: each build module