docs(06-02): complete CLI config wiring plan summary and state updates
This commit is contained in:
@@ -11,7 +11,7 @@ Requirements for custom sound mappings milestone. Each maps to roadmap phases.
|
||||
|
||||
- [x] **CFG-01**: User can create a TOML config file that overrides default sound mappings
|
||||
- [x] **CFG-02**: Tool auto-discovers config from `./netsynth.toml` or `~/.config/netsynth/config.toml` (silent if absent)
|
||||
- [ ] **CFG-03**: User can specify an explicit config path via `--config` flag (error if file missing)
|
||||
- [x] **CFG-03**: User can specify an explicit config path via `--config` flag (error if file missing)
|
||||
- [x] **CFG-04**: User can override individual values without replicating the entire default config (partial override)
|
||||
- [x] **CFG-05**: Unknown keys in config file produce a clear error with the typo'd key name
|
||||
- [ ] **CFG-06**: User can run `netsynth --print-config` to see the effective config as commented TOML
|
||||
@@ -58,7 +58,7 @@ Which phases cover which requirements. Updated during roadmap creation.
|
||||
|-------------|-------|--------|
|
||||
| CFG-01 | Phase 6 | Complete |
|
||||
| CFG-02 | Phase 6 | Complete |
|
||||
| CFG-03 | Phase 6 | Pending |
|
||||
| CFG-03 | Phase 6 | Complete |
|
||||
| CFG-04 | Phase 6 | Complete |
|
||||
| CFG-05 | Phase 6 | Complete |
|
||||
| CFG-06 | Phase 7 | Pending |
|
||||
|
||||
@@ -24,7 +24,7 @@ Full details: `.planning/milestones/v1.0-ROADMAP.md`
|
||||
**Milestone Goal:** Users can customize how traffic sounds via a TOML config file — setting custom frequencies, waveform types, and their own classification rules with named sounds.
|
||||
|
||||
- [x] **Phase 5: Waveform Types and Bank Decoupling** - Internal refactors establishing waveform enum and injectable bank signature (completed 2026-03-26)
|
||||
- [ ] **Phase 6: Config Package and Sound Overrides** - TOML loading, auto-discovery, partial merge, and frequency/waveform overrides wired end-to-end
|
||||
- [x] **Phase 6: Config Package and Sound Overrides** - TOML loading, auto-discovery, partial merge, and frequency/waveform overrides wired end-to-end (completed 2026-03-26)
|
||||
- [ ] **Phase 7: Custom Rules and Print-Config** - User-defined classification rules and --print-config UX
|
||||
|
||||
## Phase Details
|
||||
@@ -53,11 +53,11 @@ Plans:
|
||||
3. User passes `--config /path/to/custom.toml` and the tool uses that file; if the file does not exist, the tool exits with a clear error before capture begins
|
||||
4. User types `frequncy = 440` in their config file and the tool exits at startup with an error naming `frequncy` as an unrecognized key
|
||||
5. User sets waveform for one class in TOML and leaves all other classes at their defaults — the unspecified classes are unchanged
|
||||
**Plans:** 1/2 plans executed
|
||||
**Plans:** 2/2 plans complete
|
||||
|
||||
Plans:
|
||||
- [x] 06-01-PLAN.md — Config package: TOML load, validate, merge with TDD (config/config.go, config/config_test.go)
|
||||
- [ ] 06-02-PLAN.md — CLI wiring: --config flag, RunSynthesis signature change, main.go integration
|
||||
- [x] 06-02-PLAN.md — CLI wiring: --config flag, RunSynthesis signature change, main.go integration
|
||||
|
||||
### Phase 7: Custom Rules and Print-Config
|
||||
**Goal**: Users can define their own traffic classification rules in TOML, assign custom sounds to them, and inspect the full effective config before capture begins
|
||||
@@ -79,5 +79,5 @@ Plans:
|
||||
| 3. Pipeline Integration and MVP | v1.0 | 2/2 | Complete | 2026-03-26 |
|
||||
| 4. Power User Features | v1.0 | 2/2 | Complete | 2026-03-26 |
|
||||
| 5. Waveform Types and Bank Decoupling | v1.1 | 2/2 | Complete | 2026-03-26 |
|
||||
| 6. Config Package and Sound Overrides | v1.1 | 1/2 | In Progress| |
|
||||
| 6. Config Package and Sound Overrides | v1.1 | 2/2 | Complete | 2026-03-26 |
|
||||
| 7. Custom Rules and Print-Config | v1.1 | 0/? | Not started | - |
|
||||
|
||||
+14
-11
@@ -3,14 +3,14 @@ gsd_state_version: 1.0
|
||||
milestone: v1.1
|
||||
milestone_name: Custom Sound Mappings
|
||||
status: executing
|
||||
stopped_at: Phase 6 context gathered
|
||||
last_updated: "2026-03-26T19:53:17.089Z"
|
||||
last_activity: 2026-03-26 -- Phase 06 execution started
|
||||
stopped_at: Completed 06-02-PLAN.md
|
||||
last_updated: "2026-03-26T20:05:36.244Z"
|
||||
last_activity: 2026-03-26
|
||||
progress:
|
||||
total_phases: 3
|
||||
completed_phases: 1
|
||||
completed_phases: 2
|
||||
total_plans: 4
|
||||
completed_plans: 2
|
||||
completed_plans: 4
|
||||
percent: 0
|
||||
---
|
||||
|
||||
@@ -26,9 +26,9 @@ See: .planning/PROJECT.md (updated 2026-03-26)
|
||||
## Current Position
|
||||
|
||||
Phase: 06 (config-package-and-sound-overrides) — EXECUTING
|
||||
Plan: 1 of 2
|
||||
Status: Executing Phase 06
|
||||
Last activity: 2026-03-26 -- Phase 06 execution started
|
||||
Plan: 2 of 2
|
||||
Status: Ready to execute
|
||||
Last activity: 2026-03-26
|
||||
|
||||
Progress: [░░░░░░░░░░] 0%
|
||||
|
||||
@@ -52,6 +52,7 @@ Progress: [░░░░░░░░░░] 0%
|
||||
**Recent Trend:** Stable
|
||||
| Phase 05 P01 | 3min | 2 tasks | 3 files |
|
||||
| Phase 05 P02 | 4 | 2 tasks | 4 files |
|
||||
| Phase 06 P02 | 2 | 2 tasks | 3 files |
|
||||
|
||||
## Accumulated Context
|
||||
|
||||
@@ -64,6 +65,8 @@ Progress: [░░░░░░░░░░] 0%
|
||||
- [Phase 05]: WaveformType zero value is WaveformCustom — all 14 existing ClassFreqConfigs entries retain hand-tuned harmonics without modification
|
||||
- [Phase 05]: NewBank accepts injected config map instead of reading ClassFreqConfigs global — injection seam for Phase 6 config loading
|
||||
- [Phase 05]: gainPerLayer computed as 1.0/float64(len(cfgs)) — correct for any class count, no-clip guarantee preserved
|
||||
- [Phase 06]: Option A for freqCfgs propagation: pass as parameter to runLiveMode/runPcapMode — cleaner data flow vs package-level var
|
||||
- [Phase 06]: config.Load positioned after BPF validation, before output path resolution — ensures fail-fast before any I/O (D-11)
|
||||
|
||||
### Pending Todos
|
||||
|
||||
@@ -75,6 +78,6 @@ None.
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-03-26T19:39:13.119Z
|
||||
Stopped at: Phase 6 context gathered
|
||||
Resume file: .planning/phases/06-config-package-and-sound-overrides/06-CONTEXT.md
|
||||
Last session: 2026-03-26T20:05:36.237Z
|
||||
Stopped at: Completed 06-02-PLAN.md
|
||||
Resume file: None
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
---
|
||||
phase: 06-config-package-and-sound-overrides
|
||||
plan: 02
|
||||
subsystem: cmd/encode
|
||||
tags: [cli, config, RunSynthesis, dependency-injection, cobra]
|
||||
|
||||
# Dependency graph
|
||||
requires:
|
||||
- phase: 06-01
|
||||
provides: config.Load(configPath string) returns map[classify.TrafficClass]synth.FreqConfig
|
||||
- phase: 05-waveform-types-and-bank-decoupling
|
||||
provides: NewBank(tau, cfgs) with injected config map, FreqConfig.WaveformType
|
||||
|
||||
provides:
|
||||
- --config flag in CLI (CFG-03)
|
||||
- config.Load called at startup before capture (D-11 fail fast)
|
||||
- RunSynthesis(snapshots, outputPath, freqCfgs) with injected config map (D-10)
|
||||
- Merged config flows end-to-end: TOML file -> config.Load -> RunSynthesis -> NewBank
|
||||
|
||||
affects:
|
||||
- encode/mp3.go (RunSynthesis signature changed)
|
||||
- cmd/netsynth/main.go (--config flag, config.Load, pass freqCfgs through pipeline)
|
||||
|
||||
# Tech tracking
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns:
|
||||
- "Dependency injection: config map flows from main() through runLiveMode/runPcapMode to RunSynthesis to NewBank"
|
||||
- "Fail-fast config loading: config.Load called after BPF validation, before capture starts (D-11)"
|
||||
- "Explicit configPath string var for --config flag, empty string triggers auto-discovery"
|
||||
|
||||
key-files:
|
||||
created: []
|
||||
modified:
|
||||
- encode/mp3.go
|
||||
- encode/mp3_test.go
|
||||
- cmd/netsynth/main.go
|
||||
|
||||
key-decisions:
|
||||
- "Option A for freqCfgs propagation: pass as parameter to runLiveMode/runPcapMode rather than package-level var — explicit data flow, easier to test"
|
||||
- "config.Load called before output path resolution — config errors abort before any state changes"
|
||||
|
||||
patterns-established:
|
||||
- "Config map injected at call boundary (main -> run -> runLiveMode/runPcapMode -> RunSynthesis -> NewBank)"
|
||||
|
||||
requirements-completed: [CFG-03]
|
||||
|
||||
# Metrics
|
||||
duration: 2min
|
||||
completed: 2026-03-26
|
||||
---
|
||||
|
||||
# Phase 6 Plan 02: CLI Config Wiring Summary
|
||||
|
||||
**--config flag added to Cobra, config.Load wired at startup, RunSynthesis signature changed to accept injected freqCfgs map — end-to-end config flow from TOML file to synthesis**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** ~2 min
|
||||
- **Started:** 2026-03-26T20:01:59Z
|
||||
- **Completed:** 2026-03-26T20:04:27Z
|
||||
- **Tasks:** 2
|
||||
- **Files modified:** 3 (encode/mp3.go, encode/mp3_test.go, cmd/netsynth/main.go)
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- Changed `RunSynthesis` third parameter: accepts `freqCfgs map[classify.TrafficClass]synth.FreqConfig` (D-10)
|
||||
- Updated all 3 RunSynthesis call sites in encode tests to pass `synth.ClassFreqConfigs`
|
||||
- Added `configPath string` var and `--config` flag registration in Cobra (CFG-03)
|
||||
- Imported `config` and `synth` packages into cmd/netsynth/main.go
|
||||
- Wired `config.Load(configPath)` into `run()` after BPF validation, before capture (D-11)
|
||||
- Changed `runLiveMode` and `runPcapMode` signatures to accept `freqCfgs` parameter
|
||||
- Updated both `encode.RunSynthesis` call sites to pass `freqCfgs`
|
||||
- Full test suite passes: 7 packages, all green
|
||||
|
||||
## Task Commits
|
||||
|
||||
1. **Task 1** - `3dfcbbe` feat(06-02): add freqCfgs parameter to RunSynthesis
|
||||
2. **Task 2** - `413cceb` feat(06-02): wire --config flag and config.Load into CLI pipeline
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `encode/mp3.go` - RunSynthesis now accepts `freqCfgs map[classify.TrafficClass]synth.FreqConfig`; uses `freqCfgs` in `synth.NewBank(1.0, freqCfgs)` call
|
||||
- `encode/mp3_test.go` - Updated 3 RunSynthesis calls to pass `synth.ClassFreqConfigs` as third arg
|
||||
- `cmd/netsynth/main.go` - `configPath` var, `--config` flag, `config` and `synth` imports, `config.Load` call, updated function signatures, updated RunSynthesis calls
|
||||
|
||||
## Decisions Made
|
||||
|
||||
- **Option A for freqCfgs propagation**: Pass config map as function parameter to `runLiveMode`/`runPcapMode` rather than storing in a package-level variable. Cleaner data flow, functions remain testable in isolation.
|
||||
- **config.Load position in run()**: Called after BPF filter validation, before output path resolution and capture start. Config errors abort immediately before any I/O begins (D-11).
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
None - plan executed exactly as written. The worktree required a rebase onto local master to include phase 05 bank-decoupling code (NewBank 2-arg signature) and phase 06-01 config package before implementation could begin — this is expected prerequisite resolution, not a deviation.
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
- Worktree was based on origin/master (commit 41e2278, pre-phase-05). Rebased onto local master (936aeea) to get WaveformType, 2-arg NewBank, and config package. No code conflicts.
|
||||
|
||||
## User Setup Required
|
||||
|
||||
None.
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- Full end-to-end config flow is wired: user creates netsynth.toml -> `--config` passes path -> `config.Load` merges -> `RunSynthesis` uses merged map -> `NewBank` synthesizes with custom frequencies/waveforms
|
||||
- Phase 06-03 (if any) can build on this wired pipeline for additional config features
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- FOUND: encode/mp3.go — contains `func RunSynthesis(snapshots []classify.WindowSnapshot, outputPath string, freqCfgs map[classify.TrafficClass]synth.FreqConfig) error`
|
||||
- FOUND: encode/mp3_test.go — contains `RunSynthesis(snaps, tmpPath, synth.ClassFreqConfigs)`
|
||||
- FOUND: cmd/netsynth/main.go — contains `configPath string`, `config.Load(configPath)`, `runLiveMode(cmd, freqCfgs)`
|
||||
- FOUND: 3dfcbbe (Task 1 commit)
|
||||
- FOUND: 413cceb (Task 2 commit)
|
||||
|
||||
---
|
||||
*Phase: 06-config-package-and-sound-overrides*
|
||||
*Completed: 2026-03-26*
|
||||
Reference in New Issue
Block a user