carlos / platform Public

review: Astra round 2 findings for fix-dbforward-reuse-1032 (READY)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d6db3bb9af001051ad514afd75177ba638647a87 parent bd4c787
1 file changed, +44 −0
  • docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R2.md +44 −0
diff --git a/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R2.md b/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R2.md
new file mode 100644
index 000000000..9f6e8bece
--- /dev/null
+++ b/docs/superpowers/reviews/FINDINGS-fix-dbforward-reuse-1032-R2.md
@@ -0,0 +1,44 @@
+Round-1 P1 — **resolved**: [edge.go:2305](/home/paulca/amadan.net/carlos/platform-fix-dbforward-reuse-1032/internal/edge/edge.go:2305) holds the mutex across the remaining-length checks, underlying read and decrement. `Close` remains delegated without taking that mutex.
+
+Round-1 P2 — **resolved**: [edge.go:2285](/home/paulca/amadan.net/carlos/platform-fix-dbforward-reuse-1032/internal/edge/edge.go:2285) excludes HTTP/2, preserving its END_STREAM, trailer and excess-DATA handling.
+
+Reviewed `origin/main...bd4c787e82c7d4ebc0eb0ea6ee80af761fca05cf`, with merge base `a23423b7c8b5f5c4105e7a797feaf4d88061054b`.
+
+**Findings:** no outstanding P1, P2 or P3 findings in the branch diff.
+
+The claimed HTTP/1 root cause is correct. Go 1.26.10’s [transfer.go:371](/home/paulca/.local/go-dist/src/net/http/transfer.go:371) copies the declared body length, then reads again for excess bytes. Its [server.go:1392](/home/paulca/.local/go-dist/src/net/http/server.go:1392) can consume and close the inbound body while emitting response headers. A subsequent body-read error makes the transport close the upstream connection, including an unfinished response. The wrapper prevents that confirming read from reaching the closed server body.
+
+The placement at [edge.go:2341](/home/paulca/amadan.net/carlos/platform-fix-dbforward-reuse-1032/internal/edge/edge.go:2341) covers TCP, Unix, multi-upstream, backhaul, HA forwarding, tunnel and upgrade dispatch. Linked requests also enter this point. Held-stream legs and asset fills construct bodyless requests; cache misses retain the wrapped request where they proxy it. Cache hits introduce no upstream body read. The earlier HA control-path return does not proxy.
+
+The body semantics remain sound:
+
+- Unknown-length, chunked, zero-length and HTTP/2 requests are unchanged.
+- A short HTTP/1 body retains the underlying `io.ErrUnexpectedEOF`. Non-EOF errors are preserved.
+- Excess HTTP/1 bytes remain subject to the server’s existing request framing; the wrapper cannot consume the next request.
+- Content-Length and Transfer-Encoding parsing still occurs before this helper. Go rejects conflicting duplicate lengths; for accepted chunked-plus-length requests it removes Content-Length and sets the length to `-1`, bypassing the wrapper.
+- `Expect: 100-continue` still reaches the original reader. `MaxBytesReader` still detects overflow because the wrapper permits reads beyond the configured limit whenever the declared body exceeds that limit.
+- `GetBody` and retry eligibility are unchanged. Existing replay paths create fresh readers.
+- `Close` still reaches the underlying body. Returning EOF after the declared bytes, including after closure, is the intended change.
+- Hijacking and upgraded connection I/O are unchanged.
+
+I found no unintended tenant-visible change. The intended difference is that an otherwise valid streaming response survives the transport’s trailing body check.
+
+The existing full-duplex calls need separate treatment. [handover.go:297](/home/paulca/amadan.net/carlos/platform-fix-dbforward-reuse-1032/internal/edge/handover.go:297) closes ordinary HTTP/1 connections and sets a cleanup deadline, avoiding normal keep-alive reuse. [demo_api.go:132](/home/paulca/amadan.net/carlos/platform-fix-dbforward-reuse-1032/internal/edge/demo_api.go:132) lacks equivalent cleanup guarantees. Its early-response/upload interaction merits a separate reproduction and follow-up; this patch does not establish that it is safe. I did not demonstrate a panic there, and enabling full duplex alone is insufficient evidence to report one.
+
+The deterministic streaming test correctly forces the old failure: it releases the trailing read only after the client receives response headers. Without the fix, that read reaches the closed inbound body. The new HTTP/2 tests exercise trailers, delayed END_STREAM and excess DATA; the overlapping-read test addresses the counter race.
+
+**Validation limitation:** I could not execute the tests. The prescribed invocation was blocked when Go attempted to update `go.mod`; a read-only-module retry was blocked creating its build directory. Consequently, the `-count=20`, race-test and 0/400 results remain author-reported, not independently reproduced. `git diff --check` passed, and the worktree remained unchanged.
+
+**Census verdicts at the reviewed tip:**
+
+| Unit or envelope | Verdict | Basis |
+|---|---|---|
+| `Edge.ServeHTTP`, lines 2322–3267 | APPROVE | The change at line 2341 installs an in-memory body wrapper. Existing routing, authorization and storage decisions remain intact. Retain `legacy / accepted-legacy`. |
+| `declaredBody.Read`, lines 2305–2320 | APPROVE | Reads only the existing request body, with serialized accounting. Adds no filesystem, registry, bucket or root-authority access. Accept `legacy / accepted-legacy`. |
+| `internal/edge` envelope | APPROVE | Reviewed both changed production functions and the new helper. No new root-controlled input or weakened trust boundary. |
+
+Both unit digests, their legacy fingerprints, the Linux source envelope and the complete legacy-seal chain match the proposal. The final seal is `72771689d131a1baeabf32439316ea924e595ab29d13bd7d8c664f1a71da9921`. This was a direct fingerprint verification, not execution of the census tests.
+
+Round 2 has no P1; the stopping rule ends the review here.
+
+READY
\ No newline at end of file