Nyquist-based validation instead of hardcoded bounds
created
modified
synth/config.go
synth/config_test.go
NumLayers and GainPerLayer deleted — NewBank computes gain dynamically as 1/len(cfgs); static constants were dead code after v1.1
TestFrequenciesInRange now validates against Nyquist (22050 Hz) so any BaseHz in (0, 22050) is accepted without test surgery
TestClassFreqConfigsComplete removed as duplicate of TestAllClassesHaveConfig; TestNumLayersMatchesAllClasses renamed to TestClassFreqConfigsMatchAllClasses
duration
completed
tasks_completed
files_modified
1 min
2026-03-27
2
2
CLEAN-01
Phase 8 Plan 1: Constant Cleanup and Future-Proof Tests Summary
Removed stale exported constants and hardcoded test bounds from the synth package so v1.2 phases can add new traffic classes and frequencies without triggering false CI failures.
Task 1 deleted NumLayers = 14 and GainPerLayer = 1.0 / float64(NumLayers) from synth/config.go. These constants were dead code since NewBank computes gainPerLayer dynamically as 1.0 / float64(len(cfgs)). The constant block now contains only SampleRate, WindowMs, SamplesPerWindow, and WhisperFloor.
Task 2 made three improvements to synth/config_test.go:
TestFrequenciesInRange now validates each BaseHz is in (0, 22050) using float64(synth.SampleRate) / 2.0 as the Nyquist bound — no hardcoded upper limit that would reject new protocol classes above 1100 Hz.
TestNumLayersMatchesAllClasses renamed to TestClassFreqConfigsMatchAllClasses — name now accurately describes what it tests.
TestClassFreqConfigsComplete deleted — it was a semantic duplicate of TestAllClassesHaveConfig (both iterate AllClasses() and check for a map entry). Three clean, non-overlapping tests remain.
Verification Results
All six plan verification checks passed:
Zero NumLayers/GainPerLayer references in synth/*.go
Zero hardcoded 1100 bounds in synth/config_test.go
go test ./... — all 7 packages green
TestFrequenciesInRange passes
TestClassFreqConfigsMatchAllClasses passes
TestClassFreqConfigsComplete no longer exists (correctly)
Deviations from Plan
None — plan executed exactly as written.
Known Stubs
None.
Self-Check: PASSED
synth/config.go exists and contains WhisperFloor, no NumLayers/GainPerLayer
synth/config_test.go exists with nyquist validation, TestClassFreqConfigsMatchAllClasses, no TestClassFreqConfigsComplete