plan rev 2 (Astra plan R1: 2 P1 + 4 P2 applied) + R1 findings + R2 brief
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/plans/2026-10-29-static-headers.md+29 −37docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-plan-R1.md+65 −0docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-plan-R2.md+68 −0
CI passed — run details
Intent
subagents
<task-notification> <task-id>b62xp1mzr</task-id> <tool-use-id>toolu_01GkTAbBebWi1wRhJM4ZxCWg</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/0f246987-ca6b-4093-b104-f930443a8208/tasks/b62xp1mzr.output</output-file> <status>completed</status> <summary>Background command "Push and run the Astra plan review" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 17.1 g CO₂e (1,876,286 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/plans/2026-10-29-static-headers.md b/docs/superpowers/plans/2026-10-29-static-headers.md| index daec2eefc..d5e2e7978 100644 |
| --- a/docs/superpowers/plans/2026-10-29-static-headers.md |
| +++ b/docs/superpowers/plans/2026-10-29-static-headers.md |
| @@ -8,6 +8,8 @@ |
| **Tech Stack:** Go 1.26, `net/http`, the existing `internal/edge` test fixtures. |
| +**Plan rev 2** (Astra plan R1 NOT READY: 2 P1, 4 P2, all applied, marked *plan R1-n*). |
| + |
| **Spec:** `docs/superpowers/specs/2026-10-29-static-headers-design.md` (rev 4, review closed). Read it first; section numbers below are its. |
| ## Global Constraints |
| @@ -56,24 +58,26 @@ |
| - `func parseHeaders(data []byte) (*headerRules, error)`: usable rules plus an `errors.Join` naming each bad line as `line N: ...`. A bad path line drops its header lines too (spec 3.4). |
| - `func (hs *headerRules) lookup(host, p string) http.Header`: nil receiver or no match returns nil. Otherwise a fresh map, each matching rule's headers `Set` in file order (last wins). |
| -- [ ] **Step 1: Write the failing tests** in `headers_test.go`: |
| +- [ ] **Step 1: Factor `pathPattern` out of `redirects.go`, before any new test exists** (plan R1-1: Go compiles every test file in the package, so this check must run while the package has none that name `parseHeaders`). No behaviour change. Run `go test ./internal/edge/ -run 'Redirect|SPAFallback|DirectorySlash|StaticWithoutRedirects' -count=1`. Expected: PASS, unchanged. Commit: `edge: factor the _redirects source pattern out for reuse`. |
| +- [ ] **Step 2: Write the failing tests** in `headers_test.go`: |
| - `TestParseHeadersAcceptsTheSupportedForms`: the spec section 2 Fiesta file plus a host-URL path line, a tab-indented header line, a lowercase name (`cache-control: no-store`), CRLF line endings and a leading BOM. Assert 3 rules, `rules[0].set.Get("Cache-Control") == "public, max-age=31536000, immutable"`, and the lowercase name stored as `Cache-Control`. |
| - `TestParseHeadersRefusesWhatItCannotServe`, table of input → substring of the error: `Set-Cookie: a=b` → `not supported yet`; `X-Carlos-Version: x` → `not supported yet`; `Access-Control-Allow-Origin: https://a.example` → `*`; `Cross-Origin-Resource-Policy: anywhere` → `cross-origin`; `Cache-Control: max-age=1, ,` → `Cache-Control`; a header line before any path line → `before a path`; a path line with no header lines → `no headers`; `/a/*/b` path → `* must be the last segment` (the shared parser's message); `! Cache-Control` → `not supported`; a value with a control byte → `value`; a line with no colon → `Name: value`. |
| - `TestParseHeadersKeepsTheGoodLinesAroundABadOne`: a bad path line's header lines are not attached to the rule above it (`rules[0].set` has exactly its own header). |
| - `TestParseHeadersLimits`: 101 path lines → `more than 100`; a 2,049-character line → `longer than 2048`; 256 KiB + 1 → `the limit is`. |
| - `TestHeaderLookupLastRuleWins`: `/*` with `Access-Control-Allow-Origin: *` and `Cache-Control: no-store`, then `/1.0.0/*` with `Cache-Control: public, max-age=31536000, immutable`. `lookup("h", "/1.0.0/a.css")` has both headers, with the immutable value. `lookup("h", "/x")` has `no-store`. `(*headerRules)(nil).lookup` is nil. |
| - `TestParseHeadersComments`: an indented ` # note` line between two header lines is ignored (the rule has both headers); ` Cache-Control: max-age=60 # note` is refused with an error naming `Cache-Control`. |
| - - `TestPackDirRefusesABadHeadersFile`: mirrors `TestPackDirRefusesABadRedirectsFile` (`redirects_test.go:111`) with `_headers` holding `Set-Cookie: a=b`; error names `_headers` and `line`. |
| -- [ ] **Step 2: Run them and see them fail.** `go test ./internal/edge/ -run 'ParseHeaders|HeaderLookup|PackDirRefusesABadHeaders' -count=1`. Expected: build failure, `parseHeaders` undefined. |
| -- [ ] **Step 3: Factor `pathPattern` out of `redirects.go`.** No behaviour change. Run `go test ./internal/edge/ -run 'Redirect|SPAFallback|DirectorySlash|StaticWithoutRedirects' -count=1`. Expected: PASS, unchanged. |
| + - `TestPackDirRefusesABadHeadersFile`, table-driven, shaped like `TestPackDirRefusesABadRedirectsFile` (`redirects_test.go:111`). One case per class (plan R1-5): unsupported header (`Set-Cookie: a=b`), bad value (`Access-Control-Allow-Origin: https://a.example`), header line before any path line, path line with no header lines, bad path (`/a/*/b`), 101 path lines, a 2,049-character line, a 256 KiB + 1 file. Each error names `_headers`, and `line` for the per-line cases or `limit` / `more than 100` for the size cases. A good file packs. |
| +- [ ] **Step 3: Run them and see them fail.** `go test ./internal/edge/ -run 'ParseHeaders|HeaderLookup|PackDirRefusesABadHeaders' -count=1`. Expected: build failure, `parseHeaders` undefined. |
| - [ ] **Step 4: Implement `headers.go`.** Syntax as spec 3.1 (column 0 = path line; leading space or tab = header line split at the first `:`; blank and `#`-first lines skipped). One validator per allowed header, chosen by canonical name; an unknown name is `header %q is not supported yet`. Add the `_headers` branch to `PackDir` beside the `_redirects` one, same wording shape. |
| -- [ ] **Step 5: Run Step 2's command.** Expected: PASS. |
| -- [ ] **Step 6: Commit.** `git add internal/edge/headers.go internal/edge/headers_test.go internal/edge/redirects.go internal/edge/static.go && git commit -m "edge: parse _headers for static sites; ship refuses a bad one (#195, #450)"`. Set amadan task 986 Done. |
| +- [ ] **Step 5: Run Step 3's command and Step 1's.** Expected: PASS. |
| +- [ ] **Step 6: Commit.** `git add internal/edge/headers.go internal/edge/headers_test.go internal/edge/static.go && git commit -m "edge: parse _headers for static sites; ship refuses a bad one (#195, #450)"`. Set amadan task 986 Done. |
| -### Task 2: The edge serves `_headers` |
| +### Task 2: The edge serves `_headers`, and static routes leave the shared cache |
| **Files:** |
| -- Modify: `internal/edge/static.go` (`staticSite`, `servedTree`, `currentDir`, `served`, `serveTree`, `serveFile`) |
| +- Modify: `internal/edge/static.go` (`staticSite`, `servedTree`, `currentDir`, `served`, `serveTree`, `serveFile`), `internal/edge/edge.go` (the `cacheable` computation in `ServeHTTP`, and `maybeStore`'s doc comment) |
| + |
| +One task, not two (plan R1-2): with `_headers` giving a static file a positive `max-age`, the shared cache stores it and replays a 200 to a revalidation, so the 304 and 206 tests cannot pass until the cache exclusion is in. |
| - Create: `internal/edge/headerwriter.go`; tests in `internal/edge/static_headers_test.go` |
| **Interfaces:** |
| @@ -81,7 +85,7 @@ |
| - Produces: |
| - `staticSite.headers *headerRules` and `servedTree.headers *headerRules`, set in `currentDir` beside `redirects` by `func (s *staticSite) loadHeaders(dir, version string) *headerRules`, the same shape as `loadRedirects`. |
| - `serveFile(fp, p string, fi os.FileInfo, status int, extra http.Header, w http.ResponseWriter, r *http.Request)`: `extra` is the lookup result, nil for none. |
| - - `type headerWriter struct { http.ResponseWriter; hdr, extra http.Header; wroteHdr bool }` and `func newHeaderWriter(w http.ResponseWriter, extra http.Header) *headerWriter` (`hdr` = `w.Header().Clone()`). Methods: `Header()` returns `hdr`; `WriteHeader(status)`: 1xx syncs and forwards without latching; on the first final status, if 200, 206 or 304, `Set` each `extra` key into `hdr`; then sync down wholesale (as `gzipWriter.syncHeader`) and forward. `Write` calls `WriteHeader(200)` first if needed, then forwards. `Flush` does the same implicit 200, then flushes below if it is an `http.Flusher`. `Unwrap() http.ResponseWriter`. No `ReadFrom`. |
| + - `type headerWriter struct { http.ResponseWriter; hdr, extra http.Header; wroteHdr bool }` and `func newHeaderWriter(w http.ResponseWriter, extra http.Header) *headerWriter` (`hdr` = `w.Header().Clone()`). Methods: `Header()` returns `hdr`; `finish()` copies keys added to `hdr` after the status (trailers) down to the writer below, as `gzipWriter.syncTrailers` does (plan R1-3), called by `serveFile` in a `defer` once the writer exists; `WriteHeader(status)`: 1xx syncs and forwards without latching; on the first final status, if 200, 206 or 304, `Set` each `extra` key into `hdr`; then sync down wholesale (as `gzipWriter.syncHeader`) and forward. `Write` calls `WriteHeader(200)` first if needed, then forwards. `Flush` does the same implicit 200, then flushes below if it is an `http.Flusher`. `Unwrap() http.ResponseWriter`. No `ReadFrom`. |
| - [ ] **Step 1: Write the failing tests** in `static_headers_test.go`. Build the fixture through the real edge, as `TestEdgeServesStaticRouteWhenEnabled` does (`static_test.go:225`: `openReg`, `New`, `EnableStatic`, `Reload`), with `e.EnableCache(NewCache(DefaultCacheMaxEntries, DefaultCacheMaxBodyBytes))` on. Ship `1.0.0/fiesta.css` (larger than `minCompressSize`, so the compressor takes it), `1.0.0/index.html`, `index.html`, a `_redirects` of `/1/* /1.0.0/:splat 200` and the spec section 2 `_headers`. Name it `headersEdge(t, files map[string]string) (srv *httptest.Server, treeDir string)`, where `treeDir` is the extracted tree: the `cacheDir` given to `EnableStatic`, then `release.RouteAccount(rt)`, the app, and `siteDirOf(t, store, app, version)`. |
| - `TestStaticHeadersFiestaFile`: `GET /1.0.0/fiesta.css` → 200, `Cache-Control: public, max-age=31536000, immutable`, `Access-Control-Allow-Origin: *`, an `Etag`. `GET /1/fiesta.css` → 200, the same bytes, `Cache-Control: public, max-age=300`. `GET /index.html`'s page `/` → `Cache-Control: no-cache`, no `Access-Control-Allow-Origin`. |
| @@ -91,33 +95,20 @@ |
| - `TestStaticHeadersSurviveCompression`: `GET /1.0.0/fiesta.css` with `Accept-Encoding: gzip` and a body over the compressor's minimum → `Content-Encoding: gzip`, `Vary: Accept-Encoding`, and both `_headers` values. |
| - `TestStaticHeadersFileIsNotServed`: `GET /_headers` → 404. |
| - `TestStaticWithoutHeadersIsUnchanged`: the same tree with no `_headers`. For `/1.0.0/fiesta.css` (200, 304, 206, HEAD, 412, 416), `/missing` (404) and `/1.0.0` (301), the full response header set minus `Date` equals a golden captured on `main` before this task's code change. This test lives in its own file, `internal/edge/static_headers_golden_test.go`, with its own fixture (the real edge, no `_headers`) and a `-update-headers-golden` flag, so it compiles before any of this task's code exists. The golden is `internal/edge/testdata/static-headers-golden.json`. |
| - - `TestHeaderWriterKeepsItsOwnMap`: unit test on `newHeaderWriter` over an `httptest.ResponseRecorder`. A `Header().Set` before `WriteHeader` does not appear on the recorder's map until `WriteHeader`. A `Header().Del` of a key the recorder had is gone after `WriteHeader(200)`. `extra` is applied on 200, 206 and 304, not on 412. A `Write` without `WriteHeader` applies `extra`. `Flush` before any write applies `extra`. The writer does not satisfy `io.ReaderFrom`. |
| -- [ ] **Step 2: Capture the golden on the unchanged code.** With only `static_headers_golden_test.go` written (move `static_headers_test.go` aside under `$TMPDIR` for this one run), `go test ./internal/edge/ -run TestStaticWithoutHeadersIsUnchanged -update-headers-golden -count=1`. Put `static_headers_test.go` back, then run the rest and see them fail: `go test ./internal/edge/ -run 'StaticHeaders|HeaderWriter' -count=1`. Expected: build failure or FAIL on the missing headers. |
| + - `TestHeaderWriterKeepsItsOwnMap`: unit test on `newHeaderWriter` over an `httptest.ResponseRecorder`. A `Header().Set` before `WriteHeader` does not appear on the recorder's map until `WriteHeader`. A `Header().Del` of a key the recorder had is gone after `WriteHeader(200)`. `extra` is applied on 200, 206 and 304, not on 412. A `Write` without `WriteHeader` applies `extra`. `Flush` before any write applies `extra`. The writer does not satisfy `io.ReaderFrom`. A trailer declared with `Trailer: X-T` and set on `Header()` after `WriteHeader(200)` reaches the recorder after `finish()`. |
| + - `TestStaticWithMaxAgeIsNeverStoredInTheSharedCache`: `GET /1.0.0/fiesta.css` twice; between them, replace `treeDir/1.0.0/fiesta.css` on disk with other bytes (write a new file and rename it over, so the tag cache sees a new file). Assert the second answer has the new bytes and a new `Etag`. Then assert the exact key (`CacheKey{Host: "site.example.com", Method: "GET", Path: "/1.0.0/fiesta.css"}`) is absent: `e.cache.GetFor(key, req)` reports no hit (store bypass, plan R1-4). |
| + - `TestStaticIgnoresASeededSharedCacheEntry`: `e.cache.Put(key, "", &CachedResponse{StatusCode: 200, Header: http.Header{"Cache-Control": {"max-age=300"}}, Body: []byte("sentinel"), StoredAt: time.Now(), TTL: time.Minute})`, then `GET` the same URL: the answer is the file's bytes, not `sentinel` (lookup bypass, plan R1-4). |
| + - `TestProxiedStaticRouteBypassesTheSharedCache`: a backend `httptest.Server` answering `Cache-Control: public, max-age=300` with a counter in its body; register `registry.Route{Host: "site.example.com", Kind: "static", Addr: <backend host:port>, Status: "ready"}` (it takes the address arm of `Reload`'s switch, ahead of `case t.Kind == "static"`); shared cache on. Two GETs: the backend counted 2 and the key is absent. Then seed a sentinel as above: the next GET returns the backend's body. |
| +- [ ] **Step 2: Capture the golden on the unchanged code.** With only `static_headers_golden_test.go` written (move `static_headers_test.go` aside under `$TMPDIR` for this one run), `go test ./internal/edge/ -run TestStaticWithoutHeadersIsUnchanged -update-headers-golden -count=1`. Put `static_headers_test.go` back, then run the rest and see them fail: `go test ./internal/edge/ -run 'StaticHeaders|HeaderWriter' -count=1`. Expected: build failure (`newHeaderWriter` undefined). |
| - [ ] **Step 3: Implement `headerwriter.go`.** |
| -- [ ] **Step 4: Wire it in `static.go`.** Load in `currentDir` beside `loadRedirects`. In `serveTree`, compute `extra := tree.headers.lookup(requestHost(r.Host), p)` once, right after `p` is first cleaned and before the loop. Extend `found` to exclude `"/"+headersFile` as it excludes `_redirects`. Pass `extra` to `serveFile`. In `serveFile`, only in the `status == http.StatusOK` branch, after `os.Open` succeeds, `if extra != nil { w = newHeaderWriter(w, extra) }`. The non-200 branch (a `_redirects` 404 page) never gets it. |
| -- [ ] **Step 5: Run Step 2's command and the existing static suites.** `go test ./internal/edge/ -run 'StaticHeaders|HeaderWriter|StaticWithoutHeaders|Static|Redirect|SPAFallback|DirectorySlash|TagCache|PackDir' -count=1`. Expected: PASS. |
| -- [ ] **Step 6: Commit.** `git add internal/edge/headerwriter.go internal/edge/static.go internal/edge/static_headers_test.go internal/edge/static_headers_golden_test.go internal/edge/testdata/static-headers-golden.json && git commit -m "edge: static sites serve _headers on 200/206/304 by request path (#195, #450)"`. Set amadan task 987 Started (Task 3 finishes it). |
| -- [ ] **Step 7: Per-task review.** This task changes cache headers and a response writer, so it gets its own Astra review (AGENTS.md stopping rule 3), briefed from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, round 1 of 3, diff `<Task 1 tip>..HEAD`. |
| - |
| -### Task 3: Static routes leave the shared response cache |
| - |
| -**Files:** |
| -- Modify: `internal/edge/edge.go` (the `cacheable` computation in `ServeHTTP`, and the `maybeStore` doc comment's list of route refusals) |
| -- Test: `internal/edge/static_headers_test.go` |
| - |
| -**Interfaces:** |
| -- Consumes: `headersEdge` (Task 2). |
| - |
| -- [ ] **Step 1: Write the failing tests.** |
| - - `TestStaticWithMaxAgeIsNeverStoredInTheSharedCache`: with `headersEdge` and the shared cache on, `GET /1.0.0/fiesta.css` twice; between them, replace `treeDir/1.0.0/fiesta.css` on disk with other bytes (write a new file and rename it over, so the tag cache sees a new file) so a cache hit would return the old bytes. Assert the second answer has the new bytes and a new `Etag`. |
| - - `TestProxiedStaticRouteBypassesTheSharedCache`: a backend `httptest.Server` answering `Cache-Control: public, max-age=300` with a counter in its body; register `registry.Route{Host: "site.example.com", Kind: "static", Addr: <backend host:port>, Status: "ready"}` (it takes the address arm of `Reload`'s switch, ahead of `case t.Kind == "static"`); enable the shared cache; two GETs; assert the backend counted 2. |
| -- [ ] **Step 2: Run them and see them fail.** `go test ./internal/edge/ -run 'NeverStoredInTheSharedCache|ProxiedStaticRoute' -count=1`. Expected: FAIL (one stored hit each). |
| -- [ ] **Step 3: Add `&& up.route.Kind != "static"` to `cacheable`,** with a comment naming spec 4.4's four reasons in one line each, and add static to `maybeStore`'s "One refusal is NOT made here" paragraph. |
| -- [ ] **Step 4: Run Step 2's command and the cache suites.** `go test ./internal/edge/ -run 'NeverStoredInTheSharedCache|ProxiedStaticRoute|Cache' -count=1`. Expected: PASS. |
| -- [ ] **Step 5: Commit.** `git add internal/edge/edge.go internal/edge/static_headers_test.go && git commit -m "edge: static routes never enter the shared response cache (spec 4.4)"`. Set amadan task 987 Done. |
| -- [ ] **Step 6: Per-task review.** Cache change: its own Astra review, round 1 of 3. |
| +- [ ] **Step 4: Wire it in `static.go`.** Load in `currentDir` beside `loadRedirects`. In `serveTree`, compute `extra := tree.headers.lookup(requestHost(r.Host), p)` once, right after `p` is first cleaned and before the loop. Extend `found` to exclude `"/"+headersFile` as it excludes `_redirects`. Pass `extra` to `serveFile`. In `serveFile`, only in the `status == http.StatusOK` branch, after `os.Open` succeeds, `if extra != nil { hw := newHeaderWriter(w, extra); defer hw.finish(); w = hw }`. The non-200 branch (a `_redirects` 404 page) never gets it. |
| +- [ ] **Step 5: Run the new tests.** `go test ./internal/edge/ -run 'StaticHeaders|HeaderWriter|NeverStoredInTheSharedCache|SeededSharedCache|ProxiedStaticRoute' -count=1`. Expected: the header tests pass where no shared cache is involved; the revalidation, range and the three cache tests FAIL on stored hits. That is the evidence the exclusion is needed. |
| +- [ ] **Step 6: Add `&& up.route.Kind != "static"` to `cacheable`** in `Edge.ServeHTTP`, with a comment naming spec 4.4's four reasons in one line each, and add static to `maybeStore`'s "One refusal is NOT made here" paragraph. |
| +- [ ] **Step 7: Run the combined gate.** `go test ./internal/edge/ -run 'StaticHeaders|HeaderWriter|StaticWithoutHeaders|NeverStoredInTheSharedCache|SeededSharedCache|ProxiedStaticRoute|Static|Redirect|SPAFallback|DirectorySlash|TagCache|PackDir|Cache' -count=1`. Expected: PASS. |
| +- [ ] **Step 8: Commit.** `git add internal/edge/headerwriter.go internal/edge/static.go internal/edge/edge.go internal/edge/static_headers_test.go internal/edge/static_headers_golden_test.go internal/edge/testdata/static-headers-golden.json && git commit -m "edge: static sites serve _headers on 200/206/304 by request path; static routes leave the shared cache (#195, #450)"`. Set amadan task 987 Done. |
| +- [ ] **Step 9: Per-task review.** Cache headers, a response writer and the shared cache: its own Astra review (AGENTS.md stopping rule 3), briefed from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, round 1 of 3, diff `<Task 1 tip>..HEAD`. |
| -### Task 4: Docs |
| +### Task 3: Docs |
| **Files:** |
| - Modify: `docs/site/cli.md` (a `#### Response headers for a static site` section after the "Redirects for a static site" section, which ends before `#### Two builds at once`) |
| @@ -127,10 +118,11 @@ |
| - [ ] **Step 3: Write the approved text into `docs/site/cli.md`** and run `go test ./internal/docsite/ -count=1`. Expected: PASS (headings and links resolve). |
| - [ ] **Step 4: Commit.** `git add docs/site/cli.md && git commit -m "docs: _headers for static sites"`. Set amadan task 988 Done. |
| -### Task 5: Census, whole-branch review, merge |
| +### Task 4: Census, whole-branch review, merge |
| - [ ] **Step 1: Push and read CI.** `git push origin static-headers` (sandbox off for the push). Read the amadan run. |
| - [ ] **Step 2: Census.** If `TestPlan14RootReadCensus` fails: `make census-card`; write `docs/superpowers/notes/census-static-headers-claims.md` (`<file>:<unit><TAB><what changed>` per unit); `make census-propose NAME=static-headers CLAIMS=docs/superpowers/notes/census-static-headers-claims.md`; brief Astra with the card and `git diff origin/main...HEAD` for the named files; record the verdict, reviewer and tip on #280. Decisions or escalations go to Paul; approvals do not. |
| - [ ] **Step 3: Whole-branch Astra review,** round 1 of 3, diff `origin/main...HEAD`, brief from the template. Stop at the first round with no P1; apply that round's P2s. |
| -- [ ] **Step 4: Merge.** `amadan branch merge carlos/platform static-headers -squash -expect <tip>` with the full commit message (what, reviews, census, "Not released"). Never a bare `amadan branch merge`. Set amadan task 989 Done. |
| -- [ ] **Step 5: Tell the requesters.** Reply on #195 and #450: merged, not released; it reaches sites with the next release roll (dev, then flagship). Task 990 stays Started until the roll. |
| +- [ ] **Step 4: Final push and green tip** (plan R1-6). Commit the census overlay, card and claims and every review fix; `git push origin static-headers`; update the branch description (`amadan branch describe`); wait for the amadan CI run on that exact full SHA to be green. That SHA is the `-expect` value. |
| +- [ ] **Step 5: Merge, on Paul's go.** `amadan branch merge carlos/platform static-headers -squash -expect <tip>` with the full commit message (what, reviews, census, "Not released"). Never a bare `amadan branch merge`. Set amadan task 989 Done. |
| +- [ ] **Step 6: Tell the requesters.** Reply on #195 and #450: merged, not released; it reaches sites with the next release roll (dev, then flagship). Task 990 stays Started until the roll. |
diff --git a/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-plan-R1.md b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-plan-R1.md| new file mode 100644 |
| index 000000000..43ebb30c5 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-plan-R1.md |
| @@ -0,0 +1,65 @@ |
| +Reviewed `c9c260afa1f3afeb156825cbbbd3ef22361d0778` against spec rev 4 and the named code at `a8b52609`. No files changed, subagents spawned, or tests run. |
| + |
| +1. **P1 — Task 1, Step 3: the redirect regression command cannot compile.** |
| + |
| + [Steps 1–3](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:59) create tests referencing `parseHeaders` and `headerRules`, explicitly expect undefined-symbol failures, then require the redirect tests to pass before Step 4 defines those symbols. `-run` selects execution, not compilation: Go compiles all package test files ([Go source:64](/home/paulca/.local/go-dist/src/cmd/go/internal/test/test.go:64)). |
| + |
| + **Failure scenario:** following the steps leaves `headers_test.go` uncompilable during the supposedly passing regression check. |
| + |
| + **Fix:** factor and verify `pathPattern` before adding the new tests, or temporarily move the new test file aside for that check. |
| + |
| + **Fault family:** test checkpoints must have their compilation prerequisites. |
| + |
| +2. **P1 — Task 2, Step 5: revalidation cannot pass until Task 3’s cache exclusion exists.** |
| + |
| + [Task 2:86](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:86) enables the shared cache and requires a 200 followed by an `If-None-Match` request returning 304. Static routes remain eligible at [edge.go:2072](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2072); their new positive `max-age` permits storage at [edge.go:2191](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2191). A hit replays the stored status and body without checking conditions ([edge.go:2479](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/edge.go:2479)). |
| + |
| + **Failure scenario:** the initial GET stores a 200; revalidation returns that 200, failing Task 2’s required passing gate. A subsequent range request can likewise receive the cached 200. |
| + |
| + **Fix:** combine Tasks 2 and 3 into one implementation checkpoint: demonstrate the cache failures after header wiring, apply the exclusion, then run the combined passing gate before committing and reviewing. |
| + |
| + **Fault family:** static conditional responses must reach the file handler. |
| + |
| +3. **P2 — Task 2, Steps 3–4: late-header synchronization is missing.** |
| + |
| + The complete writer interface at [plan:84](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:84) only synchronizes headers at status time. Neither its implementation step nor its wiring adds finalization. The approved [spec:205](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:205) explicitly requires late additions to propagate, following [gzipWriter.finish:266](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/internal/edge/compress.go:266). |
| + |
| + **Failure scenario:** a declared trailer assigned after `WriteHeader` remains in the private map and never reaches the underlying writer. Current `ServeContent` need not emit trailers for this to be a missing specified contract. |
| + |
| + **Fix:** specify trailer synchronization on completion, wire it with a defer around serving, and add a test assigning a trailer after the final status. |
| + |
| + **Fault family:** response-writer header ownership and late-header propagation. |
| + |
| +4. **P2 — Task 3, Step 1: the tests do not independently prove lookup and storage exclusion.** |
| + |
| + Both tests at [plan:112](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:112) start empty and infer bypass from two requests reaching the handler. The [spec:263](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:263) requires both lookup and store bypass. |
| + |
| + **Failure scenario:** disabling only storage makes both tests pass while lookup remains active. Conversely, disabling only lookup also passes while responses continue being stored. |
| + |
| + **Fix:** retain these behavioral checks, assert the exact cache key remains absent after serving, and separately seed a live sentinel entry with `Cache.Put` before requesting the same key. Assert the handler’s response wins for both local and proxied static routes. |
| + |
| + **Fault family:** independent enforcement of cache admission and retrieval. |
| + |
| +5. **P2 — Task 1, Step 1: ship-refusal coverage omits required error classes.** |
| + |
| + [Plan:66](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:66) exercises `PackDir` only with an unsupported header. Other invalid inputs are tested directly against the parser. [Spec:317](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/specs/2026-10-29-static-headers-design.md:317) requires ship-level tests for bad values, misplaced header lines, empty blocks, and limits too. |
| + |
| + **Failure scenario:** a regression that mishandles one parser-error category at the packing boundary can pass the planned tests. |
| + |
| + **Fix:** make the `PackDir` test table-driven across the specified categories, checking `_headers` and the applicable line or limit diagnostic. |
| + |
| + **Fault family:** ship-time validation must reject every invalid configuration class. |
| + |
| +6. **P2 — Task 5, Steps 2–4: final changes are never explicitly committed, pushed, and gated.** |
| + |
| + The only push occurs before census generation and review fixes ([plan:132](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/docs/superpowers/plans/2026-10-29-static-headers.md:132)). The plan then proceeds directly to merge. [AGENTS.md:185](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/AGENTS.md:185) requires green CI on the exact tip. |
| + |
| + **Failure scenario:** generated census files or review fixes remain local, while the remote branch still has its earlier failing census run; the merge is refused. |
| + |
| + **Fix:** add an explicit final commit/push step for census and review changes, update the branch description, and wait for green CI on the full SHA supplied to `-expect`. |
| + |
| + **Fault family:** the reviewed, tested, and merged revisions must agree. |
| + |
| +The proposed address-backed static route reaches the intended cache path. The file-replacement technique detects replayed bytes, and the separate golden fixture can compile before Task 2’s implementation. |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-plan-R2.md b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-plan-R2.md| new file mode 100644 |
| index 000000000..5018f2fa6 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-REVIEW-BRIEF-static-headers-plan-R2.md |
| @@ -0,0 +1,68 @@ |
| +# Review brief: static-headers implementation plan, round 2 of 3 |
| + |
| +Repo carlos/platform, branch `static-headers`, commit named in the prompt. |
| +Under review: `docs/superpowers/plans/2026-10-29-static-headers.md`. |
| +Authority: the spec beside it, `docs/superpowers/specs/2026-10-29-static-headers-design.md` |
| +rev 4, whose review is CLOSED (Astra R1 and R2 findings files in |
| +`docs/superpowers/reviews/`). Paul approved the spec on 2026-10-29. Check |
| +the plan against the spec and against the code on `main` (a8b52609) it |
| +names: `internal/edge/static.go`, `redirects.go`, `redirects_test.go`, |
| +`static_test.go`, `static_cache_test.go`, `compress.go`, `edge.go`, |
| +`cache.go`, `internal/docsite`. |
| + |
| +You are an independent reviewer. Do not re-review the spec's decisions. |
| + |
| +## What to check |
| + |
| +1. Does every spec requirement have a task, and does any task contradict |
| + the spec (sections 3.1-3.4, 4.1-4.4, 5, 7)? |
| +2. Will the named tests compile and fail for the stated reason before the |
| + code, and pass after? Especially the golden in Task 2 (captured before |
| + the code change), the proxied static route in Task 3 (does a |
| + `Kind: "static"` row with `Addr` really take `Reload`'s address arm and |
| + reach the `cacheable` check?), and the cache-bypass test's way of |
| + proving a hit. |
| +3. Are the interfaces between Tasks 1-3 consistent (names, signatures)? |
| +4. Does the `pathPattern` factoring keep every existing `_redirects` error |
| + string and behaviour (`redirects_test.go`)? |
| +5. Any step a builder could not execute as written. |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: `docs/superpowers/reviews/ASTRA-FINDINGS-static-headers-plan-R1.md` |
| +(2 P1, 4 P2). The plan is now rev 2 and marks each fix *plan R1-n*; Tasks 2 |
| +and 3 were merged into Task 2, so Docs is Task 3 and Census/merge Task 4. |
| + |
| +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. |
| + |
| +## 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 task and step, 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. |