spec rev 4: Astra R2 READY AFTER FIXES, three P2s applied; review closed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+61
−10
docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R2.md+36 −0docs/superpowers/specs/2026-10-29-static-headers-design.md+25 −10
CI cancelled — superseded by a newer push — run details
Intent
Human
<task-notification> <task-id>b1xuv020e</task-id> <tool-use-id>toolu_01L14Y6L15RAwGDALskcD273</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/0f246987-ca6b-4093-b104-f930443a8208/tasks/b1xuv020e.output</output-file> <status>completed</status> <summary>Background command "Push and run Astra round 2" completed (exit code 0)</summary> </task-notification>
diff --git a/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R2.md b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R2.md| new file mode 100644 |
| index 000000000..06e07581a |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R2.md |
| @@ -0,0 +1,36 @@ |
| +R1-1 (P1): **Resolved.** Applying overrides at status time excludes 412 and 416 while preserving their existing headers. |
| +R1-2 (P2): **Partly resolved.** The proxied-route exception and tests are added, but §4.4 still opens with the incorrect blanket claim. |
| + |
| +1. **P2 — §4.3: the proposed writer violates the required header-map ownership rule.** |
| + |
| + The [design:199](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:199) explicitly modifies the shared header map. [AGENTS.md:443](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/AGENTS.md:443) requires a header-editing wrapper to own its map; [compress.go:169](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/compress.go:169) explains the separation. |
| + |
| + **Failure scenario:** a builder follows §4.3 literally and implements a wrapper that fails this repository requirement. The status restriction itself fixes the original leak; I found no new wire-level corruption from these five overrides. |
| + |
| + **Fix:** specify a private map initialized from the underlying headers. Let `ServeContent` edit it, apply overrides only for 200/206/304, then synchronize it downward—including deletions—before forwarding the status. Preserve the existing compressor and meter order. |
| + |
| + **Fault family:** response-writer header ownership. |
| + |
| +2. **P2 — §4.3: `ResponseController` unwrapping does not preserve `io.ReaderFrom`.** |
| + |
| + The [design:201](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:201) says unwrapping is sufficient for both optional interfaces. Go’s [responsecontroller.go:26](/home/paulca/.local/go-dist/src/net/http/responsecontroller.go:26) provides no `ReaderFrom` operation; [io.go:414](/home/paulca/.local/go-dist/src/io/io.go:414) checks that interface directly. |
| + |
| + **Failure scenario:** wrapping a writer that implements `ReaderFrom` with an `Unwrap`-only wrapper hides that interface from `io.Copy`. Unwrapping also does not make a direct `http.Flusher` assertion succeed. |
| + |
| + **Fix:** explicitly omit `ReaderFrom` and let copying pass through `Write`, matching [gzipWriter](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/compress.go:178) and [countingWriter](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/usagemeter.go:98). Specify flush forwarding separately, ensuring an implicit 200 passes through the status hook before flushing. |
| + |
| + **Fault family:** response-writer interface preservation. |
| + |
| +3. **P2 — §4.4: finish the R1-2 qualification.** |
| + |
| + The [opening paragraph:217](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:217) still says no static response is stored today. Tunnel selection precedes the static handler at [edge.go:805](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:805), and current [cache eligibility:2072](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2072) admits static-kind routes. |
| + |
| + **Failure scenario:** a static-kind tunnel backend returns `max-age=300`; its response can currently be stored, contradicting that paragraph despite the correction below it. |
| + |
| + **Fix:** limit the opening claim to responses produced by the local static-tree handler. Retain the documented proxy behavior change and bypass tests. |
| + |
| + **Fault family:** compatibility accounting—route kind does not identify the producing handler. |
| + |
| +No P1 remains. Fix these P2s without reopening review. Reviewed commit `45a7e0533446cf9b94111b09ce2dedada1908fd1` against the specified base and Go 1.26.10 source. No files changed; no test suites run. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/docs/superpowers/specs/2026-10-29-static-headers-design.md b/docs/superpowers/specs/2026-10-29-static-headers-design.md| index a39d1a8aa..7aa0c651d 100644 |
| --- a/docs/superpowers/specs/2026-10-29-static-headers-design.md |
| +++ b/docs/superpowers/specs/2026-10-29-static-headers-design.md |
| @@ -1,6 +1,6 @@ |
| # Static sites: response headers by path (`_headers`) |
| -Status: draft rev 3, 2026-10-29 (rev 2: builder check, two minor points in 3.4 and 4.3; rev 3: Astra R1, findings marked **(R1-n)**). Discussions #195 (item 2) and #450. |
| +Status: draft rev 3, 2026-10-29 (rev 2: builder check, two minor points in 3.4 and 4.3; rev 3: Astra R1, findings marked **(R1-n)**; rev 4: Astra R2 READY AFTER FIXES, its three P2s marked **(R2-n)**. Review closed: no further rounds). Discussions #195 (item 2) and #450. |
| Branch `static-headers`. Review budget: at most three Astra rounds; the |
| review stops at the first round with no P1 (AGENTS.md, "Stopping rules"). |
| @@ -196,11 +196,25 @@ enough: net/http's `checkPreconditions` writes a 412 for a failed `If-Match` |
| straight to the writer with whatever headers are already set (Go 1.26 |
| `net/http/fs.go`), so `immutable` would ride a response that holds no file, |
| and `serveError` clears `Cache-Control` on a 416 but would leave the |
| -cross-origin headers. The writer only adds to the shared header map before |
| -the status goes down, so the compressor and the usage meter above it see an |
| -ordinary response. It must keep `io.ReaderFrom` and `http.Flusher` working |
| -as the writer below offers them (`http.ResponseController` unwrapping is |
| -enough). A 304 keeps the headers: net/http drops only `Content-Type`, |
| +cross-origin headers. The writer follows the rule in AGENTS.md ("A ResponseWriter wrapper that |
| +edits headers needs its own header map"): it keeps a **private header map**, |
| +cloned from the writer below when it is made, and its `Header()` returns that |
| +map, so `ServeContent`'s own edits (its 304 and error deletions included) land |
| +there. On the status it applies the overrides to the private map if the |
| +status is 200, 206 or 304, then makes the map below match the private one |
| +(additions, changes and deletions), then forwards `WriteHeader`. A header set |
| +after that is synced down the way `gzipWriter` does it |
| +(`internal/edge/compress.go`). The compressor above and the usage meter keep |
| +their order. **(R2-1)** |
| + |
| +It does **not** offer `io.ReaderFrom`: `io.Copy` goes through `Write`, as it |
| +does for `gzipWriter` and `countingWriter` (`internal/edge/usagemeter.go`), |
| +because an `Unwrap` method does not make a type assertion on `ReaderFrom` |
| +succeed. It implements `Flush` itself, writing an implicit 200 through the |
| +status hook first, and offers `Unwrap` for `http.ResponseController`. |
| +**(R2-2)** |
| + |
| +A 304 keeps the headers: net/http drops only `Content-Type`, |
| `Content-Length` and `Content-Encoding` from it. |
| So they do not go on redirects (a `_redirects` 3xx, the folder slash 301, |
| @@ -214,10 +228,11 @@ A matching `Cache-Control` rule **replaces** the default `no-cache` that |
| ### 4.4 The edge's shared response cache |
| -Today no static response is stored in the edge's shared LRU (`e.cache`, |
| -`internal/edge/cache.go`): `maybeStore` (`internal/edge/edge.go`) stores only |
| -a response with a positive `max-age`, and every static answer carries |
| -`no-cache`. A `_headers` `max-age` would change that, and the cache is the |
| +Today no answer from this box's own static-tree handler is stored in the |
| +edge's shared LRU (`e.cache`, `internal/edge/cache.go`): `maybeStore` |
| +(`internal/edge/edge.go`) stores only a response with a positive `max-age`, |
| +and that handler sends `no-cache` on everything. (A proxied static-kind route |
| +is another matter; see below.) **(R2-3)** A `_headers` `max-age` would change that, and the cache is the |
| wrong place for these files: |
| - a hit (`writeCached`) replays the stored 200 with no `Age` and no |