From e38ea3175da05a59c8558135776fe1365a80985d 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/web/uploads_progress_handler_test.go | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/internal/web/uploads_progress_handler_test.go b/internal/web/uploads_progress_handler_test.go index a7d9305..0d325e2 100644 --- a/internal/web/uploads_progress_handler_test.go +++ b/internal/web/uploads_progress_handler_test.go @@ -229,16 +229,25 @@ func TestUploadProgress_ADoneJobKeepsItsRecordOfWhatWasDoneAndHowLongEachTook(t assert.NotContains(t, b, "spinner") } -func TestUploadProgress_TheFullPageRendersTheSameDisplayAsTheFragment(t *testing.T) { +// stepsBlock is the progress list of a page: from its opening tag to its closing one. +func stepsBlock(t *testing.T, html string) string { + t.Helper() + start := strings.Index(html, `
    ") + require.GreaterOrEqual(t, end, 0) + return html[start : start+end+len("
")] +} + +func TestUploadProgress_TheFullPageCarriesTheVerySameProgressListAsTheFragment(t *testing.T) { app, _ := newUploadApp(t, audioOK, 200<<20) fixedClock(app) id := seedUpload(t, userID, "m", "transcribing", "") seedProgress(t, id, twoEngineRun(), progressNow.Add(-10*time.Second), progressNow.Add(-4*time.Second)) - rec := do(t, app, get("/uploads/"+id)) + full := body(t, do(t, app, get("/uploads/"+id))) + fragment := statusBody(t, app, id) - require.Equal(t, 200, rec.Code) - b := body(t, rec) - assert.Contains(t, b, "Transcribing with iguana/kb-whisper", "the page a user opens, not only the polled fragment, shows the phases") - assert.Contains(t, b, "3m 12s") + assert.Equal(t, stepsBlock(t, fragment), stepsBlock(t, full), + "the page a user opens and the fragment HTMX swaps in must show the same list, or the display jumps on the first poll") }