From 49f7157d50a3167b96d87576325cf63d0caaa88e Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 19 Sep 2026 02:24:37 +1000 Subject: [PATCH 1/2] fix(ci): stop the docs workflow failing on a missing pip manifest .github/workflows/docs.yml runs actions/setup-python@v6 with cache: pip. That option hashes a requirements.txt or pyproject.toml to build the cache key and fails outright when neither exists: ##[error]No file in ... matched to [**/requirements.txt or **/pyproject.toml] This repository is Go and has no Python manifest, so the step failed as the first step of every run triggered by the workflow's pull_request paths: docs/** filter. mkdocs build --strict therefore never executed: docs changes were not being verified, and every docs-touching PR was reported as a build failure. It only surfaced on #878 because #878 touches docs/architecture/; PRs that do not touch docs report no checks at all. Drop cache: pip. The only Python use is a single `pip install mkdocs-material`, so there is nothing worth caching. --- .github/workflows/docs.yml | 7 ++- .../configuration/apply_test.go | 49 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0e0441dde..5203b470c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -30,10 +30,15 @@ jobs: steps: - uses: actions/checkout@v5 + # No `cache: pip` here: this repository is Go and has no + # requirements.txt or pyproject.toml for setup-python to hash. Asking for + # a pip cache makes the step fail outright with "No file ... matched to + # [**/requirements.txt or **/pyproject.toml]", so every docs-touching PR + # failed before `mkdocs build --strict` ever ran -- which also meant the + # strict link/config check silently stopped guarding anything. - uses: actions/setup-python@v6 with: python-version: "3.13" - cache: pip - run: pip install mkdocs-material diff --git a/internal/infrastructure/configuration/apply_test.go b/internal/infrastructure/configuration/apply_test.go index aef59645c..d0b03ebca 100644 --- a/internal/infrastructure/configuration/apply_test.go +++ b/internal/infrastructure/configuration/apply_test.go @@ -30,6 +30,55 @@ func TestApplyOverlayValuesFieldLevelMerge(t *testing.T) { } } +// TestApplyOverlayValuesPreservesOmittedNestedFields pins ApplyOverlayValues' +// documented promise -- "only the keys present are replaced, every field the +// overlay omits keeps its existing value" -- at the depth where it matters. +// +// The concrete risk is services.state: an overlay that changes only the target +// must not clear target_token, because dropping the token silently removes +// authentication for a non-loopback State Store. The existing field-level test +// only covers one level (budgets.max_steps); these cases go two levels deep into +// a struct of structs, which is the shape Services has. +func TestApplyOverlayValuesPreservesOmittedNestedFields(t *testing.T) { + tests := []struct { + name string + start config.Services + overlay map[string]any + want config.Services + }{ + { + name: "target-only overlay keeps the token", + start: config.Services{State: config.ServiceConnection{Target: "127.0.0.1:50051", TargetToken: "secret"}}, + overlay: map[string]any{"services": map[string]any{"state": map[string]any{"target": "10.0.0.5:50051"}}}, + want: config.Services{State: config.ServiceConnection{Target: "10.0.0.5:50051", TargetToken: "secret"}}, + }, + { + name: "token-only overlay keeps the target", + start: config.Services{State: config.ServiceConnection{Target: "10.0.0.5:50051", TargetToken: "old"}}, + overlay: map[string]any{"services": map[string]any{"state": map[string]any{"target_token": "rotated"}}}, + want: config.Services{State: config.ServiceConnection{Target: "10.0.0.5:50051", TargetToken: "rotated"}}, + }, + { + name: "sibling service is untouched", + start: config.Services{Gateway: config.ServiceConnection{Target: "127.0.0.1:50052"}, State: config.ServiceConnection{Target: "a", TargetToken: "t"}}, + overlay: map[string]any{"services": map[string]any{"state": map[string]any{"target": "b"}}}, + want: config.Services{Gateway: config.ServiceConnection{Target: "127.0.0.1:50052"}, State: config.ServiceConnection{Target: "b", TargetToken: "t"}}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cfg := config.Config{Services: tt.start} + if err := ApplyOverlayValues(&cfg, tt.overlay); err != nil { + t.Fatalf("ApplyOverlayValues: %v", err) + } + if cfg.Services != tt.want { + t.Errorf("Services = %+v, want %+v", cfg.Services, tt.want) + } + }) + } +} + func TestLoaderApplyOverlayLayersDefaultsValidatesAndRecordsProvenance(t *testing.T) { path := filepath.Join(t.TempDir(), "config.toml") if err := os.WriteFile(path, []byte("bot_user = \"widget\"\n[[repos]]\nowner = \"acme\"\nname = \"app\"\n"), 0o600); err != nil { From 63510c1fdf58c7c6cbf532d96d0cff9c8437ff56 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 19 Sep 2026 02:24:38 +1000 Subject: [PATCH 2/2] test(config): pin that a partial overlay preserves omitted nested fields ApplyOverlayValues documents that "only the keys present are replaced, every field the overlay omits keeps its existing value". That promise was only tested one level deep (budgets.max_steps); it was untested two levels deep into a struct of structs, which is the shape config.Services has. The concrete risk being pinned: an overlay that changes only services.state.target must not clear target_token, because dropping the token silently removes authentication for a non-loopback State Store. All three cases pass, so the behaviour is correct as written and no production change is warranted. This test is a regression guard on the depth that matters.