From e7b2e1ee55b60ed63a1d286c810de7ae3fdacee6 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 6 Sep 2026 07:58:36 +0000 Subject: [PATCH] test(openai): drop the audio snapshot nothing reads The mutex round the realtime transport double added a snapshot accessor for each recorded slice. Only the event one has a caller, so make lint refuses the build: realtime_doubles_test.go:64:25: func (*fakeTransport).recordedAudio is unused (unused) No spec has ever read the audio log, before the mutex or after it, so the accessor is deleted rather than nolinted and the struct comment says where the next one comes from. audioLog stays written, because a double that silently discarded what a coordinator sent it would be a different double. Assisted-by: Claude Opus 5 [claude-code] Signed-off-by: Ettore Di Giacinto --- .../endpoints/openai/realtime_doubles_test.go | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/core/http/endpoints/openai/realtime_doubles_test.go b/core/http/endpoints/openai/realtime_doubles_test.go index 0d7cc3fa6..4ad69a024 100644 --- a/core/http/endpoints/openai/realtime_doubles_test.go +++ b/core/http/endpoints/openai/realtime_doubles_test.go @@ -17,12 +17,14 @@ import ( // so streaming behaviour can be asserted without a real WebSocket/WebRTC peer. // It is not a *WebRTCTransport, so handler code takes the WebSocket path. // -// Every field is behind the mutex, and the recorded slices are read only -// through recordedEvents and recordedAudio. A real transport is written to by -// the response and turn coordinators' goroutines while the spec goroutine -// reads what has arrived so far, so a double that appended without a lock could -// not be driven the way production drives it. Both fields are named with a -// `Log` suffix so a raw read from another spec file does not compile. +// Every field is behind the mutex, and the events are read only through +// recordedEvents. A real transport is written to by the response and turn +// coordinators' goroutines while the spec goroutine reads what has arrived so +// far, so a double that appended without a lock could not be driven the way +// production drives it. Both fields are named with a `Log` suffix so a raw read +// from another spec file does not compile; audioLog has no reader yet, and the +// accessor for it is left to whichever spec first needs one, because an unread +// one does not build. type fakeTransport struct { mu sync.Mutex eventLog []types.ServerEvent @@ -60,13 +62,6 @@ func (f *fakeTransport) recordedEvents() []types.ServerEvent { return append([]types.ServerEvent(nil), f.eventLog...) } -// recordedAudio returns a snapshot of the audio chunks sent so far. -func (f *fakeTransport) recordedAudio() []fakeAudioChunk { - f.mu.Lock() - defer f.mu.Unlock() - return append([]fakeAudioChunk(nil), f.audioLog...) -} - // countEvents returns how many recorded events have the given type. func (f *fakeTransport) countEvents(et types.ServerEventType) int { n := 0