From ceba69c4bb062c53d09d5a73cebe0f11d9c21c45 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 6 Aug 2026 01:37:41 +0400 Subject: [PATCH] config: a test parses the real deploy config (V-410) Every other test in the package builds its own JSON, so a key renamed on one side and not the other went unnoticed until the daemon refused to start. This reads deploy/mavend.json through the same Load, and asserts the settings whose absence would be a silent behaviour change rather than an error: n_gpu_layers being 0 means CPU-only inference, and nothing defaults it. --- internal/config/deployconfig_test.go | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 internal/config/deployconfig_test.go diff --git a/internal/config/deployconfig_test.go b/internal/config/deployconfig_test.go new file mode 100644 index 0000000..443be09 --- /dev/null +++ b/internal/config/deployconfig_test.go @@ -0,0 +1,48 @@ +package config + +import ( + "os" + "path/filepath" + "testing" +) + +// TestDeployConfigLoads parses the file the box actually runs on. +// +// Every other test in this package builds its own JSON, so a key renamed in one +// place and not the other would go unnoticed until the daemon refused to start. +// This one reads deploy/mavend.json through the same Load the daemon calls, so +// a config change and a code change have to agree here or the suite is red. +// +// The ${VAR} expansions come from a gitignored deploy/telegram.env that is not +// present in CI. An unset var expands to the empty string, which is exactly the +// "not configured" state every block already has to handle, so the parse is +// still meaningful without the secrets. +func TestDeployConfigLoads(t *testing.T) { + path := filepath.Join("..", "..", "deploy", "mavend.json") + if _, err := os.Stat(path); err != nil { + t.Skipf("no deploy config at %s: %v", path, err) + } + cfg, err := Load(path) + if err != nil { + t.Fatalf("Load(%s): %v", path, err) + } + + // Spot-check the settings whose absence would be a silent behaviour change + // rather than a startup error. + if cfg.Phraser == nil { + t.Fatal("deploy config has no phraser block") + } + if cfg.Phraser.NGpuLayers == 0 { + t.Error("phraser.n_gpu_layers is 0 — llama-server would run CPU-only, " + + "because nothing in this package defaults that field") + } + if cfg.Voice == nil || !cfg.Voice.Enabled { + t.Fatal("deploy config does not enable voice") + } + if !cfg.Voice.UseLLMRouter() { + t.Error("deploy config turned the LLM router off") + } + if cfg.Voice.RouterThreshold <= 0 { + t.Error("router threshold did not get its default") + } +}