carlos / platform Public

spec: path routes across boxes rev 4, pool readiness gate (R3 P1-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 085d28dcf9a23b1a4bb2905230ba99763a86f5f6 parent f9ed89b
2 files changed, +150 −7
  • docs/superpowers/reviews/ASTRA-BRIEF-path-routes-across-boxes-R4.md +116 −0
  • docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md +34 −7
diff --git a/docs/superpowers/reviews/ASTRA-BRIEF-path-routes-across-boxes-R4.md b/docs/superpowers/reviews/ASTRA-BRIEF-path-routes-across-boxes-R4.md
new file mode 100644
index 000000000..d2e984621
--- /dev/null
+++ b/docs/superpowers/reviews/ASTRA-BRIEF-path-routes-across-boxes-R4.md
@@ -0,0 +1,116 @@
+# Review brief: path routes across boxes design (#186), round 4 (Paul approved a fourth round, 2026-11-19)
+
+Repo carlos/platform, branch `path-routes-across-boxes`, commit
+c051eef9d999eee5086867025dea916c3b362c74 (spec rev 3).
+Under review: `docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md`.
+Authorities: `docs/superpowers/specs/2026-09-02-path-based-routing-design.md`
+and its plan `docs/superpowers/plans/2026-09-03-path-based-routing.md`;
+`docs/superpowers/specs/2026-10-28-regional-domains-447-design.md`; the code
+on `main` (this branch is main plus the spec). 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 document, then the code it
+names, and check every claim against that code.
+
+## Fixed: do not re-argue
+
+- The 09-02 design's rulings: a prefix selects a route (no per-prefix
+ settings), first segment only, both raw and cleaned spellings, no
+ stripping, target in the claim's account, wholesale republish via
+ `PUT .../domains/{host}/paths`, 10,000 cap. Report only mechanisms that
+ fail to honour them.
+- The goal itself: a path target may live on any box (discussion #186).
+- "One hop, ever" between edges stays (the loop guard in `backhaul` and
+ `backhaulTo`, `internal/edge/edge.go`).
+
+- Scope cuts: aliases, catch-alls, platform aliases, regional and forward
+ names never select across boxes (same-box behaviour kept);
+ password-gated targets under a cross-box prefix are refused; door calls
+ never select across boxes (Paul's go on 2026-11-19, round 2 P1-2).
+ Report a mechanism that fails to keep one of these cuts, not the cut.
+- Paul's rulings of 2026-11-19: rule 2's third option for round 2 P1-1
+ (one invariant, the shared `PathFront`/`PathTarget` predicates, with a
+ guard test); region HA fronts and targets are IN scope (§5.7).
+
+## What to check
+
+1. **Tenancy.** (Also: the new `route_account`/`route_app`/`route_ha` edges-file fields, §5.1, and the front-route and target-route rules, §5.3.) Can any box, under §5.1-§5.3, send a request for a prefix to
+ a route in another account, or let one app's map select another app's
+ route, now that rows for non-local hosts and targets are derived without
+ a local route to check against? Check `homes.Owner` (`internal/edge/homemap.go`)
+ actually returns what §5.3 relies on (account, app, dialable, serving
+ box), including for HA, alias and wildcard names.
+2. **Hop correctness.** §5.4: MAC over the request `Host`, dialled to the
+ target's box, receiver re-resolves and accepts only a local answer.
+ Check `acceptHop`, `signHop`/`verifyHopEitherKey` (`mesh.go`),
+ `backhaulProxy` (Host, SNI, transport pool key), `backhaulTarget` and
+ `backhaulAlternative`. Is there any path to a second hop, a loop, or a
+ hop that lands on a box that serves a different app for the same Host?
+3. **The ServeHTTP placement** (§5.5): the remote selection against the
+ order in `ServeHTTP` (regional gate, `routeHAIngress`, the
+ `!e.servesExactly(host)` ownership block, the far asset catch,
+ `frontForwardHA`, the login POST re-resolution, the page cache and
+ response cache). Anything that would now run with the wrong entry, or
+ skip a check it needs?
+4. **Derivation on every box** (§5.1): every `ListPaths` reader and every
+ consumer of `route_paths` (registry, edgesfile `servedOwners`,
+ `assetpolicy`, `apiroutes`, `Fingerprint`, `filterDemoRoutes`). Is the
+ audit table complete and right? Any cost problem (the fast-converge
+ pass, Fingerprint every 2 s) at the cap?
+5. **Mixed-version roll** (§5.4's last paragraph, §8): old ingress, new
+ home; new ingress, old target box; the `path-hops-1` capability via
+ edges-file `capabilities`. Does any combination turn today's 200 into an
+ error, or serve the wrong app?
+6. **Regional names (#447)**: regional entries "carry no path map". Does
+ §7.1 hold, including a regional name on a box where the regional table
+ has no row, and a target that is itself a regional or forward row?
+7. **Purge and the gate** (§7.2, §7.3): does the purge change keep the
+ account requirement in `purge_header.go`; is the gate cut safe (no
+ password judged by the wrong route, no cookie for the wrong host)?
+8. **Rule 5 and rule 6 of AGENTS.md** (no dormant feature; something Paul
+ can see lands first): does §1 and §9's dev witness meet them?
+
+## Round 4
+
+Earlier rounds: R1 (7 P1, 2 P2), R2 (2 P1), R3 (1 P1), findings in
+`docs/superpowers/reviews/ASTRA-FINDINGS-path-routes-across-boxes-R{1,2,3}.md`.
+Rev 4 changes only §5.4 (a pool readiness gate before the first hop),
+§5.7 point 3, §8, §9 and §11 item 10, to answer R3 P1-1.
+
+First give one line on R3 P1-1: resolved, partly, or not. Then check the
+gate itself: does the home map actually expose T's pool membership in T's
+region view and each member's capabilities (`boxInRegionView`,
+`backhaulAlternative`, `handoverAlternative`, `wakeSnapshot` in
+`internal/edge/`), so the gate is implementable as written; and does it
+keep every earlier resolution intact. Name each finding's fault family and
+say when it repeats an earlier one. Do not re-review unchanged sections
+beyond what the gate touches.
+
+## 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). 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.
diff --git a/docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md b/docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md
index 31d5168b2..21380888a 100644
--- a/docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md
+++ b/docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md
@@ -1,6 +1,6 @@
# Path routes across boxes: a prefix whose target lives on another box
-Rev 3, 2026-11-19. Discussion #186. Builds on the path-routing design
+Rev 4, 2026-11-19. Discussion #186. Builds on the path-routing design
(`2026-09-02-path-based-routing-design.md`, "the 09-02 design" below) and
changes none of its rulings except the one it was written to lift: §6's
"a prefix's target route must be homed on the same box as the hostname's
@@ -25,7 +25,11 @@ invariant enforced in one place: the shared `PathTarget` and `PathFront`
predicates (§5.1). R2 P1-2 (door authorization across re-resolution) is
cut: door calls never select across boxes (§7.4). Rev 3 also lifts rev 2's
HA exclusion on Paul's ruling (§5.7); round 1's P1-5 and P1-6 are answered
-there rather than by exclusion.
+there rather than by exclusion. Round 3
+(`ASTRA-FINDINGS-path-routes-across-boxes-R3.md`): all 11 earlier findings
+resolved, 1 P1 in R1 P1-6's family (an old lease holder discovered after
+the first hop). Rev 4 refuses that case up front with a pool readiness gate
+(§5.4); Paul approved a fourth round.
## 1. Intent
@@ -293,12 +297,26 @@ A remote selection makes a signed backhaul through `hopTo`, with:
(`backhaulTarget`, `backhaulAttempt`) all run keyed on T with T's
backhaul owner, under the existing two-attempt cap. §5.7 says why that is
right for an HA target.
+- **Pool readiness, before the first hop** (round 3 P1-1, rule 2's first
+ option). For a target the home map shows as region-HA, or as served by
+ more than one box, the sender commits to path dispatch only when **every**
+ box the home map lists as eligible to serve or hold T (its pool's members
+ in T's region view, the same set `backhaulAlternative` and
+ `handoverAlternative` choose from) publishes `path-hops-1`. Incomplete or
+ mixed evidence (a member without the capability, a member whose edges file
+ cannot be read, a region view not yet loaded) means today's fallback,
+ decided before any byte is sent: the host's route, or a backhaul to the
+ host's home. So no holder or handover answer can name a box the request
+ may not follow to, except one that joined the pool after the check, which
+ the next bullet covers.
- **Every destination publishes `path-hops-1`** (round 1 P1-6). The check
runs on each box actually dialled, not only on the first: a cached holder,
an alternative, a holder hint or a handover destination without it is not
used. Before the first attempt that means today's fallback (the host's
route, or a backhaul to the host's home); on a follow it means the
- refusal is answered as it is today (503). A failed dial answers what a
+ refusal is answered as it is today (503). With the readiness gate this is
+ reachable only for a box that entered T's pool between the gate and the
+ follow, a window of one request. A failed dial answers what a
failed backhaul answers today (502); nothing falls back to the host's
route after bytes have been sent.
@@ -391,7 +409,9 @@ Concretely:
dispatch as for a hop to T: if it is not T's holder it answers the same
503 with a holder hint, or the same handover answer, that it gives a
hop for T today, and the sender follows under the two-attempt cap,
- checking `path-hops-1` on the box it follows to. It never forwards.
+ checking `path-hops-1` on the box it follows to. It never forwards. The
+ sender only got here because every box in T's pool passed the readiness
+ gate (§5.4).
4. **An HA front H on a box that is not H's lease holder**, when no prefix
selects: unchanged, H's own front forward. When a prefix selects a
target that is local here: served here (case 1 or case 3), and T's HA
@@ -500,7 +520,8 @@ is the opt-in, and the scaffold that does so has not shipped.
A box running this release publishes `path-hops-1` in its edges file's
capabilities and the route-owner and eligibility fields of §5.1. A sender
dials a box for a path-selected request only when that box publishes
-`path-hops-1` (§5.4, every destination), and case 3
+`path-hops-1`, and for an HA or multi-box target only when every box in its
+pool does (§5.4), and case 3
needs the front host's home to publish the route owner; an old home
publishes neither, so its prefixes keep today's behaviour. An old ingress
box backhauls to the host's home as today, and §5.4's rule keeps that
@@ -535,6 +556,11 @@ shipped.
with wire `Host` H; an HA front whose prefix selects a target never runs
H's front forward; an HA front with no prefix hit behaves as today; a
follow to a box without `path-hops-1` is not taken.
+- **Pool readiness (round 3 P1-1):** an upgraded first box, an uncached old
+ lease holder in T's pool and a healthy front route: the request gets the
+ front route's 200 and no hop is made; the same with an unreadable pool
+ member's edges file; with every pool member upgraded, the request reaches
+ T.
- **Tenancy:** a remote map whose target's route owner is another account
never selects it, on the host's box and off it; a local wildcard's map
never answers for another account's exact hostname on another box (the
@@ -574,8 +600,9 @@ shipped.
7. No new CLI surface (§5.6).
8. A hub's whole-host purge stops reaching tenants on other boxes (§7.2).
9. Password-gated targets under a cross-box prefix are refused (§7.3).
-10. No feature switch; `path-hops-1` on every dialled box protects the
- roll (§8).
+10. No feature switch; `path-hops-1` on every dialled box, and on every
+ box of an HA or multi-box target's pool before the first hop, protects
+ the roll (§8).
11. Region HA: the front name carries authority, `Host`, MAC, cache key
and purge host; the selected route carries every HA decision (§5.7).