edge: bound the warm fresh look; read AAAA too (#724, Astra R1)
P1: the fresh look read only A records, so a name with an edge A and a foreign AAAA could open the gate while the CA validates over IPv6. The warm now uses FreshResolver.ResolveAll (A plus AAAA from the same verified zone; an authoritatively empty AAAA is fine, any other AAAA failure fails the answer) through the same all-must-be-edges dnsGate. P1: fresh looks ran unbounded in the warm loop. They now run only for a name in its first hour of DNS misses, at most 6 per minute and once per name per 2 minutes, through certWarm.freshOpen. Abandoned names never get one. P2: productionWarmGates is what edge.go wires and what the tests drive, including zero lookups on an empty edge set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Fresh warm look reads A+AAAA, runs only in a name's first hour, 6/min, once per name per 2 min.
8 files changed,
+399
−116
docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md+3 −3internal/domains/freshdns.go+103 −24internal/domains/freshdns_test.go+72 −0internal/edge/certwarm.go+97 −38internal/edge/certwarm_fresh_test.go+115 −45internal/edge/edge.go+3 −1internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv+5 −4
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md b/docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md| index 0ccbeb2af..fc435b0d2 100644 |
| --- a/docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md |
| +++ b/docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md |
| @@ -4,9 +4,9 @@ Ruling `census-ruling-warm-gate-fresh-724`. The independent reviewer approves or |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `internal/edge/edge.go` `RunWithActivatorReady` | body | unchanged (5) | the cert warm DNS gate is built with dnsGateWithFresh(warmResolver, warmFresh.Resolve, ...): when the cached answer does not point here, the zone-verified FreshResolver from #724 is asked and the gate opens only if every fresh address is an edge (#724 follow-up) | |
| +| `internal/edge/edge.go` `RunWithActivatorReady` | body | unchanged (5) | the cert warm is built with productionWarmGates: the cached gate as before, plus warm.freshPoints = dnsGate(warmFresh.ResolveAll, edgeIPs), the zone-verified FreshResolver from #724 reading A and AAAA; asked only for names in their first hour of DNS misses, at most 6 per minute and once per name per 2 min; every address must be an edge (#724 follow-up) | |
| -Envelopes re-pinned: `internal/edge`. |
| +Envelopes re-pinned: `internal/domains`, `internal/edge`. |
| 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. |
| @@ -14,6 +14,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 |
| -Seal: `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129` → `427eb007fdb787d2a98998bbe14b1cf6ddb65f76a37b9cba7ee26747a2391483`. |
| +Seal: `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129` → `2b7779f82efa86d08922bb5cb487b08d20b0142c038e759cbd79b988843bda80`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/domains/freshdns.go b/internal/domains/freshdns.go| index b05641a30..4924a39c2 100644 |
| --- a/internal/domains/freshdns.go |
| +++ b/internal/domains/freshdns.go |
| @@ -100,6 +100,16 @@ func freshPublicName(name string) bool { |
| // An authoritative "no such name" is a *net.DNSError with IsNotFound, the |
| // same shape the cached resolver gives, so callers classify both alike. |
| func (r *FreshResolver) Resolve(host string) ([]string, error) { |
| + return r.lookup(host, false) |
| +} |
| + |
| +// ResolveAll is Resolve with the name's AAAA records too (see askAll). It |
| +// shares Resolve's timeout, backoff and zone verification. |
| +func (r *FreshResolver) ResolveAll(host string) ([]string, error) { |
| + return r.lookup(host, true) |
| +} |
| + |
| +func (r *FreshResolver) lookup(host string, all bool) ([]string, error) { |
| name := strings.ToLower(strings.TrimSuffix(host, ".")) |
| if !freshPublicName(name) { |
| return nil, fmt.Errorf("%w: %s has no public zone", errNoAuthority, name) |
| @@ -131,7 +141,7 @@ func (r *FreshResolver) Resolve(host string) ([]string, error) { |
| } |
| ctx, cancel := context.WithTimeout(context.Background(), timeout) |
| defer cancel() |
| - ips, err := r.resolve(ctx, name) |
| + ips, err := r.resolve(ctx, name, all) |
| if err != nil && !isNotFound(err) { |
| r.mu.Lock() |
| @@ -174,7 +184,7 @@ func isNotFound(err error) bool { |
| // target, tied to the zone that really holds the name. A level the cached |
| // resolver already knows to be an alias is skipped without asking anyone, |
| // since a CNAME cannot sit at a zone apex. |
| -func (r *FreshResolver) resolve(ctx context.Context, name string) ([]string, error) { |
| +func (r *FreshResolver) resolve(ctx context.Context, name string, all bool) ([]string, error) { |
| last := fmt.Errorf("%w: no zone found for %s", errNoAuthority, name) |
| zones := 0 |
| for zone := name; strings.Contains(zone, "."); zone = zone[strings.Index(zone, ".")+1:] { |
| @@ -204,7 +214,11 @@ func (r *FreshResolver) resolve(ctx context.Context, name string) ([]string, err |
| } |
| continue |
| } |
| - ips, err := r.ask(ctx, s, name, zone) |
| + ask := r.ask |
| + if all { |
| + ask = r.askAll |
| + } |
| + ips, err := ask(ctx, s, name, zone) |
| if err == nil || isNotFound(err) { |
| return ips, err |
| } |
| @@ -383,24 +397,34 @@ func (r *FreshResolver) verifyZone(ctx context.Context, server netip.AddrPort, z |
| return fmt.Errorf("%w: %s does not hold zone %s", errNoAuthority, server, zone) |
| } |
| -// ask sends one non-recursive IN A query for name to server, which |
| -// verifyZone has shown holds zone, and reads the answer. A CNAME chain in |
| -// the reply is followed; if it ends outside zone with no address in the |
| -// reply, the target goes to the cached LookupHost. A chain that loops, runs |
| -// past freshMaxCNAMEs, or ends inside zone with no address is not an |
| -// answer. |
| -func (r *FreshResolver) ask(ctx context.Context, server netip.AddrPort, name, zone string) ([]string, error) { |
| - reply, err := r.exchange(ctx, server, name, dnsmessage.TypeA) |
| +var ( |
| + // errNoData: the server answered with authority that name (or the end |
| + // of its in-reply CNAME chain, if that is name itself) has no records |
| + // of the asked type. |
| + errNoData = errors.New("fresh dns: no records of that type") |
| + // errInZoneNoData: the chain ends at another name inside the zone and |
| + // the reply carries no records of the asked type for it. |
| + errInZoneNoData = errors.New("fresh dns: in-zone CNAME target with no records of that type") |
| +) |
| + |
| +// askType sends one non-recursive IN query of qtype (A or AAAA) for name to |
| +// server, which verifyZone has shown holds zone, and reads the answer. A |
| +// CNAME chain in the reply is followed; if it ends outside zone with no |
| +// address in the reply, the target goes to the cached LookupHost, which |
| +// answers for both families, and cached reports that. A chain that loops or |
| +// runs past freshMaxCNAMEs is not an answer. |
| +func (r *FreshResolver) askType(ctx context.Context, server netip.AddrPort, name, zone string, qtype dnsmessage.Type) (ips []string, cached bool, err error) { |
| + reply, err := r.exchange(ctx, server, name, qtype) |
| if err != nil { |
| - return nil, err |
| + return nil, false, err |
| } |
| fqdn := name + "." |
| switch reply.RCode { |
| case dnsmessage.RCodeSuccess: |
| case dnsmessage.RCodeNameError: |
| - return nil, &net.DNSError{Err: "no such host", Name: name, Server: server.String(), IsNotFound: true} |
| + return nil, false, &net.DNSError{Err: "no such host", Name: name, Server: server.String(), IsNotFound: true} |
| default: |
| - return nil, fmt.Errorf("%w: %s answered %s for %s", errNoAuthority, server, reply.RCode, name) |
| + return nil, false, fmt.Errorf("%w: %s answered %s for %s", errNoAuthority, server, reply.RCode, name) |
| } |
| current := fqdn |
| @@ -418,30 +442,85 @@ func (r *FreshResolver) ask(ctx context.Context, server netip.AddrPort, name, zo |
| break |
| } |
| if seen[next] || hops >= freshMaxCNAMEs { |
| - return nil, fmt.Errorf("%w: CNAME chain from %s loops or runs too long", errNoAuthority, name) |
| + return nil, false, fmt.Errorf("%w: CNAME chain from %s loops or runs too long", errNoAuthority, name) |
| } |
| seen[next] = true |
| current = next |
| } |
| - var ips []string |
| for _, rr := range reply.Answers { |
| - if a, ok := rr.Body.(*dnsmessage.AResource); ok && rr.Header.Class == dnsmessage.ClassINET && |
| - strings.EqualFold(rr.Header.Name.String(), current) { |
| - ips = append(ips, netip.AddrFrom4(a.A).String()) |
| + if rr.Header.Class != dnsmessage.ClassINET || !strings.EqualFold(rr.Header.Name.String(), current) { |
| + continue |
| + } |
| + switch b := rr.Body.(type) { |
| + case *dnsmessage.AResource: |
| + if qtype == dnsmessage.TypeA { |
| + ips = append(ips, netip.AddrFrom4(b.A).String()) |
| + } |
| + case *dnsmessage.AAAAResource: |
| + if qtype == dnsmessage.TypeAAAA { |
| + ips = append(ips, netip.AddrFrom16(b.AAAA).String()) |
| + } |
| } |
| } |
| if len(ips) > 0 { |
| - return ips, nil |
| + return ips, false, nil |
| } |
| target := strings.TrimSuffix(current, ".") |
| if target == name { |
| - // Authoritative, the name exists, and it has no A record. |
| - return nil, &net.DNSError{Err: "no A record", Name: name, Server: server.String(), IsNotFound: true} |
| + return nil, false, errNoData |
| } |
| if target == zone || strings.HasSuffix(target, "."+zone) { |
| // In-zone target this server gave no address for: no fallback to |
| // a cache that may hold an old one. |
| - return nil, fmt.Errorf("%w: %s ends at in-zone %s with no address", errNoAuthority, name, target) |
| + return nil, false, errInZoneNoData |
| + } |
| + ips, err = r.LookupHost(ctx, target) |
| + return ips, true, err |
| +} |
| + |
| +// ask is askType for A, with Resolve's long-standing errors: no A record at |
| +// the name is "not found", and an in-zone target with no address is not an |
| +// answer at all. |
| +func (r *FreshResolver) ask(ctx context.Context, server netip.AddrPort, name, zone string) ([]string, error) { |
| + ips, _, err := r.askType(ctx, server, name, zone, dnsmessage.TypeA) |
| + switch { |
| + case errors.Is(err, errNoData): |
| + return nil, &net.DNSError{Err: "no A record", Name: name, Server: server.String(), IsNotFound: true} |
| + case errors.Is(err, errInZoneNoData): |
| + return nil, fmt.Errorf("%w: %s ends at in-zone target with no address", errNoAuthority, name) |
| + } |
| + return ips, err |
| +} |
| + |
| +// askAll is ask plus the name's AAAA records from the same server, for a |
| +// caller that must see every address a client could be sent to (the cert |
| +// warm's gate: a CA validating over IPv6 against a foreign AAAA fails even |
| +// when every A record is ours). The AAAA half may be authoritatively empty; |
| +// any other AAAA failure fails the whole answer. When the A half ended at an |
| +// out-of-zone target, the cached LookupHost already answered for both |
| +// families and nothing more is asked. |
| +func (r *FreshResolver) askAll(ctx context.Context, server netip.AddrPort, name, zone string) ([]string, error) { |
| + v4, cached, err := r.askType(ctx, server, name, zone, dnsmessage.TypeA) |
| + switch { |
| + case errors.Is(err, errNoData): |
| + return nil, &net.DNSError{Err: "no A record", Name: name, Server: server.String(), IsNotFound: true} |
| + case errors.Is(err, errInZoneNoData): |
| + return nil, fmt.Errorf("%w: %s ends at in-zone target with no address", errNoAuthority, name) |
| + case err != nil: |
| + return nil, err |
| + } |
| + if cached { |
| + return v4, nil |
| + } |
| + v6, _, err := r.askType(ctx, server, name, zone, dnsmessage.TypeAAAA) |
| + switch { |
| + case err == nil: |
| + return append(v4, v6...), nil |
| + case errors.Is(err, errNoData), errors.Is(err, errInZoneNoData): |
| + return v4, nil |
| + case isNotFound(err): |
| + // NXDOMAIN for AAAA right after addresses for A: inconsistent. |
| + return nil, fmt.Errorf("%w: %s gave A records but NXDOMAIN for AAAA", errNoAuthority, name) |
| } |
| - return r.LookupHost(ctx, target) |
| + return nil, err |
| } |
diff --git a/internal/domains/freshdns_test.go b/internal/domains/freshdns_test.go| index 7d6fd2cd9..fc1abcbe3 100644 |
| --- a/internal/domains/freshdns_test.go |
| +++ b/internal/domains/freshdns_test.go |
| @@ -528,3 +528,75 @@ func TestFreshResolverVerifiesTheSOAOwner(t *testing.T) { |
| t.Fatalf("Resolve = %v, want an error", ips) |
| } |
| } |
| + |
| +func aaaaRecord(name, ip string) dnsmessage.Resource { |
| + return dnsmessage.Resource{ |
| + Header: dnsmessage.ResourceHeader{Name: dnsmessage.MustNewName(name), Type: dnsmessage.TypeAAAA, Class: dnsmessage.ClassINET, TTL: 300}, |
| + Body: &dnsmessage.AAAAResource{AAAA: netip.MustParseAddr(ip).As16()}, |
| + } |
| +} |
| + |
| +// ResolveAll reports every address a client could be sent to: a foreign |
| +// AAAA next to our A must show up, or a gate that requires all addresses to |
| +// be ours would pass a name the CA validates over IPv6 elsewhere. |
| +func TestFreshResolverResolveAllIncludesAAAA(t *testing.T) { |
| + fa := startAuthority(t, "example.com", func(q dnsmessage.Question, r *dnsmessage.Message) bool { |
| + r.Authoritative = true |
| + switch q.Type { |
| + case dnsmessage.TypeA: |
| + r.Answers = []dnsmessage.Resource{aRecord("shop.example.com.", edgeIP)} |
| + case dnsmessage.TypeAAAA: |
| + r.Answers = []dnsmessage.Resource{aaaaRecord("shop.example.com.", "2001:db8::66")} |
| + } |
| + return true |
| + }) |
| + ips, err := oneZone(fa).resolver(clock()).ResolveAll("shop.example.com") |
| + if err != nil || len(ips) != 2 || ips[0] != edgeIP || ips[1] != "2001:db8::66" { |
| + t.Fatalf("ResolveAll = %v, %v; want [%s 2001:db8::66]", ips, err, edgeIP) |
| + } |
| + // Resolve (the stamp's) is unchanged: A only. |
| + if ips, err := oneZone(fa).resolver(clock()).Resolve("shop.example.com"); err != nil || len(ips) != 1 { |
| + t.Fatalf("Resolve = %v, %v; want A only", ips, err) |
| + } |
| +} |
| + |
| +func TestFreshResolverResolveAllAcceptsAnEmptyAAAA(t *testing.T) { |
| + fa := startAuthority(t, "example.com", func(q dnsmessage.Question, r *dnsmessage.Message) bool { |
| + r.Authoritative = true |
| + if q.Type == dnsmessage.TypeA { |
| + r.Answers = []dnsmessage.Resource{aRecord("shop.example.com.", edgeIP)} |
| + } |
| + return true // AAAA: authoritative NODATA |
| + }) |
| + ips, err := oneZone(fa).resolver(clock()).ResolveAll("shop.example.com") |
| + if err != nil || len(ips) != 1 || ips[0] != edgeIP { |
| + t.Fatalf("ResolveAll = %v, %v; want [%s]", ips, err, edgeIP) |
| + } |
| +} |
| + |
| +func TestFreshResolverResolveAllFailsOnABrokenAAAA(t *testing.T) { |
| + fa := startAuthority(t, "example.com", func(q dnsmessage.Question, r *dnsmessage.Message) bool { |
| + if q.Type == dnsmessage.TypeAAAA { |
| + r.RCode = dnsmessage.RCodeServerFailure |
| + return true |
| + } |
| + r.Authoritative = true |
| + r.Answers = []dnsmessage.Resource{aRecord("shop.example.com.", edgeIP)} |
| + return true |
| + }) |
| + if ips, err := oneZone(fa).resolver(clock()).ResolveAll("shop.example.com"); err == nil { |
| + t.Fatalf("ResolveAll = %v, want an error: the AAAA half is unknown", ips) |
| + } |
| +} |
| + |
| +// An out-of-zone CNAME target goes to the cached LookupHost, which answers |
| +// for both families; its IPv6 addresses come through. |
| +func TestFreshResolverResolveAllTakesBothFamiliesFromTheCNAMETarget(t *testing.T) { |
| + fa := startAuthority(t, "example.com", authoritative(cnameRecord("shop.example.com.", "edge.oncarlos.test."))) |
| + w := oneZone(fa) |
| + w.hosts["edge.oncarlos.test"] = []string{edgeIP, "2001:db8::7"} |
| + ips, err := w.resolver(clock()).ResolveAll("shop.example.com") |
| + if err != nil || len(ips) != 2 || ips[1] != "2001:db8::7" { |
| + t.Fatalf("ResolveAll = %v, %v; want both families from the target", ips, err) |
| + } |
| +} |
diff --git a/internal/edge/certwarm.go b/internal/edge/certwarm.go| index 4246f2afb..540987d87 100644 |
| --- a/internal/edge/certwarm.go |
| +++ b/internal/edge/certwarm.go |
| @@ -79,6 +79,16 @@ const ( |
| warmDNSFastFor = 10 * time.Minute |
| warmDNSRetrySlow = 5 * time.Minute |
| warmDNSSlowFor = time.Hour |
| + // The fresh look's bounds (#724). Only a name in its first |
| + // warmDNSSlowFor of DNS misses is eligible (the window in which a |
| + // customer finishes their DNS and the probe schedule is watching); |
| + // at most warmFreshPerWindow fresh looks per warmCappedDelay across all |
| + // names, and one per name per warmFreshSpacing so a large batch of new |
| + // names takes turns. Each look is bounded by the FreshResolver's own |
| + // timeout, so the warm loop spends at most warmFreshPerWindow of those |
| + // per minute on it, and nothing on names past their first hour. |
| + warmFreshPerWindow = 6 |
| + warmFreshSpacing = 2 * time.Minute |
| // warmGateRecheck is how often the loop looks at the issuer gate between |
| // passes (#386). The gate is the housekeeper lease, held in memory, so a |
| // look costs nothing; a box that takes the lease over (or takes it BACK |
| @@ -165,6 +175,16 @@ type certWarm struct { |
| // when it leaves the set. A new hold simply moves the deadline. |
| settleUntil map[string]time.Time |
| + // freshPoints is the gate's uncached second look (#724): the cached |
| + // resolver can hold a "no such name" for a new customer hostname for |
| + // the zone's SOA minimum. nil leaves the cached gate alone. It is asked |
| + // only through freshOpen, which bounds it (see there). |
| + freshPoints func(string) bool |
| + // freshSpent stamps the fresh looks in the last warmCappedDelay; |
| + // freshLast is each name's latest one. Both pruned as they age out. |
| + freshSpent []time.Time |
| + freshLast map[string]time.Time |
| + |
| // wake asks the loop for an early pass (nudge). Buffered one deep: a |
| // wake already pending covers any that arrive behind it. |
| wake chan struct{} |
| @@ -197,6 +217,7 @@ func newCertWarm(hosts func() []string, getCert func(*tls.ClientHelloInfo) (*tls |
| warmed: map[string]bool{}, |
| dnsMisses: map[string]dnsMiss{}, |
| settleUntil: map[string]time.Time{}, |
| + freshLast: map[string]time.Time{}, |
| wake: make(chan struct{}, 1), |
| now: time.Now, |
| gateTick: warmGateRecheck, |
| @@ -414,7 +435,7 @@ func (c *certWarm) probeDNS() bool { |
| sort.Strings(due) |
| points := false |
| for _, h := range due { |
| - if c.pointsHere(h) { |
| + if c.gateOpen(h) { |
| points = true |
| } |
| c.dnsMissed(h, now) |
| @@ -500,7 +521,7 @@ func (c *certWarm) pass() time.Duration { |
| c.discharge(h) |
| continue |
| } |
| - if !c.pointsHere(h) { |
| + if !c.gateOpen(h) { |
| // Handed to the DNS-miss schedule. |
| c.discharge(h) |
| c.dnsMissed(h, now) |
| @@ -746,6 +767,73 @@ func wildcardCoverer(parents func() []string) func(string) bool { |
| } |
| } |
| +// gateOpen is the DNS gate the warm applies before a new order: the cached |
| +// gate, then, when that says no, the bounded fresh look. |
| +func (c *certWarm) gateOpen(h string) bool { |
| + if c.pointsHere(h) { |
| + return true |
| + } |
| + return c.freshPoints != nil && c.freshOpen(h) && c.freshPoints(h) |
| +} |
| + |
| +// freshOpen reports whether h may have a fresh look now, and if so spends |
| +// it. A name qualifies only in its first warmDNSSlowFor of misses (a name |
| +// not yet on the schedule is on its first); the per-window and per-name |
| +// bounds are described at warmFreshPerWindow. |
| +func (c *certWarm) freshOpen(h string) bool { |
| + now := c.now() |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + if m, ok := c.dnsMisses[h]; ok && now.Sub(m.first) >= warmDNSSlowFor { |
| + return false |
| + } |
| + kept := c.freshSpent[:0] |
| + for _, t := range c.freshSpent { |
| + if now.Sub(t) < warmCappedDelay { |
| + kept = append(kept, t) |
| + } |
| + } |
| + c.freshSpent = kept |
| + for n, t := range c.freshLast { |
| + if now.Sub(t) >= warmFreshSpacing { |
| + delete(c.freshLast, n) |
| + } |
| + } |
| + if len(c.freshSpent) >= warmFreshPerWindow { |
| + return false |
| + } |
| + if _, recent := c.freshLast[h]; recent { |
| + return false |
| + } |
| + c.freshSpent = append(c.freshSpent, now) |
| + c.freshLast[h] = now |
| + return true |
| +} |
| + |
| +// Production lookups for the warm's two gates, variables so a test can |
| +// drive productionWarmGates through its real construction. |
| +var ( |
| + warmCachedLookup = warmResolver |
| + warmFreshLookup = warmFresh.ResolveAll |
| +) |
| + |
| +// productionWarmGates builds the warm's cached gate and its fresh one. Both |
| +// are dnsGate, so both require EVERY address to be an edge and fail closed |
| +// on an empty edge set; the fresh one reads both address families |
| +// (ResolveAll), because a CA validating over IPv6 against a foreign AAAA |
| +// fails even when every A record is ours. |
| +func productionWarmGates(edgeIPs func() []string) (cached, fresh func(string) bool) { |
| + return dnsGate(warmCachedLookup, edgeIPs), dnsGate(warmFreshLookup, edgeIPs) |
| +} |
| + |
| +// warmFresh is the fresh gate's resolver (#724), with its own failure |
| +// backoff. |
| +var warmFresh = &domains.FreshResolver{ |
| + LookupNS: net.DefaultResolver.LookupNS, |
| + LookupHost: net.DefaultResolver.LookupHost, |
| + LookupCNAME: net.DefaultResolver.LookupCNAME, |
| +} |
| + |
| // dnsGate builds the "does this name point at us?" test the warm applies |
| // before placing a NEW order. |
| // |
| @@ -775,19 +863,6 @@ func dnsGate(resolve func(string) ([]string, error), edgeIPs func() []string) fu |
| } |
| func dnsGateAt(resolve func(string) ([]string, error), edgeIPs func() []string, now func() time.Time) func(string) bool { |
| - return dnsGateWithFresh(resolve, nil, edgeIPs, now) |
| -} |
| - |
| -// dnsGateWithFresh is dnsGate with a second, uncached look (#724). The |
| -// issuer's own resolver can hold a "no such name" for a customer hostname |
| -// for the zone's SOA minimum: the issuer is also the name's home box, the |
| -// deployment has one box, or something looked the name up before the |
| -// customer added the record. When the cached answer does not open the gate, |
| -// fresh asks the zone's own nameservers, and the gate opens only if every |
| -// fresh address is in the edge set: the same all-must-match rule as the |
| -// cached answer, so the shared validation budget is protected as before. |
| -// fresh nil is the cached gate alone. |
| -func dnsGateWithFresh(resolve, fresh func(string) ([]string, error), edgeIPs func() []string, now func() time.Time) func(string) bool { |
| var ( |
| mu sync.Mutex |
| cached map[string]bool |
| @@ -815,35 +890,19 @@ func dnsGateWithFresh(resolve, fresh func(string) ([]string, error), edgeIPs fun |
| if len(set) == 0 { |
| return false |
| } |
| - allOurs := func(ips []string, err error) bool { |
| - if err != nil || len(ips) == 0 { |
| + ips, err := resolve(host) |
| + if err != nil || len(ips) == 0 { |
| + return false |
| + } |
| + for _, ip := range ips { |
| + if !set[ip] { |
| return false |
| } |
| - for _, ip := range ips { |
| - if !set[ip] { |
| - return false |
| - } |
| - } |
| - return true |
| } |
| - if allOurs(resolve(host)) { |
| - return true |
| - } |
| - return fresh != nil && allOurs(fresh(host)) |
| + return true |
| } |
| } |
| -// warmFresh is the DNS gate's uncached second look (#724), with its own |
| -// failure backoff. The backoff is long because the warm comes back to a |
| -// pending name hourly forever: a name whose nameservers are dead costs one |
| -// timeout per six hours here, and the cached look still runs every time. |
| -var warmFresh = &domains.FreshResolver{ |
| - LookupNS: net.DefaultResolver.LookupNS, |
| - LookupHost: net.DefaultResolver.LookupHost, |
| - LookupCNAME: net.DefaultResolver.LookupCNAME, |
| - Backoff: 6 * time.Hour, |
| -} |
| - |
| // warmResolver is the DNS gate's lookup: the system resolver, bounded so a |
| // hung one costs this host its turn in the pass and not the pass itself. |
| func warmResolver(host string) ([]string, error) { |
diff --git a/internal/edge/certwarm_fresh_test.go b/internal/edge/certwarm_fresh_test.go| index db1d9817f..dcbaa1d2c 100644 |
| --- a/internal/edge/certwarm_fresh_test.go |
| +++ b/internal/edge/certwarm_fresh_test.go |
| @@ -1,67 +1,137 @@ |
| package edge |
| import ( |
| - "errors" |
| + "crypto/tls" |
| + "fmt" |
| "net" |
| "testing" |
| "time" |
| ) |
| -// #724 follow-up: the issuer's own resolver can hold a "no such name" for |
| -// a customer hostname (it is also the home box, a single-box deployment, or |
| -// it looked the name up before the record existed). The gate then asks the |
| -// zone's own nameservers, uncached, and opens only when every fresh address |
| -// is one of ours: the same all-must-match rule, so the shared ACME |
| -// validation budget is protected exactly as before. |
| -func TestDNSGateAsksFreshWhenTheCacheSaysNo(t *testing.T) { |
| - edges := func() []string { return []string{"203.0.113.7", "198.51.100.9"} } |
| - nx := func(string) ([]string, error) { return nil, &net.DNSError{Err: "no such host", IsNotFound: true} } |
| +// #724 follow-up: the issuer's own resolver can hold a "no such name" for a |
| +// new customer hostname (it is also the home box, a single-box deployment, |
| +// or it looked the name up before the record existed). The warm's gate then |
| +// takes a fresh look, bounded: names in their first hour of misses only, at |
| +// most warmFreshPerWindow per window, one per name per warmFreshSpacing. |
| + |
| +func freshWarm(t *testing.T, clock *fakeClock, hosts []string, fresh func(string) bool) (*certWarm, *[]string) { |
| + t.Helper() |
| + var ordered []string |
| + w := newCertWarm( |
| + func() []string { return hosts }, |
| + func(h *tls.ClientHelloInfo) (*tls.Certificate, error) { |
| + ordered = append(ordered, h.ServerName) |
| + return &tls.Certificate{}, nil |
| + }, |
| + func(string) bool { return false }, // the cache says no, always |
| + nil, |
| + nil, |
| + ) |
| + w.now = clock.now |
| + w.freshPoints = fresh |
| + return w, &ordered |
| +} |
| + |
| +func TestWarmOrdersANewNameTheFreshLookSaysPointsHere(t *testing.T) { |
| + clock := &fakeClock{t: time.Unix(1_800_000_000, 0)} |
| + w, ordered := freshWarm(t, clock, []string{"www.customer.test"}, func(string) bool { return true }) |
| + w.pass() |
| + if len(*ordered) != 1 || (*ordered)[0] != "www.customer.test" { |
| + t.Fatalf("ordered %v, want the new name ordered on its fresh look", *ordered) |
| + } |
| +} |
| + |
| +func TestWarmGivesNoFreshLookPastAnHourOfMisses(t *testing.T) { |
| + clock := &fakeClock{t: time.Unix(1_800_000_000, 0)} |
| + asked := 0 |
| + w, ordered := freshWarm(t, clock, []string{"old.customer.test"}, func(string) bool { asked++; return false }) |
| + w.pass() // first miss: one fresh look |
| + clock.advance(warmDNSSlowFor + time.Minute) |
| + w.freshPoints = func(string) bool { asked++; return true } |
| + before := asked |
| + w.pass() |
| + if asked != before || len(*ordered) != 0 { |
| + t.Fatalf("a name an hour into its misses got a fresh look (asked %d -> %d, ordered %v)", before, asked, *ordered) |
| + } |
| +} |
| + |
| +func TestWarmFreshLooksAreBoundedPerWindowAndPerName(t *testing.T) { |
| + clock := &fakeClock{t: time.Unix(1_800_000_000, 0)} |
| + var hosts []string |
| + for i := 0; i < 20; i++ { |
| + hosts = append(hosts, fmt.Sprintf("n%02d.customer.test", i)) |
| + } |
| + asked := map[string]int{} |
| + w, _ := freshWarm(t, clock, hosts, func(h string) bool { asked[h]++; return false }) |
| + w.pass() |
| + total := 0 |
| + for _, n := range asked { |
| + total += n |
| + } |
| + if total != warmFreshPerWindow { |
| + t.Fatalf("fresh looks in one window = %d, want %d", total, warmFreshPerWindow) |
| + } |
| + // Inside the per-name spacing the same names are not asked again, so |
| + // the next window goes to names that have not had a turn. |
| + clock.advance(warmCappedDelay) |
| + w.pass() |
| + for h, n := range asked { |
| + if n > 1 { |
| + t.Fatalf("%s asked %d times inside warmFreshSpacing", h, n) |
| + } |
| + } |
| + if len(asked) != 2*warmFreshPerWindow { |
| + t.Fatalf("names asked after two windows = %d, want %d", len(asked), 2*warmFreshPerWindow) |
| + } |
| +} |
| + |
| +// The production gates: both require every address to be an edge, the |
| +// fresh one reads both families, and an empty edge set asks nobody. |
| +func TestProductionWarmGates(t *testing.T) { |
| + oldC, oldF := warmCachedLookup, warmFreshLookup |
| + defer func() { warmCachedLookup, warmFreshLookup = oldC, oldF }() |
| + cachedCalls, freshCalls := 0, 0 |
| + var freshAnswer []string |
| + warmCachedLookup = func(string) ([]string, error) { |
| + cachedCalls++ |
| + return nil, &net.DNSError{Err: "no such host", IsNotFound: true} |
| + } |
| + warmFreshLookup = func(string) ([]string, error) { freshCalls++; return freshAnswer, nil } |
| + |
| + edges := []string{"203.0.113.7", "2001:db8::7"} |
| + cached, fresh := productionWarmGates(func() []string { return edges }) |
| for name, tc := range map[string]struct { |
| - cached func(string) ([]string, error) |
| - fresh []string |
| - ferr error |
| + answer []string |
| want bool |
| - asked bool |
| }{ |
| - "cached miss, fresh ours": {cached: nx, fresh: []string{"203.0.113.7"}, want: true, asked: true}, |
| - "cached miss, fresh partly elsewhere": {cached: nx, fresh: []string{"203.0.113.7", "192.0.2.1"}, want: false, asked: true}, |
| - "cached miss, fresh elsewhere": {cached: nx, fresh: []string{"192.0.2.1"}, want: false, asked: true}, |
| - "cached miss, fresh empty": {cached: nx, fresh: nil, want: false, asked: true}, |
| - "cached miss, fresh failed": {cached: nx, ferr: errors.New("timeout"), want: false, asked: true}, |
| - "cached elsewhere, fresh ours": {cached: func(string) ([]string, error) { return []string{"192.0.2.1"}, nil }, |
| - fresh: []string{"198.51.100.9"}, want: true, asked: true}, |
| - "cached ours": {cached: func(string) ([]string, error) { return []string{"203.0.113.7"}, nil }, |
| - fresh: []string{"192.0.2.1"}, want: true, asked: false}, |
| + "A ours": {[]string{"203.0.113.7"}, true}, |
| + "A and AAAA ours": {[]string{"203.0.113.7", "2001:db8::7"}, true}, |
| + "A ours, AAAA elsewhere": {[]string{"203.0.113.7", "2001:db8::66"}, false}, |
| + "A elsewhere": {[]string{"192.0.2.1"}, false}, |
| + "no addresses": {nil, false}, |
| } { |
| - asked := false |
| - fresh := func(string) ([]string, error) { asked = true; return tc.fresh, tc.ferr } |
| - gate := dnsGateWithFresh(tc.cached, fresh, edges, time.Now) |
| - if got := gate("www.customer.test"); got != tc.want { |
| - t.Errorf("%s: gate = %v, want %v", name, got, tc.want) |
| + freshAnswer = tc.answer |
| + if cached("www.customer.test") { |
| + t.Fatalf("%s: the cached gate opened on NXDOMAIN", name) |
| } |
| - if asked != tc.asked { |
| - t.Errorf("%s: fresh asked = %v, want %v", name, asked, tc.asked) |
| + if got := fresh("www.customer.test"); got != tc.want { |
| + t.Errorf("%s: fresh gate = %v, want %v", name, got, tc.want) |
| } |
| } |
| -} |
| -// An empty edge set still fails closed, before anyone is asked anything. |
| -func TestDNSGateWithFreshFailsClosedOnAnEmptyEdgeSet(t *testing.T) { |
| - asked := false |
| - gate := dnsGateWithFresh( |
| - func(string) ([]string, error) { return nil, errors.New("nx") }, |
| - func(string) ([]string, error) { asked = true; return []string{"203.0.113.7"}, nil }, |
| - func() []string { return nil }, |
| - time.Now, |
| - ) |
| - if gate("www.customer.test") || asked { |
| - t.Fatalf("empty edge set: gate opened or fresh asked (asked=%v)", asked) |
| + edges = nil |
| + cachedCalls, freshCalls = 0, 0 |
| + cached, fresh = productionWarmGates(func() []string { return edges }) |
| + if cached("www.customer.test") || fresh("www.customer.test") { |
| + t.Fatal("an empty edge set opened a gate") |
| + } |
| + if cachedCalls != 0 || freshCalls != 0 { |
| + t.Fatalf("an empty edge set still looked names up (cached %d, fresh %d)", cachedCalls, freshCalls) |
| } |
| } |
| -// The production gate is built with the fresh lookup wired in. |
| -func TestWarmDNSGateWiresTheFreshLookup(t *testing.T) { |
| - if warmFresh == nil || warmFresh.LookupNS == nil || warmFresh.LookupHost == nil || warmFresh.LookupCNAME == nil { |
| +func TestProductionWarmGatesUseTheFreshResolver(t *testing.T) { |
| + if warmFresh.LookupNS == nil || warmFresh.LookupHost == nil || warmFresh.LookupCNAME == nil { |
| t.Fatal("warmFresh is not wired to the system resolver") |
| } |
| } |
diff --git a/internal/edge/edge.go b/internal/edge/edge.go| index ae06dcc45..653ee7c45 100644 |
| --- a/internal/edge/edge.go |
| +++ b/internal/edge/edge.go |
| @@ -4900,13 +4900,15 @@ func RunWithActivatorReady(args []string, act Activator, cache *Cache, ready fun |
| defer cancel() |
| return edgesfile.EdgeIPs(ctx, store, envIPs, time.Now()) |
| } |
| + cachedGate, freshGate := productionWarmGates(edgeIPs) |
| warm := newCertWarm( |
| func() []string { return e.warmSet(appsDomain, parents) }, |
| perHostCert, |
| - dnsGateWithFresh(warmResolver, warmFresh.Resolve, edgeIPs, time.Now), |
| + cachedGate, |
| e.issuerGate, |
| store, |
| ) |
| + warm.freshPoints = freshGate |
| // Woken when its set may have grown (#386), so a custom domain is |
| // ordered seconds after it reaches this box rather than at the next |
| // hourly pass: a local route reload, or a change in the names other |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 74eb69a60..7f85d7482 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -140,4 +140,4 @@ plan14-root-reads-gvisor-update-dirs.tsv 1f1b2fdb569b7be42e75e10d1943d7e51270829 |
| plan14-root-reads-region-ha-held-build.tsv beb085e4c6cdb3d430d12a8dc3c93f25cc3faf1aa7d62be37698ff9c9c82ecce |
| plan14-root-reads-fixedbox-health-alarms.tsv 0f7153571df8c1b4b50c31f57efcfdf60c71a12c80fd935fb3ea202fa0201dd5 |
| plan14-root-reads-fixed-host-ignore-user-data.tsv 250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129 |
| -plan14-root-reads-warm-gate-fresh-724.tsv 427eb007fdb787d2a98998bbe14b1cf6ddb65f76a37b9cba7ee26747a2391483 |
| +plan14-root-reads-warm-gate-fresh-724.tsv 2b7779f82efa86d08922bb5cb487b08d20b0142c038e759cbd79b988843bda80 |
diff --git a/internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv b/internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv| index 0407c81c6..be5453c07 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-warm-gate-fresh-724.tsv |
| @@ -1,5 +1,6 @@ |
| # Census overlay warm-gate-fresh-724, written by census-propose (#369). census-ruling-warm-gate-fresh-724, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-warm-gate-fresh-724.md. |
| -# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@legacy dee655330d2b73bba900a0eeff07a26886ce8fedb880cdf039f36ab1d8501ae3 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-gate-fresh-724;basis=the cert warm DNS gate is built with dnsGateWithFresh(warmResolver, warmFresh.Resolve, ...): when the cached answer does not point here, the zone-verified FreshResolver from #724 is asked and the gate opens only if every fresh address is an edge (#724 follow-up) data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 de02404e292762ef22540b43a1fefbcd1b3dedbcfa60d16646f652ee1dcfe4c0 |
| -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-gate-fresh-724;basis=the cert warm DNS gate is built with dnsGateWithFresh(warmResolver, warmFresh.Resolve, ...): when the cached answer does not point here, the zone-verified FreshResolver from #724 is asked and the gate opens only if every fresh address is an edge (#724 follow-up) data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 de02404e292762ef22540b43a1fefbcd1b3dedbcfa60d16646f652ee1dcfe4c0 |
| -@coverage internal/edge 1c8c57fd2b01c754c47113799232b917a66e674d72751d9471050dab6991d2f8 |
| +# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy ca90c6ae379642ec4940b045ce0503bf077c3ac77354821ccfa0b1b86bc3f182 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-gate-fresh-724;basis=the cert warm is built with productionWarmGates: the cached gate as before, plus warm.freshPoints = dnsGate(warmFresh.ResolveAll, edgeIPs), the zone-verified FreshResolver from #724 reading A and AAAA; asked only for names in their first hour of DNS misses, at most 6 per minute and once per name per 2 min; every address must be an edge (#724 follow-up) data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 d323759abc16baa4909e732ae92b61115d1864d69561ecd12708fbbbbd8e8fea |
| +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-gate-fresh-724;basis=the cert warm is built with productionWarmGates: the cached gate as before, plus warm.freshPoints = dnsGate(warmFresh.ResolveAll, edgeIPs), the zone-verified FreshResolver from #724 reading A and AAAA; asked only for names in their first hour of DNS misses, at most 6 per minute and once per name per 2 min; every address must be an edge (#724 follow-up) data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 d323759abc16baa4909e732ae92b61115d1864d69561ecd12708fbbbbd8e8fea |
| +@coverage internal/domains e6853d3554575f7ef64ba67bff7778ad779314041f0128e1dba0f8b12a3701a6 |
| +@coverage internal/edge 436af1c9284505769f969d10c2e31babf624ce054683e394e983e5031e2b17c7 |