Files
yoloyolo/.planning/milestones/v1.2-phases/09-frequency-design-and-group-architecture/09-02-PLAN.md
T
gurixandClaude Opus 4.6 494385b528 chore: archive v1.2 milestone — Extended Protocol Coverage
35 traffic classes across 9 protocol families shipped. Archives
ROADMAP, REQUIREMENTS, and phase directories to milestones/v1.2-*.
Updates README with new protocol families, sound design table,
and [groups] TOML config documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 16:48:53 +01:00

7.8 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
phase plan type wave depends_on files_modified autonomous requirements must_haves
09-frequency-design-and-group-architecture 02 execute 1
config/config.go
config/config_test.go
true
FREQ-04
truths artifacts key_links
autoAssignFreq returns Hz values in [2500, 4000] range, not the old [1200, 2350]
Auto-assigned classes cannot collide with any built-in frequency (max built-in is 2449 Hz, auto-assign starts at 2500 Hz)
TestAutoFreqAssignment passes with the new range bounds
addAutoFreqEntries produces FreqConfig with empty Group (zero value) for user-defined classes
path provides contains
config/config.go Updated autoAssignFreq constants baseHz = 2500.0
path provides contains
config/config_test.go Updated range assertion cfg.BaseHz < 2500.0 || cfg.BaseHz > 4000.0
from to via pattern
config/config.go synth/config.go addAutoFreqEntries creates synth.FreqConfig entries synth.FreqConfig
Update the auto-assign frequency range from [1200, 2350] to [2500, 4000] Hz so custom user-defined classes cannot collide with any built-in frequency. Update the corresponding test assertion.

Purpose: Per D-04, the auto-assign range must be pushed above all built-in frequencies (max 2449 Hz) to prevent collision. The 51 Hz buffer between 2449 and 2500 guarantees no overlap.

Output: Updated config/config.go constants, updated config/config_test.go assertion.

<execution_context> @$HOME/.claude/get-shit-done/workflows/execute-plan.md @$HOME/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/09-frequency-design-and-group-architecture/09-CONTEXT.md @.planning/phases/09-frequency-design-and-group-architecture/09-RESEARCH.md ```go func autoAssignFreq(className string) float64 { h := fnv.New32a() h.Write([]byte(className)) const ( baseHz = 1200.0 stepHz = 50.0 numSteps = uint32(24) ) return baseHz + float64(h.Sum32()%numSteps)*stepHz } ```
func addAutoFreqEntries(cfgs map[classify.TrafficClass]synth.FreqConfig, userRules []classify.Rule, autoClasses map[classify.TrafficClass]bool) {
    for _, rule := range userRules {
        if _, exists := cfgs[rule.Class]; !exists {
            baseHz := autoAssignFreq(string(rule.Class))
            cfgs[rule.Class] = synth.FreqConfig{
                BaseHz:       baseHz,
                WaveformType: synth.WaveformSine,
                Harmonics:    synth.WaveformPresetHarmonics(synth.WaveformSine, baseHz, synth.SampleRate),
                Pan:          0.0,
            }
            autoClasses[rule.Class] = true
        }
    }
}
if cfg.BaseHz < 1200.0 || cfg.BaseHz > 2350.0 {
    t.Errorf("GameServer BaseHz: got %v, want in [1200, 2350]", cfg.BaseHz)
}
Task 1: Update autoAssignFreq constants and comment config/config.go - config/config.go (lines 208-238: autoAssignFreq function and addAutoFreqEntries) 1. In the `autoAssignFreq` function (line 208-219), update three things:

a. Change the function comment from [1200, 2350] to [2500, 4000]:

// autoAssignFreq computes a deterministic frequency in [2500, 4000] Hz for a class name

b. Change the constants inside the function:

const (
    baseHz   = 2500.0
    stepHz   = 50.0
    numSteps = uint32(31) // [2500, 4000] Hz in 50 Hz steps
)

