fix: series removal sent its status line twice #176
Reference in New Issue
Block a user
Delete Branch "fix/series-remove-double-writeheader"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Every "Remove" press on
/admin/serieslogged:adminSeriesRemoveanswers the list surface with two fragments — the removed row, then the heading with the fresh count — and both went throughh.render, which sendsWriteHeadereach time. The middleware is only the last hop; it reports the caller frame, not the culprit.Cosmetic on the wire (htmx swaps both fragments fine), but it masks any real double-write behind a frame that points at the middleware.
Change
backend/internal/web/admin_series.go: the out-of-band heading executes straight ontowviah.tmpl.ExecuteTemplate, matchingwriteChromeOOB's existing convention in this package.h.renderstays for the row, which owns the status line.backend/web_test.go:TestRemoveFromListSendsOneStatusLineruns the router under a realhttptestserver with a capturedConfig.ErrorLog.httptest.ResponseRecordernever sees this warning, which is whyTestRemoveFromListAnswersRowAndFreshHeadingpassed through the bug.Verification
Reverted the handler fix with the test in place: fails with the exact production line. Restored: green.
go test ./...all green.