spec: edge page cache, Astra round 2 findings (unedited)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+65
−0
docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md+65 −0
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md| new file mode 100644 |
| index 000000000..7563b6de0 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md |
| @@ -0,0 +1,65 @@ |
| +- **R1-1 — partly resolved, remains P1.** Home publication is fenced; far publication is not. |
| +- **R1-2 — resolved.** Refusing HA routes removes the reported holder-change failure; route departure ends the home epoch. |
| +- **R1-3 — partly resolved, remains P1.** New admissions are protected, but existing LRU entries survive enabling the switch. |
| +- **R1-4 — resolved.** The shared host predicate now governs home hits, acknowledgements and lease host lists. |
| +- **R1-5 — resolved.** A retained entry can be acknowledged at its validated sequence. |
| +- **R1-6 — resolved.** Request-bound signatures, renewal nonces, receiver limits and bounded state address the reported omissions. |
| + |
| +Reviewed `5421a0f0a605303a15460a973815547510a39740`, round 2 of 3, against the merged authorities. No files changed, subagents spawned or tests run. |
| + |
| +1. **P1 — §§7–8: a far fill can resurrect a cleared entry.** |
| + |
| + **Problem and evidence:** The atomic clear/publication rule is specified for the home in [design:345](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:345). Far admission instead checks `a` against `f` and then permits storage, without requiring that check and publication to be atomic with pushes and renewals ([design:412](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:412)). The reused store performs file work before publishing its index entry ([fill.go:474](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:474), [fill.go:563](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:563)). |
| + |
| + **Failure scenario:** A far fill passes `a == f == 0`. Before publication, clear 1 removes `/post` and advances the far box to sequence 1. The pending fill then publishes the old `/post`. Subsequent renewals report sequence 1 with no missing clears, so they do not remove it. New readers can receive it after `t + L`, potentially until its year-long expiry. |
| + |
| + **Concrete fix:** Apply one atomic transition rule on each far box to fill publication, clear application and lease resets. Under that lock, recheck epoch and complete clear-history coverage through the current sequence before indexing. Reject a fill when the required history has been discarded. Waiters must obtain entries through the same current-validity checks. |
| + |
| + **Fault family:** **I1 — a clear must fence pending publications.** Carry-forward of R1-1. |
| + |
| +2. **P1 — §§5.3 and 10: enabling page caching leaves personalised LRU entries readable.** |
| + |
| + **Problem and evidence:** The new LRU rule checks credentials on the *current request* ([design:308](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:308)). Switch handling only specifies retiring page entries ([design:569](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:569)). Existing LRU entries contain no credential provenance ([cache.go:44](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/cache.go:44)); admission ignores request cookies ([edge.go:2914](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2914)), and a no-`Vary` entry matches an anonymous request ([cache.go:129](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/cache.go:129)). |
| + |
| + **Failure scenario:** With the page switch off, a cookie-bearing request stores a personalised, unmarked response in the LRU. The operator turns page caching on. An anonymous page-store miss passes the new credential check and receives that retained response. A pre-enable request completing after an enable-time purge can recreate the problem. |
| + |
| + **Concrete fix:** Make enabling the switch an admission boundary for the LRU too. Invalidate all existing entries for the instance’s served hosts and fence admissions begun under the previous policy. Alternatively, tag entries and pending admissions with a policy generation and require a current, credential-safe generation at lookup. |
| + |
| + **Fault family:** **I2 — page-cache rejection must not expose a second shared-cache path.** Carry-forward of R1-3. |
| + |
| +3. **P2 — §§7–8: the first fill and lease have no defined bootstrap.** |
| + |
| + **Problem and evidence:** A fill must assert the instance and the far box’s lease epoch ([design:393](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:393)); a renewal must already name the instance ([design:528](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:528)). The design does not explain how a cold far box obtains those values. Today’s `AssetsFor` supplies its primary only through an asset block and refuses hosts without declared asset paths ([homemap.go:1190](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/homemap.go:1190)). |
| + |
| + **Failure scenario:** A blog declares no asset prefixes. A cold far box knows its host’s home, account and app, but cannot construct the required instance-bound renewal or epoch-bound fill. Reusing asset discovery would prevent the promised header-only adoption. |
| + |
| + **Concrete fix:** Define a cold-start exchange: for example, an authenticated host-scoped discovery/initial renewal whose answer supplies the authoritative instance, epoch and eligible hosts. Alternatively, publish the necessary instance identity through the existing edges-file channel. Specify the initial fill’s epoch semantics. |
| + |
| + **Fault family:** **Protocol completeness — cold readers must establish authoritative cache scope without an asset declaration or additional bucket polling.** |
| + |
| +4. **P2 — §§3, 5.2 and 6: page-marker precedence over the asset catcher is unresolved.** |
| + |
| + **Problem and evidence:** The design permits non-HTML page responses and places page lookup at the LRU position ([design:293](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:293), [design:335](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:335)). The asset catcher already handles declared paths and returns before that point ([edge.go:2596](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2596)). Meanwhile, §3 says the asset cache keeps its rules, and clears touch the page store and LRU ([design:233](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:233)). |
| + |
| + **Failure scenario:** A marked JSON feed falls under a declared asset prefix. The existing asset path handles it before page admission. Treating the marker as effective would promise page clears that cannot invalidate the asset copy; treating it as ineffective contradicts the unrestricted marker contract. |
| + |
| + **Concrete fix:** State which declaration wins. If asset paths are excluded, explicitly scope page eligibility and document the refusal. If the page marker wins, specify admission and lookup changes on both home and far asset paths, including treatment of existing asset entries. |
| + |
| + **Fault family:** **Cache ownership — an opted-in representation needs one unambiguous invalidation contract.** |
| + |
| +5. **P3 — §§2 and 5.2: assets are compressed at fill time, not serve time.** |
| + |
| + **Evidence and consequence:** [Design:296](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:296) says pages are compressed at serve time “as assets are.” Existing fills create the gzip copy during commit ([fill.go:432](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:432)); serving selects that stored copy ([assetserve.go:37](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetserve.go:37)). Following the description would introduce a different CPU/storage tradeoff. |
| + |
| + **Concrete fix:** Correct the description and state whether pages reuse stored gzip copies or deliberately compress per delivery. |
| + |
| + **Fault family:** Implementation accuracy. |
| + |
| +**Builder questions, ranked** |
| + |
| +1. How does a cold far box discover the authoritative instance and establish its first epoch when the app declares no assets? This determines the initial wire exchange. |
| +2. Does a page marker override an asset-prefix declaration, or are those paths excluded? This determines cache precedence and the scope of clearing. |
| + |
| +R1-1 and R1-3 recur in the same fault families across two rounds, so stopping rule 2 applies. Before another fix cycle, choose refusal of the problematic cases, removal of the offending paths, or central enforcement of each invariant with guard tests/simulation. I recommend central enforcement. |
| + |
| +**NOT READY** |
| \ No newline at end of file |