carlos / platform Public

review: round 1 findings and round 2 brief, fix-dbforward-reuse-1032

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev bd4c787e82c7d4ebc0eb0ea6ee80af761fca05cf parent 398e5f6
2 files changed, +93 −0
  • docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R1.md +24 −0
  • docs/superpowers/reviews/REVIEW-BRIEF-fix-dbforward-reuse-1032-R2.md +69 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R1.md b/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R1.md
new file mode 100644
index 000000000..09705c208
--- /dev/null
+++ b/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R1.md
@@ -0,0 +1,24 @@
+Astra round 1 on fix-dbforward-reuse-1032 at 6f2938d0: NOT READY.
+(Reconstructed from the reviewing session's transcript: the original
+output file was lost when the session's scratch directory was deleted.)
+
+1. P1: the remaining-byte counter races with early-answer cleanup
+ (internal/edge/edge.go ~2292). For an HA-forwarded upload larger than
+ the replay limit, finishEarlyAnswer's discard read (replay.go ~186)
+ overlaps the transport's pending read; both enter declaredBody.Read,
+ which reads and modifies `left` outside net/http's body lock. Fix:
+ serialise the whole wrapper Read; keep Close able to unblock a pending
+ read; add an overlapping-read test; run the early-answer tests under
+ -race.
+2. P2: the synthetic EOF bypasses HTTP/2 stream completion (edge.go
+ ~2278, ~2301): on HTTP/2 the declared bytes do not end the stream;
+ trailers and errors come on a later read; the store door
+ (storedoor.go ~293) could act before END_STREAM. Fix: restrict to
+ HTTP/1, or track a real underlying EOF; add HTTP/2 tests (delayed
+ END_STREAM, trailers, extra DATA).
+
+Confirmed: the HTTP/1 root cause against Go 1.26.10's source; HTTP/1 edge
+cases sound (chunked and zero length unchanged, short bodies keep
+io.ErrUnexpectedEOF, CL/TE handling, 100-continue, MaxBytesReader, Close).
+Census: Edge.ServeHTTP, declaredBody.Read and the internal/edge envelope
+rejected pending these fixes.
diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-fix-dbforward-reuse-1032-R2.md b/docs/superpowers/reviews/REVIEW-BRIEF-fix-dbforward-reuse-1032-R2.md
new file mode 100644
index 000000000..6dd41bde8
--- /dev/null
+++ b/docs/superpowers/reviews/REVIEW-BRIEF-fix-dbforward-reuse-1032-R2.md
@@ -0,0 +1,69 @@
+# Review brief: branch fix-dbforward-reuse-1032, round 2 of 3
+
+Repo carlos/platform, branch `fix-dbforward-reuse-1032` (tip in the prompt).
+Under review: the diff `origin/main...<tip>` (base a23423b7).
+Authorities: amadan #1032, AGENTS.md ("The census", "Stopping rules").
+
+You are the independent reviewer and census reviewer (card:
+`docs/superpowers/notes/census-proposal-fix-dbforward-reuse-1032.md`:
+Edge.ServeHTTP body change, new unit declaredBody.Read). This is the
+**tenant request path** of every edge.
+
+Claimed root cause: net/http's transport, after writing a request body's
+declared bytes upstream, reads once more to confirm EOF; on HTTP/1.1 the
+server closes the inbound request body when the response head is written;
+when the upstream streams its first line at once, the edge writes the
+head before that confirming read, the read gets "invalid Read on closed
+Body", and the transport closes the upstream connection mid-stream. The
+fix: Edge.ServeHTTP hands the drain tracker a request whose body reports
+EOF at its declared length (withDeclaredBodyEnd / declaredBody).
+
+## What to check
+
+1. Is the root cause right (read the Go 1.26.10 net/http transport and
+ server code it cites)? Is the fix complete for every edge proxy path
+ (unix, tcp, backhaul, multi, held, tunnel, WebSocket upgrade, asset
+ cache, page cache)?
+2. Correctness of declaredBody: ContentLength -1 / chunked bodies,
+ ContentLength 0, a client sending fewer bytes than declared (must
+ still error, not silently truncate), more bytes than declared,
+ Expect: 100-continue, request smuggling (CL/TE conflicts must still
+ be rejected as before), hijack/upgrade paths, GetBody/retries, body
+ size limits (MaxBytesReader) still enforced, Close semantics.
+3. Any behaviour change on a request path a tenant would notice?
+4. EnableFullDuplex was rejected (panics); demo_api.go and handoverExit
+ still use it: real risk to file?
+5. Tests: the new deterministic test fails on the old code; the
+ -count=20 runs and the 0/400 loop.
+6. Census verdicts.
+
+## Round 2
+
+Earlier rounds: round 1, Astra,
+`docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R1.md` (NOT
+READY: one P1, one P2). First give one line per round-1 P1 and P2:
+resolved, partly, or not. Carry unresolved ones forward, then add new
+findings. The verdict covers everything outstanding.
+
+Fix since round 1 (398e5f62): declaredBody.Read holds a mutex across the
+length checks, the inner Read and the decrement (Close does not take it,
+so it still unblocks a pending read); withDeclaredBodyEnd wraps HTTP/1
+requests only. New tests: TestDeclaredBodySerialisesOverlappingReads
+(-race) and TestEdgeLeavesAnHTTP2BodyToItsStream (trailers, END_STREAM
+after the answer starts, extra DATA); the early-answer tests pass under
+-race; the 400-run loop failed 0 of 400. Census re-proposed (card
+updated). Give fresh census verdicts at this tip.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+- **P2**: wrong or missing. Fixed without reopening this review (request
+ path and census changes in the fix still get a scoped check).
+- **P3**: clarity or polish. Follow-up list only.
+
+## Output
+
+Findings ranked P1, P2, P3 with file:line, failure scenario and fix, and
+the invariant each breaks. Then census verdicts. End with exactly one
+verdict: READY, READY AFTER FIXES, or NOT READY. Do not edit files, spawn
+reviewers or run full suites.