From 49ab6c00eadbc5663ac92e0e3dbc1dde44f165ce Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 18:02:49 +0100 Subject: [PATCH] J26 item 1: build-node tests ask a stand-in registry, never the mesh's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every TypeScript module of a fetch gets the registry's latest SDK (ADR 0573 §2, A-284), so the harness's machine named the real registry and 11 tests (9 unit, 11 integration runs) reached the network; with the resolver down they failed. The harness now serves a registry of the test's own holding one SDK release, and the userconfig test reads its address from it. Builds: design 47 G A-284, A-285 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-build-node/cmd/mesh-build-node/fetch_test.go | 6 ++---- .../mesh-build-node/cmd/mesh-build-node/harness_test.go | 9 +++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/fetch_test.go b/modules/mesh-build-node/cmd/mesh-build-node/fetch_test.go index fc8251c1e..9571a76d6 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/fetch_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/fetch_test.go @@ -207,9 +207,7 @@ func TestAnotherNovoxPackageIsInstalledFromTheRegistryThroughAUserconfig(t *test files := typeScriptModule(`{"dependencies":{"@novox/other":"^1","lodash":"^4"}}`) files["modules/m/package-lock.json"] = `{}` m, f := fetchMachine(t, files, map[string]string{"@novox/other/index.js": "o", "lodash/index.js": "l"}) - m.Toolchain.Registry = func() (Registry, error) { - return Registry{URL: "https://git.novox.be/api/packages/novox/npm/"}, nil - } + reg, _ := m.Toolchain.Registry() var npmrc string inner := f.effect f.effect = func(c call) { @@ -226,7 +224,7 @@ func TestAnotherNovoxPackageIsInstalledFromTheRegistryThroughAUserconfig(t *test t.Fatal(err) } // Reads are anonymous (ADR 0346, CAT-BN3): the config names the scope's registry and no credential. - if !strings.Contains(npmrc, "@novox:registry=https://git.novox.be/api/packages/novox/npm/") || strings.Contains(npmrc, "_auth") { + if !strings.Contains(npmrc, "@novox:registry="+reg.URL+"\n") || strings.Contains(npmrc, "_auth") { t.Errorf("npm ci was given the config %q", npmrc) } r := out.(FetchResult) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/harness_test.go b/modules/mesh-build-node/cmd/mesh-build-node/harness_test.go index abd3a634d..86d4ad4a5 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/harness_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/harness_test.go @@ -73,10 +73,11 @@ func newMachine(t *testing.T) (*Module, *fakeMachine, string) { home, cache, work := t.TempDir(), t.TempDir(), t.TempDir() f := &fakeMachine{now: time.Unix(1_000_000, 0), cost: map[string]time.Duration{}, answer: map[string]forgekey.Ran{}} m := &Module{Node: "ace", Recipe: Recipe{Steps: "1", Lock: "lock"}, - Toolchain: &Toolchain{Paths: Paths{Home: home, Cache: cache}, Registry: func() (Registry, error) { - return Registry{URL: "https://git.novox.be/api/packages/novox/npm/"}, nil - }}, - Work: work, Clock: f.clock, Ctx: context.Background()} + Toolchain: &Toolchain{Paths: Paths{Home: home, Cache: cache}}, + Work: work, Clock: f.clock, Ctx: context.Background()} + // A test never reaches the network: the registry is a stand-in of the test's own, holding one release of the SDK + // (every TypeScript module of a fetch gets the latest, ADR 0573 §2); a test that needs another calls fakeRegistry. + fakeRegistry(t, m, map[string][]byte{"0.1.15": tgzOf(t, sdkPackage, "0.1.15")}) // A run step's commands run in bubblewrap (1309); the fake reads each back and runs its command. m.Run = throughBubblewrap(t, f.run, &f.shut) withStore(t, m) // a build pushes its bundle to a store of the test's own (ADR 0498)