From d81f8260893b0bd1b19b265e2ee3d09d57b6bf56 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 29 Aug 2026 23:35:11 +0200 Subject: [PATCH] A check that what the control plane emits is what this host accepts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "The host needs no new vocabulary" is the load-bearing claim behind every computed and contributed resource on the other side, and it had never been tested against this parser — only asserted. Skipped unless MESH_EMITTED names a file, so it stays a check somebody runs deliberately rather than a dependency between two repositories. mesh-control plan --json > /tmp/d.json MESH_EMITTED=/tmp/d.json go test ./internal/declaration/ -v Confirmed to fail when the declaration carries an action, which is the thing this parser exists to refuse. --- internal/declaration/emitted_check_test.go | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 internal/declaration/emitted_check_test.go diff --git a/internal/declaration/emitted_check_test.go b/internal/declaration/emitted_check_test.go new file mode 100644 index 0000000..948dca5 --- /dev/null +++ b/internal/declaration/emitted_check_test.go @@ -0,0 +1,33 @@ +package declaration + +import ( + "os" + "testing" +) + +// The control plane's actual output, put through the host's actual parser. +// +// Skipped unless MESH_EMITTED names a file, so this is a check somebody runs deliberately rather +// than a dependency between two repositories. It exists because "the host needs no new +// vocabulary" is the load-bearing claim of every computed and contributed resource, and the only +// honest way to know it is to hand the host one and see. +func TestWhatTheControlPlaneEmittedIsSomethingThisHostAccepts(t *testing.T) { + path := os.Getenv("MESH_EMITTED") + if path == "" { + t.Skip("set MESH_EMITTED to a declaration the control plane produced") + } + raw, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + d, err := Parse(raw) + if err != nil { + t.Fatalf("the host refuses what the control plane sends:\n%v", err) + } + if len(d.Resources) == 0 { + t.Fatal("parsed, and empty") + } + for _, r := range d.Resources { + t.Logf("accepted %s %s → %s", r.Kind(), r.Identity(), r.Target()) + } +}