High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
chore: six committed test-config fixtures carry config keys that exist nowhere in the schema, so every e2e and benchmark run now logs a WARN (PIN-191)
Luigi Agostieb5d8d92243f
diff --git a/internal/config/committed_fixtures_test.go b/internal/config/committed_fixtures_test.gonew file mode 100644index 00000000..2cf6ecad--- /dev/null+++ b/internal/config/committed_fixtures_test.go@@ -0,0 +1,81 @@+package config++import (+ "os"+ "path/filepath"+ "strings"+ "testing"++ "github.com/pinchtab/pinchtab/internal/srccensus"+)++// Every config fixture the repo ships must load clean. The unknown-key walk's first find was+// the repo's own fixtures — six of them set keys declared nowhere, so every e2e and benchmark+// run logged a WARN about a batching knob that was never applied. Permanent noise is how a+// real warning later gets skimmed past.+//+// The population is DISCOVERED, not listed. A hand-written list encodes today's fixtures and+// is the same failure this guard cleans up: the next one added lands unchecked. The floor+// below is what keeps a walk that stopped matching from passing over nothing.+func TestEveryCommittedConfigFixtureLoadsWithNoUnknownKeys(t *testing.T) {+ fixtures := committedConfigFixtures(t)+ if len(fixtures) < committedConfigFixtureFloor {+ t.Fatalf("found %d config fixtures, want at least %d; the walk stopped matching and would pass vacuously — re-point it at wherever the fixtures moved rather than deleting it", len(fixtures), committedConfigFixtureFloor)+ }++ for _, path := range fixtures {+ t.Run(filepath.Base(path), func(t *testing.T) {+ raw, err := os.ReadFile(path) // #nosec G304 -- path produced by this test's own walk.+ if err != nil {+ t.Fatal(err)+ }+ if keys := UnknownFileConfigKeys(raw); len(keys) > 0 {+ t.Errorf("%s sets %s; no config section declares them, so they do nothing and every run of this fixture logs a WARN — remove them, or add the setting to FileConfig and internal/schema/config.json if it was meant to be real", path, strings.Join(keys, ", "))+ }+ })+ }+}++// Well under the twelve that exist, so adding or retiring a fixture does not trip it while a+// walk that lost the tree still fails.+const committedConfigFixtureFloor = 8++// committedConfigFixtures walks the module for the fixture NAMING convention rather than for+// a path list. Generated configs are excluded by directory: every scratch and output tree the+// repo gitignores (tests/**/.tmp, tests/*/results) holds machine-specific files that a clean+// checkout does not have, so including them would make this guard's population depend on+// which suites the developer last ran.+func committedConfigFixtures(t *testing.T) []string {+ t.Helper()++ root, err := filepath.Abs(filepath.Join("..", ".."))+ if err != nil {+ t.Fatal(err)+ }++ var found []string+ walkErr := filepath.WalkDir(root, func(path string, entry os.DirEntry, err error) error {+ if err != nil {+ return err+ }+ if entry.IsDir() {+ if path != root && (srccensus.ExcludedDir(path) || generatedOutputDir(filepath.Base(path))) {+ return filepath.SkipDir+ }+ return nil+ }+ name := filepath.Base(path)+ if strings.HasPrefix(name, "pinchtab") && strings.HasSuffix(name, ".json") {+ found = append(found, path)+ }+ return nil+ })+ if walkErr != nil {+ t.Fatalf("cannot walk %s, so this guard would check nothing: %v", root, walkErr)+ }+ return found+}++func generatedOutputDir(name string) bool {+ return strings.HasPrefix(name, ".") || name == "results"+}diff --git a/tests/e2e/config/pinchtab-full-permissive.json b/tests/e2e/config/pinchtab-full-permissive.jsonindex 5fe9224b..64624598 100644--- a/tests/e2e/config/pinchtab-full-permissive.json+++ b/tests/e2e/config/pinchtab-full-permissive.json@@ -30,7 +30,6 @@"maxPerAgent": 3,"maxInflight": 2,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 120},"security": {diff --git a/tests/e2e/config/pinchtab-medium-permissive.json b/tests/e2e/config/pinchtab-medium-permissive.jsonindex edfa9818..9577726b 100644--- a/tests/e2e/config/pinchtab-medium-permissive.json+++ b/tests/e2e/config/pinchtab-medium-permissive.json@@ -30,7 +30,6 @@"maxPerAgent": 3,"maxInflight": 2,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 120},"security": {diff --git a/tests/e2e/config/pinchtab-network-retain-bodies.json b/tests/e2e/config/pinchtab-network-retain-bodies.jsonindex 34b3f732..29f25470 100644--- a/tests/e2e/config/pinchtab-network-retain-bodies.json+++ b/tests/e2e/config/pinchtab-network-retain-bodies.json@@ -36,7 +36,6 @@"maxPerAgent": 3,"maxInflight": 2,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 120},"security": {diff --git a/tests/e2e/config/pinchtab.json b/tests/e2e/config/pinchtab.jsonindex c4d8a846..842c2b59 100644--- a/tests/e2e/config/pinchtab.json+++ b/tests/e2e/config/pinchtab.json@@ -33,7 +33,6 @@"maxPerAgent": 3,"maxInflight": 2,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 120},"security": {diff --git a/tests/tools/config/pinchtab-benchmark.json b/tests/tools/config/pinchtab-benchmark.jsonindex bd7df4d0..cf033e2a 100644--- a/tests/tools/config/pinchtab-benchmark.json+++ b/tests/tools/config/pinchtab-benchmark.json@@ -21,7 +21,6 @@"multiInstance": {"strategy": "always-on","allocationPolicy": "fcfs",- "poolSize": 2,"restart": {"maxRestarts": 10,"initBackoffSec": 2,@@ -36,7 +35,6 @@"maxPerAgent": 5,"maxInflight": 3,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 300},"security": {@@ -55,10 +53,5 @@"enabled": true,"wrapContent": false}- },- "activity": {- "enabled": true,- "maxEvents": 10000,- "retentionHours": 24}}diff --git a/tests/tools/config/pinchtab.json b/tests/tools/config/pinchtab.jsonindex 17789926..a2b1e17d 100644--- a/tests/tools/config/pinchtab.json+++ b/tests/tools/config/pinchtab.json@@ -12,7 +12,6 @@"multiInstance": {"strategy": "always-on","allocationPolicy": "fcfs",- "poolSize": 2,"restart": {"maxRestarts": 10,"initBackoffSec": 2,@@ -27,7 +26,6 @@"maxPerAgent": 5,"maxInflight": 3,"workerCount": 2,- "maxBatchSize": 5,"resultTTLSec": 300},"security": {@@ -45,10 +43,5 @@"idpi": {"enabled": true}- },- "activity": {- "enabled": true,- "maxEvents": 10000,- "retentionHours": 24}}