spec rev 3 (Astra R1: status-time headers, proxied static cache) + R1 findings + R2 brief
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+167
−15
docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R1.md+23 −0docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R2.md+96 −0docs/superpowers/specs/2026-10-29-static-headers-design.md+48 −15
CI cancelled — superseded by a newer push — run details
Intent
Attributed to this commit: 11.6 g CO₂e (1,306,610 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on static-headers, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R1.md b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R1.md| new file mode 100644 |
| index 000000000..78f94fc59 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R1.md |
| @@ -0,0 +1,23 @@ |
| +1. **P1 — Section 4.3: a 412 retains `immutable`.** |
| + |
| + The design [sets headers before `ServeContent`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:185) and relies on its error handling. However, Go 1.26.10’s [`checkPreconditions`](/home/paulca/.local/go-dist/src/net/http/fs.go:652) writes 412 directly, without clearing headers. |
| + |
| + **Failure scenario:** request an existing `/1.0.0/fiesta.css` with `If-Match: "not-the-current-tag"`. The proposed implementation returns 412 with `Cache-Control: public, max-age=31536000, immutable`, despite serving no file bytes. This meets the brief’s explicit P1 criterion. Separately, [`serveError`](/home/paulca/.local/go-dist/src/net/http/fs.go:193) removes Cache-Control on a 416 but retains the four allowed cross-origin headers, contradicting the stated response scope. |
| + |
| + **Fix:** apply `_headers` overrides when the final status is known, only for 200, 206 and 304 from the successful-file branch. Preserve existing error behavior and the no-`_headers` behavior. Add production-wired tests for failing `If-Match`, unsatisfiable ranges, successful ranges, 304 and HEAD. |
| + |
| + **Fault family:** response-status isolation — file caching policy must not label an error response immutable. |
| + |
| +2. **P2 — Section 4.4: the blanket “no static response is stored today” claim is incorrect.** |
| + |
| + [`Reload`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:805) selects tunnel and fleet proxies before checking `Kind == "static"`; socket and address proxies also precede the [static handler](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:891). Those responses never receive `staticSite.ServeHTTP`’s default `no-cache`. The current [cache eligibility check](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2072) admits these routes, and [`maybeStore`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2184) can store their responses. |
| + |
| + **Failure scenario:** a ready static-kind route with a tunnel backend returns a cacheable 200 with `max-age=300`. Today subsequent requests can hit the shared cache; the proposed exclusion makes every request reach the backend, even without `_headers`. |
| + |
| + **Fix:** retain the approved static-kind exclusion, but qualify the no-op claim to responses produced by the local static-tree handler. Document the broader cache exclusion for proxied static-kind routes and test both lookup and storage bypass on that path. |
| + |
| + **Fault family:** compatibility accounting — route kind does not establish which handler produced the response. |
| + |
| +Reviewed the requested commit against the cited code and installed Go source. No files changed; no test suites run. |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R2.md b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R2.md| new file mode 100644 |
| index 000000000..edcb88db8 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R2.md |
| @@ -0,0 +1,96 @@ |
| +# Review brief: static-headers design (`_headers` for static sites), round 2 of 3 |
| + |
| +Repo carlos/platform, branch `static-headers`, commit named in the prompt. |
| +Under review: `docs/superpowers/specs/2026-10-29-static-headers-design.md`. |
| +Authorities: the code on `main` (a8b52609) — `internal/edge/static.go`, |
| +`internal/edge/redirects.go`, `internal/edge/edge.go` (ServeHTTP's |
| +`cacheable`, `maybeStore`, `writeCached`), `internal/edge/cache.go`, |
| +`internal/edge/assetadmit.go`, `internal/edge/assetcatch.go`, |
| +`internal/edge/compress.go`, `internal/console/apiship_assets.go`, |
| +`docs/site/cli.md`. Discussions #195 and #450 on amadan carlos/platform |
| +are the requests (summarised in the spec's section 1). Do not review |
| +against unmerged branches; if this work needs one, say so as a P1 and stop. |
| + |
| +You are an independent reviewer. Read the document, then the code it |
| +names, and check every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul approved the approach on 2026-10-29: one feature, a Netlify/Cloudflare |
| + format `_headers` file beside `_redirects`, covering both requests. |
| +- Calls the author made and wants checked, not re-litigated as taste: |
| + last-matching-rule-wins per header (not comma joining); a five-header |
| + allowlist; `Access-Control-Allow-Origin: *` only; no preflight; headers |
| + on 200-served files only; static routes taken out of the shared response |
| + cache. Report one only if it fails a stated goal or breaks something. |
| + |
| +## What to check |
| + |
| +1. Section 4.4: is taking `Kind == "static"` out of `cacheable` truly a |
| + no-op today (no static response ever stored, lookup and store both |
| + gated), and does it miss any path by which a static response with a |
| + `max-age` could still be stored or replayed to another visitor (tunnel / |
| + far-edge / backhaul paths, `viaTunnel` static routes, the hibernation |
| + branch, the asset catch)? |
| +2. Section 4.1: matching the pre-rewrite path. Check `serveTree`'s loop: |
| + is the pre-rewrite `p` and host the right input in every branch (the |
| + folder slash redirect, `/index.html` redirect, forced rules, rewrites |
| + onto a directory)? |
| +3. Section 4.3: which responses carry the headers. Check against |
| + `serveFile` and net/http's `ServeContent` (304, 206, 412, 416, HEAD) in |
| + the repo's Go toolchain. Anything that would carry `immutable` on a |
| + response that is not the file's bytes is a P1. |
| +4. Sections 3.1-3.4: is the syntax unambiguous enough to build, and does |
| + sharing the `_redirects` source parser and matcher work (the matcher's |
| + "/x/* matches /x" and trailing-slash behaviour; host-URL sources)? |
| +5. Compatibility (section 5): any existing behaviour of a site with no |
| + `_headers` that would change, header for header. |
| +6. Anything in the allowlist that could let a site set a header the |
| + platform owns or that changes a cache or security decision elsewhere |
| + in `internal/edge` (the compressor, the guard, analytics, usage |
| + metering). |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: `docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-R1.md` |
| +(round 1: one P1, the 412 carrying `immutable`; one P2, the proxied |
| +static-kind cache claim). The spec is now rev 3 and marks each fix |
| +**(R1-n)**. The round number counts every earlier review of this design. |
| + |
| +First give one line per P1 and P2 from round 1: resolved, partly, or not. |
| +Carry every unresolved or partly resolved finding forward at its current |
| +severity, then add new findings. The verdict covers everything |
| +outstanding, earlier rounds included. Check especially that the |
| +status-time writer in section 4.3 really leaves every non-200/206/304 |
| +answer header for header as it is today, and that it does not break the |
| +writer stack rules in AGENTS.md ("A ResponseWriter wrapper that edits |
| +headers needs its own header map"). |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section, the problem, the |
| +evidence (file:line, verified), the failure scenario, a concrete fix and |
| +the invariant or trust boundary it breaks (that is its fault family). End |
| +with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
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 fac688f7c..a39d1a8aa 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 2, 2026-10-29 (rev 2: builder check, two minor points in 3.4 and 4.3). 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)**). 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"). |
| @@ -182,17 +182,30 @@ an invalid `Access-Control-Allow-Origin`, so we do not. The docs say so. |
| ### 4.3 Which responses carry them |
| -The headers go on every answer that **serves a file from the tree under |
| -status 200**: the 200 itself, its 304 and 206, a `HEAD`, and a `_redirects` |
| -200 rewrite. They are set on the writer once `serveFile` has opened the file |
| -and before it calls `http.ServeContent` (not earlier: a file that fails to |
| -open answers 404, 403 or 500 and must carry none of them), so its 304 keeps them (net/http drops only |
| -`Content-Type`, `Content-Length` and `Content-Encoding` from a 304) and its |
| -errors are handled as net/http handles them. |
| - |
| -They do not go on redirects (a `_redirects` 3xx, the folder slash 301, the |
| -`/index.html` 301), on 404s (the tree's own and a `_redirects` 404 page), on |
| -the guard's refusals, or on 400/403/500. A 404 under `/1.0.0/*` marked |
| +The headers go on every answer that **serves a file's bytes from the |
| +tree**: a 200, a 206 and a 304 (and their `HEAD` forms), including a |
| +`_redirects` 200 rewrite. Nothing else gets them. **(R1-1)** |
| + |
| +They are applied **when the status is written**, not before. `serveFile` |
| +hands `http.ServeContent` a thin writer that, on the first `WriteHeader` |
| +(or the first `Write`, which implies 200), adds the matched headers to the |
| +header map and replaces `Cache-Control` only if the status is 200, 206 or |
| +304, then passes the call down. Every other status leaves the header map |
| +exactly as it would be with no `_headers` file. Setting them earlier is not |
| +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`, |
| +`Content-Length` and `Content-Encoding` from it. |
| + |
| +So they do not go on redirects (a `_redirects` 3xx, the folder slash 301, |
| +the `/index.html` 301), on 404s (the tree's own and a `_redirects` 404 page), |
| +on the guard's refusals, on a 412 or 416, or on 400/403/500. A 404 under `/1.0.0/*` marked |
| `immutable` would pin a typo in every browser for a year. |
| A matching `Cache-Control` rule **replaces** the default `no-cache` that |
| @@ -219,8 +232,21 @@ wrong place for these files: |
| So static routes are taken out of the shared cache structurally: the |
| `cacheable` computation in `Edge.ServeHTTP` gains `up.route.Kind != "static"` |
| -beside its existing `Kind != "status"` refusal. No static response is stored |
| -today, so this changes nothing for any site that exists. |
| +beside its existing `Kind != "status"` refusal, which gates both the lookup |
| +and the store. |
| + |
| +For a static route this box serves from its own tree this changes nothing: |
| +that handler sends `no-cache` on everything, so none of its answers was ever |
| +stored. **(R1-2)** A static-kind route can also be proxied: `Reload` picks a |
| +tunnel, fleet, socket or address proxy ahead of the static handler |
| +(`internal/edge/edge.go`, the `switch` before `case t.Kind == "static"`), and |
| +those answers do not pass through this box's `staticSite.ServeHTTP`. Today one |
| +of them carrying a positive `max-age` could be stored. After this change it |
| +is not, and every request reaches the box or backend behind it. That is |
| +intended: the same four reasons hold for those answers, and where the other |
| +side is another edge's static handler it sends `no-cache` today anyway. Tests |
| +cover lookup and store bypass on a proxied static-kind route as well as a |
| +local one. |
| The other edge cache, the declared-asset cache (`assetcatch.go`), is already |
| closed to static sites: the console refuses an `--assets` block on a static |
| @@ -236,6 +262,9 @@ handler, adds `Vary: Accept-Encoding` to what it compresses and honours a |
| - A tree with no `_headers` file: no change, header for header. A guard test |
| pins it. |
| +- A static-kind route this box proxies (tunnel, fleet, socket, address) no |
| + longer has its answers stored in the shared cache (section 4.4). This is the |
| + one behaviour change for a site that ships no `_headers`. |
| - A tree already deployed with a file named `_headers` (a site moved from |
| Netlify, say): after the roll its valid rules apply, its invalid lines are |
| logged and skipped, and the file is no longer served. That is the format's |
| @@ -257,7 +286,11 @@ Through the real `Edge.ServeHTTP` with a static route, not the handler alone |
| - Fiesta's file: `/1.0.0/fiesta.css` gets the immutable `Cache-Control` and |
| `*`; `/1/fiesta.css` (rewritten) gets `max-age=300`, not immutable. |
| -- A 304 and a `HEAD` carry the same headers as the 200. |
| +- A 304, a 206 and a `HEAD` carry the same headers as the 200. |
| +- A failed `If-Match` (412) and an unsatisfiable range (416) under a matching |
| + pattern carry none of them, and keep the headers they have today. |
| +- A proxied static-kind route (tunnel) is neither looked up nor stored in |
| + `e.cache`. |
| - A 404 and a redirect under a matching pattern carry none of them, and keep |
| `no-cache`. |
| - Last-rule-wins on a repeated header. |