Repository navigation
test(backend): Go CI workflow + first unit-test layer (Track B Phase 1) - #5
Conversation
…ase 1) Vertical-slice gate for Track B code-health work. - .github/workflows/go-test.yml: build/vet/test on pull_request + push to main, mirroring sibling banana-weather (setup-go with go-version-file: backend/go.mod, working-directory: backend). - backend/storage_test.go: table-driven tests for addWavHeader (RIFF/ WAVE/fmt /data markers, fileSize == len(data)+36, little-endian byteRate/blockAlign math) and generateFilename (extension inference, take- prefix, uniqueness across calls). - backend/generator_test.go: table-driven tests for normalizeTags (alias->canonical mappings, case-insensitivity, no over-matching). Written against behavior so it survives the Phase 3 regex hoist. JSON-repair path (generator.go handler) is inline/not independently callable; deferred to the phase that touches that handler per the brief. No production code or dependencies changed.
PR #5 — Track B Phase 1 (CI workflow + Go unit tests) — ReviewExecutive SummaryClean vertical-slice gate: one CI workflow mirroring CriticalNone. RequiredNone. Nit / Optional
FYI
Positive Feedback
Test CoverageNew code paths (all three target helpers) covered. Only gap is the deferred JSON-repair path, documented and justified. Backward CompatibilityN/A — test files + one workflow only; no wire format, no production code. Final VerdictAPPROVE Gates run: verified PR diff via |
What
Track B Phase 1 — the code-health vertical-slice gate. Adds the Go CI workflow and the first layer of backend unit tests. Every later Track B phase is validated against this gate.
.github/workflows/go-test.yml—go build/go vet/go testonpull_requestand push tomain, mirroring siblingbanana-weather(setup-gowithgo-version-file: backend/go.mod,cache-dependency-path: backend/go.sum,working-directory: backend).backend/storage_test.goaddWavHeader— assertsRIFF/WAVE/fmt/datamarkers at their offsets,fileSize == len(data)+36, correct little-endianbyteRate/blockAlign/sampleRate/bitsPerSamplefields, and that the raw PCM payload is preserved verbatim.generateFilename— extension inference (wav/ogg/defaultmp3),take-prefix, uniqueness across 1000 calls.backend/generator_test.gonormalizeTags— each alias→canonical mapping, case-insensitivity, and no over-matching (already-canonical and non-tag substrings untouched). Written against behavior so it survives the planned Phase 3 regex hoist.Why
Findings F6: the backend had no automated tests and no CI gate. This establishes both, table-driven and with no network / no GCP creds, matching the sibling repo's pattern.
Deferred
The JSON-repair path (
generator.gohandler: stripjsonfence →json.Unmarshal) is inline in a handler and not independently callable. Per the brief it is not refactored in this phase; it is deferred to the phase that touches that handler.Scope
No production code or dependencies changed — test files + one workflow only. No model IDs / TTS logic touched (Track A boundary respected).
Local verification (
cd backend)go test -v ./...— all subtests PASS:TestAddWavHeader(3 subtests)TestGenerateFilename(7 subtests, incl. uniqueness)TestNormalizeTags(17 subtests)