Files
archie/internal/app/archied/config_update_test.go
T
sam 5fa010c9c2 fix(plugin): add missing CLAUDE.md reference to plugin engine rule
Test TestPluginEngineRuleIsCanonicalAndSharedByAgentInstructions was
missing entirely, letting CLAUDE.md drift out of sync with
ARCHITECTURE.md#plugin-engine-rule-strict. Added the test and the
missing reference.
2026-08-31 21:25:20 +10:00

31 lines
1.1 KiB
Go

package archied
import (
"testing"
"github.com/samcharles93/archie-core/internal/config"
)
// TestApplyDottedOverlayNestsBeforeDecode pins the PATCH-path fix: the
// UI sends dotted keys ("budgets.max_steps") and yaml cannot decode a
// dotted key as a struct field, so the updates must be nested first. A
// regression here silently drops every dotted update while returning 200.
func TestApplyDottedOverlayNestsBeforeDecode(t *testing.T) {
cfg := config.Config{Budgets: config.Budgets{MaxSteps: 10}}
if err := applyDottedOverlay(&cfg, map[string]any{"budgets.max_steps": 20}); err != nil {
t.Fatal(err)
}
if cfg.Budgets.MaxSteps != 20 {
t.Fatalf("MaxSteps = %d, want 20 (dotted key must be nested before decode)", cfg.Budgets.MaxSteps)
}
}
// TestApplyDottedOverlayRejectsEmptyKey pins that a malformed dotted key
// fails instead of silently nesting under a synthetic root.
func TestApplyDottedOverlayRejectsEmptyKey(t *testing.T) {
cfg := config.Config{}
if err := applyDottedOverlay(&cfg, map[string]any{"": 1}); err == nil {
t.Fatal("empty dotted key accepted")
}
}