Description
Summary
hasHTTPResponseWriterMethods requires all three methods (Header, Write, WriteHeader) with correct signatures to classify a type as http.ResponseWriter. This contract is correct but only tested implicitly — there are no edge case tests that verify partial matches are rejected or that near-miss signatures don't pass.
Missing Test Coverage
1. Partial method set (2 of 3 methods)
A type with Write([]byte) (int, error) and Header() but no WriteHeader should produce WriterOutput (it's an io.Writer) but not HTTPResponseWrite. No test fixture exercises this boundary.
2. Near-miss Write signatures
matchesWriteSignature verifies Write([]byte) (int, error) exactly. The following near-misses should all be rejected, but none are tested:
Write([]byte) int — missing error return
Write(string) (int, error) — wrong param type
Write([]byte) (int64, error) — wrong int type
Write([]byte, int) (int, error) — extra param
Suggested Fixtures
// PartialResponseWriter has Write + Header but no WriteHeader.
// Should produce WriterOutput, NOT HTTPResponseWrite.
type PartialResponseWriter struct{}
func (p *PartialResponseWriter) Header() http.Header { return nil }
func (p *PartialResponseWriter) Write(b []byte) (int, error) { return len(b), nil }
func HandlePartialRW(w *PartialResponseWriter) {
w.Write([]byte("ok"))
}
An internal test file (p1effects_internal_test.go) could also construct synthetic types.Signature values to unit test matchesWriteSignature directly against the near-miss cases without needing full package loading.
Rationale
These are defense-in-depth tests that lock down the contracts established in #109 and #132. The current implementation is correct, but without explicit edge case coverage a future refactor could silently break the boundary conditions.
Description
internal/analysis/p1effects.go→hasHTTPResponseWriterMethodsWriterOutputfalse positive: any method namedWriteis treated asio.Writer#109, Bug:isHTTPResponseWriteruses fragile string comparison instead oftypes.Implements#132 (discovered during review council analysis)Summary
hasHTTPResponseWriterMethodsrequires all three methods (Header,Write,WriteHeader) with correct signatures to classify a type ashttp.ResponseWriter. This contract is correct but only tested implicitly — there are no edge case tests that verify partial matches are rejected or that near-miss signatures don't pass.Missing Test Coverage
1. Partial method set (2 of 3 methods)
A type with
Write([]byte) (int, error)andHeader()but noWriteHeadershould produceWriterOutput(it's anio.Writer) but notHTTPResponseWrite. No test fixture exercises this boundary.2. Near-miss
WritesignaturesmatchesWriteSignatureverifiesWrite([]byte) (int, error)exactly. The following near-misses should all be rejected, but none are tested:Write([]byte) int— missing error returnWrite(string) (int, error)— wrong param typeWrite([]byte) (int64, error)— wrong int typeWrite([]byte, int) (int, error)— extra paramSuggested Fixtures
An internal test file (
p1effects_internal_test.go) could also construct synthetictypes.Signaturevalues to unit testmatchesWriteSignaturedirectly against the near-miss cases without needing full package loading.Rationale
These are defense-in-depth tests that lock down the contracts established in #109 and #132. The current implementation is correct, but without explicit edge case coverage a future refactor could silently break the boundary conditions.