Verification: 2500.0 + float64(30)*50.0 = 4000.0. With numSteps=31, the modulo produces values 0..30, yielding Hz values 2500, 2550, ..., 4000.

  1. Do NOT modify addAutoFreqEntries. The Group field will be zero-value "" for auto-assigned entries, which is correct — user-defined classes are not part of any built-in family. The struct literal in addAutoFreqEntries does not need a Group: field because Go zero-initializes missing named fields. cd /home/dev/workspace/yoloyolo && go build ./config/... <acceptance_criteria>
    • config/config.go contains baseHz = 2500.0 (NOT 1200.0)
    • config/config.go contains numSteps = uint32(31) (NOT 24)
    • config/config.go contains // autoAssignFreq computes a deterministic frequency in [2500, 4000] Hz
    • config/config.go still contains stepHz = 50.0 (unchanged)
    • go build ./config/... exits 0 </acceptance_criteria> autoAssignFreq produces frequencies in [2500, 4000] Hz range with 31 steps of 50 Hz
Task 2: Update config_test.go auto-assign range assertion config/config_test.go - config/config_test.go (search for `1200.0` and `2350.0` — the TestAutoFreqAssignment assertion around line 363) 1. In `TestAutoFreqAssignment` (around line 363), update the range assertion:

Change from:

if cfg.BaseHz < 1200.0 || cfg.BaseHz > 2350.0 {
    t.Errorf("GameServer BaseHz: got %v, want in [1200, 2350]", cfg.BaseHz)
}

To:

if cfg.BaseHz < 2500.0 || cfg.BaseHz > 4000.0 {
    t.Errorf("GameServer BaseHz: got %v, want in [2500, 4000]", cfg.BaseHz)
}
  1. Also update the test comment at the top of TestAutoFreqAssignment (around line 344-346) from:

    // NO [sounds.GameServer] -> FreqCfgs contains "GameServer" entry with BaseHz in [1200, 2350]
    

    To:

    // NO [sounds.GameServer] -> FreqCfgs contains "GameServer" entry with BaseHz in [2500, 4000]
    
  2. Check if TestAutoFreqSkipsBuiltins (around line 563) references BaseHz == 175.0 for HTTPS. After Plan 01 rebalances HTTPS to 150.0, this test will need its expected value updated from 175.0 to 150.0. Find the assertion and update it.

    Search for 175.0 in config_test.go and update to 150.0 wherever it references the built-in HTTPS BaseHz. cd /home/dev/workspace/yoloyolo && go test ./config/... -v -count=1 -run "TestAutoFreq" <acceptance_criteria>

    • config/config_test.go contains cfg.BaseHz < 2500.0 || cfg.BaseHz > 4000.0 (NOT 1200/2350)
    • config/config_test.go contains want in [2500, 4000] in the error message
    • config/config_test.go contains BaseHz in [2500, 4000] in the test comment
    • If HTTPS 175.0 was referenced, it is now 150.0
    • go test ./config/... -run TestAutoFreqAssignment exits 0
    • go test ./config/... -run TestAutoFreqDeterministic exits 0
    • go test ./config/... -run TestAutoFreqSkipsBuiltins exits 0 </acceptance_criteria> All auto-assign test assertions match new [2500, 4000] range; HTTPS built-in reference updated to 150.0 if applicable; all config tests pass
- `go build ./config/...` compiles without errors - `go test ./config/... -v -run "TestAutoFreq"` passes all auto-freq tests - `go test ./...` passes full suite (cross-package with synth changes from Plan 01)

<success_criteria>

  • autoAssignFreq base is 2500.0 Hz, not 1200.0 (FREQ-04)
  • numSteps is 31, producing range [2500, 4000] with 50 Hz steps
  • No collision possible between built-in frequencies (max 2449 Hz) and auto-assign (min 2500 Hz)
  • All config tests pass with updated assertions </success_criteria>
After completion, create `.planning/phases/09-frequency-design-and-group-architecture/09-02-SUMMARY.md`