From 6527ebd077bb48e872846004f1bc281bdc5c3614 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 22:25:38 +0100 Subject: [PATCH] mesh-build-node: the real-toolchain tests' fixture holds the SDK where the fetch places it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the toolchain lock pins no SDK (design 47 G §571), only the fetch puts @novox/mesh-sdk in a module's node_modules. The three tests that build with the real tsc and esbuild skip the fetch, so they read the SDK from an older installed toolchain that still carried one. Once a build node installed the current lock (shanks 19:26, then g14), they failed with TS2307 (main.137, main.155). The fixture now lays a minimal SDK of its own where the fetch would, so the tests no longer depend on which toolchains a node still keeps. Builds: design 47 G §571 --- .../mesh-build-node/build_integration_test.go | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/build_integration_test.go b/modules/mesh-build-node/cmd/mesh-build-node/build_integration_test.go index 901fc6423..b80ac17d0 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/build_integration_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/build_integration_test.go @@ -58,17 +58,33 @@ func realMachine(t *testing.T) (*Module, string) { t.Fatalf("the toolchain copied from %s cannot be used: %v", from, err) } for _, id := range []string{"w1", "w2", "w3"} { - for p, body := range map[string]string{ + files := map[string]string{ "modules/m/module.json": `{"module":"m","build":{"artifacts":[{"name":"tools","kind":"bundle","language":"typescript","entrypoints":["tools/index.js"]}]}}`, "modules/m/package.json": `{"name":"m","type":"module","scripts":{"test":"node -e \"process.exit(0)\""}}`, "modules/m/tools/index.ts": "import { serveRegisteredOverStdio } from \"@novox/mesh-sdk/stdio\";\nexport const f: () => Promise = serveRegisteredOverStdio as () => Promise;\n", - } { + } + for p, body := range fetchedSDK { + files["modules/m/node_modules/@novox/mesh-sdk/"+p] = body + } + for p, body := range files { write(t, filepath.Join(work, id, "tree", filepath.FromSlash(p)), body, 0o644) } } return m, work } +// fetchedSDK is the SDK the fixture's workspaces hold where the fetch step places it, in the module's node_modules +// (fetch.go, placeSDK: the latest published release, ADR 0573 §2; design 47 G §571), made here because the integration +// level has no registry to fetch it from. The toolchain's lock names no SDK since §571, so a fixture that leaves it out +// reads one only from a toolchain installed before (main.137 and main.155: TS2307 once a build node installed the +// lock). It holds the one export the fixture and the launchers import. +var fetchedSDK = map[string]string{ + "package.json": `{"name":"@novox/mesh-sdk","version":"9.9.9","type":"module",` + + `"exports":{"./stdio":{"types":"./dist/stdio.d.ts","default":"./dist/stdio.js"}}}`, + "dist/stdio.js": "export async function serveRegisteredOverStdio() {}\n", + "dist/stdio.d.ts": "export declare function serveRegisteredOverStdio(): Promise;\n", +} + // 1490/AC2, 1491 and issue 1869, in one test so the toolchain is copied once: the real type-check and test script of the // fixture pass the unit level; a package whose test imports its own build output (as mesh-sdk's do) passes the unit level, // the test step emitting it with the real tsc, shut off, before the test script runs; and the fixture TypeScript bundle