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 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 16:48:58 +02:00
co-authored by Claude Sonnet 5.5
parent 5b3e550d9b
commit 0d8bf0f94c
+8 -5
View File
@@ -146,7 +146,7 @@ func TestWorkerProgress_TheHeartbeatBeatsWhileAnEngineCallIsStuckAndStopsWhenThe
assert.Equal(t, after, r.st.beatCount(), "no heartbeat may outlive its job") 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 := newWRig(t, time.Minute)
r.tr.result = domain.Transcription{Text: "zebrakaka secret meeting words", Endpoint: "iguana/kb-whisper", AudioSeconds: 3} r.tr.result = domain.Transcription{Text: "zebrakaka secret meeting words", Endpoint: "iguana/kb-whisper", AudioSeconds: 3}
buf := &syncLog{} buf := &syncLog{}
@@ -162,20 +162,22 @@ func TestWorkerProgress_TheLogNamesEveryPhaseInOrderAndNeverTheTranscriptOrThePa
assert.Contains(t, out, "upload=a", "every line says which upload it is about") 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, "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.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) { func TestWorkerProgress_AFailureLogsAKindNeverTheErrorTextOrThePath(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
setup func(*wrig) setup func(*wrig)
kind string line string
}{ }{
{"conversion fails and names the spool file", func(r *wrig) { {"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") 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) { {"every engine fails and the gateway echoed a word", func(r *wrig) {
r.tr.err = errors.New("gateway echoed: zebrakaka secret words") r.tr.err = errors.New("gateway echoed: zebrakaka secret words")
}, "kind=error"}, }, "upload: transcribe"},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
@@ -189,7 +191,8 @@ func TestWorkerProgress_AFailureLogsAKindNeverTheErrorTextOrThePath(t *testing.T
out := buf.String() out := buf.String()
assert.NotContains(t, out, "zebrakaka", "provider text or file contents in the log") 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.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") assert.Contains(t, out, "upload=a")
}) })
} }