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
This commit is contained in:
2026-03-27 08:55:38 +01:00
parent 4800e8e463
commit 81ef4f9df7
4 changed files with 98 additions and 21 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ Requirements for extended protocol coverage milestone. Each maps to roadmap phas
### Cleanup
- [ ] **CLEAN-01**: Remove stale `NumLayers` constant and hardcoded frequency range test assertions that would block new class additions
- [x] **CLEAN-01**: Remove stale `NumLayers` constant and hardcoded frequency range test assertions that would block new class additions
### Protocol Coverage
@@ -67,7 +67,7 @@ Which phases cover which requirements. Updated during roadmap creation.
| Requirement | Phase | Status |
|-------------|-------|--------|
| CLEAN-01 | Phase 8 | Pending |
| CLEAN-01 | Phase 8 | Complete |
| FREQ-01 | Phase 9 | Pending |
| FREQ-02 | Phase 9 | Pending |
| FREQ-03 | Phase 9 | Pending |
+4 -4
View File
@@ -35,7 +35,7 @@ Full details: `.planning/milestones/v1.1-ROADMAP.md`
**Milestone Goal:** Expand traffic classification with grouped protocol families that share recognizable sound signatures — from 14 classes to ~35, organized into frequency bands by family.
- [ ] **Phase 8: Test and Constant Cleanup** - 1 plan — Remove stale constants and update test bounds that would block all subsequent v1.2 work
- [x] **Phase 8: Test and Constant Cleanup** - 1 plan — Remove stale constants and update test bounds that would block all subsequent v1.2 work (completed 2026-03-27)
- [ ] **Phase 9: Frequency Design and Group Architecture** - Design complete Hz allocation for all ~35 classes in family bands and add Group field to FreqConfig
- [ ] **Phase 10: Classification Layer** - Add ~21 new TrafficClass constants and port rules covering all new protocol families
- [ ] **Phase 11: Synthesis and Config Layer** - Add ClassFreqConfigs entries for all new classes, update auto-assign range, and add group-header output to --print-config
@@ -50,9 +50,9 @@ Full details: `.planning/milestones/v1.1-ROADMAP.md`
1. `go test ./...` passes on main with no modifications to the new v1.2 code path
2. The stale `NumLayers`/`GainPerLayer` exported constant no longer exists in the synth package — callers cannot accidentally use it
3. `TestFrequenciesInRange` accepts the new extended Hz range without manual test surgery when new classes are added in Phase 10
**Plans:** 1 plan
**Plans:** 1/1 plans complete
Plans:
- [ ] 08-01-PLAN.md — Delete stale constants, future-proof test bounds, rename/consolidate tests
- [x] 08-01-PLAN.md — Delete stale constants, future-proof test bounds, rename/consolidate tests
### Phase 9: Frequency Design and Group Architecture
**Goal**: A complete, documented frequency allocation table for all ~35 traffic classes exists and the FreqConfig struct carries a Group field — design decisions are locked in before any protocol code is written
@@ -99,7 +99,7 @@ Plans:
| 5. Waveform Types and Bank Decoupling | v1.1 | 2/2 | Complete | 2026-03-26 |
| 6. Config Package and Sound Overrides | v1.1 | 2/2 | Complete | 2026-03-26 |
| 7. Custom Rules and Print-Config | v1.1 | 2/2 | Complete | 2026-03-26 |
| 8. Test and Constant Cleanup | v1.2 | 0/1 | Planning | - |
| 8. Test and Constant Cleanup | v1.2 | 1/1 | Complete | 2026-03-27 |
| 9. Frequency Design and Group Architecture | v1.2 | 0/? | Not started | - |
| 10. Classification Layer | v1.2 | 0/? | Not started | - |
| 11. Synthesis and Config Layer | v1.2 | 0/? | Not started | - |
+18 -15
View File
@@ -2,15 +2,15 @@
gsd_state_version: 1.0
milestone: v1.2
milestone_name: Extended Protocol Coverage
status: planning
stopped_at: Phase 8 context gathered
last_updated: "2026-03-27T07:43:09.517Z"
last_activity: 2026-03-27 — v1.2 roadmap created, 4 phases defined (8-11), 18 requirements mapped
status: verifying
stopped_at: Completed 08-01-PLAN.md
last_updated: "2026-03-27T07:55:27.296Z"
last_activity: 2026-03-27
progress:
total_phases: 4
completed_phases: 0
total_plans: 0
completed_plans: 0
completed_phases: 1
total_plans: 1
completed_plans: 1
percent: 0
---
@@ -21,14 +21,14 @@ progress:
See: .planning/PROJECT.md (updated 2026-03-27)
**Core value:** Network traffic patterns are instantly recognizable as distinct sounds — a ping sounds different from HTTPS noise, which sounds different from a port scan.
**Current focus:** Phase 8 — Test and Constant Cleanup (v1.2 start)
**Current focus:** Phase 08 — test-and-constant-cleanup
## Current Position
Phase: 8 of 11 (Test and Constant Cleanup)
Plan: — (not yet planned)
Status: Ready to plan
Last activity: 2026-03-27 — v1.2 roadmap created, 4 phases defined (8-11), 18 requirements mapped
Phase: 08 (test-and-constant-cleanup) — EXECUTING
Plan: 1 of 1
Status: Phase complete — ready for verification
Last activity: 2026-03-27
Progress: [░░░░░░░░░░] 0%
@@ -49,6 +49,7 @@ Progress: [░░░░░░░░░░] 0%
| 07 | 2 | ~6min | 3min |
**Recent Trend:** Stable
| Phase 08 P01 | 1 | 2 tasks | 2 files |
## Accumulated Context
@@ -60,6 +61,8 @@ Progress: [░░░░░░░░░░] 0%
- [v1.2 Roadmap]: GRP-02 and GRP-03 deferred to Phase 11 — PrintConfig group headers and TOML [groups] config depend on both Group field (Phase 9) and new class constants (Phase 10)
- [Phase 07]: addAutoFreqEntries runs before merge so [sounds.X] overrides apply to user-defined classes
- [Phase 07]: LoadResult struct chosen over tuple return for config.Load() — cleaner API contract
- [Phase 08]: NumLayers and GainPerLayer deleted — dead code since NewBank computes gain dynamically as 1/N
- [Phase 08]: TestFrequenciesInRange now validates against Nyquist (22050 Hz) — any new BaseHz in (0, 22050) is accepted without test surgery
### Pending Todos
@@ -72,6 +75,6 @@ Progress: [░░░░░░░░░░] 0%
## Session Continuity
Last session: 2026-03-27T07:43:09.510Z
Stopped at: Phase 8 context gathered
Resume file: .planning/phases/08-test-and-constant-cleanup/08-CONTEXT.md
Last session: 2026-03-27T07:55:27.289Z
Stopped at: Completed 08-01-PLAN.md
Resume file: None
@@ -0,0 +1,74 @@
---
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