carlos / platform Public

spec: edge page cache rev 4 after Astra round 3

Round 3 findings unedited. Waiters get pages only through the index's
Lookup after a successful Publish; far joins need a valid lease.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6e1ec7dc70edf7ccf00f1fed1edf2d3b35ad3a39 parent 4e634b3
2 files changed, +72 −12
  • docs/superpowers/specs/2026-11-08-edge-page-cache-design.md +44 −12
  • docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md +28 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
index 760a48f01..2ce4b1539 100644
--- a/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
+++ b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
@@ -1,6 +1,6 @@
# Edge page cache: design
-Status: draft rev 3, 2026-11-08. Branch `design-edge-page-cache`.
+Status: draft rev 4, 2026-11-08. Branch `design-edge-page-cache`.
Builds on the edge asset cache (`2026-10-24-edge-asset-cache-design.md`,
merged and armed on dev and flagship) and on today's `Carlos-Purge`
channel (`internal/edge/purge_header.go`, `internal/edge/purge.go`).
@@ -384,10 +384,19 @@ are totally ordered within the scope.
and lists the host (on a far box);
- the request may read it under §5.1.
Nothing else returns a stored page.
-- **Join(request).** Joins an in-flight render for the same key only
- when it isn't fenced. A fenced render stores nothing. The requests
- that were already waiting get its response, because they arrived
- before the clear did. Later requests start their own.
+- **Join(request)** (astra R3-1). A request may join an in-flight render
+ or fill for the same key only when two things hold:
+ - the flight isn't fenced;
+ - on a far box, the scope's lease is valid at the moment of joining,
+ under the same lock.
+
+ A waiter gets a stored page only through Lookup, after the flight's
+ Publish succeeds. Whatever ends a flight without a successful Publish
+ (fenced, refused, a 500, a redirect, no marker) sends every waiter
+ to make its own request: on the home to the app, on a far box as a
+ plain backhaul. Only the request that started the flight keeps the
+ in-flight exception of I1 (§8.4) and gets that flight's own response.
+ No waiter ever receives a response the index didn't admit.
**Where `valid-at` comes from:**
- **A home render:** the scope's sequence when the render started.
@@ -423,9 +432,9 @@ the sequence when the request started.
- **What clears it:** only the operator's switch turned off, or the
instance's route leaving this box. A restart or a new epoch keeps it.
-**Single-flight per key** (my call). A render that isn't kept (a 500, a
-redirect, no marker, or fenced) sends its waiters to the app for
-themselves, never an error or an empty body.
+**Single-flight per key** (my call) follows the index's Join (§6.1). A
+render that isn't kept sends its waiters to the app for themselves,
+never an error, an empty body, or the unkept response.
**Losing authority.** When the instance's route leaves this box, or the
page switch turns off, the box resets the scope **(astra R1-2)**. When
@@ -503,8 +512,9 @@ page caching armed on the far box and the request eligible:
- a validated sequence newer than the far box's applied sequence
refuses it.
- A refused fill's response is still served to the requests that
- carried it, and nothing is kept. When the acknowledgement was newer,
+ A refused fill's response goes only to the request that started the
+ fill, and nothing is kept. Its waiters make their own requests
+ (§6.1 Join). When the acknowledgement was newer,
the far box also renews in the background. Account, app and instance
come from the acknowledgement.
@@ -591,8 +601,11 @@ and instance (§8.5).
**Invariant I1.** Let a clear be applied at the home at time t. No
request that arrives at any edge after t + L is answered with a page the
-clear covers. A request that arrived before the clear reached that edge
-may still get the response already in flight for it.
+clear covers. The one exception is the request that started a render or
+fill, which gets that flight's own response (§6.1 Join). A flight
+started after t reaches the home after the clear and so carries
+post-clear content. Only a flight started before t can carry the old
+page, and its starter arrived before t.
**Why it holds:**
- **On the home:** the clear and every Publish and Lookup share the
@@ -720,6 +733,9 @@ Each slice changes something Paul can see (stopping rule 6).
- lost, delayed, duplicated and reordered pushes;
- renders and fills that straddle clears, with Publish delayed after
the file is written;
+ - round 3's timeline: an acknowledgement just before the clear, a slow
+ body, the lease expiring, a late request joining, and the push
+ arriving after t + L;
- box restarts and moves;
- switch and predicate flips, and the opt-in mark appearing mid-run;
- clock skew between boxes.
@@ -866,3 +882,19 @@ Both families recurred two rounds running, which triggers stopping rule
| **R2-5 (P3)** | Implementation accuracy | Corrected: the gzip copy is made at write time (§5.2) |
Round 3 is the last in the budget. A fourth needs Paul's go.
+
+**Round 3** (Astra, `CODEX-FINDINGS-PAGE-CACHE-R3.md`, rev 3 at
+4e634b3b). NOT READY, with one P1.
+- **Resolved:** R2-2, R2-3, R2-4 and R2-5.
+- **Partly resolved:** R2-1.
+- **R3-1 (P1), same family (I1):** §6.1's Join handed a fenced flight's
+ response to its waiters, and on a far box let a request join without a
+ valid lease. That contradicted §6.2.
+- **Resolution in rev 4:**
+ - a far box joins only under a valid lease;
+ - waiters get pages only through Lookup after a successful Publish;
+ - only the request that started a flight keeps its response;
+ - I1's exception is restated to match;
+ - the timeline is added to the simulation.
+
+The review budget is spent. Rev 4 has not been reviewed.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md
new file mode 100644
index 000000000..a6139a339
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md
@@ -0,0 +1,28 @@
+- **R2-1 — partly resolved, remains P1.** Publication is fenced on both home and far boxes; waiter delivery still permits the failure below.
+- **R2-2 — resolved.** The durable opt-in mark disables LRU lookup, including entries stored before opt-in.
+- **R2-3 — resolved.** The edges-file flag and host-scoped first renewal provide bootstrap without asset declarations.
+- **R2-4 — resolved.** Declared asset prefixes explicitly take precedence.
+
+Reviewed commit `4e634b3b1ac8bfe79b1013a69639db823c099402` on `design-edge-page-cache` against the merged authorities. No files changed, subagents spawned or tests run. R2-5’s compression correction is also resolved.
+
+1. **P1 — §§6.1, 6.2, 7.2 and 8.3–8.4: far waiters can receive a cleared response after the lease expires.**
+
+ **Problem and evidence:** The index’s `Lookup` checks lease validity, but `Join` checks only whether the flight is fenced. It explicitly gives a fenced flight’s response to existing waiters ([design:381](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:381)). Expired-lease renewal is specified for hits, leaving a miss joining an unfinished fill without that gate ([design:577](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:577)).
+
+ **Failure scenario:** With `L = 5 s`, a far fill obtains an acknowledgement for `/post` just before the home clears it at `t = 0`; its body is delayed. The far lease expires before `t = 5`. At `t = 6`, another request misses and joins the unfinished, unfenced fill. The delayed clear reaches the far box at `t = 7`, fencing that fill. At `t = 8`, publication correctly fails, but §6.1 delivers the old response to existing waiters—including the request arriving after `t + L`. These timings fit the inherited 10-second waiter timeout and 60-second fill deadline ([assetcatch.go:39](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:39), [assetcatch.go:193](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:193)).
+
+ §6.2 instead requires fenced waiters to make their own requests ([design:426](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:426)). That contradicts the central index contract; it does not establish one safe rule for the builder.
+
+ **Concrete fix:** Keep waiter delivery inside the index’s validity checks. Require a current lease before joining an existing far flight, and deliver shared results only through `Lookup`. A refused or fenced fill sends waiters through their own requests; only its original requester may retain the in-flight response exception. Reconcile §§6.1, 6.2 and 7.2 accordingly, and add the timeline above to the simulation. Existing asset coalescing already shares only admitted entries ([assetcatch.go:85](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:85)).
+
+ **Fault family:** **I1 — clears must fence pending publications and shared delivery.** The publication fix works, but the explicit waiter exception bypasses it.
+
+No additional P2 or P3 findings.
+
+**Builder questions, ranked**
+
+1. Which fenced-waiter contract governs: §6.1’s shared response or §6.2’s independent retry? Use independent retry consistently on home and far boxes, with lease validation covering joins and waiter delivery.
+
+Round 3 exhausts the review budget; another round requires Paul’s approval.
+
+**NOT READY**
\ No newline at end of file