From b4e7ffd89cfbb18b26b97229abac06e790f33cac Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 4 Nov 2026 16:43:28 +0100 Subject: [PATCH] Join: mesh-knowledge's page address is no word of the environment The overview page read MESH_KNOWLEDGE_PAGE, which nothing in the mesh sets; only its bus test did, to serve no page. checks/environment, which came with A3's merge, refuses such a read. The page listens on the port its manifest declares; the test's bundle sets the package's address empty instead. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig --- .../mesh-knowledge/cmd/mesh-knowledge/bus_test.go | 2 +- .../mesh-knowledge/cmd/mesh-knowledge/kit_test.go | 1 + modules/mesh-knowledge/cmd/mesh-knowledge/page.go | 15 ++++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/mesh-knowledge/cmd/mesh-knowledge/bus_test.go b/modules/mesh-knowledge/cmd/mesh-knowledge/bus_test.go index 48ce0a357..03c87498e 100644 --- a/modules/mesh-knowledge/cmd/mesh-knowledge/bus_test.go +++ b/modules/mesh-knowledge/cmd/mesh-knowledge/bus_test.go @@ -155,7 +155,7 @@ func (w *busWorld) start(t *testing.T) (*bundle, string) { _ = os.WriteFile(settings, []byte(`{"judge-model": "sonnet", "drafting": "off"}`), 0o600) status := filepath.Join(dir, "health.json") cmd := exec.Command(os.Args[0], "-test.run=^$") - cmd.Env = append(os.Environ(), bundleVar+"=1", "MESH_KNOWLEDGE_PAGE=off", "MESH_KNOWLEDGE_SETTINGS="+settings, "MESH_KNOWLEDGE_STATUS="+status, + cmd.Env = append(os.Environ(), bundleVar+"=1", "MESH_KNOWLEDGE_SETTINGS="+settings, "MESH_KNOWLEDGE_STATUS="+status, "MESH_SERVED_MODULE="+Module, "MESH_MODULE="+Module, "MESH_NODE=test") in, _ := cmd.StdinPipe() out, _ := cmd.StdoutPipe() diff --git a/modules/mesh-knowledge/cmd/mesh-knowledge/kit_test.go b/modules/mesh-knowledge/cmd/mesh-knowledge/kit_test.go index 781f0426c..224c55e4b 100644 --- a/modules/mesh-knowledge/cmd/mesh-knowledge/kit_test.go +++ b/modules/mesh-knowledge/cmd/mesh-knowledge/kit_test.go @@ -38,6 +38,7 @@ func TestMain(m *testing.M) { // The bundle the bus test starts: the knowledge base as the runtime launches it, its store in memory. k := newKB(newMemStore()) k.Now = func() time.Time { return bundleDay } + pageAddress = "" serve(k, os.Getenv("MESH_KNOWLEDGE_STATUS")) os.Exit(0) } diff --git a/modules/mesh-knowledge/cmd/mesh-knowledge/page.go b/modules/mesh-knowledge/cmd/mesh-knowledge/page.go index 1cb55adb2..2279a37ae 100644 --- a/modules/mesh-knowledge/cmd/mesh-knowledge/page.go +++ b/modules/mesh-knowledge/cmd/mesh-knowledge/page.go @@ -16,10 +16,14 @@ import ( stdio "git.novox.be/novox/mesh-sdk/go" ) -// PageAddress is where the page listens unless MESH_KNOWLEDGE_PAGE says otherwise: the port the manifest declares under -// `listens`, which the node's packet filter opens for this machine only. +// PageAddress is where the page listens: the port the manifest declares under `listens`, which the node's packet filter +// opens for this machine only. const PageAddress = ":8480" +// pageAddress is where this process serves the page; empty serves none (the bus test's bundle, which runs beside other +// tests on one machine). It is no word of the environment: nothing in the mesh sets one (checks/environment). +var pageAddress = PageAddress + // PageHandler renders the model as a page; any method but GET is refused, nothing is written. func PageHandler(o *Overview) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -129,12 +133,9 @@ func ServePage(k *KB) { o.Due() } }() - addr := os.Getenv("MESH_KNOWLEDGE_PAGE") + addr := pageAddress if addr == "" { - addr = PageAddress - } - if addr == "off" { - return // a test's bundle serves no page + return } srv := &http.Server{Addr: addr, Handler: PageHandler(o), ReadHeaderTimeout: 10 * time.Second} logf("[mesh-knowledge] the overview page listens on %s", addr)