From 0d8bf0f94c34ede3984af8e8e6c23ea0dfd1f47e Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 16:48:58 +0200 Subject: [PATCH] test: assertions the adversarial review found missing -- log lines, immediate saves, snapshot isolation, store and temp-file failures, bounded snippet, identical list (review F9) Co-Authored-By: Claude Sonnet 5.5 --- internal/uploads/worker_progress_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/uploads/worker_progress_test.go b/internal/uploads/worker_progress_test.go index b3d8e68..48c75c8 100644 --- a/internal/uploads/worker_progress_test.go +++ b/internal/uploads/worker_progress_test.go @@ -146,7 +146,7 @@ func TestWorkerProgress_TheHeartbeatBeatsWhileAnEngineCallIsStuckAndStopsWhenThe assert.Equal(t, after, r.st.beatCount(), "no heartbeat may outlive its job") } -func TestWorkerProgress_TheLogNamesEveryPhaseInOrderAndNeverTheTranscriptOrThePath(t *testing.T) { +func TestWorkerProgress_OnASuccessfulJobTheLogNamesEveryPhaseInOrderAndNeverTheTranscriptOrThePath(t *testing.T) { r := newWRig(t, time.Minute) r.tr.result = domain.Transcription{Text: "zebrakaka secret meeting words", Endpoint: "iguana/kb-whisper", AudioSeconds: 3} buf := &syncLog{} @@ -162,20 +162,22 @@ func TestWorkerProgress_TheLogNamesEveryPhaseInOrderAndNeverTheTranscriptOrThePa assert.Contains(t, out, "upload=a", "every line says which upload it is about") assert.NotContains(t, out, "zebrakaka", "no transcript text in the log") assert.NotContains(t, out, r.tmp, "no spool path, which carries the upload's identity, in the log") + assert.Contains(t, out, "upload transcribed", "the job's own summary line") + assert.Contains(t, out, "endpoint=iguana/kb-whisper", "which endpoint served it is a quality fact") } func TestWorkerProgress_AFailureLogsAKindNeverTheErrorTextOrThePath(t *testing.T) { tests := []struct { name string setup func(*wrig) - kind string + line string }{ {"conversion fails and names the spool file", func(r *wrig) { r.conv.err = errors.New("Error opening input file " + r.tmp + "/upload-a: Invalid data zebrakaka") - }, "kind=error"}, + }, "upload: convert"}, {"every engine fails and the gateway echoed a word", func(r *wrig) { r.tr.err = errors.New("gateway echoed: zebrakaka secret words") - }, "kind=error"}, + }, "upload: transcribe"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -189,7 +191,8 @@ func TestWorkerProgress_AFailureLogsAKindNeverTheErrorTextOrThePath(t *testing.T out := buf.String() assert.NotContains(t, out, "zebrakaka", "provider text or file contents in the log") assert.NotContains(t, out, r.tmp, "the spool path in the log") - assert.Contains(t, out, tt.kind) + assert.Contains(t, out, tt.line, "the failure must be logged at all, not only scrubbed") + assert.Contains(t, out, "kind=error") assert.Contains(t, out, "upload=a") }) }