carlos / platform Public

review: Astra brief for static-site-geo-962, round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 565cbe67faee663c97b2f460941c71cfb05eeef4 parent 2edc14b
1 file changed, +130 −0
  • docs/superpowers/reviews/REVIEW-BRIEF-static-site-geo-962-R1.md +130 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-static-site-geo-962-R1.md b/docs/superpowers/reviews/REVIEW-BRIEF-static-site-geo-962-R1.md
new file mode 100644
index 000000000..d6d082a2f
--- /dev/null
+++ b/docs/superpowers/reviews/REVIEW-BRIEF-static-site-geo-962-R1.md
@@ -0,0 +1,130 @@
+# Review brief: branch static-site-geo-962 (visitor country for static sites), round 1 of 3
+
+Repo carlos/platform, branch `static-site-geo-962`, commit 2edc14b3dda274fc215b58a53eea3553f57261a3.
+Under review: the diff `origin/main..2edc14b3` (base f2cf2828fcbdd863e408a8b37b58529cbbdbb2ea).
+Authorities, all merged on main: `docs/superpowers/specs/2026-10-06-platform-geoip-design.md`
+(the X-Carlos-Geo-* headers, §8 trust rules, R4 "no per-app switch"),
+`docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`,
+`docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`,
+`docs/superpowers/specs/2026-11-10-linked-deployments-design.md`, and AGENTS.md
+(the census section, "A ResponseWriter wrapper that edits headers needs its own
+header map"). The request is discussion #962 on amadan (quoted below). 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 diff, then the code it touches
+(`internal/edge/edge.go` Edge.ServeHTTP in full, `internal/edge/geoipheaders.go`,
+`internal/edge/assetcatch.go`, `internal/edge/static.go`), and check every claim
+in the new comments, the commit message and the docs section against that code.
+
+The request (#962): a static site (no app code) needs its page script to learn
+the visitor's country, so a pricing page can default its currency. Expose the
+same answer the X-Carlos-Geo-* headers carry through a same-origin endpoint the
+edge answers itself. Constraints given: same lookup, trust rules and opt-outs
+as the headers; `Cache-Control: no-store, private` and `Vary: *`; never in the
+edge page cache or the asset cache; nothing logged or stored per visitor beyond
+normal request logs; no cookies; GET and HEAD only; tiny JSON; decide and state
+what happens to a site's own file at the path; work for static and app sites on
+every edge kind that serves sites (shared boxes, fleet edges, ingress) and
+behind custom domains; count it in analytics the way other edge-answered
+requests are, or not at all; provider-neutral (no new cloud calls).
+
+## Design as built (check it; do not re-argue the choices themselves)
+
+- Path `/.carlos/geo` (the platform's existing reserved prefix, beside
+ `/.carlos/gate`, `/.carlos/ha-drain`, `/.carlos/lb-health`), matched after
+ `path.Clean` (`isGeoPath`), so every spelling that cleans to it is reserved.
+- GET/HEAD: 200 `{"country":"GB","source":"GeoIP2-City"}`; both null unless the
+ answer is a hit with a country. Other methods: 405 with `Allow: GET, HEAD`.
+ Headers: `Cache-Control: no-store, private`, `Vary: *`, `nosniff`, JSON.
+- Geo off: there is no per-app or per-account switch (geoip spec R4), so "off"
+ means no database on the deployment; the answer is null (not 404).
+- Answered in Edge.ServeHTTP right after `planDisabledAdmit`, before the page
+ mark holder, the meter/observer defer, the guard, the password gate, the asset
+ catch, the page cache and the LRU. Not counted, billed or recorded, like the
+ load-balancer health, steering probe and HA control answers. Answered before
+ the password gate on purpose: it describes the visitor, not the site.
+- A linked (pinned) request is not answered; it goes on to the pinned app.
+- `farAssetCatch` skips the geo path, so a far edge never catches it under a
+ declared `/.carlos/` asset prefix; it is backhauled and the home answers from
+ the hop's geo.
+
+## What to check
+
+1. **Same answer as the headers on every arm.** For each way a request reaches
+ the answering line (direct ingress, verified backhaul hop, rejected hop, HA
+ front forward and HA ingress, tunnel hub for a `Tunnel` row, the tunnel
+ client side, a forward row (`IsForward`) on the hub, alias and catch-all
+ custom domains, a regional name, a door call, a demo route, a linked
+ request), is the JSON exactly what `WriteApp` would have put in the headers
+ for that request? Is there an arm that answers the geo path BEFORE
+ `decideGeo` runs, or one that would answer with this box's own lookup where
+ the headers would carry the ingress's?
+2. **Never cached or stored.** Can any cache (page cache, local or far asset
+ catch, the hop fill `serveAssetFillForHop`, the response LRU, the backhaul
+ path, a browser or shared cache downstream) store or replay this answer, or
+ replay an older stored copy from before this change (for example an asset
+ entry or LRU entry an app produced at `/.carlos/geo`)? Do any wrappers
+ between the client and `serveGeoAnswer` (gzip, recorders, the countingWriter,
+ the connection tracker, the gate, HTTP/2) alter or drop its headers?
+3. **Shadowing and reservation.** Is the rule "the edge always answers the
+ cleaned path; a site's file or an app's route there is never reached" what
+ the code does for static trees, apps, prefix-mapped hosts and gated hosts?
+ Any spelling that reaches the site's file anyway, or a spelling the edge
+ answers that a site could reasonably need?
+4. **Skipped checks.** Answering before the guard, the rate limit, the plan
+ throttle and the password gate: does that let anyone learn anything about a
+ site, wake an instance, bypass a lapse or import refusal, or cost the
+ platform more than the request it answers? Is anything per-visitor logged or
+ stored?
+5. **Tests.** `internal/edge/geoanswer_test.go`: do they go through the real
+ wiring (`New`, `Reload`, `EnableStatic`, `ServeHTTP`, the real MaxMind test
+ database), and would each fail if the behaviour it names broke? Name any
+ arm from item 1 without a test that matters.
+6. **Census** (AGENTS.md, "The census: the reviewer decides"). Card:
+ `docs/superpowers/notes/census-proposal-static-site-geo-962.md`. Give a
+ verdict for the unit `internal/edge/edge.go` `Edge.ServeHTTP` (class body,
+ read sites unchanged) and for the re-pinned envelope `internal/edge` (read
+ every changed function in the package: `geoanswer.go`, the `farAssetCatch`
+ hunk). Reject if the change lets root open, run, query or follow anything it
+ did not before from a path or input a tenant, an app or a box agent can
+ create, write or name; if it weakens a check, refusal, validation, argument
+ or environment the recorded basis relies on; or if the diff cannot settle
+ either. Otherwise approve, citing the lines you read.
+7. **Docs accuracy** (`docs/site/cli.md`, "The visitor's country in a static
+ page"): is every statement true of the code? The wording itself goes to Paul's
+ copy review; report only statements that are false or misleading.
+
+## 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 or task, 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). Then the census verdicts (item 6). 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.
+
+In round 3, a NOT READY also says whether the P1s share one cause, and
+whether refusing the case up front or cutting the feature would remove
+them.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites; a targeted
+`go test ./internal/edge/ -run 'TestGeoAnswer|TestIsGeoPath' -count=1` with
+`TMPDIR=/tmp/g` and `GOFLAGS=-buildvcs=false` is fine, with GOCACHE left unset.