mesh-build-node-narrowed-packages: a package narrowed out of a step's workspace is no module of it
A step of one TypeScript package of a module with several (mesh-contracts' root: ts-meshbroker beside ts-meshrecovery, pipeline main.3 of 2026-11-20) fetches a workspace narrowed to that package's path. The fetch and the lint and test levels read every package artifact of the manifest, and one whose path the narrowing left out fell back to the module's directory, which holds no lock: every TypeScript step of mesh-contracts ended "could not run: the package in . has no package-lock.json". Such a package is now left out of the fetch's install and of the levels' targets; an unnarrowed tree is read as before. Builds: design 47 H H-A-136 (a step's workspace holds the artifact's paths; nothing else is fetched), ADR 0499 clause 4
This commit is contained in:
@@ -135,7 +135,7 @@ func (m *Module) testLevel(ctx context.Context, args map[string]any) (*TestResul
|
||||
if where == "" {
|
||||
where = "."
|
||||
}
|
||||
targets, err := testTargets(dir, where)
|
||||
targets, err := testTargets(dir, where, narrowed(filepath.Join(root, "tree")))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -338,8 +338,9 @@ type testTarget struct{ dir, where string }
|
||||
|
||||
// testTargets are the directories a module's tests run in: each TypeScript package artifact's own path when every
|
||||
// package the module declares names one (ADR 0634 §8: its package.json, its lock, its tests), else the module's
|
||||
// directory.
|
||||
func testTargets(dir, where string) ([]testTarget, error) {
|
||||
// directory. In a workspace narrowed to one artifact's paths (narrowedTree), a package whose path was left out is no
|
||||
// target of this step (ADR 0499 clause 4; design 47 H, H-A-136).
|
||||
func testTargets(dir, where string, narrowedTree bool) ([]testTarget, error) {
|
||||
whole := []testTarget{{dir, where}}
|
||||
raw, err := os.ReadFile(filepath.Join(dir, "module.json"))
|
||||
if err != nil {
|
||||
@@ -362,6 +363,9 @@ func testTargets(dir, where string) ([]testTarget, error) {
|
||||
if a.Kind != "package" {
|
||||
return whole, nil // a bundle is tested in its module's directory
|
||||
}
|
||||
if narrowedTree && a.narrowedAway(dir) {
|
||||
continue
|
||||
}
|
||||
at := a.packageDir(dir)
|
||||
if at == "." {
|
||||
return whole, nil
|
||||
|
||||
Reference in New Issue
Block a user