From 97f0f4813c7bbc8a461003092027d2f1f4c0984f Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 22 Oct 2026 21:18:18 +0200 Subject: [PATCH] K2: keep the captured claude-code manifest in a test file (issue 1751) The catalogue's paths check (ADR 0260) reads every file of a module but its documentation and tests, and the verbatim manifest names claude-code's own paths; as a constant in a _test.go file it stays a real capture without being taken for one module reaching into another's state. --- modules/mesh-build-go/cmd/mesh-build-go/build_test.go | 7 ++----- ...aude-code-module.json => captured_manifest_test.go} | 10 +++++++++- .../cmd/mesh-build-go/testdata/captured/README | 4 ---- .../cmd/mesh-build-image/build_test.go | 7 ++----- ...aude-code-module.json => captured_manifest_test.go} | 10 +++++++++- .../cmd/mesh-build-image/testdata/captured/README | 5 ----- 6 files changed, 22 insertions(+), 21 deletions(-) rename modules/mesh-build-go/cmd/mesh-build-go/{testdata/captured/claude-code-module.json => captured_manifest_test.go} (92%) rename modules/mesh-build-image/cmd/mesh-build-image/{testdata/captured/claude-code-module.json => captured_manifest_test.go} (92%) diff --git a/modules/mesh-build-go/cmd/mesh-build-go/build_test.go b/modules/mesh-build-go/cmd/mesh-build-go/build_test.go index 549ed826..704db9d6 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/build_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/build_test.go @@ -240,12 +240,9 @@ func TestABuildOutputDirectoryLinkedOutsideTheModuleIsRefused(t *testing.T) { // Issue 1751 (ADR 0514 §2, the review's K2): a manifest whose config value falls back to a predefined key builds. The // builder holds no published list of the keys, so it reads the manifest for its inputs (ParseManifestForInputs), not -// as a judge of config values; claude-code's real manifest (testdata/captured) is the fixture. +// as a judge of config values; claude-code's real manifest (capturedClaudeCodeManifest) is the fixture. func TestAManifestFallingBackToAPredefinedKeyBuilds(t *testing.T) { - raw, err := os.ReadFile(filepath.Join("testdata", "captured", "claude-code-module.json")) - if err != nil { - t.Fatal(err) - } + raw := []byte(capturedClaudeCodeManifest) if !strings.Contains(string(raw), `"predefined": "agent-managed-settings"`) { t.Fatal("the captured manifest no longer falls back to a predefined key") } diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/claude-code-module.json b/modules/mesh-build-go/cmd/mesh-build-go/captured_manifest_test.go similarity index 92% rename from modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/claude-code-module.json rename to modules/mesh-build-go/cmd/mesh-build-go/captured_manifest_test.go index 3b62d219..69ee6aef 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/claude-code-module.json +++ b/modules/mesh-build-go/cmd/mesh-build-go/captured_manifest_test.go @@ -1,4 +1,11 @@ -{ +package main + +// capturedClaudeCodeManifest is modules/claude-code/module.json of this catalogue at 56c68be7, copied verbatim on +// 2026-10-22 for issue 1751 (the R4e review's finding K2): a real manifest whose config value managed_settings falls +// back to the predefined key agent-managed-settings (ADR 0348 §7), which the builder holds no published list for. It +// lives in a test file, not under testdata, because the catalogue's paths check (ADR 0260) reads every other file of a +// module and the manifest names claude-code's own paths. +const capturedClaudeCodeManifest = `{ "module": "claude-code", "version": "1", "moved": true, @@ -247,3 +254,4 @@ ] } } +` diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README index b298901c..194bc050 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README @@ -24,7 +24,3 @@ The tar streams (the archives gunzipped) of the three archives above, captured t gunzip and sha256) at origin/main 0205b8f7 on 2026-10-21: directory f8af1d94...d1b6, within 294e2bec...07fb, file 055cffc2...428e. The digests above hold the gzip bytes of go1.27.1. The first try of issue 1589 on the merge check's build node answered other digests; the tests therefore compare the stream always and the digest only under go1.27.1. - -claude-code-module.json is modules/claude-code/module.json of this catalogue at 56c68be7 (copied 2026-10-22 for issue 1751, -the R4e review's finding K2): a real manifest whose config value managed_settings falls back to the predefined key -agent-managed-settings (ADR 0348 §7), which the builder holds no published list for. diff --git a/modules/mesh-build-image/cmd/mesh-build-image/build_test.go b/modules/mesh-build-image/cmd/mesh-build-image/build_test.go index d6d0dd64..966c3adc 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/build_test.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/build_test.go @@ -201,13 +201,10 @@ func TestBuildFailsForWhatIsNotAnImageOrNotThere(t *testing.T) { // Issue 1751 (ADR 0514 §2, the review's K2): a manifest whose config value falls back to a predefined key builds. The // builder holds no published list of the keys, so it reads the manifest for its inputs (ParseManifestForInputs), not -// as a judge of config values. The manifest is claude-code's real one (testdata/captured) with the image fixture's +// as a judge of config values. The manifest is claude-code's real one (capturedClaudeCodeManifest) with the image fixture's // base and artifact added to its build, since no image module of the catalogue falls back to a predefined key today. func TestAManifestFallingBackToAPredefinedKeyBuilds(t *testing.T) { - raw, err := os.ReadFile(filepath.Join("testdata", "captured", "claude-code-module.json")) - if err != nil { - t.Fatal(err) - } + raw := []byte(capturedClaudeCodeManifest) if !strings.Contains(string(raw), `"predefined": "agent-managed-settings"`) { t.Fatal("the captured manifest no longer falls back to a predefined key") } diff --git a/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/claude-code-module.json b/modules/mesh-build-image/cmd/mesh-build-image/captured_manifest_test.go similarity index 92% rename from modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/claude-code-module.json rename to modules/mesh-build-image/cmd/mesh-build-image/captured_manifest_test.go index 3b62d219..69ee6aef 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/claude-code-module.json +++ b/modules/mesh-build-image/cmd/mesh-build-image/captured_manifest_test.go @@ -1,4 +1,11 @@ -{ +package main + +// capturedClaudeCodeManifest is modules/claude-code/module.json of this catalogue at 56c68be7, copied verbatim on +// 2026-10-22 for issue 1751 (the R4e review's finding K2): a real manifest whose config value managed_settings falls +// back to the predefined key agent-managed-settings (ADR 0348 §7), which the builder holds no published list for. It +// lives in a test file, not under testdata, because the catalogue's paths check (ADR 0260) reads every other file of a +// module and the manifest names claude-code's own paths. +const capturedClaudeCodeManifest = `{ "module": "claude-code", "version": "1", "moved": true, @@ -247,3 +254,4 @@ ] } } +` diff --git a/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/README b/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/README index 90323c04..11ed2340 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/README +++ b/modules/mesh-build-image/cmd/mesh-build-image/testdata/captured/README @@ -3,8 +3,3 @@ The stored steps (what a step ends on in the module's `steps` state) of a fetch the workspace, the commit, digests and the registry's address put to fixed words (STEPID, WORKSPACE, COMMIT, REGISTRY, one sha256 digest). Written by capture_test.go (MESH_UPDATE_CAPTURED=1) from the unit tests' fake runner on 2026-10-22, and compared by bus_integration_test.go with the steps a real bus holds. mesh-delivery-builder's tests copy these files. - -claude-code-module.json is modules/claude-code/module.json of this catalogue at 56c68be7 (copied 2026-10-22 for issue 1751, -the R4e review's finding K2): a real manifest whose config value managed_settings falls back to the predefined key -agent-managed-settings (ADR 0348 §7). No image module of the catalogue falls back to one today, so the test adds the image -fixture's base and artifact to its build.