carlos / platform Public

spec: path routes across boxes rev 3, round 2 fixes and region HA

Shared PathFront/PathTarget predicates published in the edges file
(rule 2's third option for R2 P1-1); door calls never cross boxes (R2
P1-2 cut); region HA fronts and targets in scope on Paul's ruling, with
HA dispatch keyed on the selected route.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev c051eef9d999eee5086867025dea916c3b362c74 parent e7624ab
1 file changed, +169 −68
  • docs/superpowers/specs/2026-11-19-path-routes-across-boxes-design.md +169 −68
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 23afc5894..31d5168b2 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,21 +1,31 @@
# Path routes across boxes: a prefix whose target lives on another box
-Rev 2, 2026-11-19. Discussion #186. Builds on the path-routing design
+Rev 3, 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
own route".
-Written without a live session with Paul. Every decision he did not make is
-marked **my call** and listed in §11; questions only he can answer are in
-§12.
+Revs 1 and 2 were written without a live session with Paul. Every decision
+he did not make is marked **my call** and listed in §11. Paul's rulings on
+2026-11-19 (in session, after round 2): go on rule 2's options for round 2's
+two P1s; **region HA from day one** for hub tenants, which brings HA fronts
+and targets into this design (§5.7).
**Review history.** Round 1 (Astra,
`docs/superpowers/reviews/ASTRA-FINDINGS-path-routes-across-boxes-R1.md`):
7 P1, 2 P2. Rev 2 answers all nine: P1-1 by publishing a route owner
(§5.1), P1-2 by exact targets (§5.3), P1-3, P1-4 and P1-5 by narrowing who
may select across boxes (§5.3, §7.5), P1-6 by dialling exactly the checked
-box (§5.4), P1-7 in §7.2, P2-8 in §7.3, P2-9 in §6.
+box (§5.4), P1-7 in §7.2, P2-8 in §7.3, P2-9 in §6. Round 2
+(`ASTRA-FINDINGS-path-routes-across-boxes-R2.md`): 8 of 9 resolved, 2 P1.
+R2 P1-1 repeated R1 P1-2's fault family (sender and receiver agreeing on
+what a target is), so rule 2 applied; Paul chose its third option, one
+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.
## 1. Intent
@@ -58,7 +68,7 @@ route):
hostnames, platform aliases, wildcard catch-alls, regional names and
forward (fleet) rows do not select a target on another box. They keep
selecting same-box targets exactly as today.
-- **Region-HA routes**, as the front host or as the target (§7.5).
+- **Door calls across boxes** (§7.4).
- **A password gate on a target selected across boxes** (§7.3).
- No change to the wire, the write door, the cap, or the matcher (the
two-spelling first-segment rule, 09-02 §6). No multi-segment prefixes, no
@@ -149,10 +159,10 @@ derives which rows:
- The cap and its deterministic sorted truncation are unchanged, and now
matter more: every box must truncate identically.
-**A route owner in the edges file.** Each box's edges file gains, on the
-row for an exact route it serves (never an alias or `*.` row), three
-additive fields: `route_account`, `route_app` (the route's own account and
-app) and `route_ha` (the route is region-HA). Today's `account`/`app` stay
+**A route owner and two eligibility marks in the edges file.** Each box's
+edges file gains, on the row for an exact route it serves (never an alias or
+`*.` row), four additive fields: `route_account`, `route_app` (the route's
+own account and app), `path_front` and `path_target`. Today's `account`/`app` stay
exactly as they are: they are the **door's** owner, folded over every
route and path target under the name, and blank when those disagree, which
a hub with prefixes to other apps always does (round 1 P1-1). The new
@@ -160,6 +170,27 @@ fields answer a different question, "whose route is this exact name", and
are what §5.3 checks. `homeMap` exposes them only through the exact lookup
(`ExactHome`'s rule: no wildcard fallback).
+**One rule, one place (round 2 P1-1; rule 2's third option).** Whether a
+route may be a front or a target is decided by two predicates over
+`registry.Route`, `PathFront(rt)` and `PathTarget(rt)`, defined once and
+called by both sides:
+
+- the edges-file writer publishes `path_front`/`path_target` as their
+ answers for the row's route, and a sender reads only those marks;
+- the edge's local checks (§5.3) call the same functions on the local entry's
+ route, plus the entry-shape checks only a local map has (alias, platform
+ alias, regional).
+
+`PathTarget` is true for a ready route of kind `instance` or `static` that is
+not a forward, demo or sidecar route. `PathFront` is true for a route of
+kind `instance` or `static` that is not a forward, demo or sidecar route.
+Region HA does not change either answer (§5.7). A guard test walks every
+route kind and every flag the registry carries (forward, demo, sidecar, HA,
+replica, hibernating, static, service) and fails if the published mark and
+the local predicate ever disagree, or if a new kind appears that neither
+names. A missing mark reads as false, so an old publisher's routes are
+never targets.
+
Every `ListPaths` reader must then be checked against rows whose host is not
local (**the builder's audit**, a required plan task):
@@ -171,6 +202,7 @@ local (**the builder's audit**, a required plan task):
| `apiroutes` (`carlos routes`) | rows hang under listed hosts | rows only under hosts the listing has; no orphan rows |
| `Fingerprint` | hashes all rows | unchanged; must still move on every row change |
| purge ownership (`purgeOwns`, `ownsHost`) | front host in `m` | §7.2 |
+| edges-file writer | — | publishes `route_account`, `route_app`, `path_front`, `path_target` from the shared predicates |
**My call:** one table, not a second "remote paths" table. The rows are the
same fact (a claim's prefix map); the reader decides what locality means.
@@ -203,24 +235,24 @@ indirection) is one function, shared by the local and remote maps.
**Who may select across boxes.** A remote selection, or a local selection
of a target for a front host this box does not serve, is allowed only when
-the request's `Host` is a **front route**: the exact name of a route that
-is not region-HA, matched exactly (never through a wildcard key), and not
-an alias, platform alias, regional name or forward row. On the host's own
-box that is the exact entry with `!up.alias && !up.platformAlias &&
-up.regional == regionalNone && !up.route.IsForward() && !up.route.HA`; off
-it, the home map's exact row for `Host` with `route_account`/`route_app`
-equal to the row's claim account and app and `route_ha` false. Any other
-front name keeps today's selection: same-box targets only, and the
-ownership block after the lookup runs exactly as today (round 1 P1-3,
-P1-4, P1-5).
+the request's `Host` is a **front route** and the request is not a door call
+(§7.4). A front route is the exact name of a route, matched exactly (never
+through a wildcard key), whose route satisfies `PathFront`. On the host's
+own box that is the exact entry with `!up.alias && !up.platformAlias &&
+up.regional == regionalNone && PathFront(up.route)`; off it, the home map's
+exact row for `Host` with `path_front` set and `route_account`/`route_app`
+equal to the row's claim account and app. Any other front name keeps
+today's selection: same-box targets only, and the ownership block after the
+lookup runs exactly as today (round 1 P1-3, P1-4).
**What may be selected across boxes.** A **target route**: the exact name of
a route, resolved through the home map's exact lookup only (never
-`Owner`'s wildcard fallback), with `route_account` equal to the row's
-account and `route_ha` false; its box dialable and publishing `path-hops-1`
-(§8). Locally, `m[T]` must be a route's own entry: not an alias, platform
-alias, regional, forward, demo or sidecar entry. The same rule on both
-sides, so sender and receiver agree on what a target is (round 1 P1-2).
+`Owner`'s wildcard fallback), with `path_target` set and `route_account`
+equal to the row's account; the box it would be dialled on publishing
+`path-hops-1` (§8). Locally, `m[T]` must be a route's own entry (not an
+alias, platform alias or regional entry) whose route satisfies
+`PathTarget`. Both sides run the same predicate, so sender and receiver
+agree on what a target is (round 1 P1-2, round 2 P1-1).
Cases, on the box the request arrives on, for a front route:
@@ -254,12 +286,21 @@ A remote selection makes a signed backhaul through `hopTo`, with:
- **`Host` unchanged and the MAC over the request's `Host`**, as every hop is
signed today (`signHop(key, host, now)`). SNI is the request's host; every
edge serves every cert (`certsync`'s mirror).
-- **Dialled exactly to the box the target rule checked.** No holder cache, no
- `backhaulAlternative`, no handover redirect: those exist for region-HA
- routes, which are excluded, and each would choose a box the capability
- check never saw (round 1 P1-6). A failed dial answers what a failed
- backhaul answers today (502); it never falls back to the host's route
- after bytes have been sent.
+- **Dialled as a backhaul for T.** The hop is an ordinary backhaul for the
+ target in every respect but its wire `Host` and MAC: the first box is the
+ home map's exact serving box for T, and the holder cache, suspect-box
+ alternatives, the holder follow and the handover follow
+ (`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.
+- **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
+ failed backhaul answers today (502); nothing falls back to the host's
+ route after bytes have been sent.
**No new hop header.** The receiving box runs the same selection itself,
from `Host` and path, against its own maps and home map, and on a verified
@@ -298,9 +339,8 @@ resolves that `Host` exactly to the same row. A wildcard or alias match
never carries the mark, so the block's exact-name precedence check runs as
today (round 1 P1-4).
-**HA ingress.** `routeHAIngress` and `frontForwardHA` see no change: the front
-route and the target are both non-HA by §5.3, so neither has HA metadata to
-act on for a cross-box selection (round 1 P1-5; §7.5).
+**HA dispatch** runs on the selected route, not the request's `Host`
+(§5.7).
Downstream of selection, nothing changes: the target's entry carries
metering, the version header, the activator, admission, rate limits and the
@@ -313,15 +353,58 @@ exclusion of path-routed hosts (`pagecache.go`) must hold for case 3 too.
- The reconcile log keeps its per-host "names no local ready route" count,
reworded so it no longer tells anyone to co-locate.
- The edge logs, throttled per host, when a front route's prefix names a
- target that is not a target route anywhere, is in another account, is
- region-HA, or sits on a box without `path-hops-1`; and when a front name
- is not a front route (alias, wildcard, HA) but its map names a remote
- target. These are the "it still falls through" reasons an operator can
+ target that is not a target route anywhere, is in another account, or
+ sits on a box without `path-hops-1`; and when a front name is not a front
+ route (alias, wildcard, forward) but its map names a remote target. These are the "it still falls through" reasons an operator can
act on.
- **My call:** no new CLI surface in this slice. `carlos domains paths`
already lists the map; the hub scaffold's version check is the end-to-end
test of reachability.
+### 5.7 Region HA (Paul, 2026-11-19: HA from day one)
+
+Hub tenants are region-HA from day one, and the hub may be too, so HA fronts
+and HA targets are in. The rule that makes them safe is one split, applied
+everywhere a request is dispatched:
+
+- **The front name** (the request's `Host`, H) is used for: the front-route
+ authority check (§5.3), the HTTP `Host` the app receives, the hop MAC and
+ SNI, the response cache key, and the purge host.
+- **The selected route** (T when a prefix selects, H otherwise) is used for
+ everything route-shaped: `routeHAIngress`, `frontForwardHA`, `moveGate`
+ and handover, admission, the activator, the holder cache and backhaul
+ owner, and the capability check.
+
+Concretely:
+
+1. **A prefix selects T on any box.** H's HA dispatch does not run for this
+ request; T's does, exactly as it would for a request whose `Host` were T.
+ Today `routeHAIngress` resolves HA metadata from the request's `Host` and
+ compares it with the local upstream (`haingress.go`), which is round 1
+ P1-5; it and `frontForwardHA` take the selected route instead of
+ re-deriving it from `Host`.
+2. **No prefix selects.** H's HA dispatch runs exactly as today.
+3. **Every hop a path-selected request makes** (the cross-box hop of §5.4,
+ an HA front forward to T's lease holder, a holder or handover follow)
+ carries wire `Host` H and is keyed on T on the sending side. The
+ receiving box re-resolves (H, path) to T (§5.4) and then runs T's HA
+ 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.
+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
+ dispatch decides as above.
+
+Region HA's own invariants (one holder serves, the two-attempt cap, no
+third hop, handover only on a marked first attempt) are untouched: this
+design only changes which route's identity they are evaluated against.
+
+**Rule 4 check for this section:** no region-HA design is in flight on an
+unmerged branch (the open region-HA branches are build branches of merged
+specs). If one starts before this merges, this section waits for it.
+
## 6. Latency and cost
- **Republishing a map:** about five seconds (09-02 §7), now on every box.
@@ -386,23 +469,28 @@ issued. It is never judged by the front route's gate. Hub tenants
authenticate with the hub session (user-models §6.3), so the hub model does
not need the gate.
-### 7.4 Door callers
+### 7.4 Door callers (round 2 P1-2: cut)
+
+A hop carries only a signed "this was a door call" bit, not which app made
+it, so a receiving box that re-resolves to a different app could serve it
+under the caller's exemption. Rather than carry caller identity across the
+hop, door calls do not select across boxes in this slice (**Paul's go on
+the cut**):
+
+- a door call never takes a **remote** selection, and never takes case 3's
+ "target local, front not local" answer: it goes down today's door branch
+ (`Owner(host)` against the door's app, then a backhaul to the host's home);
+- a received hop carrying the verified door mark (`hopDoorFrom`) never
+ takes an answer from the **remote map**; it is served from this box's
+ local map only, as today, or refused;
+- same-box selection for a door caller is unchanged.
-A door caller's own app selected through a prefix is served as on the same
-box (the door scope compares against the selected route). The edges file's
-door owner for a front host is unchanged, so a remote target app calling
-the **front host's own route** through the door is not admitted. **My
-call:** unchanged in this slice; a tenant calls the hub on its own hostname.
+A tenant calls the hub on the hub's own hostname, and itself on its own.
-### 7.5 Region HA and fleets
+### 7.5 Fleets
-Region-HA routes are excluded as front routes and as targets (§5.3). Their
-dispatch (`routeHAIngress`, `frontForwardHA`, the holder cache, handover)
-resolves identity from the request's `Host` and would need to carry the
-selected target through all of it (round 1 P1-5, P1-6). A prefix that names
-an HA target, or sits on an HA front, keeps today's same-box behaviour and
-is logged. Whether hub tenants need HA in this slice is §12's first
-question. A target that is a fleet forward row is unchanged from today.
+A target that is a fleet forward row is not a target route (`PathTarget`),
+so it keeps today's behaviour everywhere.
## 8. Rollout and the mixed-version fleet
@@ -410,8 +498,9 @@ No feature switch (**my call**): publishing a map that names a remote target
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 fields of §5.1. A sender selects a remote
-target only when the box it will dial publishes `path-hops-1`, and case 3
+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
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
@@ -429,11 +518,23 @@ shipped.
- Derivation: rows for a non-local host and non-local targets on every box;
cross-account local targets still refused; identical sorted truncation;
an unchanged republish writes nothing.
-- Edges file: route-owner fields on exact route rows only; the door owner
- unchanged for a mixed host (the existing mixed-owner test stays green).
+- Edges file: route-owner and eligibility fields on exact route rows only;
+ the door owner unchanged for a mixed host (the existing mixed-owner test
+ stays green).
+- **The guard test of §5.1**: for every route kind and flag, the published
+ `path_front`/`path_target` and the local predicates agree; a forward row
+ is never a target on either side.
- Selection: all four cases of §5.3, each with each check failing; a
wildcard-only owner of the target never selects; an alias, a catch-all
- and an HA front never select remotely.
+ and a forward front never select remotely.
+- Door: a door call never selects remotely or via case 3; a door-marked hop
+ never takes a remote-map answer, including when sender and receiver maps
+ differ.
+- HA (§5.7): an HA target reached from the front's box, from a third box and
+ from a non-holder pool box; holder follow and handover follow keyed on T
+ 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.
- **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
@@ -461,10 +562,11 @@ shipped.
## 11. Calls I made (for Paul to confirm or overturn)
1. Approach A: the ingress box selects, one hop, receiver re-resolves (§4).
-2. Only a claim's own exact, non-HA route selects across boxes; aliases,
+2. Only a claim's own exact route selects across boxes; aliases,
catch-alls, regional and forward names keep same-box behaviour (§5.3).
-3. One `route_paths` table derived on every box; three additive edges-file
- fields for the route owner (§5.1).
+3. One `route_paths` table derived on every box; four additive edges-file
+ fields, the route owner and two eligibility marks (§5.1). Targets are
+ `instance` or `static` routes.
4. Ownership and account checks at request time against the home map (§5.3).
5. No new hop header; the receiving box re-runs selection (§5.4).
6. The host's home box, receiving a hop that selects a remote target, serves
@@ -472,14 +574,13 @@ 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. Door calls from a remote target to the front host's own route stay
- refused (§7.4).
-11. No feature switch; `path-hops-1` protects the roll (§8).
+10. No feature switch; `path-hops-1` on every dialled box 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).
## 12. Questions for Paul
-1. **Do hub tenants (or the hub) need region HA in this slice?** Rev 2
- excludes HA fronts and HA targets, which keeps HA dispatch untouched. If
- Seamus or Patrix tenants will be born-HA from the start, HA needs its own
- design pass (carrying the selected target through `routeHAIngress`,
- holders and handover) before this can serve them.
+None open. Making region HA the default for every instance (Paul,
+2026-11-19: "the new default across the board") is a platform decision of
+its own, outside this design; this design only stops excluding HA.