fix: resolve 4 critical audio mixer bugs (v0.5)

- SwitchDevice volume silently zeroed: Init uses cfg.SavedVolume,
  SwitchDevice restores saved volume after reopening device
- SwitchDevice not persisted to database: caller saves SelectedAudioDevice
- Device restore passes invalid 'system default' to SDL: now passes ''
- Stop() no-op when audio toggled off: removed AudioEnabled guard

Regression tests added for all 4 bugs. CI now runs go test before build.
This commit is contained in:
NeilClack
2026-07-11 11:39:58 -05:00
parent 72910e7006
commit bb132ceeaf
8 changed files with 150 additions and 34 deletions
+8 -1
View File
@@ -29,7 +29,14 @@ Only one test suite exists: `internal/mixer/mixer_test.go`. Run with:
go test ./internal/mixer/
```
No lint or typecheck commands are configured in the repo. CI only runs `nix build -L`.
No lint or typecheck commands are configured in the repo. CI runs `go test` then `nix build -L`.
**Every bug fix MUST include regression tests.** When fixing a bug, write tests that:
1. Reproduce the exact conditions that caused the bug (should pass with the fix, fail without it)
2. Verify the correct behavior after the fix
3. Cover edge cases related to the bug
Do not merge a bug fix without corresponding tests.
## Branch Model