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 <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto committed 2026-09-06 07:58:36 +00:00
1 parent d170de2095
commit e7b2e1ee55
1 file changed
+8 -13
@@ -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