plan: edge page cache slice 1, final whole-branch review findings
Astra's round-1 merge review, unedited.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-1-FINAL-R1.md+125 −0
CI failed — run details
Intent
<task-notification> <task-id>ac41d4461b6421881</task-id> <tool-use-id>toolu_01PkNf3wVLkNeS6pAuG1TvrH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/d79ef2b4-4291-4945-bd45-b3f16796c4ba/tasks/ac41d4461b6421881.output</output-file> <status>completed</status> <summary>Agent "Apply corrected copy EPC-4/13/16" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: done. The commit is in place, but git printed a lock error while making it. - **Commit:** 039f23f8 `docs, cli: corrected page cache copy (EPC-4, 13, 16)`, with the house trailer (Claude Opus 5.5, as the house rules file specifies). It is HEAD on edge-page-cache-1. - **Tests:** `go test . -run 'ApprovedPageCacheCopy|SetPages'` passes. I ran it outside the sandbox with a short TMPDIR, because inside it the CLI tests abort on the `~/.carlos/config` check. `go test ./internal/docsite` passes. - **Report:** written to `.superpowers/sdd/2026-11-08-edge-page-cache-plan-1-home/copy-fix-report.md`. Concerns: - **Git lock:** `git commit` printed "Unable to create packed-refs.lock: File exists". The commit still landed. An empty `/home/paulca/amadan.net/carlos/platform/.git/packed-refs.lock` (timestamped 08:15) is still there. It may be from the other reviewer or the sandbox, so I left it alone. - **Extra test edit:** `pages_cli_test.go` pinned the old EPC-4 wording, so I updated that line to the approved text. - **Untracked file:** `docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-1-FINAL-R1.md` was already untracked before I started. I did not touch it.</result> <usage><subagent_tokens>45569</subagent_tokens><tool_uses>6</tool_uses><duration_ms>70600</duration_ms></usage> </task-notification>
Attributed to this commit: 37.6 g CO₂e (4,928,867 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on edge-page-cache-1, 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/CODEX-FINDINGS-PAGE-CACHE-1-FINAL-R1.md b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-1-FINAL-R1.md| new file mode 100644 |
| index 000000000..c53be4bc1 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-1-FINAL-R1.md |
| @@ -0,0 +1,125 @@ |
| +Reviewed `507193bb..c08469a8`, whole-branch round 1. Findings below are source-verified; I did not run tests. Worktree and HEAD remain unchanged. |
| + |
| +**P1** |
| + |
| +1. **Moving an instance behind a tunnel does not reset its cached pages.** |
| + Location: [pagecache.go:100](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/pagecache.go:100). |
| + |
| + `applyPageRoutes` resets only when `pageRowEligible` fails. That predicate ignores tunnel dispatch, although request eligibility separately rejects `up.viaTunnel` at line 213. Reload can move an existing instance onto a tunnel while retaining its row, build and config; this also retires its local process ([edge.go:1253](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/edge.go:1253)). |
| + |
| + **Failure scenario:** cache a page locally, move serving behind a tunnel, change content and clear it on the remote serving box, then restore local serving with unchanged build/config. The old local entry survives and becomes a hit again, potentially for its year-long lifetime. Neither process retirement nor the page sweep resets it. |
| + |
| + **Fix:** include the resolved serving route’s loss of local eligibility in reload invalidation. Reset pages and fence outstanding tickets while retaining the opt-in mark for temporary ineligibility. Add a local → tunnel → local regression with unchanged inputs. |
| + |
| + **Boundary:** home authority and Task 9’s reset-on-ineligibility rule. |
| + |
| +**P2** |
| + |
| +2. **`all` can still purge a replacement instance’s primary-host LRU entries.** |
| + Locations: [purge_header.go:757](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/purge_header.go:757), [purge.go:187](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/purge.go:187). |
| + |
| + Both channels unconditionally call `PurgeHost` on the original hostname before validating the expanded hosts. The page scope is pinned correctly; the primary-host LRU purge is not. |
| + |
| + **Failure scenario:** A’s response or control listener survives reassignment of its hostname to B. B fills an unmarked LRU entry. A sends `all` and deletes B’s entry. The replacement-instance test explicitly exempts this primary-host behaviour at [pageclear_test.go:483](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/pageclear_test.go:483). |
| + |
| + **Fix:** make LRU eviction ownership-aware, including the primary, with ownership validation protected against concurrent reload. Extend both replacement tests to assert B’s primary LRU survives. |
| + |
| + **Boundary:** purge authority. This is the same family recorded in both Task 8 fix rounds; stopping rule 2 applies before another fix cycle. |
| + |
| +3. **Demo responses omit the required cache diagnostic.** |
| + Location: [demo_traffic.go:325](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/demo_traffic.go:325). |
| + |
| + This path installs the marker holder but proxies through `appWriter` without `pageDiagnostics(...).wrap(...)`. |
| + |
| + **Failure scenario:** a demo instance returns a valid marker; the marker is stripped, but the visitor receives no `Carlos-Cache: bypass`. |
| + |
| + **Fix:** install the diagnostic-only wrapper and cover the production demo path, including marker stripping. |
| + |
| + **Boundary:** Global Constraints’ diagnostic contract for every marked response. |
| + |
| +4. **Two approved messages describe behaviour the implementation does not provide.** |
| + Locations: [instances_pages.go:67](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/instances_pages.go:67), [cli.md:1214](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/docs/site/cli.md:1214). |
| + |
| + - “Every request reaches the app” after `set-pages off` is false: clearing the mark restores the LRU, explicitly tested at [pagecache_reload_test.go:192](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/pagecache_reload_test.go:192). |
| + - The clearing paragraph gives header-style path semantics for both channels. The socket actually clears an exact `(path, query)` through `TargetURL`, including when query is empty ([purge.go:198](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/purge.go:198)). |
| + |
| + **Failure scenario:** an operator expects caching to be disabled, or an app expects a socket purge of `/p` to remove `/p?x=1`; neither happens. |
| + |
| + **Fix:** correct the approved copy and its assertions. Explain the socket’s separate `path`/`query` fields and exact-match behaviour. |
| + |
| + **Boundary:** operator and app-facing contracts. |
| + |
| +5. **Two required test witnesses do not exercise their claimed boundary.** |
| + Locations: [store_test.go:566](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/assetcache/store_test.go:566), [pagearm_test.go:87](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/host/pagearm_test.go:87). |
| + |
| + `TestDeleteConcurrentWithGet` derives both key and operation from the same parity: each key gets only Gets or only Deletes. `TestAgentWiresCurrentInputs` calls the helper directly, so removing the production call leaves it passing. |
| + |
| + **Failure scenario:** a same-key concurrency regression or disconnected production inputs hook escapes these tests. |
| + |
| + **Fix:** exercise Get/Delete against overlapping keys, and add a witness through the production wiring that fails when that connection is removed. |
| + |
| + **Boundary:** Task 1’s concurrency guard and Task 10’s integration coverage. |
| + |
| +6. **Departed-instance metadata has no lifetime bound.** |
| + Locations: [index.go:182](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/pageindex/index.go:182), [index.go:248](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/pageindex/index.go:248), [inputs.go:177](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/activator/inputs.go:177). |
| + |
| + Scopes are inserted but never removed. Reset empties their contents; Sweep removes records only. The current-inputs cache likewise retains departed hosts’ merged environments. Every reload continues sorting and resetting historical page scopes. |
| + |
| + **Failure scenario:** repeated instance creation/deletion on a long-running box grows retained memory and reload work with deployment history rather than current instances. |
| + |
| + **Fix:** retire departed metadata safely, preserving stale-ticket rejection and durable marks. Add a churn check demonstrating bounded retained state. |
| + |
| + **Boundary:** requested memory and lifecycle bounds. |
| + |
| +**P3** |
| + |
| +7. **The earlier two-instance simulation only makes one instance page-cache eligible.** |
| + Location: [pagecache_sim_test.go:73](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/edge-page-cache-1/internal/edge/pagecache_sim_test.go:73). |
| + |
| + The second instance gets process inputs but no `def/shop/v1` declaration fixture. It therefore always bypasses page caching. The later Task 9 simulation supplies that fixture correctly. |
| + |
| + **Failure scenario:** this test’s description overstates its own cross-instance coverage. |
| + |
| + **Fix:** load the second declaration and assert hits per instance. Follow-up only because the later simulation covers both. |
| + |
| + **Boundary:** test coverage clarity. |
| + |
| +**Deferred minors triage** |
| + |
| +| Ledger minor | Disposition | Reason | |
| +|---|---|---| |
| +| T1: Get/Delete parity | **Fix before merge** | Finding 5; no same-key overlap. | |
| +| T2: Abort during running Finish untested | **Follow-up** | Locking and `finishing` guard are explicit; no defect found. | |
| +| T5: malformed marker permits LRU | **Follow-up** | Matches the plan’s `Bad` versus `Marked` distinction. Any stricter refusal changes that contract. | |
| +| T5: demo holder untested; test-only hook | **Fix before merge** for demo coverage | Include with finding 3. The nil-in-production hook itself needs no fix. | |
| +| T6: Darwin/Windows activator vet failures | **Follow-up** | Reported pre-existing; offending behaviour is not introduced here. | |
| +| T7: demo diagnostics absent | **Fix before merge** | Finding 3. | |
| +| T8: Windows `readerConn` vet failure | **Follow-up** | Existing test portability issue. | |
| +| T10: wiring witness missing | **Fix before merge** | Finding 5. | |
| +| T10: failure fixture stops at `MkdirAll` | **Follow-up** | It does not exercise `pageindex.Open` failure, but both production error branches leave caching disabled. | |
| +| T12: command dispatch/parsing/lowercasing untested | **Follow-up** | Dispatch and normalization are present; no functional error found. | |
| +| T12: missing `recordNotFound` explanation | **Follow-up** | Existing error propagation works; explanatory copy can follow. | |
| + |
| +**Rulings** |
| + |
| +- **R1 — Holds.** The existing asset sweep loop calls the page index’s Sweep. |
| +- **R2 — Holds.** Copy approval preceded Task 12. Finding 4 concerns factual accuracy, not ordering. |
| +- **R3 — Holds.** Cross-family task review follows the stated review policy. |
| +- **R4 — Holds.** Placement beside instance environment and purge documentation is appropriate. |
| +- **R5 — Holds.** A successful reservation supports “tried to keep one”; later recording failure does not make that diagnostic false. |
| +- **R6 — Holds.** Clearing the requesting alias’s pages fixes the specified alias case within the responding instance. |
| +- **R7 — Holds as the governing rule, but implementation is incomplete.** Finding 2 identifies the remaining primary-host LRU exception. |
| +- **R8 — Holds.** Without the activator hook, unknown inputs safely prevent page caching. |
| +- **R9 — Holds under the ledger’s stated exemption.** Wrapped error prefixes do not alter the caching contract. |
| + |
| +**Declined to judge** |
| + |
| +- Far-edge leases, fills, pushes and single-flight: assigned to slice 2. |
| +- Operator clear/status commands: assigned to slice 3. |
| +- Unit-backed page caching: explicitly excluded from this plan. |
| +- The LRU’s existing cookie/Authorization admission rules for instances that never opt in: explicitly excluded. |
| +- Independent census approval: already reviewed separately; this review does not replace it. |
| +- Deployment, dev arming and Patrix adoption: post-merge work requiring the separate rollout authorization. |
| +- Reported cross-platform vet failures and current CI status: not independently executed or verified in this read-only review. |
| + |
| +NOT READY |
| \ No newline at end of file |