Narrow both build modules' fetch with mesh-sdk's buildstep.Narrow, the one copy (issue 1758, ADR 0499 §4)

The local narrowing of mesh-build-go and mesh-build-node moves into mesh-sdk (feat/r4e-sdk
d1af87a), with its tests; each module keeps its fetch-level test on real git. The three
build modules are pinned to d1af87a.
This commit is contained in:
2026-10-22 18:42:17 +02:00
parent 035c950ff2
commit 59c28971cb
12 changed files with 15 additions and 333 deletions
@@ -107,7 +107,7 @@ func (m *Module) fetchTool() StepTool {
func (m *Module) fetch(ctx context.Context, args map[string]any) (any, error) {
// What the builder and the checker ask, in mesh-sdk's one form (ADR 0499 §4): with the module's directory and its
// named paths, the workspace is narrowed to them (narrow.go).
// named paths, the workspace is narrowed to them (buildstep.Narrow).
req, err := buildstep.ParseFetchRequest(args)
if err != nil {
return nil, err
@@ -142,7 +142,7 @@ func (m *Module) fetch(ctx context.Context, args map[string]any) (any, error) {
}
}
if len(req.Paths) > 0 {
if err := narrow(tree, req); err != nil {
if err := buildstep.Narrow(tree, req); err != nil {
return nil, err
}
// Said beside the tree, so the listing of the tree's modules leaves out those narrowed away.
@@ -208,7 +208,7 @@ func (m *Module) typeScriptModules(ctx context.Context, tree string) (dirs []str
}
raw, err := os.ReadFile(filepath.Join(tree, filepath.FromSlash(l)))
if os.IsNotExist(err) && narrowed(tree) {
continue // outside a narrowed workspace's paths (narrow.go): no module of this build
continue // outside a narrowed workspace's paths (buildstep.Narrow): no module of this build
}
if err != nil {
return nil, nil, err