Builder names the module's directory on every fetch; the fetch request accepts dir with no paths (A-447)

Builds: design 47 G (G-22 lead answers 2) A-447
This commit is contained in:
2026-11-16 12:22:37 +01:00
parent e7c05c5370
commit d0e7dee951
6 changed files with 23 additions and 18 deletions
@@ -253,8 +253,8 @@ func TestTheFetchOfAModuleNamingItsPathsCarriesItsDirectoryAndThosePaths(t *test
}
r2 := newRig(t, goBundle)
r2.consider(t, "modules/m")
if a := r2.bm.callsOf("build_go_fetch")[0].body.(map[string]any); a["dir"] != nil || a["paths"] != nil {
t.Errorf("fetch args = %+v, want no dir or paths for a module naming none", a)
if a := r2.bm.callsOf("build_go_fetch")[0].body.(map[string]any); a["dir"] != "modules/m" || a["paths"] != nil {
t.Errorf("fetch args = %+v, want the module's directory and no paths for a module naming none (A-447)", a)
}
}
@@ -1047,11 +1047,12 @@ func (n *askNotes) note(ctx context.Context, language, id, step string) error {
// is copied by its pinned reference with no fetch (ADR 0498 clause 4); a lane of copies alone fetches nothing. A lane of a
// key taken over at start waits for the ask the key names and puts none.
func (b *Builder) runLane(ctx context.Context, l *lane, repository string, m meshcatalog.ModulesByModuleValue, module string, asked *askNotes) {
req := sdkstep.Fetch{Repository: repository, Commit: m.Commit}
// The module's directory goes with every fetch, so a Go build downloads and judges that module and what its go.mod
// replaces alone, never another Go module of the tree (design 47 G, A-447).
req := sdkstep.Fetch{Repository: repository, Commit: m.Commit, Dir: m.Path}
if m.Inputs2 != nil && len(m.Inputs2.Paths) > 0 {
// A module whose every artifact names its paths is built from those alone (ADR 0499 clause 4): the paths come from
// the indexer's kept inputs, never from a manifest (the lead's decision L8 of R4e).
req.Dir = m.Path
for p := range m.Inputs2.Paths {
req.Paths = append(req.Paths, p)
}