docs(11-02): complete group-ordered PrintConfig and [groups] TOML plan

This commit is contained in:
2026-03-27 16:37:18 +01:00
parent 7bf3ea12a3
commit 15ad990f83
3 changed files with 115 additions and 15 deletions
+4 -4
View File
@@ -38,7 +38,7 @@ Full details: `.planning/milestones/v1.1-ROADMAP.md`
- [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** - 2 plans — Design complete Hz allocation for all ~35 classes in family bands and add Group field to FreqConfig
- [x] **Phase 10: Classification Layer** - 2 plans — Add 21 new TrafficClass constants, 30 port rules, and test coverage for all new protocol families (completed 2026-03-27)
- [ ] **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
- [x] **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 (completed 2026-03-27)
## Phase Details
@@ -91,10 +91,10 @@ Plans:
2. A pcap or live capture that triggers Mail traffic produces tones that are audibly in the same timbral family — same waveform type, similar frequency register — while still being distinguishable from each other
3. Users can define `[groups]` in their TOML config to reassign a protocol to a different sound family, and --print-config reflects the reassignment
4. `go test ./...` passes and a listening test on a representative pcap confirms family identity is perceptually clear
**Plans:** 1/2 plans executed
**Plans:** 2/2 plans complete
Plans:
- [x] 11-01-PLAN.md — Add 21 ClassFreqConfigs entries, update AllClasses() to 35, fix all count tests
- [ ] 11-02-PLAN.md — Refactor PrintConfig for group headers, add [groups] TOML support
- [x] 11-02-PLAN.md — Refactor PrintConfig for group headers, add [groups] TOML support
## Progress
@@ -110,4 +110,4 @@ Plans:
| 8. Test and Constant Cleanup | v1.2 | 1/1 | Complete | 2026-03-27 |
| 9. Frequency Design and Group Architecture | v1.2 | 1/2 | In Progress| |
| 10. Classification Layer | v1.2 | 2/2 | Complete | 2026-03-27 |
| 11. Synthesis and Config Layer | v1.2 | 1/2 | In Progress| |
| 11. Synthesis and Config Layer | v1.2 | 2/2 | Complete | 2026-03-27 |
+14 -11
View File
@@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.2
milestone_name: Extended Protocol Coverage
status: executing
stopped_at: Phase 11 context gathered
last_updated: "2026-03-27T15:27:37.402Z"
last_activity: 2026-03-27 -- Phase 11 execution started
stopped_at: Completed 11-02-PLAN.md
last_updated: "2026-03-27T15:37:08.972Z"
last_activity: 2026-03-27
progress:
total_phases: 4
completed_phases: 3
completed_phases: 4
total_plans: 7
completed_plans: 5
completed_plans: 7
percent: 0
---
@@ -26,9 +26,9 @@ See: .planning/PROJECT.md (updated 2026-03-27)
## Current Position
Phase: 11 (synthesis-and-config-layer) — EXECUTING
Plan: 1 of 2
Status: Executing Phase 11
Last activity: 2026-03-27 -- Phase 11 execution started
Plan: 2 of 2
Status: Ready to execute
Last activity: 2026-03-27
Progress: [░░░░░░░░░░] 0%
@@ -52,6 +52,7 @@ Progress: [░░░░░░░░░░] 0%
| Phase 08 P01 | 1 | 2 tasks | 2 files |
| Phase 09 P02 | 3 | 2 tasks | 2 files |
| Phase 10 P02 | 2 | 2 tasks | 1 files |
| Phase 11 P02 | 5min | 2 tasks | 2 files |
## Accumulated Context
@@ -67,6 +68,8 @@ Progress: [░░░░░░░░░░] 0%
- [Phase 08]: TestFrequenciesInRange now validates against Nyquist (22050 Hz) — any new BaseHz in (0, 22050) is accepted without test surgery
- [Phase 09]: autoAssignFreq range moved to [2500, 4000] Hz with numSteps=31 to guarantee no collision with built-in frequencies (max 2449 Hz)
- [Phase 10]: TestAllClassesCount updated to 32 (14 existing + 18 new; LDAP/Kerberos/Syslog excluded until Phase 11 adds ClassFreqConfigs)
- [Phase 11]: Non-canonical group names (user-invented via [groups]) emitted after canonical groups in alphabetical order
- [Phase 11]: builtinByGroup built from result.FreqCfgs[cls].Group (effective group after reassignment) not from synth defaults
### Pending Todos
@@ -79,6 +82,6 @@ Progress: [░░░░░░░░░░] 0%
## Session Continuity
Last session: 2026-03-27T15:16:36.797Z
Stopped at: Phase 11 context gathered
Resume file: .planning/phases/11-synthesis-and-config-layer/11-CONTEXT.md
Last session: 2026-03-27T15:37:08.965Z
Stopped at: Completed 11-02-PLAN.md
Resume file: None
@@ -0,0 +1,97 @@
---
phase: 11
plan: 02
subsystem: config
tags: [print-config, group-headers, toml-groups, user-facing-output]
dependency_graph:
requires: [synth/config.go FreqConfig.Group field from Phase 11 Plan 01, classify/types.go AllClasses() with 35 entries]
provides: [Group-ordered PrintConfig output, [groups] TOML support, applyGroupOverrides function]
affects: [config/config.go, config/config_test.go]
tech_stack:
added: []
patterns: [rawConfig Groups field for TOML [groups] table, groupOrder canonical slice for section ordering]
key_files:
created: []
modified:
- config/config.go
- config/config_test.go
decisions:
- "Non-canonical group names (user-invented via [groups]) emitted after canonical groups in alphabetical order"
- "builtinByGroup built from result.FreqCfgs[cls].Group (effective group after reassignment) not from synth defaults"
metrics:
duration: ~5min
completed: "2026-03-27"
tasks: 2
files_modified: 2
---
# Phase 11 Plan 02: Group-Ordered PrintConfig and [groups] TOML Support Summary
**One-liner:** Refactored PrintConfig to emit group section headers (Infrastructure, Web, Mail, Remote Access, File Transfer, Database, Discovery, VoIP, Unknown) with classes sorted by ascending BaseHz, and added [groups] TOML table support for user-defined protocol-to-group reassignment.
## What Was Built
### Task 1: Add [groups] TOML support and refactor PrintConfig for group headers
**config/config.go** — Three changes:
**1. Groups field on rawConfig:**
```go
type rawConfig struct {
Sounds map[string]SoundOverride `toml:"sounds"`
Rules []RawRule `toml:"rules"`
Groups map[string]string `toml:"groups"`
}
```
**2. applyGroupOverrides function** — overlays [groups] reassignments onto FreqConfig.Group in-place. Unknown class names emit a stderr warning and are skipped (not an error). Unknown group names are silently accepted (users can invent custom groups). Called in Load() after merge().
**3. PrintConfig refactored** — replaced flat AllClasses() iteration with:
- `groupOrder` canonical slice: `["Infrastructure", "Web", "Mail", "Remote Access", "File Transfer", "Database", "Discovery", "VoIP", "Unknown"]`
- Built-in classes grouped by their effective Group field, sorted ascending by BaseHz within each group
- Section headers emitted as `# GroupName\n\n`
- Non-canonical group names (user-invented) emitted after canonical groups in alphabetical order
- User-defined classes (not in AllClasses()) emitted under `# User-defined` section
### Task 2: Add tests for group headers, group reassignment, and unknown class warning
**config/config_test.go** — 4 new test functions:
| Test | What It Covers |
|------|---------------|
| `TestPrintConfigGroupHeaders` | GRP-02: all 8 populated group headers present in canonical order |
| `TestLoadGroupOverride` | GRP-03: [groups] reassigns IMAP from Mail to Web, Hz/waveform unchanged |
| `TestLoadGroupUnknownClass` | D-09: unknown class in [groups] produces no error, map size unchanged |
| `TestPrintConfigGroupReassignment` | GRP-03: PrintConfig places reassigned IMAP between Web and Mail headers |
## Verification Results
```
go test ./...
ok github.com/netsynth/netsynth/aggregate (cached)
ok github.com/netsynth/netsynth/capture (cached)
ok github.com/netsynth/netsynth/classify
ok github.com/netsynth/netsynth/cmd/netsynth
ok github.com/netsynth/netsynth/config
ok github.com/netsynth/netsynth/encode
ok github.com/netsynth/netsynth/synth
```
All 7 packages pass.
## Commits
| Task | Commit | Description |
|------|--------|-------------|
| 1 | 374282e | feat(11-02): add [groups] TOML support and group-ordered PrintConfig |
| 2 | 7bf3ea1 | test(11-02): add group header and reassignment tests (GRP-02, GRP-03) |
## Deviations from Plan
None - plan executed exactly as written.
## Known Stubs
None — PrintConfig group output is fully wired to FreqConfig.Group field populated in Phase 11 Plan 01. No placeholder data.
## Self-Check: PASSED