certwarm: a name published not pointing is not a warm candidate
Remove the cached-certificate exemption added in 98102683 (#724). Whether autocert would renew a cache entry or mint a new one cannot be decided from outside autocert, so the exemption could place an order with no DNS gate, cap or accounting. The candidate set is the pointing warm set again, as at dabcc3e3: certCached, the cached seam, UnpointedHosts, the unpointed wake, warmUnpointed and the renew-only branch are gone. A cached certificate for such a name keeps serving and re-arms on a handshake at the issuer; the warm re-arms it once it points again. Retire a DNS-miss entry when its name leaves the set (at the full pass and before a probe would look it up) and when the name is re-armed as already warmed. Read the warm set only after the issuer gate, so a non-issuer's pass does no candidate work.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
8 files changed,
+263
−403
docs/superpowers/notes/census-proposal-warm-set-published-724.md+2 −2internal/edge/certwarm.go+80 −156internal/edge/certwarm_test.go+164 −122internal/edge/edge.go+2 −2internal/edge/homemap.go+11 −71internal/edge/homemap_dnspointing_test.go+0 −46internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv+3 −3
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-warm-set-published-724.md b/docs/superpowers/notes/census-proposal-warm-set-published-724.md| index ad7025a82..935b58cbe 100644 |
| --- a/docs/superpowers/notes/census-proposal-warm-set-published-724.md |
| +++ b/docs/superpowers/notes/census-proposal-warm-set-published-724.md |
| @@ -4,7 +4,7 @@ Ruling `census-ruling-warm-set-published-724`. The independent reviewer approves |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `internal/edge/edge.go` `RunWithActivatorReady` | body | unchanged (5) | #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). The call also passes certCached(certCache, time.Now), a read-only check of the autocert cache the edge already built here (Cache.Get of the host's own entry, parsed and checked for validity, never an order): the warm uses it, with the home map's UnpointedHosts, to keep re-arming the renewal of a published name that is not marked pointing only when its certificate is already cached; a not-pointing name with no cached certificate is never looked up or ordered. No read site added in this unit, same 5 sites. | |
| +| `internal/edge/edge.go` `RunWithActivatorReady` | body | unchanged (5) | #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. No read site added in this unit, same 5 sites. | |
| | `internal/host/edgesfile.go` `edgesFileWriteClaims` | sites | +registry:Alias, +registry:DNSStatus, +registry:Host | #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. | |
| Envelopes re-pinned: `internal/edge`, `internal/edgesfile`, `internal/host`. |
| @@ -16,6 +16,6 @@ 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 |
| - `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;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 |
| -Seal: `499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24` → `c9fb1a88d978f029b4d7bd7c082247ff3160d98d72270b16d1a6ee0e4beba012`. |
| +Seal: `499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24` → `52f4ec108856f2c6ee4e43d4bd9f1030f01fa466223a73036c2c749e74e6988c`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/edge/certwarm.go b/internal/edge/certwarm.go| index 53af9ac05..384cb6497 100644 |
| --- a/internal/edge/certwarm.go |
| +++ b/internal/edge/certwarm.go |
| @@ -30,14 +30,12 @@ import ( |
| "errors" |
| "log" |
| "net" |
| - "slices" |
| "sort" |
| "strings" |
| "sync" |
| "time" |
| "golang.org/x/crypto/acme" |
| - "golang.org/x/crypto/acme/autocert" |
| "github.com/carlosframework/platform/internal/certwarm" |
| "github.com/carlosframework/platform/internal/release" |
| @@ -127,15 +125,6 @@ type certWarm struct { |
| // not under the apps domain and not covered by a wildcard. See |
| // Edge.warmSet. |
| hosts func() []string |
| - // unpointed lists the published names no home box has seen pointing |
| - // (Edge.warmUnpointed, #724), and cached reports whether this box's |
| - // cert cache holds a certificate for a host that autocert would serve |
| - // and renew rather than mint anew. Together they are the renewal |
| - // re-arm for a name that is not in hosts: see candidates. Either one |
| - // nil (a warm built by newCertWarm alone) means there are no such |
| - // names, and the set is hosts and nothing else. |
| - unpointed func() []string |
| - cached func(host string) bool |
| // getCert is autocert's per-host path (NOT the wildcard-wrapped one — a |
| // wrapped call would be answered by the wildcard and order nothing). |
| getCert func(*tls.ClientHelloInfo) (*tls.Certificate, error) |
| @@ -161,7 +150,9 @@ type certWarm struct { |
| warmed map[string]bool |
| // dnsMisses is the DNS-miss schedule: each never-warmed host that has |
| // failed the DNS gate, with when it first did and when to look again. |
| - // Cleared when the host's order goes out and pruned with the set. |
| + // An entry is retired when the host's order goes out, when the host is |
| + // re-armed as already warmed, and when the host leaves the set |
| + // (retireDNSMisses): a name no longer in the set is never looked up. |
| dnsMisses map[string]dnsMiss |
| // recentOrders stamps the new orders placed in the last warmCappedDelay, |
| // the window warmOrdersPerPass is counted over. |
| @@ -347,7 +338,7 @@ func (c *certWarm) hasNewHost() bool { |
| return false |
| } |
| now := c.now() |
| - hosts, _ := c.candidates() |
| + hosts := c.hosts() |
| c.mu.Lock() |
| defer c.mu.Unlock() |
| for _, h := range hosts { |
| @@ -365,50 +356,6 @@ func (c *certWarm) hasNewHost() bool { |
| return false |
| } |
| -// candidates is the set one pass works over: every host in the warm set, |
| -// plus each published name that is not pointing but whose certificate this |
| -// box already holds (renewOnly). |
| -// |
| -// The two halves separate first issuance from renewal (#724). A FIRST order |
| -// needs the name's home box to have published it as pointing: before that |
| -// the name is not looked up at all, because a lookup made before the record |
| -// exists is remembered as "no such name" for the zone's negative TTL. A |
| -// name that is not pointing and has no certificate here is therefore simply |
| -// not a candidate: no gate lookup, no DNS-miss entry, no order. |
| -// |
| -// RENEWAL must not need that mark. A home box's verdict can be wrong while |
| -// the name still serves (a partial read of the edge set stamps "elsewhere"), |
| -// and this warm's memory of what it has warmed is lost on a restart. So a |
| -// not-pointing name with a cached certificate takes the renewal re-arm |
| -// path: ungated and uncapped, a cache read that re-arms autocert's renewal |
| -// timer. cached answers only for a certificate autocert would serve; an |
| -// expired or unreadable entry is not one, since asking for it would place a |
| -// new order with no DNS gate in front of it. |
| -func (c *certWarm) candidates() (hosts []string, renewOnly map[string]bool) { |
| - hosts = c.hosts() |
| - if c.unpointed == nil || c.cached == nil { |
| - return hosts, nil |
| - } |
| - inSet := make(map[string]bool, len(hosts)) |
| - for _, h := range hosts { |
| - inSet[h] = true |
| - } |
| - for _, h := range c.unpointed() { |
| - if inSet[h] || !c.cached(h) { |
| - continue |
| - } |
| - inSet[h] = true |
| - if renewOnly == nil { |
| - // hosts belongs to the caller of c.hosts; never append in place. |
| - hosts = slices.Clone(hosts) |
| - renewOnly = map[string]bool{} |
| - } |
| - renewOnly[h] = true |
| - hosts = append(hosts, h) |
| - } |
| - return hosts, renewOnly |
| -} |
| - |
| // dnsMissed puts host on the DNS-miss schedule, or moves it along: its first |
| // miss is kept, and its next check is set by how long it has been missing. |
| func (c *certWarm) dnsMissed(host string, now time.Time) { |
| @@ -456,6 +403,10 @@ func (c *certWarm) probeDNS() bool { |
| if !c.isIssuer() { |
| return false |
| } |
| + // A name that has left the set since the last pass is retired here, not |
| + // looked up: its home box may have just published it as not pointing |
| + // (#724), and the next full pass can be an hour away. |
| + c.retireDNSMisses(hostSet(c.hosts())) |
| now := c.now() |
| c.mu.Lock() |
| var due []string |
| @@ -476,6 +427,28 @@ func (c *certWarm) probeDNS() bool { |
| return points |
| } |
| +// hostSet is hosts as a membership set. |
| +func hostSet(hosts []string) map[string]bool { |
| + set := make(map[string]bool, len(hosts)) |
| + for _, h := range hosts { |
| + set[h] = true |
| + } |
| + return set |
| +} |
| + |
| +// retireDNSMisses drops every DNS-miss entry whose host is not in inSet, the |
| +// warm set as the caller has just read it. The schedule exists to look a |
| +// name up again, and only a name in the set may be looked up. |
| +func (c *certWarm) retireDNSMisses(inSet map[string]bool) { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + for h := range c.dnsMisses { |
| + if !inSet[h] { |
| + delete(c.dnsMisses, h) |
| + } |
| + } |
| +} |
| + |
| // orderBudget is how many new orders the window still allows, after |
| // forgetting the stamps that have left it. |
| func (c *certWarm) orderBudget(now time.Time) int { |
| @@ -493,18 +466,20 @@ func (c *certWarm) orderBudget(now time.Time) int { |
| // pass warms every host in the set once and returns how long to wait. |
| func (c *certWarm) pass() time.Duration { |
| - hosts, renewOnly := c.candidates() |
| // Stand down before ANY work: unlike the wildcard manager there is no |
| - // cache to load first, so a non-issuer has nothing useful to do here. |
| - // The gate comes BEFORE the empty-set check, not after, because the |
| - // sweep at the bottom of this pass has work to do in a deployment with |
| - // no custom domains at all — spent challenge tokens and long-expired |
| - // certs are not the warm set's business. |
| + // cache to load first, so a non-issuer has nothing useful to do here, |
| + // not even reading the set. The gate comes BEFORE the empty-set check, |
| + // not after, because the sweep at the bottom of this pass has work to |
| + // do in a deployment with no custom domains at all: spent challenge |
| + // tokens and long-expired certs are not the warm set's business. |
| ctx, ok := c.issuerGate() |
| if !ok { |
| - c.logStandDown(len(hosts)) |
| + c.logStandDown(-1) |
| return warmInterval |
| } |
| + // The set is read once, after the gate, and it is an in-memory read: |
| + // the route table and the home map's last snapshot (Edge.warmSet). |
| + hosts := c.hosts() |
| if len(hosts) == 0 { |
| c.mu.Lock() |
| clear(c.dnsMisses) |
| @@ -519,19 +494,18 @@ func (c *certWarm) pass() time.Duration { |
| // that currently HAVE a record, which is what makes both the |
| // delete-on-success and the prune below decidable without a Get per host. |
| records := c.loadRecords(ctx) |
| - inSet := make(map[string]bool, len(hosts)) |
| - for _, h := range hosts { |
| - inSet[h] = true |
| - } |
| + inSet := hostSet(hosts) |
| orders, capped := 0, false |
| budget := c.orderBudget(c.now()) |
| for _, h := range hosts { |
| now := c.now() |
| c.mu.Lock() |
| until, backing := c.nextAttempt[h] |
| - // A not-pointing name whose certificate is cached is a renewal |
| - // re-arm whether or not this process has warmed it (candidates). |
| - seen := c.warmed[h] || renewOnly[h] |
| + seen := c.warmed[h] |
| + if seen { |
| + // A warmed host has no first order left to wait for DNS on. |
| + delete(c.dnsMisses, h) |
| + } |
| c.mu.Unlock() |
| if backing && now.Before(until) { |
| continue |
| @@ -609,13 +583,7 @@ func (c *certWarm) pass() time.Duration { |
| } |
| } |
| c.prune(ctx, records, inSet) |
| - c.mu.Lock() |
| - for h := range c.dnsMisses { |
| - if !inSet[h] { |
| - delete(c.dnsMisses, h) |
| - } |
| - } |
| - c.mu.Unlock() |
| + c.retireDNSMisses(inSet) |
| owed, isOwed := c.owedWait(inSet) |
| // Housekeeping last: it is the least urgent thing this pass does, and |
| // running it after the orders means a slow bucket delays litter removal |
| @@ -703,6 +671,11 @@ func (c *certWarm) logStandDown(hosts int) { |
| return |
| } |
| c.lastStandDownLog = time.Now() |
| + if hosts < 0 { |
| + // Stood down before the set was read (pass's first gate). |
| + log.Printf("edge: cert warm standing down: another box holds the issuer lease") |
| + return |
| + } |
| log.Printf("edge: cert warm standing down for %d host(s) — another box holds the issuer lease", hosts) |
| } |
| @@ -739,6 +712,16 @@ func warmHello(host string) *tls.ClientHelloInfo { |
| // alias, so an alias-only rule would silently never warm the shipped headline |
| // flow. |
| // |
| +// What follows from that for a name published NOT pointing (#724): it is not |
| +// a warm candidate at all. The warm neither orders it nor re-arms its |
| +// renewal, and never looks it up. A certificate already cached for it keeps |
| +// serving, and its renewal is re-armed by the first handshake for it that |
| +// reaches the issuer. When its home box publishes it pointing again the |
| +// warm re-arms it on the next pass. There is deliberately no "cached |
| +// certificate" exception: whether autocert would renew an entry or mint a |
| +// new one cannot be decided from outside autocert, and a wrong guess is an |
| +// order with no DNS gate in front of it. |
| +// |
| // Where the names come from, and where they deliberately do not (#724): the |
| // PUBLISHED edges files, through the home map. OwnServedHosts is this box's |
| // own file and ServedHosts is every other box's, and both leave out a custom |
| @@ -752,10 +735,6 @@ func warmHello(host string) *tls.ClientHelloInfo { |
| // publication instead means the issuer's FIRST lookup of a new custom name |
| // comes after its home box has seen the record. |
| // |
| -// A published name that is NOT yet pointing is not in this set; it is in |
| -// warmUnpointed, which exists only so that a name whose certificate this |
| -// box already holds keeps being renewed (certWarm.candidates). |
| -// |
| // The one thing still read from the route table is a regional name |
| // (regional.go, #447): no box publishes those in its edges file, so the |
| // table is the only place the regional apex exists. They are written by the |
| @@ -776,43 +755,11 @@ func warmHello(host string) *tls.ClientHelloInfo { |
| // test would warm every app of a new account per-host during exactly the |
| // window before their wildcard lands. |
| func (e *Edge) warmSet(appsDomain string, parents func() []string) []string { |
| - consider, out := warmFilter(appsDomain, parents) |
| - for h, up := range e.current() { |
| - if up.regional != regionalNone { |
| - consider(h) |
| - } |
| - } |
| - homes := e.homes.Load() |
| - for _, h := range homes.OwnServedHosts() { |
| - consider(h) |
| - } |
| - for _, h := range homes.ServedHosts() { |
| - consider(h) |
| - } |
| - return out() |
| -} |
| - |
| -// warmUnpointed is warmSet's complement over the same publication: the |
| -// custom names some box publishes that no box homing them has seen pointing |
| -// (homeMap.UnpointedHosts), through the same three exclusions. The warm |
| -// places no first order for these and never looks them up; it only keeps |
| -// renewing one whose certificate it already holds (certWarm.candidates). |
| -func (e *Edge) warmUnpointed(appsDomain string, parents func() []string) []string { |
| - consider, out := warmFilter(appsDomain, parents) |
| - for _, h := range e.homes.Load().UnpointedHosts() { |
| - consider(h) |
| - } |
| - return out() |
| -} |
| - |
| -// warmFilter is the exclusions warmSet documents, as a collector: consider |
| -// offers a name, out returns the kept ones, sorted and without duplicates. |
| -func warmFilter(appsDomain string, parents func() []string) (consider func(string), out func() []string) { |
| appsDomain = strings.ToLower(strings.TrimSpace(appsDomain)) |
| covered := wildcardCoverer(parents) |
| seen := map[string]bool{} |
| - var kept []string |
| - consider = func(h string) { |
| + var out []string |
| + consider := func(h string) { |
| h = strings.ToLower(strings.TrimSpace(h)) |
| if h == "" || seen[h] || strings.HasPrefix(h, "*.") { |
| return |
| @@ -824,24 +771,31 @@ func warmFilter(appsDomain string, parents func() []string) (consider func(strin |
| return |
| } |
| seen[h] = true |
| - kept = append(kept, h) |
| + out = append(out, h) |
| + } |
| + for h, up := range e.current() { |
| + if up.regional != regionalNone { |
| + consider(h) |
| + } |
| + } |
| + homes := e.homes.Load() |
| + for _, h := range homes.OwnServedHosts() { |
| + consider(h) |
| } |
| - return consider, func() []string { |
| - sort.Strings(kept) |
| - return kept |
| + for _, h := range homes.ServedHosts() { |
| + consider(h) |
| } |
| + sort.Strings(out) |
| + return out |
| } |
| // newIssuerWarm builds this edge's cert warm and wires its two wakes. It is |
| // the whole of the production wiring, so a test that calls it exercises the |
| // same set, gate and wakes the edge runs with: the set is warmSet, the DNS |
| // gate is dnsGate over resolve and edgeIPs, and the warm is nudged by a |
| -// local route reload and by a change in the published name set |
| -// (homeMap.setServedWake). cached is the renewal re-arm's read of the cert |
| -// cache (certCached in production); nil means no name has a certificate, |
| -// so a published name that is not pointing is never touched. The caller |
| -// starts the loop. |
| -func (e *Edge) newIssuerWarm(appsDomain string, parents func() []string, getCert func(*tls.ClientHelloInfo) (*tls.Certificate, error), resolve func(string) ([]string, error), edgeIPs func() []string, cached func(string) bool, store release.Store) *certWarm { |
| +// local route reload and by a change in either half of the published name |
| +// set (homeMap.setServedWake). The caller starts the loop. |
| +func (e *Edge) newIssuerWarm(appsDomain string, parents func() []string, getCert func(*tls.ClientHelloInfo) (*tls.Certificate, error), resolve func(string) ([]string, error), edgeIPs func() []string, store release.Store) *certWarm { |
| warm := newCertWarm( |
| func() []string { return e.warmSet(appsDomain, parents) }, |
| getCert, |
| @@ -849,8 +803,6 @@ func (e *Edge) newIssuerWarm(appsDomain string, parents func() []string, getCert |
| e.issuerGate, |
| store, |
| ) |
| - warm.unpointed = func() []string { return e.warmUnpointed(appsDomain, parents) } |
| - warm.cached = cached |
| // Woken when its set may have grown (#386), so a custom domain is |
| // ordered seconds after it is published rather than at the next hourly |
| // pass: a change in the names this box or another publishes (#724), or a |
| @@ -861,34 +813,6 @@ func (e *Edge) newIssuerWarm(appsDomain string, parents func() []string, getCert |
| return warm |
| } |
| -// certCacheReadTimeout budgets one cert cache read by certCached. |
| -const certCacheReadTimeout = 10 * time.Second |
| - |
| -// certCached is the production `cached` seam of newIssuerWarm: whether cache |
| -// holds, under the key autocert stores a host's ECDSA certificate at (the |
| -// bare host name, which is what warmHello asks for), a certificate autocert |
| -// would serve as it is: key and leaf match, the leaf names the host, and now |
| -// is inside its validity. That is the case where GetCertificate reads the |
| -// cache and arms the renewal timer. Anything else (no entry, an unreadable |
| -// one, an expired one) reads as not cached, because autocert would answer |
| -// it with a new order. Read-only: it never asks autocert for anything. |
| -func certCached(cache autocert.Cache, now func() time.Time) func(host string) bool { |
| - return func(host string) bool { |
| - ctx, cancel := context.WithTimeout(context.Background(), certCacheReadTimeout) |
| - defer cancel() |
| - raw, err := cache.Get(ctx, host) |
| - if err != nil { |
| - return false |
| - } |
| - cert, err := parseCertEntry(raw) |
| - if err != nil { |
| - return false |
| - } |
| - at := now() |
| - return !at.Before(cert.Leaf.NotBefore) && !at.After(cert.Leaf.NotAfter) && cert.Leaf.VerifyHostname(host) == nil |
| - } |
| -} |
| - |
| // wildcardCoverer reports whether a host is exactly one label under a |
| // wildcard parent this box has configured or derived — by SHAPE, never by |
| // whether the parent's cert exists yet (see warmSet). A nil parents func |
diff --git a/internal/edge/certwarm_test.go b/internal/edge/certwarm_test.go| index 641d4cdd0..f50d33496 100644 |
| --- a/internal/edge/certwarm_test.go |
| +++ b/internal/edge/certwarm_test.go |
| @@ -11,7 +11,6 @@ import ( |
| "time" |
| "golang.org/x/crypto/acme" |
| - "golang.org/x/crypto/acme/autocert" |
| "github.com/carlosframework/platform/internal/certwarm" |
| "github.com/carlosframework/platform/internal/release" |
| @@ -148,14 +147,14 @@ type issuerWarmFixture struct { |
| mu sync.Mutex |
| lookups map[string]int |
| orders map[string]int |
| - // certs is the fixture's cert cache: the hosts the `cached` seam |
| - // answers yes for. |
| - certs map[string]bool |
| + // away is the hosts the fake resolver answers with an address outside |
| + // the edge set, so the DNS gate stays shut for them. |
| + away map[string]bool |
| } |
| func newIssuerWarmFixture(t *testing.T, ownHosts string) *issuerWarmFixture { |
| t.Helper() |
| - f := &issuerWarmFixture{lookups: map[string]int{}, orders: map[string]int{}, certs: map[string]bool{}} |
| + f := &issuerWarmFixture{lookups: map[string]int{}, orders: map[string]int{}, away: map[string]bool{}} |
| f.e, f.m, f.s = publishedEdge(t, ownHosts) |
| f.w = f.e.newIssuerWarm("oncarlos.test", nil, |
| func(h *tls.ClientHelloInfo) (*tls.Certificate, error) { |
| @@ -168,31 +167,17 @@ func newIssuerWarmFixture(t *testing.T, ownHosts string) *issuerWarmFixture { |
| f.mu.Lock() |
| defer f.mu.Unlock() |
| f.lookups[host]++ |
| + if f.away[host] { |
| + return []string{"192.0.2.1"}, nil |
| + } |
| return []string{"203.0.113.7"}, nil |
| }, |
| func() []string { return []string{"203.0.113.7"} }, |
| - func(host string) bool { |
| - f.mu.Lock() |
| - defer f.mu.Unlock() |
| - return f.certs[host] |
| - }, |
| nil, |
| ) |
| return f |
| } |
| -// restart replaces the warm with a fresh one over the same edge, as an |
| -// issuer restart does: nothing remembered of what was warmed. |
| -func (f *issuerWarmFixture) restart() { |
| - old := f.w |
| - f.w = f.e.newIssuerWarm("oncarlos.test", nil, old.getCert, func(host string) ([]string, error) { |
| - f.mu.Lock() |
| - defer f.mu.Unlock() |
| - f.lookups[host]++ |
| - return []string{"203.0.113.7"}, nil |
| - }, func() []string { return []string{"203.0.113.7"} }, old.cached, nil) |
| -} |
| - |
| func (f *issuerWarmFixture) publish(t *testing.T, box, hosts string) { |
| t.Helper() |
| putJSON(t, f.s, "control/edges/"+box+".json", `{"v":1,"box":"`+box+`","eip":"1.1.1.1","hosts":`+hosts+`}`) |
| @@ -278,137 +263,194 @@ func TestIssuerWarmWaitsForACustomRouteToPoint(t *testing.T) { |
| } |
| } |
| -// Renewal does not wait on the pointing mark (#724, Astra's P1). A route |
| -// homed on betty still serves, but betty's DNS verdict is wrong (a partial |
| -// edge-set read stamped it "elsewhere"), so it is published dns_pointing |
| -// false. The issuer holds its valid certificate and restarts, which empties |
| -// the warm's memory. The fresh warm must still ask autocert for it, because |
| -// that cache read is what re-arms the renewal timer; and it does so without |
| -// a DNS lookup, as every renewal re-arm does. A second false-marked name |
| -// with NO certificate, in the same set, is the #724 case and stays |
| -// untouched: no lookup, no order. |
| -func TestIssuerWarmReArmsACachedCertItsHomeBoxSaysIsNotPointing(t *testing.T) { |
| - const held, fresh, ownHeld = "store.example.net", "new.example.net", "shop.example.com" |
| - f := newIssuerWarmFixture(t, `{"`+ownHeld+`":{"role":"home","platform":false,"dns_pointing":false}}`) |
| - f.publish(t, "betty", `{ |
| - "`+held+`":{"role":"home","platform":false,"dns_pointing":false}, |
| - "`+fresh+`":{"role":"home","alias":true,"dns_pointing":false}}`) |
| - f.certs[held], f.certs[ownHeld] = true, true |
| - f.restart() |
| - |
| - if !f.w.hasNewHost() { |
| - t.Fatal("a cached certificate waiting for its renewal re-arm does not count as work for a wake") |
| +// A name published not pointing is not a warm candidate at all, certificate |
| +// or no certificate (#724). One the warm has already warmed, whose home box |
| +// then stamps it not pointing, is left alone: not looked up, not asked of |
| +// autocert, pass after pass. Its cached certificate keeps serving and a |
| +// handshake at the issuer re-arms it; the warm does not. When the name |
| +// points again it is re-armed as the warmed name it is: one getCert, no |
| +// lookup, nothing spent from the order budget. |
| +func TestIssuerWarmLeavesAWarmedNameAloneWhileItIsNotPointing(t *testing.T) { |
| + const own, remote = "shop.example.com", "store.example.net" |
| + pub := func(f *issuerWarmFixture, pointing string) { |
| + f.publish(t, "annie", `{"`+own+`":{"role":"home","platform":false,"dns_pointing":`+pointing+`}}`) |
| + f.publish(t, "betty", `{"`+remote+`":{"role":"home","alias":true,"dns_pointing":`+pointing+`}}`) |
| } |
| + f := newIssuerWarmFixture(t, `{}`) |
| + pub(f, "true") |
| f.w.pass() |
| - for _, h := range []string{held, ownHeld} { |
| - if lookups, asks := f.counts(h); asks != 1 || lookups != 0 { |
| - t.Fatalf("%s after the restart: %d getCert call(s), %d lookup(s); want the ungated re-arm, 1 and 0", h, asks, lookups) |
| + for _, h := range []string{own, remote} { |
| + if lookups, asks := f.counts(h); lookups != 1 || asks != 1 { |
| + t.Fatalf("%s, first order: %d lookup(s), %d getCert call(s), want 1 and 1", h, lookups, asks) |
| } |
| } |
| - if lookups, asks := f.counts(fresh); lookups != 0 || asks != 0 { |
| - t.Fatalf("the uncached, not-pointing alias got %d lookup(s) and %d order(s), want none", lookups, asks) |
| - } |
| - if n := len(f.w.dnsMisses); n != 0 { |
| - t.Fatalf("%d name(s) on the DNS-miss schedule, want none: its probes look names up", n) |
| - } |
| + spent := len(f.w.recentOrders) |
| + |
| + pub(f, "false") |
| if f.w.hasNewHost() { |
| - t.Fatal("after the re-arm the uncached, not-pointing alias counts as a new host") |
| + t.Fatal("a warmed name that stopped pointing counts as a new host") |
| } |
| - |
| - // Every later pass re-arms again, and still asks the resolver nothing. |
| f.w.pass() |
| - if _, asks := f.counts(held); asks != 2 { |
| - t.Fatalf("second pass: %d getCert call(s) for the held name, want 2", asks) |
| - } |
| - if n := f.totalLookups(); n != 0 { |
| - t.Fatalf("%d resolver lookup(s) over two passes of not-pointing names (%v)", n, f.lookups) |
| + f.w.pass() |
| + for _, h := range []string{own, remote} { |
| + if lookups, asks := f.counts(h); lookups != 1 || asks != 1 { |
| + t.Fatalf("%s while not pointing: %d lookup(s), %d getCert call(s); want still 1 and 1, the warm leaves it alone", h, lookups, asks) |
| + } |
| + if !f.w.warmed[h] { |
| + t.Fatalf("%s was forgotten as warmed while it was not pointing: pointing again would cost a new gated order", h) |
| + } |
| } |
| - // Betty's verdict comes right. The name is now an ordinary member of |
| - // the set, already warmed: a re-arm, not a new gated order. |
| - f.publish(t, "betty", `{ |
| - "`+held+`":{"role":"home","platform":false,"dns_pointing":true}, |
| - "`+fresh+`":{"role":"home","alias":true,"dns_pointing":false}}`) |
| + pub(f, "true") |
| if f.w.hasNewHost() { |
| - t.Fatal("a held name that flipped to pointing counts as a new host") |
| + t.Fatal("a warmed name that points again counts as a new host") |
| } |
| f.w.pass() |
| - if lookups, asks := f.counts(held); asks != 3 || lookups != 0 { |
| - t.Fatalf("held name after it flipped to pointing: %d getCert call(s), %d lookup(s); want 3 and 0 (re-armed, not re-ordered)", asks, lookups) |
| + for _, h := range []string{own, remote} { |
| + if lookups, asks := f.counts(h); lookups != 1 || asks != 2 { |
| + t.Fatalf("%s pointing again: %d lookup(s), %d getCert call(s); want 1 and 2 (re-armed once, ungated)", h, lookups, asks) |
| + } |
| } |
| - if n := len(f.w.recentOrders); n != 0 { |
| - t.Fatalf("%d new order(s) counted against the cap for re-arms", n) |
| + if n := len(f.w.recentOrders); n != spent { |
| + t.Fatalf("the re-arms spent order budget: %d stamp(s), was %d", n, spent) |
| } |
| } |
| -// The other half of the same rule. A not-pointing name with no certificate |
| -// is not a new host, so no wake runs a pass for it; once its home box sees |
| -// it pointing, it is. And a not-pointing name whose cached certificate has |
| -// gone (expired, or removed) drops back out rather than being ordered with |
| -// no gate in front of it. |
| -func TestIssuerWarmNewHostFollowsPointingOrACachedCert(t *testing.T) { |
| +// The wake agrees with the pass: a name is a new host only once its home |
| +// box publishes it pointing, and stops being one when that is withdrawn. |
| +func TestIssuerWarmNewHostFollowsPointing(t *testing.T) { |
| const name = "shop.example.com" |
| f := newIssuerWarmFixture(t, `{"`+name+`":{"role":"home","platform":false,"dns_pointing":false}}`) |
| if f.w.hasNewHost() { |
| - t.Fatal("a not-pointing name with no certificate counts as a new host") |
| + t.Fatal("a not-pointing name counts as a new host") |
| } |
| - f.certs[name] = true |
| + f.publish(t, "annie", `{"`+name+`":{"role":"home","platform":false,"dns_pointing":true}}`) |
| if !f.w.hasNewHost() { |
| - t.Fatal("a not-pointing name with a cached certificate is not picked up") |
| - } |
| - f.w.pass() |
| - delete(f.certs, name) |
| - f.w.pass() |
| - if lookups, asks := f.counts(name); asks != 1 || lookups != 0 { |
| - t.Fatalf("after its cached certificate went: %d getCert call(s), %d lookup(s); want 1 and 0", asks, lookups) |
| + t.Fatal("the name is not a new host once its home box sees it pointing") |
| } |
| - |
| - g := newIssuerWarmFixture(t, `{"`+name+`":{"role":"home","platform":false,"dns_pointing":false}}`) |
| - if g.w.hasNewHost() { |
| - t.Fatal("a not-pointing name with no certificate counts as a new host") |
| + f.publish(t, "annie", `{"`+name+`":{"role":"home","platform":false,"dns_pointing":false}}`) |
| + if f.w.hasNewHost() { |
| + t.Fatal("the name is still a new host after its home box withdrew the mark") |
| } |
| - g.publish(t, "annie", `{"`+name+`":{"role":"home","platform":false,"dns_pointing":true}}`) |
| - if !g.w.hasNewHost() { |
| - t.Fatal("the name is not a new host once its home box sees it pointing") |
| + if n := f.totalLookups(); n != 0 { |
| + t.Fatalf("hasNewHost looked %d name(s) up", n) |
| } |
| } |
| -// certCached is the production seam: yes only for a cache entry autocert |
| -// would serve as it stands. An expired entry, an entry for another name, an |
| -// unreadable one and a missing one all read as not cached, because asking |
| -// autocert for any of them places a new order. |
| -func TestCertCachedOnlyForACertAutocertWouldServe(t *testing.T) { |
| - now := time.Now() |
| - cache := autocert.DirCache(t.TempDir()) |
| - // An entry in autocert's shape: the private key, then the chain. |
| - put := func(key, name string, notAfter time.Time) { |
| +// A pointing name the issuer's own gate refuses goes on the DNS-miss |
| +// schedule, whose probes look it up. When its home box then publishes it |
| +// not pointing it has left the set, and the schedule must let go of it |
| +// before the next lookup: at the probe (the next full pass can be an hour |
| +// away) and at the full pass. |
| +func TestIssuerWarmRetiresADNSMissWhenTheNameStopsPointing(t *testing.T) { |
| + const name, other = "shop.example.com", "store.example.net" |
| + hosts := func(pointing string) string { |
| + return `{"` + name + `":{"role":"home","platform":false,"dns_pointing":` + pointing + `},"` + other + `":{"role":"home","platform":false,"dns_pointing":true}}` |
| + } |
| + missed := func(t *testing.T) *issuerWarmFixture { |
| t.Helper() |
| - cert, priv := selfSignedLeaf(t, name, notAfter) |
| - raw, err := encodeWildcardPEM(cert, priv) |
| - if err != nil { |
| - t.Fatal(err) |
| + f := newIssuerWarmFixture(t, hosts("true")) |
| + f.away[name] = true |
| + f.w.pass() |
| + if _, ok := f.w.dnsMisses[name]; !ok { |
| + t.Fatal("setup: the name the gate refused is not on the DNS-miss schedule") |
| } |
| - if err := cache.Put(context.Background(), key, raw); err != nil { |
| - t.Fatal(err) |
| + if lookups, asks := f.counts(name); lookups != 1 || asks != 0 { |
| + t.Fatalf("setup: %d lookup(s), %d order(s), want 1 and 0", lookups, asks) |
| } |
| + f.publish(t, "annie", hosts("false")) |
| + return f |
| } |
| - put("valid.example.com", "valid.example.com", now.Add(time.Hour)) |
| - put("expired.example.com", "expired.example.com", now.Add(-time.Minute)) |
| - put("wrong.example.com", "other.example.com", now.Add(time.Hour)) |
| - if err := cache.Put(context.Background(), "junk.example.com", []byte("not a certificate")); err != nil { |
| - t.Fatal(err) |
| - } |
| - cached := certCached(cache, func() time.Time { return now }) |
| - for host, want := range map[string]bool{ |
| - "valid.example.com": true, |
| - "expired.example.com": false, |
| - "wrong.example.com": false, |
| - "junk.example.com": false, |
| - "absent.example.com": false, |
| - } { |
| - if got := cached(host); got != want { |
| - t.Errorf("certCached(%s) = %v, want %v", host, got, want) |
| + |
| + t.Run("probe", func(t *testing.T) { |
| + f := missed(t) |
| + // Well past the entry's next check: the probe would look it up. |
| + f.w.now = func() time.Time { return time.Now().Add(warmDNSRetrySlow + time.Minute) } |
| + if f.w.probeDNS() { |
| + t.Fatal("the probe reported a name that points here") |
| + } |
| + if lookups, _ := f.counts(name); lookups != 1 { |
| + t.Fatalf("the probe looked a not-pointing name up: %d lookup(s), want still 1", lookups) |
| + } |
| + if _, ok := f.w.dnsMisses[name]; ok { |
| + t.Fatal("the name is still on the DNS-miss schedule after it left the set") |
| + } |
| + if _, wait := f.w.dnsWait(); wait { |
| + t.Fatal("a DNS re-check is still scheduled") |
| + } |
| + }) |
| + t.Run("pass", func(t *testing.T) { |
| + f := missed(t) |
| + f.w.pass() |
| + if _, ok := f.w.dnsMisses[name]; ok { |
| + t.Fatal("the name is still on the DNS-miss schedule after a full pass without it") |
| + } |
| + if lookups, _ := f.counts(name); lookups != 1 { |
| + t.Fatalf("the pass looked a not-pointing name up: %d lookup(s), want still 1", lookups) |
| } |
| + }) |
| +} |
| + |
| +// A name re-armed as already warmed has no first order left to wait for DNS |
| +// on, so a DNS-miss entry for it is retired on that path. It stays in the |
| +// set, so the prune would keep it and its probes would go on. |
| +func TestIssuerWarmRetiresADNSMissOnTheReArmPath(t *testing.T) { |
| + const name = "shop.example.com" |
| + f := newIssuerWarmFixture(t, `{"`+name+`":{"role":"home","platform":false,"dns_pointing":true}}`) |
| + f.w.pass() |
| + if !f.w.warmed[name] { |
| + t.Fatal("setup: the name was not warmed") |
| + } |
| + f.w.dnsMissed(name, f.w.now()) |
| + f.w.pass() |
| + if _, ok := f.w.dnsMisses[name]; ok { |
| + t.Fatal("a re-armed name is still on the DNS-miss schedule") |
| + } |
| + if lookups, asks := f.counts(name); lookups != 1 || asks != 2 { |
| + t.Fatalf("%d lookup(s), %d getCert call(s), want 1 and 2", lookups, asks) |
| + } |
| +} |
| + |
| +// Authority before work. A box that is not the issuer reads no set, looks |
| +// nothing up and asks autocert for nothing: not in a pass, not on a wake, |
| +// not at a DNS re-check that is due. |
| +func TestIssuerWarmDoesNoCandidateWorkWithoutTheLease(t *testing.T) { |
| + const name, missing = "shop.example.com", "store.example.net" |
| + f := newIssuerWarmFixture(t, `{ |
| + "`+name+`":{"role":"home","platform":false,"dns_pointing":true}, |
| + "`+missing+`":{"role":"home","platform":false,"dns_pointing":true}}`) |
| + f.away[missing] = true |
| + f.w.pass() |
| + if _, ok := f.w.dnsMisses[missing]; !ok { |
| + t.Fatal("setup: no DNS-miss entry to probe") |
| + } |
| + lookups, setReads := f.totalLookups(), 0 |
| + _, asks := f.counts(name) |
| + set := f.w.hosts |
| + f.w.hosts = func() []string { setReads++; return set() } |
| + f.w.issuer = func() (context.Context, bool) { return context.Background(), false } |
| + f.w.now = func() time.Time { return time.Now().Add(warmDNSRetrySlow + time.Minute) } |
| + |
| + if d := f.w.pass(); d != warmInterval { |
| + t.Fatalf("a non-issuer's pass asked to come back in %s, want %s", d, warmInterval) |
| + } |
| + if f.w.hasNewHost() { |
| + t.Fatal("a non-issuer reported a new host") |
| + } |
| + if f.w.probeDNS() { |
| + t.Fatal("a non-issuer's probe reported a name that points here") |
| + } |
| + if setReads != 0 { |
| + t.Fatalf("a non-issuer read the warm set %d time(s)", setReads) |
| + } |
| + if n := f.totalLookups(); n != lookups { |
| + t.Fatalf("a non-issuer made %d resolver lookup(s)", n-lookups) |
| + } |
| + if _, n := f.counts(name); n != asks { |
| + t.Fatalf("a non-issuer made %d getCert call(s)", n-asks) |
| + } |
| + if _, ok := f.w.dnsMisses[missing]; !ok { |
| + t.Fatal("a non-issuer changed the DNS-miss schedule") |
| } |
| } |
diff --git a/internal/edge/edge.go b/internal/edge/edge.go| index 6308f723a..ab9c51822 100644 |
| --- a/internal/edge/edge.go |
| +++ b/internal/edge/edge.go |
| @@ -4901,8 +4901,8 @@ func RunWithActivatorReady(args []string, act Activator, cache *Cache, ready fun |
| return edgesfile.EdgeIPs(ctx, store, envIPs, time.Now()) |
| } |
| // The set, the DNS gate and the wakes are newIssuerWarm's |
| - // (certwarm.go). certCached reads the cache autocert itself reads. |
| - warm := e.newIssuerWarm(appsDomain, parents, perHostCert, warmResolver, edgeIPs, certCached(certCache, time.Now), store) |
| + // (certwarm.go). |
| + warm := e.newIssuerWarm(appsDomain, parents, perHostCert, warmResolver, edgeIPs, store) |
| go warm.run() |
| log.Printf("edge: cert warm on (%s pass) — custom domains are ordered and renewed proactively, not on first handshake", warmInterval) |
| } |
diff --git a/internal/edge/homemap.go b/internal/edge/homemap.go| index 5afbfaae3..b846964ea 100644 |
| --- a/internal/edge/homemap.go |
| +++ b/internal/edge/homemap.go |
| @@ -308,10 +308,6 @@ type homeSnapshot struct { |
| // home names whose DNS it has seen pointing. Sorted, never written after |
| // the snapshot is published. |
| ownServed []string |
| - // unpointed is UnpointedHosts' answer: the exact home names some box |
| - // publishes that no box homing them has seen pointing. Sorted, never |
| - // written after the snapshot is published. |
| - unpointed []string |
| // read is set once the snapshot comes from a successful hosts refresh: |
| // the empty snapshot a restart starts from is not an answer (AssetsFor). |
| read bool |
| @@ -337,11 +333,10 @@ type homeMap struct { |
| snap *homeSnapshot |
| // hostsWake fires after a Refresh that changed the NAME set (setHostsWake). |
| hostsWake func() |
| - // servedWake fires after a Refresh that changed the ServedHosts set, the |
| - // OwnServedHosts set or the UnpointedHosts set (setServedWake): the cert |
| - // warm's cue that a custom domain was attached on another box (#386), or |
| - // that this box or another published one, pointing or not (#724). |
| - // Separate from hostsWake |
| + // servedWake fires after a Refresh that changed the ServedHosts set or |
| + // the OwnServedHosts set (setServedWake): the cert warm's cue that a |
| + // custom domain was attached on another box (#386), or that this box or |
| + // another published one as pointing (#724). Separate from hostsWake |
| // because their filters are opposites: hostsWake ignores exactly the |
| // unclassed rows a custom domain arrives as. |
| servedWake func() |
| @@ -657,8 +652,7 @@ func (m *homeMap) refreshHosts(ctx context.Context) error { |
| // deterministic; say so once a refresh. |
| log.Printf("edge: home map: %d host(s) published by two boxes at the same installation stamp, e.g. %s", len(tied), tied[0]) |
| } |
| - ownServed := ownServedHosts(next, m.self) |
| - snap := &homeSnapshot{groupObserved: m.snapshot().groupObserved, files: next, hosts: hosts, ownServed: ownServed, unpointed: unpointedHosts(hosts, next, m.self, ownServed), read: true, departureComplete: failed == 0, readerComplete: failed == 0 && !readerMissing} |
| + snap := &homeSnapshot{groupObserved: m.snapshot().groupObserved, files: next, hosts: hosts, ownServed: ownServedHosts(next, m.self), read: true, departureComplete: failed == 0, readerComplete: failed == 0 && !readerMissing} |
| m.mu.Lock() |
| m.snap = snap |
| wake := m.hostsWake |
| @@ -677,11 +671,10 @@ func (m *homeMap) refreshHosts(ctx context.Context) error { |
| // that. |
| go wake() |
| } |
| - if served != nil && (!sameServedSet(prev.hosts, snap.hosts) || !slices.Equal(prev.ownServed, snap.ownServed) || !slices.Equal(prev.unpointed, snap.unpointed)) { |
| - // A part of the warm set moved: another box's names, this box's |
| - // own publication (a custom name it has just stamped "pointing", |
| - // #724), or the names published without that stamp, which the warm |
| - // keeps renewing when it already holds their certificate. |
| + if served != nil && (!sameServedSet(prev.hosts, snap.hosts) || !slices.Equal(prev.ownServed, snap.ownServed)) { |
| + // Either half of the warm set moved: another box's names, or this |
| + // box's own publication (a custom name it has just stamped |
| + // "pointing", #724). |
| go served() |
| } |
| return nil |
| @@ -743,43 +736,6 @@ func ownServedHosts(files map[string]edgesFileView, self string) []string { |
| return slices.Compact(out) |
| } |
| -// unpointedHosts is UnpointedHosts' answer for one poll: every exact home |
| -// name published, in this box's own file or another's, that neither |
| -// ServedHosts nor OwnServedHosts lists because no box homing it has seen |
| -// its DNS pointing. ownServed is ownServedHosts over the same files. Sorted; |
| -// nil for an unlabelled box. |
| -func unpointedHosts(hosts map[string]homeEntry, files map[string]edgesFileView, self string, ownServed []string) []string { |
| - if self == "" { |
| - return nil |
| - } |
| - pointing := func(host string) bool { |
| - if _, ok := slices.BinarySearch(ownServed, host); ok { |
| - return true |
| - } |
| - e, ok := hosts[host] |
| - return ok && servedInput(host, e) |
| - } |
| - var out []string |
| - for host, e := range hosts { |
| - if e.dial && !strings.HasPrefix(host, "*.") && !pointing(host) { |
| - out = append(out, host) |
| - } |
| - } |
| - for _, f := range files { |
| - if f.Box != self { |
| - continue |
| - } |
| - for host, h := range f.Hosts { |
| - if host == "" || strings.HasPrefix(host, "*.") || h.Role != edgeRoleHome || pointing(host) { |
| - continue |
| - } |
| - out = append(out, host) |
| - } |
| - } |
| - slices.Sort(out) |
| - return slices.Compact(out) |
| -} |
| - |
| // samePlatformSet reports whether two folds name the same PLATFORM hosts — |
| // the only names that can move a wildcard parent (homes may differ; an |
| // unclassed name may come and go). |
| @@ -932,22 +888,6 @@ func (m *homeMap) OwnServedHosts() []string { |
| return slices.Clone(m.snapshot().ownServed) |
| } |
| -// UnpointedHosts is the rest of what the boxes publish: the exact home |
| -// names, this box's own and every other's, that no box homing them has seen |
| -// pointing, so neither ServedHosts nor OwnServedHosts lists them (#724). |
| -// The cert warm never looks these up and never places a first order for |
| -// one; it reads them only to keep renewing a name whose certificate it |
| -// already holds, so that a home box's "not pointing" verdict cannot by |
| -// itself end the renewal of a certificate that is still serving. |
| -// |
| -// Sorted, nil-safe, and nothing for an unlabelled box, as ServedHosts. |
| -func (m *homeMap) UnpointedHosts() []string { |
| - if m == nil || m.self == "" { |
| - return nil |
| - } |
| - return slices.Clone(m.snapshot().unpointed) |
| -} |
| - |
| // setHostsWake installs the callback a changed host set fires (Refresh). |
| // Under the map's own lock: run() is already polling when the wildcard |
| // manager is wired in after it. |
| @@ -960,8 +900,8 @@ func (m *homeMap) setHostsWake(fn func()) { |
| m.mu.Unlock() |
| } |
| -// setServedWake installs the callback a changed ServedHosts, OwnServedHosts |
| -// or UnpointedHosts set fires (Refresh), on the same terms as setHostsWake. |
| +// setServedWake installs the callback a changed ServedHosts or |
| +// OwnServedHosts set fires (Refresh), on the same terms as setHostsWake. |
| func (m *homeMap) setServedWake(fn func()) { |
| if m == nil { |
| return |
diff --git a/internal/edge/homemap_dnspointing_test.go b/internal/edge/homemap_dnspointing_test.go| index 98f4af7e4..b5731b0c4 100644 |
| --- a/internal/edge/homemap_dnspointing_test.go |
| +++ b/internal/edge/homemap_dnspointing_test.go |
| @@ -116,49 +116,3 @@ func TestHomeMapServedHostsPointingOnAnyHomeBox(t *testing.T) { |
| t.Fatalf("served hosts = %v, want shop.example.com", got) |
| } |
| } |
| - |
| -// UnpointedHosts is what the two served sets leave out: the exact home |
| -// names published, here or elsewhere, that no box homing them has seen |
| -// pointing. A name leaves it the moment any home box marks it pointing, and |
| -// a change in it alone wakes the warm (a certificate it holds may need its |
| -// renewal re-armed). |
| -func TestHomeMapUnpointedHostsIsTheRestOfThePublication(t *testing.T) { |
| - s := meshTestStore(t) |
| - putJSON(t, s, "control/edges/annie.json", `{"v":1,"box":"annie","eip":"1.1.1.1","hosts":{ |
| - "app.acct.apps.test":{"role":"home","platform":true}, |
| - "*.catch.example.com":{"role":"home","dns_pointing":false}, |
| - "shop.example.com":{"role":"home","dns_pointing":false}, |
| - "both.example.com":{"role":"home","dns_pointing":false}}}`) |
| - putJSON(t, s, "control/edges/betty.json", `{"v":1,"box":"betty","eip":"2.2.2.2","hosts":{ |
| - "old.example.net":{"role":"home","alias":true}, |
| - "both.example.com":{"role":"home","dns_pointing":true}}}`) |
| - m := newHomeMap(s, "annie") |
| - var woke atomic.Int32 |
| - m.setServedWake(func() { woke.Add(1) }) |
| - refreshHomeMap(t, m) |
| - waitWoke(t, &woke, 1) |
| - if got := strings.Join(m.UnpointedHosts(), ","); got != "shop.example.com" { |
| - t.Fatalf("unpointed = %q, want shop.example.com alone: betty has seen both.example.com pointing", got) |
| - } |
| - |
| - // Another box publishes a not-pointing name: neither served set moves, |
| - // the unpointed set does, and that wakes the warm. |
| - served := strings.Join(m.OwnServedHosts(), ",") + "|" + strings.Join(m.ServedHosts(), ",") |
| - putJSON(t, s, "control/edges/carol.json", `{"v":1,"box":"carol","eip":"3.3.3.3","hosts":{"store.example.net":{"role":"home","dns_pointing":false}}}`) |
| - refreshHomeMap(t, m) |
| - waitWoke(t, &woke, 2) |
| - if got := strings.Join(m.OwnServedHosts(), ",") + "|" + strings.Join(m.ServedHosts(), ","); got != served { |
| - t.Fatalf("the served sets moved (%q to %q) for a not-pointing name", served, got) |
| - } |
| - if got := strings.Join(m.UnpointedHosts(), ","); got != "shop.example.com,store.example.net" { |
| - t.Fatalf("unpointed = %q, want shop.example.com,store.example.net", got) |
| - } |
| - |
| - if got := newHomeMap(s, "").UnpointedHosts(); got != nil { |
| - t.Fatalf("an unlabelled box reported unpointed hosts %v", got) |
| - } |
| - var nilMap *homeMap |
| - if got := nilMap.UnpointedHosts(); got != nil { |
| - t.Fatalf("a nil map reported %v", got) |
| - } |
| -} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 800f95170..826240802 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -148,4 +148,4 @@ plan14-root-reads-billing-dashboard-1.tsv 8924fafc5b6083858a72f45c764081abe3bcad |
| plan14-root-reads-billing-dash-3-cost.tsv 8924fafc5b6083858a72f45c764081abe3bcad6a6de71901470586c076c64bb6 |
| plan14-root-reads-no-negative-prime-724.tsv ab10145ee873e26b87a653f728cd0c9737592fefe94b659ac5988201c195cb7a |
| plan14-root-reads-gvisor-probe-retry.tsv 499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24 |
| -plan14-root-reads-warm-set-published-724.tsv c9fb1a88d978f029b4d7bd7c082247ff3160d98d72270b16d1a6ee0e4beba012 |
| +plan14-root-reads-warm-set-published-724.tsv 52f4ec108856f2c6ee4e43d4bd9f1030f01fa466223a73036c2c749e74e6988c |
diff --git a/internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv b/internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv| index 8d73237ba..ca45ae8f6 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-warm-set-published-724.tsv |
| @@ -1,8 +1,8 @@ |
| # Census overlay warm-set-published-724, written by census-propose (#369). census-ruling-warm-set-published-724, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-warm-set-published-724.md. |
| # 1 body, 1 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@legacy 15edc984232abd79860462c6a2d0963cbd720c170d01edc7c79a312fec2866a4 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). The call also passes certCached(certCache, time.Now), a read-only check of the autocert cache the edge already built here (Cache.Get of the host's own entry, parsed and checked for validity, never an order): the warm uses it, with the home map's UnpointedHosts, to keep re-arming the renewal of a published name that is not marked pointing only when its certificate is already cached; a not-pointing name with no cached certificate is never looked up or ordered. No read site added in this unit, same 5 sites. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 e9bec259306cdcd6372708c5bed6998ec13cbd1090568e7b00cee9c957ffc772 |
| -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). The call also passes certCached(certCache, time.Now), a read-only check of the autocert cache the edge already built here (Cache.Get of the host's own entry, parsed and checked for validity, never an order): the warm uses it, with the home map's UnpointedHosts, to keep re-arming the renewal of a published name that is not marked pointing only when its certificate is already cached; a not-pointing name with no cached certificate is never looked up or ordered. No read site added in this unit, same 5 sites. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 e9bec259306cdcd6372708c5bed6998ec13cbd1090568e7b00cee9c957ffc772 |
| +@legacy 10058a8a917d510989e7a95be9a9f22007d0ae3f96cce61a14954336edab9ff0 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. No read site added in this unit, same 5 sites. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 2dc64b1405b94ea073dcef2714368eb00a0b3e6738c319847f59aecb24e159cd |
| +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. No read site added in this unit, same 5 sites. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 2dc64b1405b94ea073dcef2714368eb00a0b3e6738c319847f59aecb24e159cd |
| 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. registry:Account@16743,registry:Alias@10183,registry:Alias@10340,registry:Alias@10410,registry:Alias@10442,registry:Alias@11186,registry:Alias@11396,registry:Alias@14216,registry:Alias@14266,registry:Alias@9544,registry:Alias@9563,registry:Alias@9662,registry:Alias@9716,registry:Alias@9751,registry:Alias@9813,registry:App@16755,registry:DNSStatus@10349,registry:DNSStatus@5731,registry:DNSStatus@9858,registry:Host@14119,registry:Host@14139,registry:Host@14404,registry:Host@14484,registry:Host@14519,registry:Host@14568,registry:Host@15030,registry:Host@15065,registry:Host@16173,registry:Host@4188,registry:Host@4279,registry:Host@4325,registry:Host@4384,registry:Host@5723,registry:Host@5970,registry:Host@6940,registry:Host@9589,registry:Host@9637,registry:Incarnation@5930,registry:Platform@5238,registry:Pool@4239,registry:Provisioned@5252,registry:Replica@5276,registry:ServingSeq@5945,registry:Status@2957,whole:Route@1026,whole:Route@18213,whole:Route@1841,whole:Route@19038,whole:Route@19213,whole:Route@2327,whole:Route@7025,whole:Route@750,whole:RouteAlias@14170,whole:RouteAlias@18235,whole:RouteAlias@19228,whole:RouteAlias@9427,whole:RouteAlias@9509,whole:RouteAlias@9701,whole:RoutePath@18228,whole:RoutePath@19221,whole:RoutePath@6809,whole:RoutePath@6841,whole:RoutePath@6888,whole:RoutePath@6916,whole:RoutePath@6954,whole:RoutePath@6974,whole:RoutePath@6986,whole:RoutePath@7040,whole:WildcardDomain@14097,whole:WildcardDomain@14473 5b2180cec383f62ccb24a32a8eff30ab462eaab4d13f4b7b0503fc639a0c6b49 |
| -@coverage internal/edge 8a8d210477603e04341b1c1ecc155b9a961ff9c9f707b4741863d7a2ecef68ce |
| +@coverage internal/edge ef0e5280ce45cabc1551f4c671f9d7520c8402e8fc6179f57403f9c217d47208 |
| @coverage internal/edgesfile 55e261de1c2527dade77aefaefd3515595bfccb7c6bbaeec246c5ab1308047dc |
| @coverage internal/host 6e65359f159ffa837e000c1506df6545f7f47857a0e29f73338c0b0338d50201 |