carlos / platform Public

spec rev 2 (builder check) + Astra R1 brief for static-headers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev df09f954b8e6490b820e281c53e5354325efe843 parent b0928a1
2 files changed, +87 −4
  • docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R1.md +80 −0
  • docs/superpowers/specs/2026-10-29-static-headers-design.md +7 −4
diff --git a/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R1.md b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R1.md
new file mode 100644
index 000000000..d08351165
--- /dev/null
+++ b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-R1.md
@@ -0,0 +1,80 @@
+# Review brief: static-headers design (`_headers` for static sites), round 1 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).
+
+## 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 e012fba8c..fac688f7c 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 1, 2026-10-29. Discussions #195 (item 2) and #450.
+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.
Branch `static-headers`. Review budget: at most three Astra rounds; the
review stops at the first round with no P1 (AGENTS.md, "Stopping rules").
@@ -145,7 +145,9 @@ so the count is kept small.
`loadRedirects` in `currentDir`, and carries the result in `servedTree`
with the redirect rules, so one request never pairs one version's files
with another's headers. A line it cannot use (only a tree packed by
- something else can hold one) is logged and skipped; the rest apply.
+ something else can hold one) is logged and skipped; the rest apply. A path
+ line it cannot use takes its header lines with it: they are skipped too,
+ never attached to the path line above.
- The edge never serves the `_headers` file itself: it is configuration, as
`_redirects` is (`serveTree`'s `found`).
@@ -182,8 +184,9 @@ an invalid `Access-Control-Allow-Origin`, so we do not. The docs say so.
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 before `serveFile` calls
-`http.ServeContent`, so its 304 keeps them (net/http drops only
+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.