Files
yoloyolo/.planning/phases/08-test-and-constant-cleanup/08-01-SUMMARY.md
T
gurix 81ef4f9df7 docs(08-01): complete constant-cleanup plan
- SUMMARY for 08-01: stale constants removed, tests future-proofed
- STATE.md: plan advanced, progress 100%, decisions recorded
- ROADMAP.md: Phase 8 marked Complete
- REQUIREMENTS.md: CLEAN-01 marked complete
2026-03-27 08:55:38 +01:00

75 lines
3.2 KiB
Markdown

---
phase: 08-test-and-constant-cleanup
plan: 01
subsystem: synth
tags: [cleanup, constants, tests, ci]
dependency_graph:
requires: []
provides: [clean-constant-block, future-proof-frequency-tests]
affects: [synth/config.go, synth/config_test.go]
tech_stack:
added: []
patterns: [Nyquist-based validation instead of hardcoded bounds]
key_files:
created: []
modified:
- synth/config.go
- synth/config_test.go
decisions:
- 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
metrics:
duration: "1 min"
completed: "2026-03-27"
tasks_completed: 2
files_modified: 2
requirements_satisfied:
- 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.
## Tasks Completed
| Task | Name | Commit | Files |
|------|------|--------|-------|
| 1 | Delete stale NumLayers and GainPerLayer constants | fd17061 | synth/config.go |
| 2 | Update synth/config_test.go — future-proof frequency bounds, rename test, remove duplicate | 4800e8e | synth/config_test.go |
## What Was Done
**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`:
1. `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.
2. `TestNumLayersMatchesAllClasses` renamed to `TestClassFreqConfigsMatchAllClasses` — name now accurately describes what it tests.
3. `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
- Commits fd17061 and 4800e8e exist
- Full test suite green