carlos / platform Public

alias-wake-338: a platform alias wakes its sleeping instance through the instance's own entry (#338 follow-up)

A platform alias (the domains pass's apex mint) shares its instance's
socket but was a plain socket proxy: it never woke a sleeping instance
(502 whenever it slept), bypassed the instance's gate and fence, and under
generations dialled a socket the instance no longer listens on.

- edge: PlatformAliasFold resolves a ready platform alias to the one ready
  route of its own effective account and app on its socket, and the alias
  takes that route's OWN upstream entry (as #151 attached hostnames do),
  so the existing activator wake, lease, fence, gate and generation socket
  apply. An owner that is not ready, two owners, or another tenant's socket
  refuse the alias: it is not served, never a direct proxy. The alias keeps
  only its own prefix map. Its platform host stays in the wildcard parent
  set; anything attached to it does not.
- host: the edges file does not advertise a refused alias; the asset policy
  resolves an alias as the edge does, and refuses an asset block to a
  hostname attached to a platform alias (cut, stopping rule 2).
- Tests production-wired (real edge, activator, registry, edges-file
  writer): wake through the alias, fence and one-wake behaviour, cross
  account and app never woken or reached, a moving instance, prefix maps,
  publication. Mutation-checked.
- Astra: round 1 NOT READY (2 P1, 2 P2, fixed), round 2 NOT READY (1 P1,
  1 P2 carried; both cut), round 3 READY. Census approved (#280).

Needs a box release; not released or rolled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from alias-wake-338 into main.
claude agent, operated by paul@keymail.dev a55f0f23474aa3ae1208d4d6b4269f471d1496c2 parent e92c22a
16 files changed, +878 −2
  • docs/superpowers/notes/census-proposal-alias-wake-338.md +31 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R2.md +43 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R3.md +29 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md +32 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R2.md +45 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R3.md +49 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md +93 −0
  • internal/edge/edge.go +42 −2
  • internal/edge/platformalias.go +68 −0
  • internal/edge/platformalias_test.go +153 −0
  • internal/host/aliaswake_assets_test.go +70 −0
  • internal/host/aliaswake_test.go +175 −0
  • internal/host/assetpolicy.go +23 −0
  • internal/host/edgesfile.go +8 −0
  • internal/provision/testdata/plan14-root-reads-alias-wake-338.tsv +16 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0

CI failed — run details

landed from alias-wake-338

diff --git a/docs/superpowers/notes/census-proposal-alias-wake-338.md b/docs/superpowers/notes/census-proposal-alias-wake-338.md
new file mode 100644
index 000000000..88a04fc52
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-alias-wake-338.md
@@ -0,0 +1,31 @@
+# Census approval: alias-wake-338
+
+Ruling `census-ruling-alias-wake-338`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/edge/edge.go` `Edge.currentHosts` | body | unchanged (4) | #338 follow-up: a resolved platform alias (platformAlias) stays in the wildcard parent set as its own row was before; attached hostnames still excluded |
+| `internal/edge/edge.go` `Edge.Reload` | sites | +whole:Route | #338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias |
+| `internal/host/assetpolicy.go` `assetInputs.primary` | sites | +whole:Route ×2 | #338 follow-up: a refused platform alias has no primary; a resolved one resolves to its source's row, as the edge serves it; a hostname attached to a platform alias has none (refused, Astra r2 P2) |
+| `internal/host/assetpolicy.go` `newAssetInputs` | sites | +whole:Route | #338 follow-up: records edge.PlatformAliasFold over the same routes (platformOf, platformRefused) |
+| `internal/host/edgesfile.go` `edgesFileWriteClaims` | sites | +registry:Host, +whole:Route | #338 follow-up: skips publishing a platform alias edge.PlatformAliasFold refuses (and so anything attached to it); reads the same route listing |
+
+Envelopes re-pinned: `internal/edge`, `internal/host`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Escalate if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. An escalation goes to the census owner as a decision.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/edge/edge.go` `Edge.currentHosts`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
+- `internal/edge/edge.go` `Edge.Reload`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added
+- `internal/host/assetpolicy.go` `assetInputs.primary`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): resolves a hostname to its route row or, for an exact alias, its primary's, over rows already read; reads nothing itself; no root pass calls it; no root decision
+- `internal/host/assetpolicy.go` `newAssetInputs`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): indexes rows already read (routes by host, exact aliases to their primary, hosts with path rows) and the owners (servedOwners when not handed them); reads nothing itself; no root pass calls it; no root decision
+- `internal/host/edgesfile.go` `edgesFileWriteClaims`: authority, task F,J1. Basis: rev3=census-ruling-self-serve-moves-1;basis=root-route;kept=F;scope=protected-decision-only; the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): region-ha-2a's body, which with the box's lifetimes switch on also publishes each served row's lifetime pair (registry:Incarnation and registry:ServingSeq, two new sites on the rows it already lists) and an alias's or served catch-all's primary's pair, and names that primary as target_host whatever the switch; a report the edge orders unstamped entries by, not a decision; no record, /data, release or claim read added; F,J1 authority retained; self-serve moves 1 Task 8;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 8: takes a localAddrs reader (instancectl.LocalAddresses in production, which reads /proc/net/fib_trie and /proc/net/if_inet6 in the agent) and publishes its non-loopback entries as the edges file's addrs before the write gate (boxAddrs, no read of its own), so an address change writes once. The same 44 sites, offsets moved; no record, /data, release or claim read added; a report the console's egress grant check reads, not a root decision; F,J1 authority retained.;rev3=census-ruling-edge-asset-cache-3;basis=starts with assets = assets.active(), so a policy whose box has not opened its asset store publishes no assets blocks and reads no manifests, and copies the decision's Primary (the route host the block was decided for, drift D4) into the published assets block; read sites unchanged (44); no read added. Merged onto main's #328 body, which takes the localAddrs reader: the assets.active() line sits after that signature and the loop passes pub and instancectl.LocalAddresses;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: the claims argument (*edgesClaims) becomes addrs (AddressSource) and the applyEdgesClaims(ctx, claims, routes, hosts) call is deleted with edgesclaims.go, which is the one whole:Route site removed: no host claim is read and every served row publishes as with region HA off; the box-address publication is the same code reading addrs.BoxAddresses() instead of claims.addrs; a report the edge reads, not a root decision; no read added; merge of origin/main d7ae1d76: main's edge asset cache plan 3 body is kept (census-ruling-edge-asset-cache-3): the first line is assets = assets.active(), so a policy whose store has not opened publishes no assets blocks and reads no manifests, and edgesFileLoop passes pub (assets.active() for that tick) in the assets argument; main's claims *edgesClaims argument is this branch's addrs AddressSource, and no edgesClaims, applyEdgesClaims or hostclaim reference remains
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/edge/platformalias.go:PlatformAliasFold`: reads +registry:Account ×2, +registry:App ×4, +registry:Host ×3, +registry:Platform ×2, +registry:Socket ×6, +registry:Status ×2, +whole:Route ×10; written legacy, accepted-legacy, frozen
+
+Seal: `f8acbc0dd8828636e3f73d9afd0e539d3dfd1346e0232d91903c33d6eb27d820` → `deeddee1bf22a18562acda97cc34c6d73ee0dff1825100c73fa0be4c6a3f3e7b`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-alias-wake-338.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R2.md
new file mode 100644
index 000000000..25eda5951
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R2.md
@@ -0,0 +1,43 @@
+| Round-1 finding | Disposition |
+|---|---|
+| P1: non-ready sources restore direct proxy | **Resolved.** Ownership includes non-ready routes; their aliases are refused ([platformalias.go:46](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:46)). |
+| P1: alias prefix map disables wake | **Resolved.** The instance’s entry supplies the default backend while the alias retains its prefix map ([edge.go:1038](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1038)). |
+| P2: asset-policy primary disagrees | **Partly resolved.** Direct platform aliases resolve correctly; hostnames attached to them still resolve incorrectly. Carried forward below. |
+| P2: refused aliases remain advertised | **Resolved.** Refused rows are excluded before dependent aliases are published ([edgesfile.go:542](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:542), [edgesfile.go:645](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:645)). |
+
+Census verdicts cover root-input authority; they do not clear the behavioral findings below.
+
+| Census item | Verdict and evidence |
+|---|---|
+| `Edge.currentHosts` | **APPROVE.** Preserves platform names without giving attached names wildcard-parent authority ([edge.go:1224](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1224), [edge.go:1071](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1071)). |
+| `Edge.Reload` | **APPROVE.** Reuses existing registry rows and upstreams; adds no privileged input source or root-side operation ([edge.go:1025](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1025)). |
+| `assetInputs.primary` | **APPROVE.** Resolves already-read rows; no new root read. Existing disposition remains appropriate ([assetpolicy.go:261](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:261)). |
+| `newAssetInputs` | **APPROVE.** Indexes the existing snapshot through the shared fold ([assetpolicy.go:208](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:208)). |
+| `edgesFileWriteClaims` | **APPROVE.** Adds publication filtering over the same listing; retains `authority`, `F,J1`, with no additional root input ([edgesfile.go:534](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:534)). |
+| `PlatformAliasFold` | **APPROVE.** Reads route fields and builds maps; opens nothing. `legacy` / `accepted-legacy` fits its reads ([platformalias.go:43](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:43)). |
+| `internal/edge` envelope | **APPROVE.** Reviewed the changed declarations and dispatch consumers. Linux source fingerprint matches the overlay. |
+| `internal/host` envelope | **APPROVE.** Reviewed the changed publication and policy declarations and their consumers. Linux source fingerprint matches the overlay. |
+
+1. **P1 — Inherited prefixes escape the remote door’s app scope.**
+ **Fault family:** published ownership must cover every backend reachable through a hostname.
+
+ A `shop` instance has `/docs → docs-app`; its platform alias has no prefix map of its own. [edge.go:1038](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1038) copies the instance’s map into the alias. However, publication still uses `servedOwners`, which counts only path rows keyed directly on each hostname ([edgesfile.go:158](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:158), [edgesfile.go:609](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:609)). The alias is consequently advertised as wholly owned by `shop`.
+
+ A `shop` door caller on another box can request that alias’s `/docs` path: the remote ownership check admits it ([edge.go:1703](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1703)). Only the door flag crosses the hop, not the caller’s identity ([edge.go:3291](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:3291)), so the home cannot enforce the final app check and serves `docs-app`, retaining the door’s rate-limit exemption.
+
+ **Fix:** derive published ownership from the same effective default backend and prefix map used by the edge, including attached hostnames. Publish no owner for mixed-app dispatch. Add a two-edge door test proving the other app is never reached.
+
+2. **P2 — Attached hostnames still miss platform-alias asset resolution.**
+ **Fault family:** cache policy and dispatch must identify the same primary. **Carried forward from round 1.**
+
+ For `www.example → platform-alias → instance`, the new checks resolve only the initially requested hostname. The attached-alias arm then returns `in.byHost[ph]` directly ([assetpolicy.go:265](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:265), [assetpolicy.go:272](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:272)). Policy therefore selects the platform row, while dispatch selects the instance.
+
+ Ordinary minted platform rows lack `AssetGen`, so caching is refused. Even with metadata, the primary comparison fails ([assetcatch.go:245](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/assetcatch.go:245)); local caching and acknowledged remote fills remain unavailable.
+
+ **Fix:** resolve the attached target through the platform fold, preserving refusal and intermediate prefix-map exclusions. Test fill followed by hit through an attached hostname. This family recurs in rounds 1 and 2: under stopping rule 2, choose an explicit refusal, remove this caching case, or centralize complete resolution with a guard test. I recommend centralizing it.
+
+No P3 findings.
+
+Reviewed `76af20e0274f925ee521e1d7667eec388eed024b` using `git diff origin/main...HEAD`. All six function digests, frozen-row fingerprints, both envelopes and the chain seal match. Changed Go files are formatted. Targeted tests could not start because Go’s build directory was blocked by the read-only sandbox; runtime and mutation-test results remain unverified. No files changed.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R3.md b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R3.md
new file mode 100644
index 000000000..5beba2065
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338-R3.md
@@ -0,0 +1,29 @@
+| Earlier finding | Disposition and verified evidence |
+|---|---|
+| R1 P1: non-ready sources restore direct proxy | **Resolved.** Ownership includes non-ready routes; their aliases are refused ([platformalias.go:46](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:46)). |
+| R1 P1: alias prefix map disables wake | **Resolved.** The source supplies the upstream entry while the alias retains its own paths ([edge.go:1039](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1039)). |
+| R1 P2: asset policy identifies the wrong primary | **Resolved within the accepted cut.** Direct platform aliases resolve to their source; attached hostnames are refused asset policy ([assetpolicy.go:261](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:261)). |
+| R1 P2: rejected aliases remain advertised | **Resolved.** Publication excludes refused aliases and requires a served primary for attached hostnames ([edgesfile.go:542](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:542), [edgesfile.go:645](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:645)). |
+| R2 P1: inherited prefixes escape door app scope | **Resolved.** Unconditional assignment of `own.paths` removes inherited source paths, including when the alias has none ([edge.go:1045](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1045)). |
+| R2 P2: attached hostnames miss asset resolution | **Resolved by explicit refusal.** The policy returns no primary for hostnames attached to folded or refused platform aliases ([assetpolicy.go:278](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:278)). |
+
+Census verdicts:
+
+| Item | Verdict and evidence |
+|---|---|
+| `Edge.currentHosts` | **APPROVE.** Retains platform aliases as wildcard-parent inputs; attached hostnames clear that authority ([edge.go:1224](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1224), [edge.go:1071](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1071)). |
+| `Edge.Reload` | **APPROVE.** Reuses existing upstreams from the registry snapshot. Adds no privileged input source; preserves the source’s wake, gate and generation handling ([edge.go:1027](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1027)). |
+| `assetInputs.primary` | **APPROVE.** Resolves existing rows or refuses them; adds no root read. Existing `legacy` disposition remains appropriate ([assetpolicy.go:261](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:261)). |
+| `newAssetInputs` | **APPROVE.** Indexes the existing snapshot through the shared fold; no additional input authority ([assetpolicy.go:208](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:208)). |
+| `edgesFileWriteClaims` | **APPROVE.** Narrows publication using the same route listing. Retains `authority`, `F,J1`; introduces no new root input ([edgesfile.go:534](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:534)). |
+| `PlatformAliasFold` | **APPROVE.** Compares route fields and constructs maps without opening resources. Effective-account/app matching and readiness refusal support `legacy` / `accepted-legacy` ([platformalias.go:43](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:43)). |
+| `internal/edge` envelope | **APPROVE.** Reviewed changed declarations and dispatch consumers, including source-keyed activation ([edge.go:2067](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:2067)). Recomputed Linux envelope matches. |
+| `internal/host` envelope | **APPROVE.** Reviewed policy and publication changes and their consumers, including asset eligibility checks ([assetpolicy.go:295](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:295)). Recomputed Linux envelope matches. |
+
+Findings: **P1: none. P2: none. P3: none.**
+
+Reviewed `66150cc19abf1d695d982212b1fc4a9320af5bb7` using `git diff origin/main...HEAD`. All six declaration hashes, five frozen-row fingerprints, both envelopes and the chain seal match. Changed Go files are formatted.
+
+Targeted tests could not start because the sandbox blocked Go’s build directory. Runtime and mutation-test results remain unverified. Network restrictions prevented reading discussions #338 and #392. No files changed.
+
+READY
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md
new file mode 100644
index 000000000..e6a90b403
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md
@@ -0,0 +1,32 @@
+| Census item | Verdict | Evidence |
+|---|---|---|
+| `Edge.currentHosts` | APPROVE | [edge.go:1215](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1215) preserves platform aliases in the parent set; attached hostnames clear `platformAlias` at line 1062. No new input authority. |
+| `Edge.Reload` | APPROVE | [edge.go:1023](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1023) uses the existing registry snapshot and already-built upstreams. No additional privileged filesystem operation or root-side validation change. |
+| `platformAliasFold` | APPROVE | [platformalias.go:37](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:37) reads route columns and builds maps; it opens nothing. The `legacy` / `accepted-legacy` disposition fits these reads. |
+| `internal/edge` envelope | APPROVE | Reviewed all changed production declarations and their dispatch consumers. The Linux envelope, three function digests, frozen-row fingerprints and appended chain seal match. These census approvals do not clear the behavioral findings below. |
+
+1. **P1 — Tenant boundary / maintenance fence: non-ready sources restore the unsafe direct proxy.**
+ [platformalias.go:41](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/platformalias.go:41) excludes non-ready routes from both ownership maps. When an instance changes from `ready` to `moving`, its still-ready platform alias therefore becomes neither resolved nor rejected. Reload retains the alias’s original `unixProxy`, without hibernation or the instance’s fence. The move path explicitly sets that status before quiescence at [movespass.go:1557](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/movespass.go:1557). While the socket remains live, alias requests can still reach it. A foreign alias likewise escapes rejection when the foreign socket owner becomes non-ready.
+
+ **Fix:** distinguish socket ownership from eligibility to serve. Refuse aliases whose known source is non-ready or foreign instead of treating those sockets as unowned. Add a request-level test covering a ready → moving transition and reload. **Fault family:** alias requests must retain the source’s readiness, tenancy and maintenance restrictions.
+
+2. **P1 — Path routing: an alias’s own prefix map disables the wake fix entirely.**
+ The `own.paths != nil` condition at [edge.go:1034](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1034) preserves the complete old alias entry. Requests for `/` or an unmatched prefix return that entry through [edge.go:1496](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1496). Consequently, a sleeping instance still produces 502, and the instance’s gate and fence remain bypassed on that fallback.
+
+ **Fix:** inherit the instance’s upstream entry while preserving the alias’s own prefix map. Test both an unmatched path waking the instance and a matched prefix reaching its configured target. **Fault family:** path dispatch must preserve lifecycle protection for the default backend.
+
+3. **P2 — Asset cache: policy resolution disagrees permanently with the folded upstream.**
+ After [edge.go:1038](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1038), the alias’s upstream names the instance. However, [assetpolicy.go:253](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/assetpolicy.go:253) still resolves it to the platform row. Ordinary minted aliases lack the instance’s asset generation; aliases carrying asset metadata instead fail the primary comparison at [assetcatch.go:245](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/assetcatch.go:245). Local caching and acknowledged remote fills cannot work for these folded names, including hostnames attached to them.
+
+ **Fix:** apply the same primary resolution in asset-policy construction, including generation, gates and path exclusions. Test cache fill followed by a hit through a platform alias. **Fault family:** cache policy and request dispatch must identify the same primary.
+
+4. **P2 — Homes / ACME: rejected aliases remain advertised deployment-wide.**
+ Deleting a foreign alias at [edge.go:1026](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/edge.go:1026) changes only the local routing map. The publisher still includes its ready registry row at [edgesfile.go:584](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/host/edgesfile.go:584). Other edges continue advertising that home and forwarding requests that it refuses. Certificate admission also remains possible because [certsync.go:195](/home/paulca/amadan.net/carlos/platform-alias-wake/internal/edge/certsync.go:195) uses `deploymentHost`, which accepts published home-map membership.
+
+ **Fix:** apply the alias rejection rule before publishing homes and dependent attached hostnames. Test the published file and another edge’s certificate admission. **Fault family:** advertised serving and certificate eligibility must match actual routing.
+
+No P3 findings.
+
+Reviewed requested commit `e06f553b312a4e7f71dfb4e09443861bf13e9eb7` against `origin/main`. Formatting and diff checks passed. Targeted alias tests could not start because the read-only filesystem prevented Go from creating its build directory; execution and mutation-test results remain unverified. No files changed.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R2.md
new file mode 100644
index 000000000..fab3c256f
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R2.md
@@ -0,0 +1,45 @@
+# Review brief: branch alias-wake-338, round 2 of 3
+
+Repo carlos/platform, branch `alias-wake-338`, commit 1eb4340ffabc6a312b874c6867f3015e8a1ff610.
+Under review: the diff `d3c5601be33f99fb64f293dc6d308b9301567c08..1eb4340ffabc6a312b874c6867f3015e8a1ff610` (`git diff origin/main...HEAD`),
+especially the round-1 fixes `e06f553b312a4e7f71dfb4e09443861bf13e9eb7..1eb4340ffabc6a312b874c6867f3015e8a1ff610`.
+Authorities and fixed points: as in round 1,
+docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md (read it;
+its "Fixed", "What to check" and "Census" sections apply unchanged).
+
+## Round 2
+
+Earlier rounds: round 1, docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md
+(NOT READY: P1 1 non-ready sources restore the direct proxy; P1 2 an
+alias's own prefix map disables the fix; P2 3 asset policy primary; P2 4
+refused aliases still advertised).
+
+First give one line per P1 and P2 from round 1: resolved, partly, or not.
+Carry every unresolved or partly resolved finding forward at its current
+severity, then add new findings. The verdict covers everything
+outstanding, earlier rounds included.
+
+The fix: `edge.PlatformAliasFold` (internal/edge/platformalias.go) is the
+one rule, read by `Edge.Reload`, `edgesFileWriteClaims` and the asset
+policy (`newAssetInputs`, `assetInputs.primary`). Census: verdicts for
+every unit on docs/superpowers/notes/census-proposal-alias-wake-338.md.
+
+## 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.
+- **P3**: clarity or polish. Follow-up list only.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open. Name each finding's fault
+family (the invariant it breaks).
+
+## Output
+
+The round-1 disposition table, census verdicts, then findings P1, P2, P3,
+each with evidence (file:line, verified), scenario and fix. End with
+exactly one verdict: READY, READY AFTER FIXES, or NOT READY.
+
+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/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R3.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R3.md
new file mode 100644
index 000000000..b87695ded
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338-R3.md
@@ -0,0 +1,49 @@
+# Review brief: branch alias-wake-338, round 3 of 3 (final)
+
+Repo carlos/platform, branch `alias-wake-338`, commit 4d364319244579efca26f3ca3e8c86bda578b0d7.
+Under review: the diff `d3c5601be33f99fb64f293dc6d308b9301567c08..4d364319244579efca26f3ca3e8c86bda578b0d7` (`git diff origin/main...HEAD`),
+especially the round-2 fixes `76af20e0274f925ee521e1d7667eec388eed024b..4d364319244579efca26f3ca3e8c86bda578b0d7`.
+Authorities and fixed points: as in round 1,
+docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md; its
+"Fixed", "What to check" and "Census" sections apply unchanged.
+
+## Round 3
+
+Earlier rounds: docs/superpowers/reviews/CODEX-FINDINGS-alias-wake-338.md
+(round 1) and CODEX-FINDINGS-alias-wake-338-R2.md (round 2: NOT READY,
+P1 inherited prefixes escape the door's app scope; P2 attached hostnames
+miss platform-alias asset resolution, carried from round 1).
+
+Round 2's two findings were answered by cuts, as stopping rule 2 offers,
+not by more resolution: a platform alias keeps only its own prefix map
+(never the instance's), and a hostname attached to a platform alias is
+refused an asset block. Both restore what main does today for those
+cases. Do not ask for the cut features back; judge whether the cuts
+close the findings and whether they break anything.
+
+First give one line per P1 and P2 from rounds 1 and 2: resolved, partly,
+or not. Carry every unresolved finding forward, then add new findings.
+Census: verdicts for every unit on
+docs/superpowers/notes/census-proposal-alias-wake-338.md.
+
+## 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.
+- **P3**: clarity or polish. Follow-up list only.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open. Name each finding's fault
+family.
+
+## Output
+
+The disposition table, census verdicts, then findings P1, P2, P3, each
+with evidence (file:line, verified), scenario and fix. End with exactly
+one verdict: READY, READY AFTER FIXES, or NOT READY. This is round 3: a
+NOT READY also says whether the P1s share one cause, and whether
+refusing the case up front or cutting the feature would remove them.
+
+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/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md
new file mode 100644
index 000000000..ae34759ff
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-wake-338.md
@@ -0,0 +1,93 @@
+# Review brief: branch alias-wake-338, round 1 of 3
+
+Repo carlos/platform, branch `alias-wake-338`, commit a4824e656daf12928bf8bbcac57e625cd09508d4.
+Under review: the diff `d3c5601be33f99fb64f293dc6d308b9301567c08..a4824e656daf12928bf8bbcac57e625cd09508d4` (`git diff origin/main...HEAD`).
+Authorities: AGENTS.md on main (stopping rules, the census); amadan
+discussions #338 and #392; the merged first fix d3c5601b (aliases follow
+their instance's socket). Do not review against unmerged branches.
+
+You are an independent reviewer. Read the diff, then the code it touches
+and calls, and check every claim against that code.
+
+## The change
+
+A platform alias (`Route.Platform`, the domains pass's apex mint) shares
+its instance's socket. The edge built it as a plain socket proxy
+(internal/edge/edge.go, the `t.Socket != ""` arm with Hibernate false),
+so it never woke a sleeping instance and answered 502 while it slept.
+
+internal/edge/platformalias.go `platformAliasFold` and its use in
+`Edge.Reload` (after the path fold, before the attached-hostname fold):
+an alias with exactly one ready non-platform, non-sidecar route of the
+same effective account and app on its socket takes that route's OWN
+upstream entry (as #151 attached hostnames do: same proxy, route,
+hibernating), so the existing activator wake path applies. An alias
+whose socket only another tenant's route holds is dropped from the map.
+`currentHosts` keeps a resolved alias (`platformAlias`) in the wildcard
+parent set; the #151 fold clears the flag for hostnames attached to it.
+
+## Fixed: do not re-argue
+
+- Paul's goal: these addresses work. The coordinator asked for this
+ follow-up to reuse the existing wake path, never across tenants.
+- Behaviour that follows from sharing the instance's entry, intended:
+ the instance's gate now applies to its alias (it was bypassed); usage,
+ the version header and purge tenancy are the instance's (as for #151);
+ the response cache keys on the requested host.
+
+## What to check
+
+1. Tenant boundary (the invariant): an alias never resolves to, wakes or
+ reaches a route of another effective account or app; legacy empty
+ accounts; ambiguous sockets; an alias that is itself not ready.
+2. The wake path is unchanged: activator keying on the instance's host,
+ one entry, the lease, the maintenance fence, generations
+ (appSocketProxy), RetireExcept's `managed` set; no second wake path.
+3. Edge table side effects: Allowed/ACME (a dropped foreign alias is no
+ longer Allowed), currentHosts and wildcard parents, homes and edges
+ file publication, the path fold, attached hostnames to an alias,
+ static and tunnel or fleet-placed sources, probes and the asset cache.
+4. Anything that reads `up.alias` or assumes `m[host].route.Host == host`.
+5. Tests: production-wired where they claim (internal/host/aliaswake_test.go
+ drives a real edge over a real activator and registry), and they fail
+ when the mechanism is removed.
+
+## Census
+
+Give a verdict for every unit and the re-pinned envelope on the card
+(docs/superpowers/notes/census-proposal-alias-wake-338.md), per AGENTS.md
+"The census": reject if the change lets root open, run, query or follow
+anything it did not before from a path or input a tenant, an app or a box
+agent can create, write or name; if it weakens a check, refusal,
+validation, argument or environment root relies on; if a new disposition
+is wrong for the unit's reads; or if the diff cannot settle any of these.
+Otherwise approve. Cite the lines you read.
+
+## 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
+
+Census verdicts first. Then findings ranked P1, P2, P3. Each gives the
+section, 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/internal/edge/edge.go b/internal/edge/edge.go
index e986d4258..bb2b1ced1 100644
--- a/internal/edge/edge.go
+++ b/internal/edge/edge.go
@@ -426,6 +426,10 @@ type upstream struct {
// the flag exists so wildcard parent derivation (currentHosts) never
// treats a customer hostname as a platform host.
alias bool
+ // platformAlias marks a platform alias resolved to its instance's entry
+ // (platformalias.go). It is an alias like the above, but its own host is
+ // a platform host, so currentHosts keeps it in the wildcard parent set.
+ platformAlias bool
// paths, when non-nil, splits this hostname's traffic by leading URL
// segment: a bare first segment ("paulca") mapped to the HOSTNAME of the
// route that serves it, resolved against the same live map at request
@@ -1008,6 +1012,40 @@ func (e *Edge) Reload() error {
up.paths[p.Prefix] = p.Target
m[p.Host] = up
}
+ // Platform aliases (#338 follow-up, platformalias.go): an alias that
+ // shares one ready same-tenant route's socket resolves to that route's
+ // OWN entry, as an attached hostname does below, so a request to it
+ // wakes the instance through the instance's own wake path, fence and
+ // lease. Before the attached-hostname fold so a hostname attached to the
+ // alias inherits the result. The alias keeps its OWN prefix map (none
+ // for a minted apex) and never inherits the instance's: the edges file
+ // publishes a hostname's owner from its own path rows (servedOwners),
+ // so an inherited map would let a door caller of one app reach another
+ // app's target through the alias (Astra r2 P1). A refused alias, or one
+ // whose instance has no entry here, is not served: never a direct proxy
+ // around the instance.
+ sources, refused := PlatformAliasFold(routes)
+ for host := range refused {
+ if _, ok := m[host]; ok {
+ delete(m, host)
+ e.logThrottled("platform-alias-refused "+host, fmt.Sprintf(
+ "platform alias %s is not served: its socket is not one ready route of its own account and app", host))
+ }
+ }
+ for host, src := range sources {
+ own, ok := m[host]
+ if !ok {
+ continue
+ }
+ up, srcOK := m[src]
+ if !srcOK {
+ delete(m, host)
+ continue
+ }
+ up.paths = own.paths
+ up.alias, up.platformAlias = true, true
+ m[host] = up
+ }
// Attached hostnames (#151): each alias resolves to the primary's OWN
// entry — same proxy value, same route (so activator keying, version
// header, and purge tenancy are all the primary's). Routes always win
@@ -1028,7 +1066,9 @@ func (e *Edge) Reload() error {
if !ok {
continue
}
- up.alias = true
+ // An attached hostname is never a platform host, even when its
+ // primary is a platform alias resolved above.
+ up.alias, up.platformAlias = true, false
m[a.Alias] = up
}
// Fleet channel auth: registry-backed, so this refreshes on the SAME poll
@@ -1185,7 +1225,7 @@ func (e *Edge) currentHosts() []string {
m := e.current()
out := make([]string, 0, len(m))
for h, up := range m {
- if (up.route.Platform || up.route.Provisioned) && !up.alias {
+ if (up.route.Platform || up.route.Provisioned) && !up.alias || up.platformAlias {
out = append(out, h)
}
}
diff --git a/internal/edge/platformalias.go b/internal/edge/platformalias.go
new file mode 100644
index 000000000..2f17a7fc4
--- /dev/null
+++ b/internal/edge/platformalias.go
@@ -0,0 +1,68 @@
+package edge
+
+import (
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// Platform aliases (#338 follow-up).
+//
+// A platform alias is a row the domains pass minted (Route.Platform, the
+// <app>.<sqid>.<apps-domain> apex) that copies another route's socket: no
+// process of its own, the same instance under a second name. Built as an
+// ordinary socket route it was a plain proxy to that socket, so it never
+// woke a sleeping instance (502 whenever the instance slept), it bypassed
+// the instance's gate and maintenance fence, and under generations it
+// dialled a socket the instance no longer listens on.
+//
+// So the edge resolves such an alias to its instance's OWN entry, exactly as
+// an attached hostname (#151) resolves to its primary's: the same proxy, the
+// same route row, so the wake, the lease, the fence, the gate, the
+// generation socket and usage are all the instance's, and nothing about the
+// wake path is new.
+//
+// The rule, one function for every reader (the edge's table, the edges file
+// the box publishes, the asset policy), so what is served, advertised and
+// cached never disagree:
+// - the alias's owners are the non-platform, non-sidecar routes of its
+// own tenant (the same effective account and app) on its socket,
+// whatever their status;
+// - exactly one owner, ready: the alias resolves to it (sources);
+// - one owner not ready (moving, failed, creating), two owners, or no
+// owner of its own while another tenant's route holds the socket: the
+// alias is not served at all (refused). It never falls back to a
+// direct proxy that would skip the owner's readiness, fence or tenancy;
+// - nobody's socket (a stale path, a hand-made row): neither. The row
+// stays the plain socket route it always was.
+
+// platformAliasKey is a socket as one tenant holds it.
+type platformAliasKey struct{ account, app, socket string }
+
+// PlatformAliasFold applies the rule above to one registry listing. It
+// judges only ready platform rows with a socket; the caller serves nothing
+// that is not ready anyway.
+func PlatformAliasFold(routes []registry.Route) (sources map[string]string, refused map[string]bool) {
+ owners := map[platformAliasKey][]registry.Route{}
+ held := map[string]bool{}
+ for _, s := range routes {
+ if s.Platform || s.IsSidecar() || s.App == "" || s.Socket == "" {
+ continue
+ }
+ k := platformAliasKey{registry.EffectiveAccount(s.Account), s.App, s.Socket}
+ owners[k] = append(owners[k], s)
+ held[s.Socket] = true
+ }
+ sources, refused = map[string]string{}, map[string]bool{}
+ for _, a := range routes {
+ if !a.Platform || a.Socket == "" || a.Status != "ready" {
+ continue
+ }
+ own := owners[platformAliasKey{registry.EffectiveAccount(a.Account), a.App, a.Socket}]
+ switch {
+ case a.App != "" && len(own) == 1 && own[0].Status == "ready":
+ sources[a.Host] = own[0].Host
+ case len(own) > 0 || held[a.Socket]:
+ refused[a.Host] = true
+ }
+ }
+ return sources, refused
+}
diff --git a/internal/edge/platformalias_test.go b/internal/edge/platformalias_test.go
new file mode 100644
index 000000000..a6832fdbc
--- /dev/null
+++ b/internal/edge/platformalias_test.go
@@ -0,0 +1,153 @@
+package edge
+
+import (
+ "maps"
+ "slices"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// The fold's rule: an alias resolves only to the one ready route of its
+// own effective account and app on its socket. Another tenant's socket, two
+// of its own tenant's routes, or its one owner not ready: refused, never a
+// direct proxy. A socket nobody holds: neither.
+func TestPlatformAliasFold(t *testing.T) {
+ inst := func(host, acct, app, sock string) registry.Route {
+ return registry.Route{Host: host, Kind: "instance", Account: acct, App: app, Socket: sock, Status: "ready", Hibernate: true}
+ }
+ alias := func(host, acct, app, sock string) registry.Route {
+ return registry.Route{Host: host, Kind: "instance", Account: acct, App: app, Socket: sock, Status: "ready", Platform: true}
+ }
+ routes := []registry.Route{
+ inst("a.abc.example.com", "abc", "shop", "/s/a.sock"),
+ alias("shop.abc.example.com", "abc", "shop", "/s/a.sock"),
+ alias("shop.xyz.example.com", "xyz", "shop", "/s/a.sock"), // another account
+ alias("blog.abc.example.com", "abc", "blog", "/s/a.sock"), // another app
+ alias("stale.abc.example.com", "abc", "shop", "/s/gone.sock"), // nobody's socket
+ inst("legacy.example.com", "", "ops", "/s/l.sock"), // empty account is the ops account
+ alias("ops.bab.example.com", "bab", "ops", "/s/l.sock"), // ...so this is the same tenant
+ inst("d1.abc.example.com", "abc", "dup", "/s/d.sock"), // two of one tenant's
+ inst("d2.abc.example.com", "abc", "dup", "/s/d.sock"), // routes on one socket
+ alias("dup.abc.example.com", "abc", "dup", "/s/d.sock"), // refused
+ {Host: "w.abc.example.com", Kind: "sidecar", Account: "abc", App: "shop", Socket: "/s/w.sock", Status: "ready"},
+ alias("side.abc.example.com", "abc", "shop", "/s/w.sock"), // a sidecar holds nothing
+ {Host: "n.abc.example.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/n.sock", Status: "creating"},
+ alias("notready.abc.example.com", "abc", "shop", "/s/n.sock"), // its owner is not ready: refused
+ }
+ sources, refused := PlatformAliasFold(routes)
+ wantSources := map[string]string{"shop.abc.example.com": "a.abc.example.com", "ops.bab.example.com": "legacy.example.com"}
+ if !maps.Equal(sources, wantSources) {
+ t.Errorf("sources = %v, want %v", sources, wantSources)
+ }
+ wantRefused := map[string]bool{"shop.xyz.example.com": true, "blog.abc.example.com": true,
+ "dup.abc.example.com": true, "notready.abc.example.com": true}
+ if !maps.Equal(refused, wantRefused) {
+ t.Errorf("refused = %v, want %v", refused, wantRefused)
+ }
+}
+
+// Wired through Reload: the alias maps to the instance's OWN entry (the
+// identical proxy, the instance's route, hibernating), as an attached
+// hostname does; another tenant's alias on the socket has no entry; and the
+// alias's own platform host stays in the wildcard parent set.
+func TestPlatformAliasSharesTheInstanceEntry(t *testing.T) {
+ reg := openReg(t)
+ for _, rt := range []registry.Route{
+ {Host: "a.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Hibernate: true},
+ {Host: "shop.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Platform: true},
+ {Host: "shop.xyz.oncarlos.com", Kind: "instance", Account: "xyz", App: "shop", Socket: "/s/a.sock", Status: "ready", Platform: true},
+ } {
+ if err := reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ upsertAlias(t, reg, "www.shop.example", "shop.abc.oncarlos.com")
+ e, err := New(reg, &routeRecordingActivator{})
+ if err != nil {
+ t.Fatal(err)
+ }
+ m := e.current()
+ inst, ok := m["a.abc.oncarlos.com"]
+ if !ok || !inst.hibernating {
+ t.Fatalf("instance entry: %+v", inst)
+ }
+ for _, h := range []string{"shop.abc.oncarlos.com", "www.shop.example"} {
+ up, ok := m[h]
+ if !ok || up.proxy != inst.proxy || up.route.Host != "a.abc.oncarlos.com" || !up.hibernating || !up.alias {
+ t.Errorf("%s is not the instance's entry: %+v", h, up)
+ }
+ }
+ if _, ok := m["shop.xyz.oncarlos.com"]; ok {
+ t.Error("another account's alias on the instance's socket is served")
+ }
+ hosts := e.currentHosts()
+ if !slices.Contains(hosts, "shop.abc.oncarlos.com") || slices.Contains(hosts, "www.shop.example") {
+ t.Errorf("currentHosts = %v, want the platform alias and not the attached hostname", hosts)
+ }
+}
+
+// An alias with a prefix map of its own keeps the map over the instance's
+// entry: its default backend is the instance's (and wakes it), and a
+// matched prefix still names its own target.
+func TestPlatformAliasKeepsItsOwnPrefixMap(t *testing.T) {
+ reg := openReg(t)
+ for _, rt := range []registry.Route{
+ {Host: "a.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Hibernate: true},
+ {Host: "shop.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Platform: true},
+ {Host: "docs.abc.oncarlos.com", Kind: "service", Account: "abc", App: "docs", Addr: "127.0.0.1:1", Status: "ready"},
+ } {
+ if err := reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := reg.UpsertPath(registry.RoutePath{Host: "shop.abc.oncarlos.com", Prefix: "docs", Target: "docs.abc.oncarlos.com"}); err != nil {
+ t.Fatal(err)
+ }
+ e, err := New(reg, &routeRecordingActivator{})
+ if err != nil {
+ t.Fatal(err)
+ }
+ m := e.current()
+ up := m["shop.abc.oncarlos.com"]
+ if up.proxy != m["a.abc.oncarlos.com"].proxy || !up.hibernating || up.route.Host != "a.abc.oncarlos.com" {
+ t.Fatalf("alias default backend is not the instance's entry: %+v", up)
+ }
+ if up.paths["docs"] != "docs.abc.oncarlos.com" {
+ t.Errorf("alias prefix map lost: %v", up.paths)
+ }
+ if m["a.abc.oncarlos.com"].paths != nil {
+ t.Errorf("the alias's prefix map leaked onto the instance: %v", m["a.abc.oncarlos.com"].paths)
+ }
+}
+
+// An alias never inherits its instance's prefix map (Astra r2 P1): the
+// published owner of a hostname is read from its own path rows, so an
+// inherited map would route one app's door caller to another app.
+func TestPlatformAliasDoesNotInheritTheInstancesPrefixMap(t *testing.T) {
+ reg := openReg(t)
+ for _, rt := range []registry.Route{
+ {Host: "a.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Hibernate: true},
+ {Host: "shop.abc.oncarlos.com", Kind: "instance", Account: "abc", App: "shop", Socket: "/s/a.sock", Status: "ready", Platform: true},
+ {Host: "docs.abc.oncarlos.com", Kind: "service", Account: "abc", App: "docs", Addr: "127.0.0.1:1", Status: "ready"},
+ } {
+ if err := reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := reg.UpsertPath(registry.RoutePath{Host: "a.abc.oncarlos.com", Prefix: "docs", Target: "docs.abc.oncarlos.com"}); err != nil {
+ t.Fatal(err)
+ }
+ e, err := New(reg, &routeRecordingActivator{})
+ if err != nil {
+ t.Fatal(err)
+ }
+ m := e.current()
+ if m["a.abc.oncarlos.com"].paths["docs"] == "" {
+ t.Fatal("fixture: the instance has no prefix map")
+ }
+ up := m["shop.abc.oncarlos.com"]
+ if up.paths != nil || up.proxy != m["a.abc.oncarlos.com"].proxy {
+ t.Errorf("alias = paths %v, instance proxy %v; want no prefix map over the instance's entry", up.paths, up.proxy == m["a.abc.oncarlos.com"].proxy)
+ }
+}
diff --git a/internal/host/aliaswake_assets_test.go b/internal/host/aliaswake_assets_test.go
new file mode 100644
index 000000000..452a7ac8d
--- /dev/null
+++ b/internal/host/aliaswake_assets_test.go
@@ -0,0 +1,70 @@
+package host
+
+import (
+ "testing"
+
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// #338 follow-up, Astra r1 P2s: the edges file and the asset policy read
+// platform aliases by the edge's own rule (edge.PlatformAliasFold). A
+// served alias publishes its instance's asset block, naming the instance
+// as its primary, as the edge's folded entry does; a refused alias
+// (another account's socket, or an instance that is not ready) is neither
+// advertised nor given assets, so no other edge forwards to it or orders a
+// certificate for it.
+func TestPlatformAliasPublicationFollowsTheEdgesRule(t *testing.T) {
+ t.Parallel()
+ w := newAssetWorld(t)
+ w.ship("v1", "/assets/")
+ const inst = "shop-a.abc.example.com"
+ w.instance(inst, assetGen1, "v1")
+ sock := "/run/carlos/" + inst + ".sock"
+ for _, rt := range []registry.Route{
+ // The alias row carries a build and generation of its own, so a hostname
+ // attached to it would be given one if it resolved to this row.
+ {Host: "shop.abc.example.com", Kind: "instance", Account: "abc", App: "shop", Platform: true, Status: "ready", Socket: sock, AssetGen: assetGen1, Version: "v1"},
+ {Host: "shop.xyz.example.com", Kind: "instance", Account: "xyz", App: "shop", Platform: true, Status: "ready", Socket: sock},
+ } {
+ if err := w.reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ w.confirm()
+ hosts := w.hosts()
+ wantAssets(t, hosts, "shop.abc.example.com", []string{"/assets/"}, assetGen1, assetT0)
+ if got := hosts["shop.abc.example.com"].Assets.Primary; got != inst {
+ t.Errorf("alias published primary %q, want %s", got, inst)
+ }
+ if got, ok := w.policy.For("shop.abc.example.com"); !ok || got.Primary != inst || got.Gen != assetGen1 {
+ t.Errorf("For(alias) = %+v %v, want the instance's block", got, ok)
+ }
+ if _, ok := hosts["shop.xyz.example.com"]; ok {
+ t.Error("another account's alias on the socket was advertised")
+ }
+ if _, ok := w.policy.For("shop.xyz.example.com"); ok {
+ t.Error("another account's alias was given assets")
+ }
+ // A hostname attached to the platform alias is refused, not cached
+ // through it (Astra r2 P2, refused up front).
+ if err := w.reg.UpsertAlias(registry.RouteAlias{Alias: "www.shop.example", Host: "shop.abc.example.com", Account: "abc", App: "shop"}); err != nil {
+ t.Fatal(err)
+ }
+ if err := w.reg.SetAliasDNSStatus("www.shop.example", "pointing", assetT0.Unix()); err != nil {
+ t.Fatal(err)
+ }
+ hosts = w.hosts()
+ wantNoAssets(t, hosts, "www.shop.example")
+ if _, ok := w.policy.For("www.shop.example"); ok {
+ t.Error("a hostname attached to a platform alias was given assets")
+ }
+
+ // The instance leaves ready: its alias stops being advertised with it.
+ if err := w.reg.SetStatus(inst, "moving"); err != nil {
+ t.Fatal(err)
+ }
+ hosts = w.hosts()
+ if _, ok := hosts["shop.abc.example.com"]; ok {
+ t.Error("the alias of a moving instance is still advertised")
+ }
+}
diff --git a/internal/host/aliaswake_test.go b/internal/host/aliaswake_test.go
new file mode 100644
index 000000000..0358f489e
--- /dev/null
+++ b/internal/host/aliaswake_test.go
@@ -0,0 +1,175 @@
+package host
+
+import (
+ "context"
+ "errors"
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/activator"
+ "github.com/carlosframework/platform/internal/edge"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// #338 follow-up, production-wired: a real edge over a real activator and
+// registry. A platform alias (the domains pass's apex mint, which shares
+// its instance's socket) wakes the sleeping instance through the instance's
+// own wake path: one wake, keyed on the instance's host, under the
+// instance's fence. Another account's alias on the same socket never wakes
+// it.
+func TestPlatformAliasWakesItsSleepingInstance(t *testing.T) {
+ const host = "shop-a.bab.oncarlos.com"
+ reg, inst, svc, _ := wakeFixture(t, host, time.Hour, func(w http.ResponseWriter, r *http.Request) {
+ io.WriteString(w, "awake")
+ })
+ for _, rt := range []registry.Route{
+ {Host: "shop.bab.oncarlos.com", Kind: "instance", Account: "bab", App: "app", Platform: true, Status: "ready", Socket: inst.socket},
+ {Host: "shop.xyz.oncarlos.com", Kind: "instance", Account: "xyz", App: "app", Platform: true, Status: "ready", Socket: inst.socket},
+ {Host: "blog.bab.oncarlos.com", Kind: "instance", Account: "bab", App: "blog", Platform: true, Status: "ready", Socket: inst.socket},
+ } {
+ if err := reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ e, err := edge.New(reg, svc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ server := httptest.NewServer(e)
+ defer server.Close()
+ client := &http.Client{Timeout: 10 * time.Second}
+ get := func(host string) (int, string) {
+ t.Helper()
+ r, _ := http.NewRequest(http.MethodGet, server.URL+"/", nil)
+ r.Host = host
+ resp, err := client.Do(r)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ b, _ := io.ReadAll(resp.Body)
+ return resp.StatusCode, string(b)
+ }
+
+ // Another account's alias, and another app's, on the instance's
+ // socket: neither wakes it.
+ for _, other := range []string{"shop.xyz.oncarlos.com", "blog.bab.oncarlos.com"} {
+ if code, _ := get(other); code == http.StatusOK {
+ t.Errorf("%s answered 200", other)
+ }
+ if inst.running() || svc.Owns(host) || inst.startCount() != 0 {
+ t.Fatalf("%s woke another tenant's instance", other)
+ }
+ }
+
+ // The instance's fence holds for its alias as it does for its host.
+ gen := uint64(7)
+ fctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ // Nothing was running, so the stop is unproven; the fence is installed.
+ if _, err := svc.FenceAndStopIfUnfenced(fctx, host, gen); err != nil && !errors.Is(err, activator.ErrStopUnproven) {
+ t.Fatal(err)
+ }
+ ownCode, _ := get(host)
+ aliasCode, _ := get("shop.bab.oncarlos.com")
+ if aliasCode != ownCode || ownCode == http.StatusOK || inst.startCount() != 0 {
+ t.Fatalf("under the fence: host %d, alias %d, starts %d", ownCode, aliasCode, inst.startCount())
+ }
+ if !svc.LiftFence(host, gen) {
+ t.Fatal("fence not lifted")
+ }
+
+ // The alias wakes the sleeping instance, once, keyed on its host.
+ if code, body := get("shop.bab.oncarlos.com"); code != http.StatusOK || body != "awake" {
+ t.Fatalf("alias: %d %q, want 200 awake", code, body)
+ }
+ if !svc.Owns(host) || inst.startCount() != 1 {
+ t.Fatalf("after the alias: owns %v, starts %d", svc.Owns(host), inst.startCount())
+ }
+ // The instance's own host and the alias share that one wake.
+ if code, body := get(host); code != http.StatusOK || body != "awake" {
+ t.Fatalf("host: %d %q", code, body)
+ }
+ if code, _ := get("shop.bab.oncarlos.com"); code != http.StatusOK || inst.startCount() != 1 {
+ t.Fatalf("second alias request: %d, starts %d", code, inst.startCount())
+ }
+ // The app sees the name the browser asked for.
+ served := inst.served()
+ if len(served) == 0 || served[0].Host != "shop.bab.oncarlos.com" {
+ t.Errorf("first request reached the app with Host %v", served)
+ }
+ // With the instance awake, another tenant's alias on its socket still
+ // never reaches it: the edge does not serve it at all.
+ before := len(inst.served())
+ for _, other := range []string{"shop.xyz.oncarlos.com", "blog.bab.oncarlos.com"} {
+ if code, _ := get(other); code == http.StatusOK {
+ t.Errorf("%s answered 200 with the instance awake", other)
+ }
+ }
+ if len(inst.served()) != before {
+ t.Errorf("another tenant's alias reached the awake instance")
+ }
+
+ // The instance leaves "ready" (a move sets "moving" before it
+ // quiesces): its alias is not served, even with the socket still live.
+ // Never a direct proxy around the instance's own status.
+ if err := reg.SetStatus(host, "moving"); err != nil {
+ t.Fatal(err)
+ }
+ if err := e.Reload(); err != nil {
+ t.Fatal(err)
+ }
+ before = len(inst.served())
+ if code, _ := get("shop.bab.oncarlos.com"); code == http.StatusOK || len(inst.served()) != before {
+ t.Errorf("alias of a moving instance answered %d and reached it", code)
+ }
+}
+
+// The alias's own prefix map, through the real edge and activator: a
+// matched prefix reaches its target, the default wakes the instance.
+func TestPlatformAliasPrefixMapWakesTheInstanceByDefault(t *testing.T) {
+ const host = "shop-a.bab.oncarlos.com"
+ reg, inst, svc, _ := wakeFixture(t, host, time.Hour, func(w http.ResponseWriter, r *http.Request) {
+ io.WriteString(w, "awake")
+ })
+ docs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "docs") }))
+ defer docs.Close()
+ for _, rt := range []registry.Route{
+ {Host: "shop.bab.oncarlos.com", Kind: "instance", Account: "bab", App: "app", Platform: true, Status: "ready", Socket: inst.socket},
+ {Host: "docs.bab.oncarlos.com", Kind: "service", Account: "bab", App: "docs", Status: "ready", Addr: docs.Listener.Addr().String()},
+ } {
+ if err := reg.Upsert(rt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := reg.UpsertPath(registry.RoutePath{Host: "shop.bab.oncarlos.com", Prefix: "docs", Target: "docs.bab.oncarlos.com"}); err != nil {
+ t.Fatal(err)
+ }
+ e, err := edge.New(reg, svc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ server := httptest.NewServer(e)
+ defer server.Close()
+ get := func(path string) (int, string) {
+ t.Helper()
+ r, _ := http.NewRequest(http.MethodGet, server.URL+path, nil)
+ r.Host = "shop.bab.oncarlos.com"
+ resp, err := (&http.Client{Timeout: 10 * time.Second}).Do(r)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ b, _ := io.ReadAll(resp.Body)
+ return resp.StatusCode, string(b)
+ }
+ if code, body := get("/docs/intro"); code != http.StatusOK || body != "docs" || inst.startCount() != 0 {
+ t.Fatalf("matched prefix: %d %q, starts %d", code, body, inst.startCount())
+ }
+ if code, body := get("/elsewhere"); code != http.StatusOK || body != "awake" || inst.startCount() != 1 {
+ t.Fatalf("unmatched path: %d %q, starts %d", code, body, inst.startCount())
+ }
+}
diff --git a/internal/host/assetpolicy.go b/internal/host/assetpolicy.go
index 5ae832c93..de306cf0e 100644
--- a/internal/host/assetpolicy.go
+++ b/internal/host/assetpolicy.go
@@ -198,11 +198,19 @@ type assetInputs struct {
pathHosts map[string]bool
// owners is servedOwners over the served rows.
owners map[string]*hostOwner
+ // platformOf maps a platform alias the edge serves with its instance's
+ // entry to that instance's host; platformRefused holds the ones the edge
+ // does not serve (edge.PlatformAliasFold).
+ platformOf map[string]string
+ platformRefused map[string]bool
}
func newAssetInputs(routes []registry.Route, served map[string]edgeHost, paths []registry.RoutePath, aliases []registry.RouteAlias, owners map[string]*hostOwner) assetInputs {
in := assetInputs{byHost: make(map[string]registry.Route, len(routes)), aliasOf: map[string]string{},
pathHosts: map[string]bool{}, owners: owners}
+ // Platform aliases resolve as the edge resolves them (#338 follow-up),
+ // so the policy names the primary the edge serves the alias with.
+ in.platformOf, in.platformRefused = edge.PlatformAliasFold(routes)
for _, r := range routes {
in.byHost[r.Host] = r
}
@@ -251,10 +259,25 @@ func (p *assetPolicy) readAssetInputs() (assetInputs, error) {
// primary resolves host to the route the edge serves it with: its own row,
// or for an exact alias its primary's (a real route beats an alias).
func (in assetInputs) primary(host string) (registry.Route, bool) {
+ if in.platformRefused[host] {
+ return registry.Route{}, false
+ }
+ if src, ok := in.platformOf[host]; ok {
+ r, ok := in.byHost[src]
+ return r, ok
+ }
if r, ok := in.byHost[host]; ok {
return r, true
}
if ph, ok := in.aliasOf[host]; ok {
+ // A hostname attached to a platform alias is refused, not resolved
+ // through it: the cache never holds it (Astra r2 P2, stopping rule 2:
+ // refused up front rather than a third resolution fix). The minted
+ // apex row carries no asset generation, so this is what it got
+ // before platform aliases were folded.
+ if _, viaPlatform := in.platformOf[ph]; viaPlatform || in.platformRefused[ph] {
+ return registry.Route{}, false
+ }
r, ok := in.byHost[ph]
return r, ok
}
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go
index 7dd53d55e..8b5fb1f8b 100644
--- a/internal/host/edgesfile.go
+++ b/internal/host/edgesfile.go
@@ -16,6 +16,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/appconfig"
+ "github.com/carlosframework/platform/internal/edge"
"github.com/carlosframework/platform/internal/instancectl"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
@@ -535,7 +536,14 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re
return fmt.Errorf("edges: list: %w", err)
}
hosts := make(map[string]edgeHost, len(routes))
+ // A platform alias the edge refuses to serve (edge.PlatformAliasFold:
+ // another tenant's socket, or an owner that is not ready) is not
+ // advertised either, nor anything attached to it (#338 follow-up).
+ _, refusedAliases := edge.PlatformAliasFold(routes)
for _, r := range routes {
+ if refusedAliases[r.Host] {
+ continue
+ }
// edge.Reload (internal/edge/edge.go) is the deployment's own
// definition of "serves": it skips any row whose Status != "ready"
// because a pending/creating/failed row has no working backend and
diff --git a/internal/provision/testdata/plan14-root-reads-alias-wake-338.tsv b/internal/provision/testdata/plan14-root-reads-alias-wake-338.tsv
new file mode 100644
index 000000000..9c40a8da0
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-alias-wake-338.tsv
@@ -0,0 +1,16 @@
+# Census overlay alias-wake-338, written by census-propose (#369). census-ruling-alias-wake-338, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-alias-wake-338.md.
+# 1 body, 4 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 50b49b4c666f8ef7da4d351441b1518dfa0ab7022e1a32f0de1c7730257190c9 internal/edge/edge.go Edge.currentHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: a resolved platform alias (platformAlias) stays in the wildcard parent set as its own row was before; attached hostnames still excluded registry:Platform@123,registry:Provisioned@144,whole:Route@126,whole:Route@147 ca98cb2611a9334a4f42b2dea56f3273f4ee01395657d70a3012891927199354
+@legacy 830ca468138fa214556ed707b67fdec08b6746a072e7a6d665c666360b1f090a internal/edge/platformalias.go PlatformAliasFold legacy accepted-legacy accepted-legacy;rev3=census-ruling-alias-wake-338;basis=#338 follow-up (renamed from platformAliasFold, exported for the publisher and asset policy): from a registry listing, maps each ready platform alias with a socket to the one ready non-platform, non-sidecar route of the same effective account and app on that socket (sources), else refuses it when its socket has any owner (its own tenant's not ready or ambiguous, or another tenant's); reads route columns only, opens nothing registry:Account@343,registry:Account@656,registry:App@245,registry:App@355,registry:App@668,registry:App@704,registry:Host@773,registry:Host@783,registry:Host@845,registry:Platform@214,registry:Platform@527,registry:Socket@260,registry:Socket@362,registry:Socket@414,registry:Socket@541,registry:Socket@675,registry:Socket@823,registry:Status@559,registry:Status@736,whole:Route@200,whole:Route@374,whole:Route@393,whole:Route@404,whole:Route@512,whole:Route@606,whole:Route@723,whole:Route@736,whole:Route@783,whole:Route@806 a18e4963cf88320ef3fb94b666b02838dc12cc3e9b2df3f2cbe2576ca682735f
+@legacy 0b78ae5838265ecfdf8817d80ab707a3d44c6fc50ee7d374ac140fb097dcd591 internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias registry:Account@20179,registry:Alias@18348,registry:Alias@18435,registry:Alias@18671,registry:FleetBox@5526,registry:Health@7689,registry:Health@7807,registry:Hibernate@13017,registry:Hibernate@14927,registry:Hibernate@6049,registry:Host@13065,registry:Host@14989,registry:Host@15297,registry:Host@15324,registry:Host@16125,registry:Host@16391,registry:Host@18474,registry:Host@6098,registry:Host@8290,registry:Host@8385,registry:Host@8665,registry:Host@8691,registry:Host@8743,registry:Kind@11542,registry:Kind@11564,registry:Kind@12993,registry:Kind@14903,registry:Kind@6025,registry:Kind@8831,registry:Kind@8891,registry:Name@20169,registry:Prefix@16366,registry:Region@2252,registry:Socket@15305,registry:Socket@5633,registry:Socket@6162,registry:Status@1835,registry:Target@16378,registry:Tunnel@4574,registry:Tunnel@4630,registry:Version@11523,registry:Version@11625,whole:Fleet@20119,whole:Fleet@20148,whole:Route@130,whole:Route@15357,whole:Route@15364,whole:Route@15460,whole:Route@17269,whole:Route@4692,whole:Route@5590,whole:Route@6218,whole:Route@648,whole:Route@8808,whole:Route@8881,whole:Route@8941,whole:RouteAlias@18319,whole:RoutePath@16103 92d3dc52f9638ec6d4142762e815ab6799071ee43e36744edec87cd6081bea10
+@legacy 1acf1712972cf57058153c598e807202c734dc347425b0e61660cce48727cc1d internal/host/assetpolicy.go assetInputs.primary legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): resolves a hostname to its route row or, for an exact alias, its primary's, over rows already read; reads nothing itself; no root pass calls it; no root decision;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: a refused platform alias has no primary; a resolved one resolves to its source's row, as the edge serves it; a hostname attached to a platform alias has none (refused, Astra r2 P2) whole:Route@190,whole:Route@211,whole:Route@236,whole:Route@264,whole:Route@767,whole:Route@787 ab10026a614763331fb3c9b8bf66f0795b132b4dd3465512638fec7771f51fae
+@legacy 1a9bb53143c27a675bcaf1b5683f6be5de1c5dc1e0d367bc3f7d9c144f49671f internal/host/assetpolicy.go newAssetInputs legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): indexes rows already read (routes by host, exact aliases to their primary, hosts with path rows) and the owners (servedOwners when not handed them); reads nothing itself; no root pass calls it; no root decision;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: records edge.PlatformAliasFold over the same routes (platformOf, platformRefused) registry:Alias@685,registry:Alias@720,registry:Alias@766,registry:Host@576,registry:Host@633,registry:Host@777,whole:Route@195,whole:Route@239,whole:Route@528,whole:Route@555,whole:Route@569,whole:Route@586,whole:Route@837,whole:RouteAlias@670,whole:RoutePath@610,whole:RoutePath@853 54c90ae15c22220b05121ba828a4a7c7be5c8a990d585bbe88900caaf319225d
+internal/edge/edge.go Edge.currentHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: a resolved platform alias (platformAlias) stays in the wildcard parent set as its own row was before; attached hostnames still excluded registry:Platform@123,registry:Provisioned@144,whole:Route@126,whole:Route@147 ca98cb2611a9334a4f42b2dea56f3273f4ee01395657d70a3012891927199354
+internal/edge/platformalias.go PlatformAliasFold legacy accepted-legacy accepted-legacy;rev3=census-ruling-alias-wake-338;basis=#338 follow-up (renamed from platformAliasFold, exported for the publisher and asset policy): from a registry listing, maps each ready platform alias with a socket to the one ready non-platform, non-sidecar route of the same effective account and app on that socket (sources), else refuses it when its socket has any owner (its own tenant's not ready or ambiguous, or another tenant's); reads route columns only, opens nothing registry:Account@343,registry:Account@656,registry:App@245,registry:App@355,registry:App@668,registry:App@704,registry:Host@773,registry:Host@783,registry:Host@845,registry:Platform@214,registry:Platform@527,registry:Socket@260,registry:Socket@362,registry:Socket@414,registry:Socket@541,registry:Socket@675,registry:Socket@823,registry:Status@559,registry:Status@736,whole:Route@200,whole:Route@374,whole:Route@393,whole:Route@404,whole:Route@512,whole:Route@606,whole:Route@723,whole:Route@736,whole:Route@783,whole:Route@806 a18e4963cf88320ef3fb94b666b02838dc12cc3e9b2df3f2cbe2576ca682735f
+internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias registry:Account@20179,registry:Alias@18348,registry:Alias@18435,registry:Alias@18671,registry:FleetBox@5526,registry:Health@7689,registry:Health@7807,registry:Hibernate@13017,registry:Hibernate@14927,registry:Hibernate@6049,registry:Host@13065,registry:Host@14989,registry:Host@15297,registry:Host@15324,registry:Host@16125,registry:Host@16391,registry:Host@18474,registry:Host@6098,registry:Host@8290,registry:Host@8385,registry:Host@8665,registry:Host@8691,registry:Host@8743,registry:Kind@11542,registry:Kind@11564,registry:Kind@12993,registry:Kind@14903,registry:Kind@6025,registry:Kind@8831,registry:Kind@8891,registry:Name@20169,registry:Prefix@16366,registry:Region@2252,registry:Socket@15305,registry:Socket@5633,registry:Socket@6162,registry:Status@1835,registry:Target@16378,registry:Tunnel@4574,registry:Tunnel@4630,registry:Version@11523,registry:Version@11625,whole:Fleet@20119,whole:Fleet@20148,whole:Route@130,whole:Route@15357,whole:Route@15364,whole:Route@15460,whole:Route@17269,whole:Route@4692,whole:Route@5590,whole:Route@6218,whole:Route@648,whole:Route@8808,whole:Route@8881,whole:Route@8941,whole:RouteAlias@18319,whole:RoutePath@16103 92d3dc52f9638ec6d4142762e815ab6799071ee43e36744edec87cd6081bea10
+internal/host/assetpolicy.go assetInputs.primary legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): resolves a hostname to its route row or, for an exact alias, its primary's, over rows already read; reads nothing itself; no root pass calls it; no root decision;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: a refused platform alias has no primary; a resolved one resolves to its source's row, as the edge serves it; a hostname attached to a platform alias has none (refused, Astra r2 P2) whole:Route@190,whole:Route@211,whole:Route@236,whole:Route@264,whole:Route@767,whole:Route@787 ab10026a614763331fb3c9b8bf66f0795b132b4dd3465512638fec7771f51fae
+internal/host/assetpolicy.go newAssetInputs legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in the edges file loop (edgesFileLoop, edgesFileWriteClaims), only on a box armed with CARLOS_ASSET_CACHE=1 (armAssetPolicy answers nil otherwise): indexes rows already read (routes by host, exact aliases to their primary, hosts with path rows) and the owners (servedOwners when not handed them); reads nothing itself; no root pass calls it; no root decision;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: records edge.PlatformAliasFold over the same routes (platformOf, platformRefused) registry:Alias@685,registry:Alias@720,registry:Alias@766,registry:Host@576,registry:Host@633,registry:Host@777,whole:Route@195,whole:Route@239,whole:Route@528,whole:Route@555,whole:Route@569,whole:Route@586,whole:Route@837,whole:RouteAlias@670,whole:RoutePath@610,whole:RoutePath@853 54c90ae15c22220b05121ba828a4a7c7be5c8a990d585bbe88900caaf319225d
+internal/host/edgesfile.go edgesFileWriteClaims authority F,J1 rev3=census-ruling-self-serve-moves-1;basis=root-route;kept=F;scope=protected-decision-only; the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): region-ha-2a's body, which with the box's lifetimes switch on also publishes each served row's lifetime pair (registry:Incarnation and registry:ServingSeq, two new sites on the rows it already lists) and an alias's or served catch-all's primary's pair, and names that primary as target_host whatever the switch; a report the edge orders unstamped entries by, not a decision; no record, /data, release or claim read added; F,J1 authority retained; self-serve moves 1 Task 8;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 8: takes a localAddrs reader (instancectl.LocalAddresses in production, which reads /proc/net/fib_trie and /proc/net/if_inet6 in the agent) and publishes its non-loopback entries as the edges file's addrs before the write gate (boxAddrs, no read of its own), so an address change writes once. The same 44 sites, offsets moved; no record, /data, release or claim read added; a report the console's egress grant check reads, not a root decision; F,J1 authority retained.;rev3=census-ruling-edge-asset-cache-3;basis=starts with assets = assets.active(), so a policy whose box has not opened its asset store publishes no assets blocks and reads no manifests, and copies the decision's Primary (the route host the block was decided for, drift D4) into the published assets block; read sites unchanged (44); no read added. Merged onto main's #328 body, which takes the localAddrs reader: the assets.active() line sits after that signature and the loop passes pub and instancectl.LocalAddresses;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: the claims argument (*edgesClaims) becomes addrs (AddressSource) and the applyEdgesClaims(ctx, claims, routes, hosts) call is deleted with edgesclaims.go, which is the one whole:Route site removed: no host claim is read and every served row publishes as with region HA off; the box-address publication is the same code reading addrs.BoxAddresses() instead of claims.addrs; a report the edge reads, not a root decision; no read added; merge of origin/main d7ae1d76: main's edge asset cache plan 3 body is kept (census-ruling-edge-asset-cache-3): the first line is assets = assets.active(), so a policy whose store has not opened publishes no assets blocks and reads no manifests, and edgesFileLoop passes pub (assets.active() for that tick) in the assets argument; main's claims *edgesClaims argument is this branch's addrs AddressSource, and no edgesClaims, applyEdgesClaims or hostclaim reference remains;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: skips publishing a platform alias edge.PlatformAliasFold refuses (and so anything attached to it); reads the same route listing registry:Account@12119,registry:Alias@6067,registry:Alias@6102,registry:Alias@6524,registry:Alias@6681,registry:Alias@6751,registry:Alias@6783,registry:Alias@7456,registry:Alias@9811,registry:App@12131,registry:DNSStatus@6199,registry:DNSStatus@6690,registry:Host@10039,registry:Host@1068,registry:Host@11549,registry:Host@3905,registry:Host@6159,registry:Host@7004,registry:Host@7440,registry:Host@7613,registry:Host@9858,registry:Host@9905,registry:Host@9955,registry:Host@9990,registry:Incarnation@3865,registry:Platform@3644,registry:Provisioned@3658,registry:Replica@3682,registry:ServingSeq@3880,registry:Status@1611,whole:Route@1012,whole:Route@1039,whole:Route@13214,whole:Route@13640,whole:Route@13815,whole:Route@4275,whole:Route@750,whole:RouteAlias@13236,whole:RouteAlias@13830,whole:RouteAlias@6052,whole:RouteAlias@9764,whole:RoutePath@13229,whole:RoutePath@13823,whole:RoutePath@4290,whole:WildcardDomain@9944 e75a5d7aacc51670ce9506f9301600c8a2bcfa3340825de0cc5b1b89ec8b5508
+@coverage internal/edge eb3743f07bd5cd8394b4e9dfff5931bff9099e51362687f1e9c88baf716404de
+@coverage internal/host e7130e3b04365ef971d16875c72b7b6e0d70706e5c8f663f74d64870081984ef
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index a7b879c4b..092af8496 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -11,3 +11,4 @@ plan14-root-reads-alias-socket-follow-338.tsv 5192052a23d2fdd6f5d48b5617fe28a9bb
plan14-root-reads-usage-attribution-390.tsv 5192052a23d2fdd6f5d48b5617fe28a9bb03458e1e931c060fbdc42c3d627927
plan14-root-reads-ha-p1a-433.tsv f8acbc0dd8828636e3f73d9afd0e539d3dfd1346e0232d91903c33d6eb27d820
plan14-root-reads-rollup-tenant-tags.tsv f8acbc0dd8828636e3f73d9afd0e539d3dfd1346e0232d91903c33d6eb27d820
+plan14-root-reads-alias-wake-338.tsv deeddee1bf22a18562acda97cc34c6d73ee0dff1825100c73fa0be4c6a3f3e7b