carlos / platform Public

edges: publish pre-issued aliases before their DNS points here (#1293)

A home box publishes an attached alias only once its DNS sweep stamps it
pointing, so on a switch every other edge answered 503 "Almost ready"
for 5-7 minutes. An alias inside the operator's DNS-01 scope
(CARLOS_DNS01_ZONES for claims of CARLOS_DNS01_ACCOUNTS) that already
holds a current certificate is now published before it points, marked
dns_pointing false: every edge relays it from the moment DNS switches,
and the issuer's HTTP-01 warm still leaves it alone.

- edge.DNS01Scope: the zone + account rule, shared by the pre-issuer
  and the edges-file writer.
- internal/host/edgesfile.go: the exception, with an explicit false
  mark even on a box with no apps domain.
- Tests: writer (scope, cert, account, zone, scope off, no apps domain)
  and reader (a not-pointing alias is relayed, kept out of the warm).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 70bb14f98fa0732dce91b0d6ba2ab561ea66d7e9 parent da8a1fe
10 files changed, +317 −30
  • docs/superpowers/notes/census-proposal-alias-publish-precert-1293.md +23 −0
  • internal/edge/dns01scope.go +49 −0
  • internal/edge/edge.go +1 −1
  • internal/edge/homemap_dnspointing_test.go +22 −0
  • internal/edge/precert.go +15 −21
  • internal/edge/precert_test.go +32 −4
  • internal/host/edgesfile.go +25 −4
  • internal/host/edgesfile_precert_test.go +141 −0
  • internal/provision/testdata/plan14-root-reads-alias-publish-precert-1293.tsv +8 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0

CI cancelled — superseded by a newer push — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-Wyrbm6
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/benbjohnson/litestream v0.5.14
go: downloading github.com/superfly/ltx v0.5.1
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/pion/randutil v0.1.0
go: downloading golang.org/x/text v0.43.0
go: downloading golang.org/x/sync v0.24.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading github.com/klauspost/compress v1.20.2
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec

amadan: job cancelled — a newer push superseded it
diff --git a/docs/superpowers/notes/census-proposal-alias-publish-precert-1293.md b/docs/superpowers/notes/census-proposal-alias-publish-precert-1293.md
new file mode 100644
index 000000000..3c689b4a3
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-alias-publish-precert-1293.md
@@ -0,0 +1,23 @@
+# Census approval: alias-publish-precert-1293
+
+Ruling `census-ruling-alias-publish-precert-1293`. 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` `RunWithActivatorReady` | body | unchanged (5) | the edge process (carlos-edge.service, user carlos), not root: the pre-issuer start log now reads its zones from p.scope.Zones (the zones and accounts moved into the shared edge.DNS01Scope); no behaviour change, no read added, the existing 5 read sites unchanged. |
+
+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. 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 the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/edge/edge.go` `RunWithActivatorReady`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added.;rev3=census-ruling-precert-dns01-1293;basis=the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- reads `internal/host/edgesfile.go:edgesFileWriteClaims`: +registry:Account, +registry:Alias, +registry:CertExpiresAt; keeps authority, task F,J1
+
+Seal: `841361b89e20c3763149e8784cdebb037dcc4b828b24196a01d3e300ff319661` → `6d54b64391d27d1c0fe03466aaa8975fc58b839a5aedff2f8dbb21c5093c06c1`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-alias-publish-precert-1293.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/edge/dns01scope.go b/internal/edge/dns01scope.go
new file mode 100644
index 000000000..98ec10e05
--- /dev/null
+++ b/internal/edge/dns01scope.go
@@ -0,0 +1,49 @@
+package edge
+
+import (
+ "slices"
+ "strings"
+)
+
+// DNS01Scope is the operator's authorization to act for a hostname before its
+// DNS points at the deployment (#1293): the zones named in CARLOS_DNS01_ZONES,
+// for claims of the accounts named in CARLOS_DNS01_ACCOUNTS. Two readers hold
+// the same rule, which is why it lives in one exported place:
+//
+// - the issuer's pre-issuer (precert.go) orders certificates over DNS-01
+// only for names it allows;
+// - a home box's edges-file writer (internal/host) publishes an alias that
+// is not pointing yet, marked dns_pointing false, only for a name it
+// allows that already has a current certificate, so every edge can relay
+// it before the DNS switch.
+//
+// The zero value allows nothing.
+type DNS01Scope struct {
+ Zones []string
+ Accounts []string
+}
+
+// DNS01ScopeFromEnv reads both settings through getenv. Quiet: an entry that
+// does not parse is dropped without a log line, because the edges-file writer
+// reads this on every pass; the edge logs bad entries once, at start.
+func DNS01ScopeFromEnv(getenv func(string) string) DNS01Scope {
+ return DNS01Scope{
+ Zones: parseDNS01Zones(getenv("CARLOS_DNS01_ZONES"), false),
+ Accounts: parseDNS01Accounts(getenv("CARLOS_DNS01_ACCOUNTS"), false),
+ }
+}
+
+// Allows reports whether host, claimed by account, is inside the scope: the
+// account is named, and host is a named zone or a name under one.
+func (s DNS01Scope) Allows(host, account string) bool {
+ if account == "" || !slices.Contains(s.Accounts, account) {
+ return false
+ }
+ host = strings.TrimSuffix(strings.ToLower(host), ".")
+ for _, z := range s.Zones {
+ if host == z || strings.HasSuffix(host, "."+z) {
+ return true
+ }
+ }
+ return false
+}
diff --git a/internal/edge/edge.go b/internal/edge/edge.go
index 52501ce1c..d7c4eb441 100644
--- a/internal/edge/edge.go
+++ b/internal/edge/edge.go
@@ -5155,7 +5155,7 @@ func RunWithActivatorReady(args []string, act Activator, cache *Cache, ready fun
// the claim, before they point here. nil = not configured.
if p := e.newPreIssuerFromEnv(certCache, mirror, wm); p != nil {
go p.run()
- log.Printf("edge: certificates before DNS moves on for %v (DNS-01, %s pass, issuer only)", p.zones, preIssueInterval)
+ log.Printf("edge: certificates before DNS moves on for %v (DNS-01, %s pass, issuer only)", p.scope.Zones, preIssueInterval)
}
}
tlsCfg.GetCertificate = getCert
diff --git a/internal/edge/homemap_dnspointing_test.go b/internal/edge/homemap_dnspointing_test.go
index b5731b0c4..9aa53fd66 100644
--- a/internal/edge/homemap_dnspointing_test.go
+++ b/internal/edge/homemap_dnspointing_test.go
@@ -1,6 +1,7 @@
package edge
import (
+ "slices"
"strings"
"sync/atomic"
"testing"
@@ -116,3 +117,24 @@ func TestHomeMapServedHostsPointingOnAnyHomeBox(t *testing.T) {
t.Fatalf("served hosts = %v, want shop.example.com", got)
}
}
+
+// #1293: a home box publishes a pre-issued alias before its DNS points here,
+// marked dns_pointing false. Every other edge must relay it to that box (the
+// whole point) while the cert warm still leaves it alone.
+func TestHomeMapRelaysAnAliasNotPointingYet(t *testing.T) {
+ s := meshTestStore(t)
+ putJSON(t, s, "control/edges/betty.json", `{"v":1,"box":"betty","eip":"2.2.2.2","hosts":{
+ "app.acct.apps.test":{"role":"home","platform":true},
+ "billing.example.com":{"role":"home","alias":true,"target_host":"app.acct.apps.test","dns_pointing":false}}}`)
+ m := newHomeMap(s, "annie")
+ refreshHomeMap(t, m)
+ if eip, box, ok := m.Home("billing.example.com"); !ok || box != "betty" || eip != "2.2.2.2" {
+ t.Fatalf("Home(billing.example.com) = %q, %q, %v; want betty's 2.2.2.2", eip, box, ok)
+ }
+ if !m.KnownHost("billing.example.com") {
+ t.Fatal("KnownHost(billing.example.com) = false; a relayed name must be known")
+ }
+ if slices.Contains(m.ServedHosts(), "billing.example.com") {
+ t.Fatal("a name not pointing yet must stay out of the cert warm's set")
+ }
+}
diff --git a/internal/edge/precert.go b/internal/edge/precert.go
index 9198c71de..465e851b2 100644
--- a/internal/edge/precert.go
+++ b/internal/edge/precert.go
@@ -115,7 +115,7 @@ func preIssueDue(leaf *x509.Certificate, now time.Time) bool {
// lowercased, trailing dot dropped, deduplicated. An entry that is not a
// hostname is dropped with a log line. nil when nothing valid is listed,
// which is "off".
-func parseDNS01Zones(raw string) []string {
+func parseDNS01Zones(raw string, warn bool) []string {
var out []string
for _, z := range strings.Split(raw, ",") {
z = strings.TrimSuffix(strings.ToLower(strings.TrimSpace(z)), ".")
@@ -123,7 +123,9 @@ func parseDNS01Zones(raw string) []string {
continue
}
if !provision.ValidHostShape(z) {
- log.Printf("edge: CARLOS_DNS01_ZONES entry %q is not a zone name, ignored", z)
+ if warn {
+ log.Printf("edge: CARLOS_DNS01_ZONES entry %q is not a zone name, ignored", z)
+ }
continue
}
if !slices.Contains(out, z) {
@@ -136,7 +138,7 @@ func parseDNS01Zones(raw string) []string {
// parseDNS01Accounts reads CARLOS_DNS01_ACCOUNTS: comma-separated account
// sqids, as claims record them. An entry that is not a sqid is dropped with a
// log line. nil when none is valid, which is "off".
-func parseDNS01Accounts(raw string) []string {
+func parseDNS01Accounts(raw string, warn bool) []string {
var out []string
for _, a := range strings.Split(raw, ",") {
a = strings.TrimSpace(a)
@@ -144,7 +146,9 @@ func parseDNS01Accounts(raw string) []string {
continue
}
if !domains.ValidSqid(a) {
- log.Printf("edge: CARLOS_DNS01_ACCOUNTS entry %q is not an account sqid, ignored", a)
+ if warn {
+ log.Printf("edge: CARLOS_DNS01_ACCOUNTS entry %q is not an account sqid, ignored", a)
+ }
continue
}
if !slices.Contains(out, a) {
@@ -157,9 +161,9 @@ func parseDNS01Accounts(raw string) []string {
// preIssuer is the pass. Every input is a field so the decisions are
// testable without an ACME server; newPreIssuerFromEnv wires the real ones.
type preIssuer struct {
- zones []string
- // accounts are the sqids whose claims qualify; nothing else does.
- accounts []string
+ // scope is the operator's zones and accounts; nothing outside it
+ // qualifies.
+ scope DNS01Scope
// cache is the PUBLISHING cache (certsync.go): its Get reads this box's
// own disk, its Put writes the disk and then the bucket.
cache autocert.Cache
@@ -195,7 +199,7 @@ func newPreIssuer(zones, accounts []string, cache autocert.Cache, store release.
claims func(context.Context) ([]domains.Claim, error), published func(string) ([]byte, bool),
covered func(string) bool, order func(context.Context, string) (*tls.Certificate, *ecdsa.PrivateKey, error)) *preIssuer {
return &preIssuer{
- zones: zones, accounts: accounts, cache: cache, store: store, issuer: issuer, claims: claims,
+ scope: DNS01Scope{Zones: zones, Accounts: accounts}, cache: cache, store: store, issuer: issuer, claims: claims,
published: published, covered: covered, order: order, now: time.Now,
nextAttempt: map[string]time.Time{}, tried: map[string]time.Time{}, putAt: map[string]time.Time{},
}
@@ -215,11 +219,11 @@ func dns01OrderFunc(cache autocert.Cache, directory string, dns dnsProvider) fun
// CARLOS_DNS01_ACCOUNTS or no DNS provider to publish through (logged). Called only on a box with a deployment store, so the mirror and
// the issuer gate exist.
func (e *Edge) newPreIssuerFromEnv(cache autocert.Cache, mirror *certMirror, wm *wildcardManager) *preIssuer {
- zones := parseDNS01Zones(os.Getenv("CARLOS_DNS01_ZONES"))
+ zones := parseDNS01Zones(os.Getenv("CARLOS_DNS01_ZONES"), true)
if len(zones) == 0 || e.staticStore == nil || mirror == nil {
return nil
}
- accounts := parseDNS01Accounts(os.Getenv("CARLOS_DNS01_ACCOUNTS"))
+ accounts := parseDNS01Accounts(os.Getenv("CARLOS_DNS01_ACCOUNTS"), true)
if len(accounts) == 0 {
log.Printf("edge: CARLOS_DNS01_ZONES is set but CARLOS_DNS01_ACCOUNTS names no account — certificates are not issued before DNS moves")
return nil
@@ -247,16 +251,6 @@ func (p *preIssuer) run() {
}
}
-// inZone reports whether host is a listed zone or a name under one.
-func (p *preIssuer) inZone(host string) bool {
- for _, z := range p.zones {
- if host == z || strings.HasSuffix(host, "."+z) {
- return true
- }
- }
- return false
-}
-
// candidates is the sorted set of hostnames the pass looks after.
func (p *preIssuer) candidates(claims []domains.Claim) []string {
var out []string
@@ -265,7 +259,7 @@ func (p *preIssuer) candidates(claims []domains.Claim) []string {
switch {
case c.Pending, strings.HasPrefix(host, "*."):
continue
- case !p.inZone(host), !slices.Contains(p.accounts, c.Account):
+ case !p.scope.Allows(host, c.Account):
continue
case p.covered != nil && p.covered(host):
continue
diff --git a/internal/edge/precert_test.go b/internal/edge/precert_test.go
index 3f888451f..01b892829 100644
--- a/internal/edge/precert_test.go
+++ b/internal/edge/precert_test.go
@@ -298,22 +298,22 @@ func TestPreIssueCandidates(t *testing.T) {
}
func TestDNS01AccountsFromEnv(t *testing.T) {
- got := parseDNS01Accounts(" abc ,,not a sqid,abc,xyz")
+ got := parseDNS01Accounts(" abc ,,not a sqid,abc,xyz", true)
if want := []string{"abc", "xyz"}; !slices.Equal(got, want) {
t.Fatalf("parseDNS01Accounts = %v, want %v", got, want)
}
- if parseDNS01Accounts("") != nil {
+ if parseDNS01Accounts("", true) != nil {
t.Fatal("unset must be nil: the feature is off")
}
}
func TestDNS01ZonesFromEnv(t *testing.T) {
- got := parseDNS01Zones(" Example.com. ,,ti.example ,not a zone, example.com,*.wild.test")
+ got := parseDNS01Zones(" Example.com. ,,ti.example ,not a zone, example.com,*.wild.test", true)
want := []string{"example.com", "ti.example"}
if !slices.Equal(got, want) {
t.Fatalf("parseDNS01Zones = %v, want %v", got, want)
}
- if parseDNS01Zones("") != nil {
+ if parseDNS01Zones("", true) != nil {
t.Fatal("unset must be nil: the feature is off")
}
}
@@ -606,3 +606,31 @@ func TestSameChallengeNameOrdersDoNotCollide(t *testing.T) {
}
ca.checkFaults(t)
}
+
+func TestDNS01ScopeAllows(t *testing.T) {
+ s := DNS01Scope{Zones: []string{"example.com"}, Accounts: []string{"acct"}}
+ for _, c := range []struct {
+ host, account string
+ want bool
+ }{
+ {"example.com", "acct", true},
+ {"Billing.Example.com.", "acct", true},
+ {"a.b.example.com", "acct", true},
+ {"badexample.com", "acct", false},
+ {"billing.example.com", "other", false},
+ {"billing.example.com", "", false},
+ {"billing.example.org", "acct", false},
+ } {
+ if got := s.Allows(c.host, c.account); got != c.want {
+ t.Errorf("Allows(%q, %q) = %v, want %v", c.host, c.account, got, c.want)
+ }
+ }
+ if (DNS01Scope{}).Allows("example.com", "acct") {
+ t.Error("the zero scope must allow nothing")
+ }
+ env := map[string]string{"CARLOS_DNS01_ZONES": "example.com, bad zone", "CARLOS_DNS01_ACCOUNTS": "acct,not a sqid"}
+ got := DNS01ScopeFromEnv(func(k string) string { return env[k] })
+ if !slices.Equal(got.Zones, []string{"example.com"}) || !slices.Equal(got.Accounts, []string{"acct"}) {
+ t.Errorf("DNS01ScopeFromEnv = %+v", got)
+ }
+}
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go
index 23cb0178f..e4646ee23 100644
--- a/internal/host/edgesfile.go
+++ b/internal/host/edgesfile.go
@@ -814,7 +814,17 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re
// tenant an unbounded set of names the shared issuer will order for
// (#277's amplification envelope covers routes, which the platform
// provisions). A name that actually resolves to this deployment is
- // the name whose validations must be answerable everywhere;
+ // the name whose validations must be answerable everywhere.
+ // One exception (#1293): an alias the operator has authorized for
+ // DNS-01 (edge.DNS01Scope: CARLOS_DNS01_ZONES for claims of
+ // CARLOS_DNS01_ACCOUNTS) that already holds a current certificate
+ // (the pre-issued one, stamped into cert_expires_at by the domains
+ // sweep) is published before it points, marked dns_pointing false.
+ // Every edge then relays it to this box the moment DNS switches,
+ // instead of answering "Almost ready" until the next sweep; the
+ // false mark keeps it out of the issuer's HTTP-01 warm set, and the
+ // name is the operator's, not a tenant's, so the envelope above is
+ // not widened;
// - never platform-class: a customer's name derives no wildcard parent;
// - marked alias: the reader lets a real route on another box beat it;
// - no "*.parent" catch-all alias: a remote edge could dial it but has
@@ -847,6 +857,8 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re
resolve[a.Alias] = p
}
}
+ dns01 := edge.DNS01ScopeFromEnv(os.Getenv)
+ nowUnix := time.Now().Unix()
for _, a := range aliases {
if a.Alias == "" || strings.HasPrefix(a.Alias, "*.") {
continue
@@ -855,7 +867,9 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re
if !served {
continue
}
- if a.DNSStatus != "pointing" {
+ pointing := a.DNSStatus == "pointing"
+ preIssued := !pointing && a.CertExpiresAt > nowUnix && dns01.Allows(a.Alias, a.Account)
+ if !pointing && !preIssued {
// Withheld, and said so ONCE per name per process: an alias
// whose DNS resolves to an address outside PLATFORM_EDGE_IPS
// (a region EIP missing from that list is the usual cause) is
@@ -881,10 +895,17 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re
// off), and names the primary as its target: the edge compares two
// aliases' pairs only for one target.
p := hosts[primary]
- // Only a pointing alias reaches here, so its mark is always true.
+ // A pointing alias takes the ordinary mark. A pre-issued one is
+ // always an explicit false, even where dnsPointingMark would leave
+ // the mark off (no apps domain): absent reads as pointing.
+ mark := dnsPointingMark(appsDomain, a.Alias, true)
+ if preIssued {
+ notPointing := false
+ mark = &notPointing
+ }
hosts[a.Alias] = edgeHost{Role: "home", Alias: true, Account: acct, App: app, Stamp: p.Stamp,
Incarnation: p.Incarnation, ServingSeq: p.ServingSeq, TargetHost: primary,
- DNSPointing: dnsPointingMark(appsDomain, a.Alias, true)}
+ DNSPointing: mark}
}
// Replica placements (#162): a row minted from a role=replica record —
diff --git a/internal/host/edgesfile_precert_test.go b/internal/host/edgesfile_precert_test.go
new file mode 100644
index 000000000..6c382653c
--- /dev/null
+++ b/internal/host/edgesfile_precert_test.go
@@ -0,0 +1,141 @@
+package host
+
+import (
+ "context"
+ "encoding/json"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// #1293: an alias the operator has authorized for DNS-01 (CARLOS_DNS01_ZONES
+// and CARLOS_DNS01_ACCOUNTS) that already holds a current certificate is
+// published before its DNS points here, marked dns_pointing false, so every
+// edge relays it to this box from the moment DNS switches. Everything else
+// keeps waiting for the "pointing" stamp.
+func TestEdgesFilePublishesPreIssuedAliasesBeforeDNS(t *testing.T) {
+ withheldAliasSaid = sync.Map{}
+ t.Setenv("PLATFORM_APPS_DOMAIN", "apps.test")
+ t.Setenv("CARLOS_DNS01_ZONES", "example.com")
+ t.Setenv("CARLOS_DNS01_ACCOUNTS", "acct")
+ s, reg := release.NewDirStore(t.TempDir()), edgesTestRegistry(t)
+ if err := reg.Upsert(registry.Route{Host: "app.acct.apps.test", Kind: "service", Addr: "10.0.0.1:3000", Status: "ready", Platform: true}); err != nil {
+ t.Fatal(err)
+ }
+ now := time.Now()
+ future, past := now.Add(80*24*time.Hour).Unix(), now.Add(-time.Hour).Unix()
+ for _, a := range []struct {
+ alias, account, status string
+ certAt int64
+ }{
+ {"billing.example.com", "acct", "elsewhere", future}, // the case: published, not pointing
+ {"fresh.example.com", "acct", "", future}, // no DNS record yet: same
+ {"live.example.com", "acct", "pointing", future}, // pointing: published as before
+ {"nocert.example.com", "acct", "elsewhere", 0}, // no certificate yet
+ {"expired.example.com", "acct", "elsewhere", past}, // certificate expired
+ {"other.example.com", "zzz", "elsewhere", future}, // an account the operator did not name
+ {"outside.example.org", "acct", "elsewhere", future}, // outside the zones
+ {"badexample.com", "acct", "elsewhere", future}, // a suffix, not a subdomain
+ } {
+ if err := reg.UpsertAlias(registry.RouteAlias{Alias: a.alias, Host: "app.acct.apps.test", Account: a.account, App: "app", DNSStatus: a.status}); err != nil {
+ t.Fatal(err)
+ }
+ if a.certAt != 0 {
+ if err := reg.SetAliasCertExpiresAt(a.alias, a.certAt); err != nil {
+ t.Fatal(err)
+ }
+ }
+ }
+ type hostView struct {
+ Role string `json:"role"`
+ Alias bool `json:"alias"`
+ TargetHost string `json:"target_host"`
+ DNSPointing *bool `json:"dns_pointing"`
+ }
+ publish := func() map[string]hostView {
+ t.Helper()
+ var last []byte
+ if err := edgesFilePass(context.Background(), s, reg, edgesFile{Box: "annie"}, "1.2.3.4", &last); err != nil {
+ t.Fatal(err)
+ }
+ body, _, err := s.Get(context.Background(), "control/edges/annie.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var f struct {
+ Hosts map[string]hostView `json:"hosts"`
+ }
+ if err := json.Unmarshal(body, &f); err != nil {
+ t.Fatal(err)
+ }
+ return f.Hosts
+ }
+ hosts := publish()
+ for _, name := range []string{"billing.example.com", "fresh.example.com"} {
+ h, ok := hosts[name]
+ if !ok || h.Role != "home" || !h.Alias || h.DNSPointing == nil || *h.DNSPointing {
+ t.Errorf("%s = %+v (published %v); want home, alias, dns_pointing false", name, h, ok)
+ }
+ }
+ if h := hosts["live.example.com"]; h.DNSPointing == nil || !*h.DNSPointing {
+ t.Errorf("live.example.com = %+v; want dns_pointing true", h)
+ }
+ for _, absent := range []string{"nocert.example.com", "expired.example.com", "other.example.com", "outside.example.org", "badexample.com"} {
+ if _, ok := hosts[absent]; ok {
+ t.Errorf("%s must not be published before it points here", absent)
+ }
+ }
+
+ // With the scope unset, only pointing aliases are published, as before.
+ t.Setenv("CARLOS_DNS01_ZONES", "")
+ hosts = publish()
+ if _, ok := hosts["billing.example.com"]; ok {
+ t.Error("scope off: billing.example.com must wait for the pointing stamp")
+ }
+ if _, ok := hosts["live.example.com"]; !ok {
+ t.Error("scope off: a pointing alias must still be published")
+ }
+}
+
+// A box with no apps domain never stamps DNS, so a pre-issued alias there must
+// still carry an explicit false: an absent mark reads as pointing, which
+// would put the name in the issuer's HTTP-01 warm set.
+func TestEdgesFilePreIssuedAliasMarkWithoutAppsDomain(t *testing.T) {
+ withheldAliasSaid = sync.Map{}
+ t.Setenv("PLATFORM_APPS_DOMAIN", "")
+ t.Setenv("CARLOS_DNS01_ZONES", "example.com")
+ t.Setenv("CARLOS_DNS01_ACCOUNTS", "acct")
+ s, reg := release.NewDirStore(t.TempDir()), edgesTestRegistry(t)
+ if err := reg.Upsert(registry.Route{Host: "app.example.net", Kind: "service", Addr: "10.0.0.1:3000", Status: "ready", Platform: true}); err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.UpsertAlias(registry.RouteAlias{Alias: "billing.example.com", Host: "app.example.net", Account: "acct", App: "app"}); err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.SetAliasCertExpiresAt("billing.example.com", time.Now().Add(80*24*time.Hour).Unix()); err != nil {
+ t.Fatal(err)
+ }
+ var last []byte
+ if err := edgesFilePass(context.Background(), s, reg, edgesFile{Box: "annie"}, "1.2.3.4", &last); err != nil {
+ t.Fatal(err)
+ }
+ body, _, err := s.Get(context.Background(), "control/edges/annie.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var f struct {
+ Hosts map[string]struct {
+ DNSPointing *bool `json:"dns_pointing"`
+ } `json:"hosts"`
+ }
+ if err := json.Unmarshal(body, &f); err != nil {
+ t.Fatal(err)
+ }
+ h, ok := f.Hosts["billing.example.com"]
+ if !ok || h.DNSPointing == nil || *h.DNSPointing {
+ t.Fatalf("billing.example.com = %+v (published %v); want an explicit dns_pointing false", h, ok)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-alias-publish-precert-1293.tsv b/internal/provision/testdata/plan14-root-reads-alias-publish-precert-1293.tsv
new file mode 100644
index 000000000..1574cd0ee
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-alias-publish-precert-1293.tsv
@@ -0,0 +1,8 @@
+# Census overlay alias-publish-precert-1293, written by census-propose (#369). census-ruling-alias-publish-precert-1293, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-alias-publish-precert-1293.md.
+# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 1 reads re-frozen at their disposition with the claim, 0 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 68b6a36b116b67087a57c727659810163456a951e35ec4a36f3d671912136335 internal/edge/edge.go RunWithActivatorReady legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added.;rev3=census-ruling-precert-dns01-1293;basis=the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged.;rev3=census-ruling-alias-publish-precert-1293;basis=the edge process (carlos-edge.service, user carlos), not root: the pre-issuer start log now reads its zones from p.scope.Zones (the zones and accounts moved into the shared edge.DNS01Scope); no behaviour change, no read added, the existing 5 read sites unchanged. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 59e23002365aaecb99ac7b0f5719095ade566b0e5d4b965fa8671574fa6f1996
+internal/edge/edge.go RunWithActivatorReady legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added.;rev3=census-ruling-precert-dns01-1293;basis=the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged.;rev3=census-ruling-alias-publish-precert-1293;basis=the edge process (carlos-edge.service, user carlos), not root: the pre-issuer start log now reads its zones from p.scope.Zones (the zones and accounts moved into the shared edge.DNS01Scope); no behaviour change, no read added, the existing 5 read sites unchanged. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 59e23002365aaecb99ac7b0f5719095ade566b0e5d4b965fa8671574fa6f1996
+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;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 and its fix rounds: publishes by FleetArmVerdict (via fleetRefusedFor): withheld rows left out; a forward host's path rows left out of its owner; no assets for forward rows; the alias loop replays Reload's alias fold from the served rows so a chained alias carries its root primary's owner; certRefused and parentRefused leave out a refused claim's wildcard parent (+registry:Alias x5, +registry:Host x4, +whole:Route, +whole:RouteAlias x2, +whole:RoutePath x7, +whole:WildcardDomain). Rows already read in the pass; keeps authority F,J1; publishes less, never more.;rev3=census-ruling-probe-burst-limit;basis=sets the constant BurstNotices=true on the box's own edges file (this build's edge answers probe-burst notices, so peers may send them); not from config or any read; the same 65 sites; a report other edges read, not a root decision; F,J1 authority retained; no new root read or write kind;rev3=census-ruling-region-ha-p3a;basis=Publish one injected role snapshot with box_role/admitted/drained; retain legacy route and alias rows during booting, cutting namespace withdrawal under the 2026-11-04 ruling; acknowledge the exact published tuple only after PUT; existing registry reads unchanged.;rev3=census-ruling-region-ha-p2b;basis=region HA P2b-1 T0 (Q1 ruling): before building the comparison copy and the body, a nil NamedPools on the identity becomes []string{} so the additive named_pools field is always an explicit array; the list itself is computed once at arm by edgesFileEligibility from the same provisionTickConfig(os.Getenv) parse as serves_shared_pool (CARLOS_POOLS through provision.ParseBoxPools, filtered to nonempty provision.ValidPool names, sorted, unique). A report the console reads for create admission, not a root decision; no record, /data, release or claim read added; read sites unchanged (65); F,J1 authority retained. One-off cost: the first pass after the upgrade writes once per box (seeded gate null vs []).;rev3=census-ruling-region-ha-p3b;basis=Require cached GroupReadersReady before first group publication and append additive names-2 capability even for supplied identities. Agent writes the same edges object/index with existing registry reads; known readers come from root boot configuration, snapshot from existing fold, no added GET/LIST or root authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Omit non-forward, non-platform-alias rows outside local served pools from home publication; added Host/Pool field reads and local configuration use, existing registry/store operations retained.;rev3=census-ruling-edge-page-cache-1;basis=prunes the manifest cache through the new atomic pointer (assets.manifests.Load().prune(...), nil-safe); nothing else changes; read sites unchanged (67); no read added;rev3=census-ruling-region-ha-held-build;basis=writes also when DrainPublishRequired, and reports the written drain state, its ha_drain mark (transaction and publication id) and generation to DrainSource (in-memory); the file gains ha_drained and ha_drain beside the existing draining; no read added. held-requests Task 4: sets the constant ha_take=1 on the box's own file when its in-memory capabilities include region-ha-1 (this build's edge answers take requests); not from config or any read; a report other edges read, not a root decision; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the agent as carlos: reads PLATFORM_APPS_DOMAIN from the environment once per pass (the variable domainsLoop already reads) and sets an additive dns_pointing mark on each published custom name through dnsPointingMark: true on a published alias (registry:Alias, already published only when its dns_status is pointing), and on a route with a hostname outside the apps domain whether its registry:DNSStatus is pointing (registry:Host, registry:DNSStatus on rows the pass already lists). No mark under the apps domain, on a wildcard row, or with no apps domain set. A report the issuer cert warm reads to leave a not-yet-pointing custom name out of its set, not a root decision; it publishes the same names as before. No record, /data, release or claim read added; no new registry query; F,J1 authority retained. One-off cost: the first pass after the upgrade writes once on a box homing a custom name.;rev3=census-ruling-held-floor-capability;basis=held floor capability (region HA §25.9, agent manager 8a3d302, 2026-11-10): sets the constant ha_handover=1 on the box's own edges file on every pass, whatever its capabilities (this build understands the held-requests headers and the drain acknowledgement); the group roll floor reads it. Not from config or any read; ha_take unchanged; a report other tools read, not a root decision; no read added; F,J1 authority retained. One-off cost: the first pass after the upgrade writes once per box.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: fleetArmInputs now returns edge.ForwardOwners (this box's fleets table and its active links, registry LinkOwners, read only where tunnels are on), passed to edge.FleetArmVerdict as before, so the hub's eligible link-placed forward rows are published for backhaul like fleet rows; same listing and verdict, no read added in the unit;rev3=census-ruling-path-routes-across-boxes;basis=#186 spec 5.1: publishes route_account, route_app, path_front, path_target (registry.PathFront/PathTarget over the route row) on exact real route rows only (never a platform alias or a '*.' row); additive omitempty fields read from the registry route rows already loaded; adds reads of Route.Host and Route.App;rev3=census-ruling-alias-publish-precert-1293;basis=the box agent writing its own control/edges/<box>.json: an alias not yet stamped pointing is now also published (marked dns_pointing false) when edge.DNS01Scope allows it and the alias row already carries a current cert_expires_at. New inputs: CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the agent environment (the root-owned host.env, operator-only, parsed by edge.DNS01ScopeFromEnv, no file or path read) and the alias row fields Account and CertExpiresAt it already lists via reg.ListAliases. No new file, path, command or network read by root; the decision only adds entries to the box's own published file, which remote edges already treat as routing hints for names this box serves; same read sites otherwise. registry:Account@11064,registry:Account@18176,registry:Alias@10562,registry:Alias@10581,registry:Alias@10680,registry:Alias@10808,registry:Alias@10843,registry:Alias@10905,registry:Alias@11055,registry:Alias@11403,registry:Alias@11560,registry:Alias@11630,registry:Alias@11662,registry:Alias@12566,registry:Alias@12657,registry:Alias@15649,registry:Alias@15699,registry:App@18188,registry:App@6228,registry:CertExpiresAt@11013,registry:DNSStatus@10959,registry:DNSStatus@11569,registry:DNSStatus@5744,registry:Host@10607,registry:Host@10655,registry:Host@15552,registry:Host@15572,registry:Host@15837,registry:Host@15917,registry:Host@15952,registry:Host@16001,registry:Host@16463,registry:Host@16498,registry:Host@17606,registry:Host@4189,registry:Host@4292,registry:Host@4338,registry:Host@4397,registry:Host@5736,registry:Host@6155,registry:Host@6323,registry:Host@7293,registry:Incarnation@5943,registry:Platform@5251,registry:Pool@4252,registry:Provisioned@5265,registry:Replica@5289,registry:ServingSeq@5958,registry:Status@2953,whole:Route@1026,whole:Route@1839,whole:Route@19646,whole:Route@20471,whole:Route@20646,whole:Route@2323,whole:Route@6224,whole:Route@6284,whole:Route@6308,whole:Route@7378,whole:Route@750,whole:RouteAlias@10445,whole:RouteAlias@10527,whole:RouteAlias@10793,whole:RouteAlias@15603,whole:RouteAlias@19668,whole:RouteAlias@20661,whole:RoutePath@19661,whole:RoutePath@20654,whole:RoutePath@7162,whole:RoutePath@7194,whole:RoutePath@7241,whole:RoutePath@7269,whole:RoutePath@7307,whole:RoutePath@7327,whole:RoutePath@7339,whole:RoutePath@7393,whole:WildcardDomain@15530,whole:WildcardDomain@15906 cd30ecf8865bd29bdd58e64da0f6b4027f32b530c04dacde0c8bb6d2d6d44d29
+@coverage internal/edge 81db6f1cfc956d4f71732f0f11fcee48c63a02a367bc758997528f2ae93f7702
+@coverage internal/host cddb278c0587766a4ef519b90e472f8c18e1910cbe65c484ef6eed2e316fbade
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 45ea54a0b..2f39dae4b 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -284,3 +284,4 @@ plan14-root-reads-egress-allow-cidr-console.tsv 9fb6041c2fe2f33edf7cc2a0fb6dc050
plan14-root-reads-ha-departure-evidence.tsv 924ffc4037d32d7b46af1e373bad1476fc7305833fc6c06d50d5c8c3ab5ac177
plan14-root-reads-stateless-scale-2-fleet-sizes.tsv 00fe607a04674579005013fae1e275cb0434ce54493b1efbe678aed59a12366b
plan14-root-reads-store-versioning.tsv 841361b89e20c3763149e8784cdebb037dcc4b828b24196a01d3e300ff319661
+plan14-root-reads-alias-publish-precert-1293.tsv 6d54b64391d27d1c0fe03466aaa8975fc58b839a5aedff2f8dbb21c5093c06c1