region HA P1a Task 1: P0: edges file reads box addresses directly; scheduler moved; claim read removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+240
−872
internal/host/boxaddress_test.go+51 −10internal/host/edgesclaims.go+0 −291internal/host/edgesclaims_test.go+0 −428internal/host/edgesfile.go+16 −21internal/host/edgesfile_test.go+84 −121internal/host/edgesschedule.go+41 −0internal/host/edgesschedule_test.go+47 −0internal/host/movesoffline_lifetime_test.go+1 −1
diff --git a/internal/host/boxaddress_test.go b/internal/host/boxaddress_test.go| index 92aa7177a..ac2bceef1 100644 |
| --- a/internal/host/boxaddress_test.go |
| +++ b/internal/host/boxaddress_test.go |
| @@ -5,8 +5,10 @@ import ( |
| "encoding/json" |
| "errors" |
| "net/http" |
| + "strings" |
| "testing" |
| + "github.com/carlosframework/platform/internal/registry" |
| "github.com/carlosframework/platform/internal/release" |
| ) |
| @@ -151,22 +153,20 @@ func readEdgesFile(t *testing.T, s release.Store, box string) edgesFile { |
| func TestEdgesFilePublishesOnlyWhatTheSourceReports(t *testing.T) { |
| s, reg := release.NewDirStore(t.TempDir()), edgesTestRegistry(t) |
| seedRoute(t, reg, "app.example.com") |
| - claims := newEdgesClaims("annie", (&claimsBook{}).read) |
| src := &countingAddresses{answers: []BoxAddresses{ |
| {Private: "10.0.1.5", PrivateCIDR: "10.0.0.0/16", Public: "203.0.113.9"}, |
| {Private: "10.0.1.5", PrivateCIDR: "10.0.0.0/16"}, |
| }} |
| - claims.addrs = src |
| var last []byte |
| ident := edgesFile{Box: "annie", BoxID: "annie"} |
| // The loop's own reading (the eip argument) is not what is published. |
| - if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "198.51.100.1", &last, false, claims, false, nil, nil); err != nil { |
| + if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "198.51.100.1", &last, false, src, false, nil, nil); err != nil { |
| t.Fatal(err) |
| } |
| if f := readEdgesFile(t, s, "annie"); f.EIP != "203.0.113.9" || f.PrivateIP != "10.0.1.5" || f.PrivateCIDR != "10.0.0.0/16" { |
| t.Fatalf("first publication: %+v", f) |
| } |
| - if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, false, claims, false, nil, nil); err != nil { |
| + if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, false, src, false, nil, nil); err != nil { |
| t.Fatal(err) |
| } |
| if f := readEdgesFile(t, s, "annie"); f.EIP != "" || f.PrivateIP != "10.0.1.5" { |
| @@ -177,7 +177,7 @@ func TestEdgesFilePublishesOnlyWhatTheSourceReports(t *testing.T) { |
| } |
| } |
| -// With region HA off there is no claims cache, and the publisher is |
| +// With region HA off there is no address source, and the publisher is |
| // main's: no private address, and a blank probe holds the last EIP. |
| func TestEdgesFileWithRegionHAOffKeepsTheEIPHold(t *testing.T) { |
| s, reg := release.NewDirStore(t.TempDir()), edgesTestRegistry(t) |
| @@ -265,7 +265,6 @@ func TestEnvAddressesCIDRWithoutIP(t *testing.T) { |
| func TestEdgesFileUnknownAddressesLeaveThePublishedFileStanding(t *testing.T) { |
| s, reg := release.NewDirStore(t.TempDir()), edgesTestRegistry(t) |
| seedRoute(t, reg, "app.example.com") |
| - claims := newEdgesClaims("annie", (&claimsBook{}).read) |
| src := &countingAddresses{ |
| answers: []BoxAddresses{ |
| {Private: "10.0.1.5", PrivateCIDR: "10.0.0.0/16", Public: "203.0.113.9"}, |
| @@ -274,10 +273,9 @@ func TestEdgesFileUnknownAddressesLeaveThePublishedFileStanding(t *testing.T) { |
| }, |
| unknown: map[int]bool{1: true}, |
| } |
| - claims.addrs = src |
| var last []byte |
| ident := edgesFile{Box: "annie", BoxID: "annie"} |
| - if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, false, claims, false, nil, nil); err != nil { |
| + if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, false, src, false, nil, nil); err != nil { |
| t.Fatal(err) |
| } |
| before, _, err := s.Get(context.Background(), edgesFileKey("annie")) |
| @@ -286,7 +284,7 @@ func TestEdgesFileUnknownAddressesLeaveThePublishedFileStanding(t *testing.T) { |
| } |
| lastBefore := string(last) |
| // A forced timed pass, which would rewrite an unchanged body. |
| - err = edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, true, claims, false, nil, nil) |
| + err = edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, true, src, false, nil, nil) |
| if !errors.Is(err, errBoxAddressesUnknown) { |
| t.Fatalf("unknown read: err %v, want errBoxAddressesUnknown", err) |
| } |
| @@ -301,7 +299,7 @@ func TestEdgesFileUnknownAddressesLeaveThePublishedFileStanding(t *testing.T) { |
| t.Fatalf("published file lost its addresses: %+v", f) |
| } |
| // The retry reads again and publishes what it now reports. |
| - if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, true, claims, false, nil, nil); err != nil { |
| + if err := edgesFileWriteClaims(context.Background(), s, reg, ident, "", &last, true, src, false, nil, nil); err != nil { |
| t.Fatal(err) |
| } |
| if f := readEdgesFile(t, s, "annie"); f.PrivateIP != "10.0.1.6" { |
| @@ -311,3 +309,46 @@ func TestEdgesFileUnknownAddressesLeaveThePublishedFileStanding(t *testing.T) { |
| t.Fatalf("source read %d times, want once per attempt", src.reads) |
| } |
| } |
| + |
| +// testRegistryWithInstance is a registry holding one ready, provisioned |
| +// exec instance: the relocatable host the removed claim reader used to |
| +// read a claim for. |
| +func testRegistryWithInstance(t *testing.T, host string) *registry.Registry { |
| + t.Helper() |
| + reg := edgesTestRegistry(t) |
| + if err := reg.Upsert(registry.Route{Host: host, Kind: "instance", Socket: "/run/carlos/" + host + ".sock", |
| + Provisioned: true, App: "jam", Account: "bab", Status: "ready"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + return reg |
| +} |
| + |
| +// testIdent is the identity half of box's edges file. |
| +func testIdent(box string) edgesFile { return edgesFile{Box: box, BoxID: box} } |
| + |
| +// Region HA P1a Task 1: with region HA on, the edges file takes the box's |
| +// addresses straight from the address source. No claim is read, so a |
| +// relocatable host is never withheld and the pass touches nothing in the |
| +// bucket but its own file. |
| +func TestEdgesFileRegionHAPublishesAddressWithoutClaimRead(t *testing.T) { |
| + ctx := context.Background() |
| + s := &egressCountingStore{Store: release.NewDirStore(t.TempDir())} |
| + reg := testRegistryWithInstance(t, "shop.example.com") |
| + var last []byte |
| + addrs := staticAddresses{Private: "10.0.1.5", PrivateCIDR: "10.0.0.0/16", Public: "203.0.113.9"} |
| + if err := edgesFileWriteClaims(ctx, s, reg, testIdent("box-a"), "", &last, true, addrs, false, nil, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + f := readEdgesFile(t, s, "box-a") |
| + if f.PrivateIP != "10.0.1.5" || f.EIP != "203.0.113.9" { |
| + t.Fatalf("private_ip = %q, eip = %q", f.PrivateIP, f.EIP) |
| + } |
| + if _, ok := f.Hosts["shop.example.com"]; !ok { |
| + t.Fatal("host withheld by claim filtering") |
| + } |
| + for _, r := range s.seen { |
| + if _, key, _ := strings.Cut(r, " "); key != edgesFileKey("box-a") { |
| + t.Errorf("the pass made %q: an edges file pass reads and writes only its own file", r) |
| + } |
| + } |
| +} |
diff --git a/internal/host/edgesclaims.go b/internal/host/edgesclaims.go| deleted file mode 100644 |
| index bd9c55690..000000000 |
| --- a/internal/host/edgesclaims.go |
| +++ /dev/null |
| @@ -1,291 +0,0 @@ |
| -package host |
| - |
| -import ( |
| - "context" |
| - "log" |
| - "math" |
| - "os" |
| - "sort" |
| - "time" |
| - |
| - "github.com/carlosframework/platform/internal/hostclaim" |
| - "github.com/carlosframework/platform/internal/registry" |
| -) |
| - |
| -// Region HA spec 1 §5.4: with CARLOS_REGION_HA on, a relocatable host is |
| -// published as home only by the box its claim's op.exec names, carrying |
| -// the claim's holder.stamp so the edge's home map believes the newest |
| -// installation (HA4). The edge never reads claims; this publisher does, on |
| -// a slow cache, because the safety gate is the activator's fresh read at |
| -// every spawn (claim C4), not this file. |
| - |
| -const ( |
| - // edgesClaimTTL is how long one claim read stands: reconcile's sweep |
| - // (H9). A held row's entry can be stale this long, which can only send |
| - // a request to a box that then refuses to spawn. |
| - edgesClaimTTL = 10 * time.Minute |
| - // edgesClaimReadsPerPass bounds the GETs one pass makes, so a box with |
| - // thousands of hosts spreads its reads over several passes instead of |
| - // stalling one. A host not read yet publishes as it did before this |
| - // file existed. |
| - edgesClaimReadsPerPass = 256 |
| - // edgesClaimPassEvery is how often the loop runs an extra pass while |
| - // claim reads are due. The registry timer alone (5 to 6 minutes) would |
| - // take 40 minutes to refresh 2,000 hosts at 256 a pass; with these |
| - // passes every host is re-read within about edgesClaimTTL plus four |
| - // minutes. |
| - edgesClaimPassEvery = 30 * time.Second |
| - // edgesClaimPassDeadline bounds one pass's claim reads, so a store that |
| - // stops answering cannot stall the edges file. A read the deadline cuts |
| - // short is a failed read: the host keeps its last decision. |
| - edgesClaimPassDeadline = 20 * time.Second |
| - // edgesClaimLogEvery: a run of passes with failed claim reads is logged |
| - // on its first pass and every this many after. |
| - edgesClaimLogEvery = 60 |
| -) |
| - |
| -// edgesDecision is what one claim says about this box and one host. |
| -type edgesDecision struct { |
| - withhold bool // the claim names another executor, or none |
| - stamp int64 // holder.stamp when this box is the executor |
| -} |
| - |
| -// edgesClaimEntry is one host's last decision and last read attempt. A |
| -// failed read moves attempted and keeps the decision, so a claim that |
| -// cannot be read goes to the back of the queue instead of holding its |
| -// place at the front (claim C6: an error is never absence). |
| -type edgesClaimEntry struct { |
| - decision edgesDecision |
| - decided bool // some read of this claim has succeeded |
| - attempted time.Time |
| -} |
| - |
| -// edgesClaims caches one decision per host. It is used only by the edges |
| -// file loop's goroutine. |
| -type edgesClaims struct { |
| - self string // this box's reference: the edges file's box_id |
| - read func(ctx context.Context, host string) (hostclaim.Observed, error) |
| - now func() time.Time |
| - entries map[string]edgesClaimEntry |
| - hosts []string // the relocatable hosts of the last pass |
| - // passDeadline bounds one pass's claim reads (edgesClaimPassDeadline). |
| - passDeadline time.Duration |
| - logf func(format string, a ...any) |
| - failingRun int // consecutive passes with a failed claim read |
| - // addrs is the box's own addresses, read before every publication |
| - // (region HA spec 2 §6). It rides here because this cache exists |
| - // exactly when region HA is on. |
| - addrs AddressSource |
| -} |
| - |
| -func newEdgesClaims(self string, read func(context.Context, string) (hostclaim.Observed, error)) *edgesClaims { |
| - return &edgesClaims{self: self, read: read, now: time.Now, entries: map[string]edgesClaimEntry{}, |
| - passDeadline: edgesClaimPassDeadline, logf: log.Printf, addrs: boxAddressSource(os.Getenv)} |
| -} |
| - |
| -// relocatableRow is spec 1 §2's relocatable host as a registry row shows |
| -// it: a provisioned instance whose process is the activator's own exec |
| -// child. Unit-backed, addr-backed, static and service routes keep their |
| -// box and are published as before; sidecars are never published at all. |
| -func relocatableRow(r registry.Route) bool { |
| - return r.Provisioned && r.Kind == "instance" && r.Backing == "" && r.Unit == "" && |
| - r.Addr == "" && r.Addrs == "" && r.Socket != "" |
| -} |
| - |
| -// decideClaim turns one observation into a decision. An absent claim |
| -// leaves the host as it was before claims existed: a region can only be |
| -// given a second box once every host has one (spec §8). |
| -func (c *edgesClaims) decideClaim(obs hostclaim.Observed) edgesDecision { |
| - if obs.Absent || obs.Claim == nil { |
| - return edgesDecision{} |
| - } |
| - cl := obs.Claim |
| - if cl.Holder == nil || cl.Op.Exec != c.self { |
| - return edgesDecision{withhold: true} |
| - } |
| - stamp := cl.Holder.Stamp |
| - if stamp > math.MaxInt64 { |
| - stamp = 0 |
| - } |
| - return edgesDecision{stamp: int64(stamp)} |
| -} |
| - |
| -func (c *edgesClaims) dueAt(h string, now time.Time) bool { |
| - e, ok := c.entries[h] |
| - return !ok || now.Sub(e.attempted) >= edgesClaimTTL |
| -} |
| - |
| -// backlog reports whether any host of the last pass has a read due. |
| -func (c *edgesClaims) backlog(now time.Time) bool { |
| - for _, h := range c.hosts { |
| - if c.dueAt(h, now) { |
| - return true |
| - } |
| - } |
| - return false |
| -} |
| - |
| -// decide returns a decision for each host that has one. Hosts whose last |
| -// attempt is older than edgesClaimTTL are read, never-attempted first and |
| -// then oldest attempt first, up to edgesClaimReadsPerPass. A read that |
| -// fails keeps the previous decision; a host with no successful read has |
| -// none, and publishes as before. Once ctx ends no further read is made: |
| -// the hosts not reached stay due, in their place, for a later pass. |
| -func (c *edgesClaims) decide(ctx context.Context, hosts []string) map[string]edgesDecision { |
| - now := c.now() |
| - c.hosts = append(c.hosts[:0], hosts...) |
| - want := make(map[string]bool, len(hosts)) |
| - var due []string |
| - for _, h := range hosts { |
| - want[h] = true |
| - if c.dueAt(h, now) { |
| - due = append(due, h) |
| - } |
| - } |
| - for h := range c.entries { |
| - if !want[h] { |
| - delete(c.entries, h) |
| - } |
| - } |
| - sort.Slice(due, func(i, j int) bool { |
| - ei, iok := c.entries[due[i]] |
| - ej, jok := c.entries[due[j]] |
| - if iok != jok { |
| - return !iok // never attempted first |
| - } |
| - if !ei.attempted.Equal(ej.attempted) { |
| - return ei.attempted.Before(ej.attempted) |
| - } |
| - return due[i] < due[j] |
| - }) |
| - if len(due) > edgesClaimReadsPerPass { |
| - due = due[:edgesClaimReadsPerPass] |
| - } |
| - var failed, made int |
| - var firstErr error |
| - var firstHost string |
| - for _, h := range due { |
| - if ctx.Err() != nil { |
| - break |
| - } |
| - e := c.entries[h] |
| - e.attempted = now |
| - made++ |
| - if obs, err := c.read(ctx, h); err == nil { |
| - e.decision, e.decided = c.decideClaim(obs), true |
| - } else { |
| - if failed == 0 { |
| - firstErr, firstHost = err, h |
| - } |
| - failed++ |
| - } |
| - c.entries[h] = e |
| - } |
| - c.logReads(made, failed, firstHost, firstErr) |
| - out := make(map[string]edgesDecision, len(c.entries)) |
| - for h, e := range c.entries { |
| - if e.decided { |
| - out[h] = e.decision |
| - } |
| - } |
| - return out |
| -} |
| - |
| -// logReads logs a pass's failed claim reads, throttled: the first pass of |
| -// a failing run and every edgesClaimLogEvery-th after it, then once when a |
| -// pass's reads all succeed again. |
| -func (c *edgesClaims) logReads(made, failed int, host string, err error) { |
| - if failed > 0 { |
| - c.failingRun++ |
| - if c.failingRun == 1 || c.failingRun%edgesClaimLogEvery == 0 { |
| - c.logf("agent: edges file: %d of %d claim reads failed (failing pass #%d), first %s: %v; those hosts keep their last decision", failed, made, c.failingRun, host, err) |
| - } |
| - return |
| - } |
| - if made > 0 && c.failingRun > 0 { |
| - c.logf("agent: edges file: claim reads recovered after %d failing passes", c.failingRun) |
| - c.failingRun = 0 |
| - } |
| -} |
| - |
| -// applyEdgesClaims withholds or stamps every relocatable row in hosts |
| -// (edgesFileWrite's served map, before aliases join it, so an alias of a |
| -// withheld host is withheld with it and an alias of a stamped host takes |
| -// its stamp). claims nil leaves hosts untouched. A host hostclaim.Key |
| -// rejects has no claim to read and publishes as before. The pass's reads |
| -// share one deadline, claims.passDeadline. |
| -func applyEdgesClaims(ctx context.Context, claims *edgesClaims, routes []registry.Route, hosts map[string]edgeHost) { |
| - if claims == nil { |
| - return |
| - } |
| - var reloc []string |
| - for _, r := range routes { |
| - if _, served := hosts[r.Host]; served && relocatableRow(r) { |
| - if _, err := hostclaim.Key(r.Host); err != nil { |
| - continue |
| - } |
| - reloc = append(reloc, r.Host) |
| - } |
| - } |
| - ctx, cancel := context.WithTimeout(ctx, claims.passDeadline) |
| - defer cancel() |
| - for host, d := range claims.decide(ctx, reloc) { |
| - h, ok := hosts[host] |
| - if !ok { |
| - continue |
| - } |
| - if d.withhold { |
| - delete(hosts, host) |
| - continue |
| - } |
| - h.Stamp = d.stamp |
| - hosts[host] = h |
| - } |
| -} |
| - |
| -// edgesLoopState is edgesFileLoop's per-tick decision: the registry and |
| -// timer schedule, plus, with region HA on, an extra pass every |
| -// edgesClaimPassEvery while claim reads are due. A claim pass is a |
| -// publication like any other: it waits out the schedule's retry backoff |
| -// after a failed write, and its own outcome moves that backoff, so a bucket |
| -// that refuses every write is not asked every 30 seconds (Astra plan R2-1). |
| -type edgesLoopState struct { |
| - sched *edgesFileSchedule |
| - claims *edgesClaims |
| - claimsNext time.Time |
| - schedDue bool |
| - claimDue bool |
| - assetDue bool |
| -} |
| - |
| -// due reports whether to run a pass on this tick. |
| -func (s *edgesLoopState) due(now time.Time, fp string, fpOK bool) bool { |
| - return s.dueWith(now, fp, fpOK, false) |
| -} |
| - |
| -// dueWith is due with the asset cache's own reason to publish: assetsDue is |
| -// assetPolicy.rewriteDue. Like a claim pass, an assets pass waits out the |
| -// schedule's retry backoff after a failed write and moves it with its own |
| -// outcome, and is never the timer's. |
| -func (s *edgesLoopState) dueWith(now time.Time, fp string, fpOK, assetsDue bool) bool { |
| - s.schedDue = s.sched.due(now, fp, fpOK) |
| - s.claimDue = s.claims != nil && !now.Before(s.claimsNext) && !now.Before(s.sched.retryAt) && s.claims.backlog(now) |
| - s.assetDue = assetsDue && !now.Before(s.sched.retryAt) |
| - return s.schedDue || s.claimDue || s.assetDue |
| -} |
| - |
| -// timed reports whether the pass due just allowed is the timer's. |
| -func (s *edgesLoopState) timed() bool { return s.schedDue && s.sched.timed } |
| - |
| -// done records the pass's outcome. Every pass, claim passes included, goes |
| -// through the schedule: a failure advances its backoff, and a success |
| -// clears it and records the fingerprint the pass published. A claim pass |
| -// is never the timer's (due cleared timed), so the timer does not move. |
| -func (s *edgesLoopState) done(now time.Time, ok bool) { |
| - if s.schedDue || s.claimDue || s.assetDue { |
| - s.sched.done(now, ok) |
| - } |
| - if s.claims != nil { |
| - s.claimsNext = now.Add(edgesClaimPassEvery) |
| - } |
| -} |
diff --git a/internal/host/edgesclaims_test.go b/internal/host/edgesclaims_test.go| deleted file mode 100644 |
| index bc1c22486..000000000 |
| --- a/internal/host/edgesclaims_test.go |
| +++ /dev/null |
| @@ -1,428 +0,0 @@ |
| -package host |
| - |
| -import ( |
| - "context" |
| - "encoding/json" |
| - "errors" |
| - "fmt" |
| - "testing" |
| - "time" |
| - |
| - "github.com/carlosframework/platform/internal/hostclaim" |
| - "github.com/carlosframework/platform/internal/registry" |
| - "github.com/carlosframework/platform/internal/release" |
| -) |
| - |
| -// seedInstance upserts a ready, provisioned exec instance: a relocatable |
| -// host (spec 1 §2). |
| -func seedInstance(t *testing.T, reg *registry.Registry, host string) { |
| - t.Helper() |
| - if err := reg.Upsert(registry.Route{Host: host, Kind: "instance", Socket: "/run/carlos/" + host + ".sock", |
| - Provisioned: true, App: "jam", Account: "bab", Status: "ready"}); err != nil { |
| - t.Fatal(err) |
| - } |
| -} |
| - |
| -// claimsBook answers claim reads from a map; a missing host is an absent |
| -// claim, a host in errs fails. |
| -type claimsBook struct { |
| - claims map[string]*hostclaim.Claim |
| - errs map[string]bool |
| - reads []string |
| -} |
| - |
| -func (b *claimsBook) read(_ context.Context, host string) (hostclaim.Observed, error) { |
| - b.reads = append(b.reads, host) |
| - if b.errs[host] { |
| - return hostclaim.Observed{}, errors.New("SlowDown") |
| - } |
| - c, ok := b.claims[host] |
| - if !ok { |
| - return hostclaim.Observed{Host: host, Absent: true}, nil |
| - } |
| - return hostclaim.Observed{Host: host, Claim: c, ETag: "e"}, nil |
| -} |
| - |
| -func serving(exec string, stamp uint64) *hostclaim.Claim { |
| - return &hostclaim.Claim{V: 2, Gen: 7, Holder: &hostclaim.Holder{Stamp: stamp}, |
| - Op: hostclaim.Op{Kind: hostclaim.KindServing, ID: "op-1", Exec: exec}} |
| -} |
| - |
| -func publishWithClaims(t *testing.T, reg *registry.Registry, claims *edgesClaims) map[string]edgeHost { |
| - t.Helper() |
| - // These tests are about the hosts; the box's addresses come from a |
| - // fixed source, never from IMDS. nil claims is region HA off. |
| - if claims != nil { |
| - claims.addrs = staticAddresses{Public: "1.2.3.4"} |
| - } |
| - st := release.NewDirStore(t.TempDir()) |
| - var last []byte |
| - if err := edgesFileWriteClaims(context.Background(), st, reg, edgesFile{Box: "annie", BoxID: "annie"}, "1.2.3.4", &last, false, claims, false, nil, nil); err != nil { |
| - t.Fatal(err) |
| - } |
| - body, _, err := st.Get(context.Background(), edgesFileKey("annie")) |
| - if err != nil { |
| - t.Fatal(err) |
| - } |
| - var f edgesFile |
| - if err := json.Unmarshal(body, &f); err != nil { |
| - t.Fatal(err) |
| - } |
| - return f.Hosts |
| -} |
| - |
| -func TestEdgesFileFollowsTheClaimsExecutor(t *testing.T) { |
| - reg := edgesTestRegistry(t) |
| - for _, h := range []string{"mine.bab.test", "theirs.bab.test", "between.bab.test", "unclaimed.bab.test"} { |
| - seedInstance(t, reg, h) |
| - } |
| - seedRoute(t, reg, "static.example.com") // not relocatable: never read, always home |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{ |
| - "mine.bab.test": serving("annie", 41), |
| - "theirs.bab.test": serving("bert", 42), |
| - "between.bab.test": serving("", 43), // op.exec none: nobody serves it |
| - }} |
| - hosts := publishWithClaims(t, reg, newEdgesClaims("annie", book.read)) |
| - if h, ok := hosts["mine.bab.test"]; !ok || h.Stamp != 41 || h.Role != "home" { |
| - t.Fatalf("executor's host = %+v, %v; want home stamped 41", h, ok) |
| - } |
| - for _, h := range []string{"theirs.bab.test", "between.bab.test"} { |
| - if _, ok := hosts[h]; ok { |
| - t.Errorf("%s published by a box its claim does not name", h) |
| - } |
| - } |
| - if h, ok := hosts["unclaimed.bab.test"]; !ok || h.Stamp != 0 { |
| - t.Errorf("a host with no claim = %+v, %v; want home, unstamped, as before", h, ok) |
| - } |
| - if h, ok := hosts["static.example.com"]; !ok || h.Stamp != 0 { |
| - t.Errorf("a service route = %+v, %v; want home, unstamped", h, ok) |
| - } |
| - for _, r := range book.reads { |
| - if r == "static.example.com" { |
| - t.Error("read a claim for a route that is not relocatable") |
| - } |
| - } |
| -} |
| - |
| -func TestEdgesFileWithholdsTheAliasOfAWithheldHost(t *testing.T) { |
| - reg := edgesTestRegistry(t) |
| - seedInstance(t, reg, "theirs.bab.test") |
| - if err := reg.UpsertAlias(registry.RouteAlias{Alias: "www.customer.com", Host: "theirs.bab.test", Account: "bab", App: "jam", DNSStatus: "pointing"}); err != nil { |
| - t.Fatal(err) |
| - } |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"theirs.bab.test": serving("bert", 42)}} |
| - hosts := publishWithClaims(t, reg, newEdgesClaims("annie", book.read)) |
| - if len(hosts) != 0 { |
| - t.Fatalf("hosts = %v, want none", hosts) |
| - } |
| -} |
| - |
| -// Review Focus 2: a claim that cannot be read never moves a host. It keeps |
| -// the last decision, or, never read, publishes as it did before claims. |
| -func TestEdgesFileKeepsTheLastDecisionWhenAClaimCannotBeRead(t *testing.T) { |
| - reg := edgesTestRegistry(t) |
| - seedInstance(t, reg, "mine.bab.test") |
| - seedInstance(t, reg, "theirs.bab.test") |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"mine.bab.test": serving("annie", 41), "theirs.bab.test": serving("bert", 42)}} |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - claims := newEdgesClaims("annie", book.read) |
| - claims.now = func() time.Time { return clock } |
| - publishWithClaims(t, reg, claims) |
| - clock = clock.Add(edgesClaimTTL) |
| - book.errs = map[string]bool{"mine.bab.test": true, "theirs.bab.test": true} |
| - hosts := publishWithClaims(t, reg, claims) |
| - if h, ok := hosts["mine.bab.test"]; !ok || h.Stamp != 41 { |
| - t.Fatalf("mine = %+v, %v: an unreadable claim dropped or unstamped a served host", h, ok) |
| - } |
| - if _, ok := hosts["theirs.bab.test"]; ok { |
| - t.Fatal("an unreadable claim published a host this box was told not to") |
| - } |
| - |
| - fresh := newEdgesClaims("annie", book.read) |
| - if h, ok := publishWithClaims(t, reg, fresh)["mine.bab.test"]; !ok || h.Stamp != 0 { |
| - t.Fatalf("never read = %+v, %v; want home, unstamped", h, ok) |
| - } |
| -} |
| - |
| -func TestEdgesClaimsRereadOnlyAfterTheTTL(t *testing.T) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"mine.bab.test": serving("annie", 41)}} |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - c := newEdgesClaims("annie", book.read) |
| - c.now = func() time.Time { return clock } |
| - ctx := context.Background() |
| - c.decide(ctx, []string{"mine.bab.test"}) |
| - clock = clock.Add(edgesClaimTTL - time.Second) |
| - c.decide(ctx, []string{"mine.bab.test"}) |
| - if len(book.reads) != 1 { |
| - t.Fatalf("%d reads inside the TTL, want 1", len(book.reads)) |
| - } |
| - book.claims["mine.bab.test"] = serving("bert", 50) |
| - clock = clock.Add(time.Second) |
| - if d := c.decide(ctx, []string{"mine.bab.test"})["mine.bab.test"]; !d.withhold { |
| - t.Fatalf("decision after the TTL = %+v; the move to another box was not seen", d) |
| - } |
| - c.decide(ctx, nil) |
| - if len(c.entries) != 0 { |
| - t.Fatalf("a host no longer served kept its entry: %v", c.entries) |
| - } |
| -} |
| - |
| -func TestEdgesClaimsBoundReadsPerPassNeverReadFirst(t *testing.T) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{}} |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - c := newEdgesClaims("annie", book.read) |
| - c.now = func() time.Time { return clock } |
| - var hosts []string |
| - for i := 0; i < edgesClaimReadsPerPass+10; i++ { |
| - hosts = append(hosts, fmt.Sprintf("h%04d.bab.test", i)) |
| - } |
| - ctx := context.Background() |
| - c.decide(ctx, hosts) |
| - if len(book.reads) != edgesClaimReadsPerPass { |
| - t.Fatalf("first pass read %d claims, want %d", len(book.reads), edgesClaimReadsPerPass) |
| - } |
| - book.reads = nil |
| - c.decide(ctx, hosts) |
| - if len(book.reads) != 10 { |
| - t.Fatalf("second pass read %d claims, want the 10 never read", len(book.reads)) |
| - } |
| -} |
| - |
| -// Astra plan R1-2: an alias and a served catch-all are dialled through |
| -// their primary's installation, so they carry its stamp. Unstamped, a dead |
| -// predecessor's alias would tie with the successor's and the edge would |
| -// keep the first box by name. |
| -func TestEdgesFileStampsAliasesAndCatchAllsWithTheirPrimary(t *testing.T) { |
| - reg := edgesTestRegistry(t) |
| - seedInstance(t, reg, "mine.bab.test") |
| - for _, a := range []registry.RouteAlias{ |
| - {Alias: "www.customer.com", Host: "mine.bab.test", Account: "bab", App: "jam", DNSStatus: "pointing"}, |
| - {Alias: "*.customer.com", Host: "mine.bab.test", Account: "bab", App: "jam", DNSStatus: "pointing"}, |
| - } { |
| - if err := reg.UpsertAlias(a); err != nil { |
| - t.Fatal(err) |
| - } |
| - } |
| - if err := reg.UpsertWildcardDomain(registry.WildcardDomain{Host: "customer.com", Account: "bab", App: "jam"}); err != nil { |
| - t.Fatal(err) |
| - } |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"mine.bab.test": serving("annie", 57)}} |
| - hosts := publishWithClaims(t, reg, newEdgesClaims("annie", book.read)) |
| - for _, key := range []string{"mine.bab.test", "www.customer.com", "*.customer.com"} { |
| - if h, ok := hosts[key]; !ok || h.Stamp != 57 || h.Role != "home" { |
| - t.Errorf("%s = %+v, %v; want home at stamp 57", key, h, ok) |
| - } |
| - } |
| - // With no claim reader the file is what it always was: no stamps. |
| - for key, h := range publishWithClaims(t, reg, nil) { |
| - if h.Stamp != 0 { |
| - t.Errorf("%s stamped %d with region HA off", key, h.Stamp) |
| - } |
| - } |
| -} |
| - |
| -// Astra plan R1-4: claims that keep failing go to the back of the queue, |
| -// so they cannot hold every read of every pass. |
| -func TestEdgesClaimsAFailingClaimDoesNotStarveTheRest(t *testing.T) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"zz-healthy.bab.test": serving("annie", 7)}, errs: map[string]bool{}} |
| - var hosts []string |
| - for i := 0; i < edgesClaimReadsPerPass; i++ { |
| - h := fmt.Sprintf("a%04d.bab.test", i) |
| - book.errs[h] = true |
| - hosts = append(hosts, h) |
| - } |
| - hosts = append(hosts, "zz-healthy.bab.test") |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - c := newEdgesClaims("annie", book.read) |
| - c.now = func() time.Time { return clock } |
| - ctx := context.Background() |
| - c.decide(ctx, hosts) // the 256 failing claims sort first and all fail |
| - clock = clock.Add(edgesClaimPassEvery) |
| - if d, ok := c.decide(ctx, hosts)["zz-healthy.bab.test"]; !ok || d.stamp != 7 { |
| - t.Fatalf("healthy claim = %+v, %v: starved by claims that cannot be read", d, ok) |
| - } |
| -} |
| - |
| -// Astra plan R1-5: the loop's own schedule, with a stable registry, keeps |
| -// every claim of a 2,000-host box fresh. Timer passes alone come every |
| -// five to six minutes and read 256 claims each. |
| -func TestEdgesLoopRefreshesEveryClaimWithinTheTTL(t *testing.T) { |
| - t.Parallel() |
| - const n = 2000 |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{}} |
| - var hosts []string |
| - for i := 0; i < n; i++ { |
| - h := fmt.Sprintf("h%04d.bab.test", i) |
| - book.claims[h] = serving("annie", uint64(i+1)) |
| - hosts = append(hosts, h) |
| - } |
| - start := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - clock := start |
| - claims := newEdgesClaims("annie", book.read) |
| - claims.now = func() time.Time { return clock } |
| - state := &edgesLoopState{sched: newEdgesFileSchedule(start, func() time.Duration { return 5*time.Minute + 30*time.Second }), claims: claims} |
| - lastRead := map[string]time.Time{} |
| - worst := time.Duration(0) |
| - for clock = start; clock.Before(start.Add(3 * time.Hour)); clock = clock.Add(edgesFileWatchInterval) { |
| - if !state.due(clock, "fp", true) { |
| - continue |
| - } |
| - book.reads = nil |
| - claims.decide(context.Background(), hosts) |
| - for _, h := range book.reads { |
| - lastRead[h] = clock |
| - } |
| - state.done(clock, true) |
| - if clock.Sub(start) < time.Hour { |
| - continue // warm-up: the first reads of every host |
| - } |
| - for _, h := range hosts { |
| - if age := clock.Sub(lastRead[h]); age > worst { |
| - worst = age |
| - } |
| - } |
| - } |
| - if limit := edgesClaimTTL + 5*time.Minute; worst > limit { |
| - t.Fatalf("a claim went %s without a read, want at most %s", worst, limit) |
| - } |
| -} |
| - |
| -// Astra plan R2-1: a claim pass is a publication. While the bucket refuses |
| -// every write, claim passes wait out the schedule's backoff and their own |
| -// failures move it; once writes succeed, the 30-second claim passes resume. |
| -func TestEdgesLoopClaimPassesObeyTheRetryBackoff(t *testing.T) { |
| - t.Parallel() |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{}} |
| - var hosts []string |
| - for i := 0; i < 4000; i++ { // enough that reads stay due throughout |
| - h := fmt.Sprintf("h%04d.bab.test", i) |
| - book.claims[h] = serving("annie", 1) |
| - hosts = append(hosts, h) |
| - } |
| - start := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - clock := start |
| - claims := newEdgesClaims("annie", book.read) |
| - claims.now = func() time.Time { return clock } |
| - state := &edgesLoopState{sched: newEdgesFileSchedule(start, func() time.Duration { return 5*time.Minute + 30*time.Second }), claims: claims} |
| - failUntil := start.Add(20 * time.Minute) |
| - var during, after []time.Time |
| - for clock = start; clock.Before(failUntil.Add(8 * time.Minute)); clock = clock.Add(edgesFileWatchInterval) { |
| - if !state.due(clock, "fp", true) { |
| - continue |
| - } |
| - claims.decide(context.Background(), hosts) |
| - ok := !clock.Before(failUntil) |
| - if ok { |
| - after = append(after, clock) |
| - } else { |
| - during = append(during, clock) |
| - } |
| - state.done(clock, ok) |
| - } |
| - // Unthrottled, a claim pass every 30 seconds would be 40 attempts in |
| - // 20 minutes. The backoff (2 s doubling to 5 min) plus the timer allows |
| - // about a dozen. |
| - t.Logf("%d attempts while failing, %d after", len(during), len(after)) |
| - if len(during) > 16 { |
| - t.Fatalf("%d publication attempts while every write failed, want at most 16: %v", len(during), during) |
| - } |
| - // Recovery waits out the backoff (at most five minutes), then the |
| - // 30-second claim passes resume. |
| - if len(after) < 3 || after[len(after)-1].Sub(after[len(after)-2]) != edgesClaimPassEvery { |
| - t.Fatalf("passes after writes recovered = %v, want the 30-second claim passes back within eight minutes", after) |
| - } |
| -} |
| - |
| -// Final review 4: a store that never answers cannot stall the edges file. |
| -// The pass has a deadline; a read it cuts short keeps the last decision as |
| -// any failed read does, and the reads not yet made wait for a later pass. |
| -func TestEdgesClaimsPassHasADeadline(t *testing.T) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"mine.bab.test": serving("annie", 41), "theirs.bab.test": serving("bert", 42)}} |
| - hang := false |
| - read := func(ctx context.Context, host string) (hostclaim.Observed, error) { |
| - if hang { |
| - select { // a Get that blocks until the context ends |
| - case <-ctx.Done(): |
| - return hostclaim.Observed{}, ctx.Err() |
| - case <-time.After(2 * time.Second): // so a missing deadline fails rather than hangs |
| - return hostclaim.Observed{}, errors.New("no deadline") |
| - } |
| - } |
| - return book.read(ctx, host) |
| - } |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - c := newEdgesClaims("annie", read) |
| - c.now = func() time.Time { return clock } |
| - c.passDeadline = 100 * time.Millisecond |
| - c.logf = func(string, ...any) {} |
| - routes := []registry.Route{ |
| - {Host: "mine.bab.test", Kind: "instance", Socket: "/run/carlos/mine.sock", Provisioned: true}, |
| - {Host: "theirs.bab.test", Kind: "instance", Socket: "/run/carlos/theirs.sock", Provisioned: true}, |
| - } |
| - served := func() map[string]edgeHost { |
| - return map[string]edgeHost{"mine.bab.test": {Role: "home"}, "theirs.bab.test": {Role: "home"}} |
| - } |
| - applyEdgesClaims(context.Background(), c, routes, served()) |
| - clock = clock.Add(edgesClaimTTL) |
| - hang = true |
| - hosts := served() |
| - start := time.Now() |
| - applyEdgesClaims(context.Background(), c, routes, hosts) |
| - if took := time.Since(start); took > time.Second { |
| - t.Fatalf("the pass took %s against a store that never answers, want about its 100ms deadline", took) |
| - } |
| - if h, ok := hosts["mine.bab.test"]; !ok || h.Stamp != 41 { |
| - t.Fatalf("mine = %+v, %v: a read cut short by the deadline moved a served host", h, ok) |
| - } |
| - if _, ok := hosts["theirs.bab.test"]; ok { |
| - t.Fatal("a read cut short by the deadline published a host this box was told not to") |
| - } |
| - if d := newEdgesClaims("annie", read).passDeadline; d != 20*time.Second { |
| - t.Fatalf("the default pass deadline is %s, want 20s", d) |
| - } |
| -} |
| - |
| -// Final review 4: a host hostclaim.Key rejects is never read; it publishes |
| -// as it did before claims. |
| -func TestEdgesClaimsNeverReadAHostKeyRejects(t *testing.T) { |
| - const bad = "under_score.bab.test" |
| - if _, err := hostclaim.Key(bad); err == nil { |
| - t.Fatalf("hostclaim.Key accepts %q; the test needs a host it rejects", bad) |
| - } |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{bad: serving("bert", 42)}} |
| - c := newEdgesClaims("annie", book.read) |
| - routes := []registry.Route{{Host: bad, Kind: "instance", Socket: "/run/carlos/x.sock", Provisioned: true}} |
| - hosts := map[string]edgeHost{bad: {Role: "home"}} |
| - applyEdgesClaims(context.Background(), c, routes, hosts) |
| - if len(book.reads) != 0 { |
| - t.Fatalf("read claims for %v", book.reads) |
| - } |
| - if h, ok := hosts[bad]; !ok || h.Stamp != 0 { |
| - t.Fatalf("%s = %+v, %v; want home, unstamped, as before", bad, h, ok) |
| - } |
| -} |
| - |
| -// Final review 4: claim read failures are logged on the first failing |
| -// pass and every 60th after it, and once when reads recover. |
| -func TestEdgesClaimsLogReadFailuresThrottled(t *testing.T) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{}, errs: map[string]bool{"a.bab.test": true}} |
| - clock := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| - c := newEdgesClaims("annie", book.read) |
| - c.now = func() time.Time { return clock } |
| - var lines []string |
| - c.logf = func(format string, a ...any) { lines = append(lines, fmt.Sprintf(format, a...)) } |
| - for i := 0; i < 120; i++ { |
| - c.decide(context.Background(), []string{"a.bab.test"}) |
| - clock = clock.Add(edgesClaimTTL) |
| - } |
| - if len(lines) != 3 { // passes 1, 60 and 120 |
| - t.Fatalf("%d lines for 120 failing passes, want 3: %q", len(lines), lines) |
| - } |
| - book.errs = nil |
| - c.decide(context.Background(), []string{"a.bab.test"}) |
| - clock = clock.Add(edgesClaimTTL) |
| - c.decide(context.Background(), []string{"a.bab.test"}) |
| - if len(lines) != 4 { |
| - t.Fatalf("lines after recovery = %q, want one recovery line", lines) |
| - } |
| -} |
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go| index 5af30612b..fe5d022f7 100644 |
| --- a/internal/host/edgesfile.go |
| +++ b/internal/host/edgesfile.go |
| @@ -16,7 +16,6 @@ import ( |
| "time" |
| "github.com/carlosframework/platform/internal/appconfig" |
| - "github.com/carlosframework/platform/internal/hostclaim" |
| "github.com/carlosframework/platform/internal/instancectl" |
| "github.com/carlosframework/platform/internal/registry" |
| "github.com/carlosframework/platform/internal/release" |
| @@ -503,10 +502,11 @@ func boxAddrs(read func() ([]netip.Prefix, error)) []string { |
| // not tell what this box holds (region HA on). Nothing has been written. |
| var errBoxAddressesUnknown = errors.New("edges file: the box's addresses could not be read") |
| -// edgesFileWriteClaims is edgesFileWrite with the claim reader region HA |
| -// adds (edgesclaims.go), the lifetimes switch, the asset-cache policy and |
| -// the box-address reader. claims is nil unless CARLOS_REGION_HA is on, and |
| -// nil publishes exactly what edgesFileWrite always has. lifetimes is the |
| +// edgesFileWriteClaims is edgesFileWrite with the box's address source |
| +// region HA adds, the lifetimes switch, the asset-cache policy and the |
| +// local-address reader. addrs is nil unless CARLOS_REGION_HA is on, and nil |
| +// publishes exactly what edgesFileWrite always has. No host claim is read: |
| +// every served row publishes as it would with region HA off. lifetimes is the |
| // box's own lifetimes switch (host claims off, the same reading that builds |
| // the box judge, newBoxJudge): on, every served row publishes its lifetime |
| // pair and every alias and served catch-all its primary's; off, no entry |
| @@ -518,7 +518,7 @@ var errBoxAddressesUnknown = errors.New("edges file: the box's addresses could n |
| // |
| // localAddrs is read on every pass for Addrs (boxAddrs); the loop passes |
| // instancectl.LocalAddresses, and tests their own. |
| -func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Registry, ident edgesFile, eip string, last *[]byte, refresh bool, claims *edgesClaims, lifetimes bool, assets *assetPolicy, localAddrs func() ([]netip.Prefix, error)) error { |
| +func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Registry, ident edgesFile, eip string, last *[]byte, refresh bool, addrs AddressSource, lifetimes bool, assets *assetPolicy, localAddrs func() ([]netip.Prefix, error)) error { |
| box := ident.Box |
| // The authority clocks are copied before any registry read (see |
| // assetClocks): the rows read below are then at least as new as the |
| @@ -586,10 +586,6 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re |
| } |
| hosts[r.Host] = h |
| } |
| - // Region HA (spec 1 §5.4): a relocatable host is home only on the box |
| - // its claim names, stamped with the installation. Before owners and |
| - // aliases, so an alias of a withheld host is withheld with it. |
| - applyEdgesClaims(ctx, claims, routes, hosts) |
| // Owners (#175 P7): computed over the served rows alone, before any alias |
| // or catch-all joins the map, so an alias can only ever inherit a route's. |
| paths, err := reg.ListPaths() |
| @@ -760,7 +756,7 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re |
| } |
| // Asset-cache blocks (edge asset cache design §3.3, §4.1), last, over the |
| - // finished map: a host the claims withheld, an alias not yet pointing and |
| + // finished map: an alias not yet pointing and |
| // a catch-all key are not in it, or are refused by the rule. An alias |
| // takes its primary's block and at. The manifest cache keeps only the |
| // builds the local routes reference, pruned whatever this pass decides. |
| @@ -797,7 +793,7 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re |
| } |
| var private BoxAddresses |
| - if claims != nil && claims.addrs != nil { |
| + if addrs != nil { |
| // Region HA spec 2 §6 (A1-12): publish only what the box's address |
| // source reports now. An authoritative blank publishes no address, |
| // never the last one: that may be the region's EIP, which the load |
| @@ -805,7 +801,7 @@ func edgesFileWriteClaims(ctx context.Context, s release.Store, reg *registry.Re |
| // writes nothing: the previous file stands and the loop retries, |
| // so one failed request does not hide a healthy box from its |
| // readers. |
| - read, ok := claims.addrs.BoxAddresses() |
| + read, ok := addrs.BoxAddresses() |
| if !ok { |
| return errBoxAddressesUnknown |
| } |
| @@ -1049,13 +1045,12 @@ func edgesFileLoop(reg *registry.Registry, lifetimes bool, sb servingBuild) { |
| // The local floor files this file publishes are refreshed hourly by |
| // their own loop, on this loop's store handle (moves spec §11). |
| go movesFloorLoop(ctx, store, dataDir) |
| - // Region HA reads each relocatable host's claim (spec 1 §5.4); off, the |
| - // file is exactly what it always was. |
| - var claims *edgesClaims |
| + // Region HA publishes the box's own addresses, read afresh before every |
| + // publication (region HA spec 2 §6); off, the file is exactly what it |
| + // always was. |
| + var addrs AddressSource |
| if regionHAEnabled(os.Getenv) { |
| - claims = newEdgesClaims(box, func(ctx context.Context, host string) (hostclaim.Observed, error) { |
| - return hostclaim.Read(ctx, store, host) |
| - }) |
| + addrs = boxAddressSource(os.Getenv) |
| } |
| // The asset cache's publication (design §4.1): nil, and so nothing at |
| // all, unless the box is armed. The manifests are read from this loop's |
| @@ -1069,7 +1064,7 @@ func edgesFileLoop(reg *registry.Registry, lifetimes bool, sb servingBuild) { |
| sched := newEdgesFileSchedule(time.Now(), func() time.Duration { |
| return 5*time.Minute + rand.N(time.Minute) |
| }) |
| - state := &edgesLoopState{sched: sched, claims: claims} |
| + state := &edgesLoopState{sched: sched} |
| tick := time.NewTicker(edgesFileWatchInterval) |
| defer tick.Stop() |
| fpErrs, passErrs := 0, 0 |
| @@ -1104,7 +1099,7 @@ func edgesFileLoop(reg *registry.Registry, lifetimes bool, sb servingBuild) { |
| ident.Headroom = headroomFor(headroomCapabilities(ident.Capabilities), dataDir, reg) |
| ident = withMovesFields(ident, dataDir, optDir) |
| ident = withSeedsFields(ident, dataDir, optDir) |
| - err = edgesFileWriteClaims(ctx, store, reg, ident, eip, &last, state.timed(), claims, lifetimes, assets, instancectl.LocalAddresses) |
| + err = edgesFileWriteClaims(ctx, store, reg, ident, eip, &last, state.timed(), addrs, lifetimes, assets, instancectl.LocalAddresses) |
| if err != nil { |
| // Throttled: a bucket that refuses every write (an IAM Deny, an |
| // outage) is retried on a backoff, and each retry must not be a |
diff --git a/internal/host/edgesfile_test.go b/internal/host/edgesfile_test.go| index c79e6950f..9d4ec950f 100644 |
| --- a/internal/host/edgesfile_test.go |
| +++ b/internal/host/edgesfile_test.go |
| @@ -24,7 +24,6 @@ import ( |
| "github.com/carlosframework/platform/internal/appconfig" |
| "github.com/carlosframework/platform/internal/edge" |
| "github.com/carlosframework/platform/internal/edgesfile" |
| - "github.com/carlosframework/platform/internal/hostclaim" |
| "github.com/carlosframework/platform/internal/moves" |
| "github.com/carlosframework/platform/internal/registry" |
| "github.com/carlosframework/platform/internal/release" |
| @@ -1856,16 +1855,12 @@ func lifetimeRow(t *testing.T, reg *registry.Registry, host string, inc, seq uin |
| } |
| // publishLifetimes runs the real writer once as box and returns the raw |
| -// body and its hosts. claims nil is region HA off; lifetimes is the |
| -// box-side lifetimes switch. |
| -func publishLifetimes(t *testing.T, reg *registry.Registry, box string, claims *edgesClaims, lifetimes bool) ([]byte, map[string]edgeHost) { |
| +// body and its hosts. lifetimes is the box-side lifetimes switch. |
| +func publishLifetimes(t *testing.T, reg *registry.Registry, box string, lifetimes bool) ([]byte, map[string]edgeHost) { |
| t.Helper() |
| - if claims != nil { |
| - claims.addrs = staticAddresses{Public: "1.2.3.4"} |
| - } |
| st := release.NewDirStore(t.TempDir()) |
| var last []byte |
| - if err := edgesFileWriteClaims(context.Background(), st, reg, edgesFile{Box: box, BoxID: box}, "1.2.3.4", &last, false, claims, lifetimes, nil, nil); err != nil { |
| + if err := edgesFileWriteClaims(context.Background(), st, reg, edgesFile{Box: box, BoxID: box}, "1.2.3.4", &last, false, nil, lifetimes, nil, nil); err != nil { |
| t.Fatal(err) |
| } |
| body, _, err := st.Get(context.Background(), edgesFileKey(box)) |
| @@ -1920,7 +1915,7 @@ func wantEntry(t *testing.T, why string, hosts map[string]edgeHost, key string, |
| func TestEdgesFilePublishesThePairAndTargetHost(t *testing.T) { |
| reg := pairRegistry(t) |
| - body, hosts := publishLifetimes(t, reg, "annie", nil, true) |
| + body, hosts := publishLifetimes(t, reg, "annie", true) |
| wantEntry(t, "the row", hosts, "shop.example.com", 2, 3, "") |
| if h := wantEntry(t, "the alias", hosts, "www.shop.example.net", 2, 3, "shop.example.com"); !h.Alias { |
| t.Errorf("alias entry = %+v, want marked alias", h) |
| @@ -1940,85 +1935,37 @@ func TestEdgesFilePublishesThePairAndTargetHost(t *testing.T) { |
| func TestLifetimesOffWriterPublishesNoPair(t *testing.T) { |
| reg := pairRegistry(t) |
| - for _, ha := range []bool{false, true} { |
| - var claims *edgesClaims |
| - var stamp int64 |
| - if ha { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{"shop.example.com": serving("annie", 41)}} |
| - claims, stamp = newEdgesClaims("annie", book.read), 41 |
| - } |
| - why := fmt.Sprintf("region HA %v", ha) |
| - body, hosts := publishLifetimes(t, reg, "annie", claims, false) |
| - for _, key := range []string{"shop.example.com", "www.shop.example.net", "*.shop.example.net"} { |
| - if h := hosts[key]; h.Stamp != stamp { |
| - t.Errorf("%s: %s stamp %d, want %d", why, key, h.Stamp, stamp) |
| - } |
| - } |
| - wantEntry(t, why, hosts, "shop.example.com", 0, 0, "") |
| - wantEntry(t, why, hosts, "www.shop.example.net", 0, 0, "shop.example.com") |
| - wantEntry(t, why, hosts, "*.shop.example.net", 0, 0, "shop.example.com") |
| - wantEntry(t, why, hosts, "*.certonly.example.net", 0, 0, "") |
| - for _, s := range []string{"incarnation", "serving_seq"} { |
| - if bytes.Contains(body, []byte(s)) { |
| - t.Errorf("%s: a lifetimes-off body carries %s:\n%s", why, s, body) |
| - } |
| - } |
| - if !bytes.Contains(body, []byte(`"target_host":"shop.example.com"`)) { |
| - t.Errorf("%s: a lifetimes-off body lacks target_host:\n%s", why, body) |
| + body, hosts := publishLifetimes(t, reg, "annie", false) |
| + for _, key := range []string{"shop.example.com", "www.shop.example.net", "*.shop.example.net"} { |
| + if h := hosts[key]; h.Stamp != 0 { |
| + t.Errorf("%s stamp %d, want 0", key, h.Stamp) |
| } |
| } |
| -} |
| - |
| -// claimRead is how one pass's claim read for the host went. |
| -type claimRead int |
| - |
| -const ( |
| - readHAOff claimRead = iota // region HA off: no claim reader at all |
| - readPositive // the claim names this box: stamped |
| - readAbsent // no claim object |
| - readFailed // the read errored, and never succeeded before |
| - readUndecided // the pass's deadline came before the read |
| -) |
| - |
| -func (r claimRead) String() string { |
| - return [...]string{"ha-off", "positive", "absent", "failed", "undecided"}[r] |
| -} |
| - |
| -// claimsFor builds the region HA claim reader for one claim state, with |
| -// box as this box and stamp as its claim's holder stamp. |
| -func claimsFor(r claimRead, box, host string, stamp uint64) (*edgesClaims, *claimsBook) { |
| - book := &claimsBook{claims: map[string]*hostclaim.Claim{}} |
| - switch r { |
| - case readHAOff: |
| - return nil, book |
| - case readPositive, readUndecided: |
| - book.claims[host] = serving(box, stamp) |
| - case readFailed: |
| - book.errs = map[string]bool{host: true} |
| + wantEntry(t, "lifetimes off", hosts, "shop.example.com", 0, 0, "") |
| + wantEntry(t, "lifetimes off", hosts, "www.shop.example.net", 0, 0, "shop.example.com") |
| + wantEntry(t, "lifetimes off", hosts, "*.shop.example.net", 0, 0, "shop.example.com") |
| + wantEntry(t, "lifetimes off", hosts, "*.certonly.example.net", 0, 0, "") |
| + for _, s := range []string{"incarnation", "serving_seq"} { |
| + if bytes.Contains(body, []byte(s)) { |
| + t.Errorf("a lifetimes-off body carries %s:\n%s", s, body) |
| + } |
| } |
| - c := newEdgesClaims(box, book.read) |
| - c.logf = func(string, ...any) {} // a failed read logs; not this test's business |
| - if r == readUndecided { |
| - c.passDeadline = 0 // expired before the first read: no decision |
| + if !bytes.Contains(body, []byte(`"target_host":"shop.example.com"`)) { |
| + t.Errorf("a lifetimes-off body lacks target_host:\n%s", body) |
| } |
| - return c, book |
| } |
| -// publication is one writer configuration and the stamp and pair it must |
| -// publish for the host. |
| +// publication is one writer configuration and the pair it must publish for |
| +// the host. No writer stamps: the claim reader that did is gone (region HA |
| +// P1a Task 1), so every entry is unstamped. |
| type publication struct { |
| lifetimes bool |
| - read claimRead |
| row registry.Pair |
| - // claimStamp is the holder stamp of the claim this box would read |
| - // (positive and undecided reads); stamp is what it must publish. |
| - claimStamp uint64 |
| - stamp int64 |
| - pair registry.Pair |
| + pair registry.Pair |
| } |
| func (p publication) String() string { |
| - return fmt.Sprintf("lifetimes=%v read=%s row=(%d, %d) claim stamp %d", p.lifetimes, p.read, p.row.Incarnation, p.row.ServingSeq, p.claimStamp) |
| + return fmt.Sprintf("lifetimes=%v row=(%d, %d)", p.lifetimes, p.row.Incarnation, p.row.ServingSeq) |
| } |
| func pairLess(a, b registry.Pair) bool { |
| @@ -2028,16 +1975,13 @@ func pairLess(a, b registry.Pair) bool { |
| return a.ServingSeq < b.ServingSeq |
| } |
| -// mixedHistory is the brief's mixed-history statement: whether the |
| -// earlier file's publication keeps the dial, and the clause that says so. |
| +// mixedHistory is the brief's mixed-history statement, unstamped: whether |
| +// the earlier file's publication keeps the dial, and the clause that says |
| +// so. |
| func mixedHistory(first, second publication) (bool, string) { |
| switch { |
| - case first.stamp > 0 && second.stamp > 0: |
| - return first.stamp >= second.stamp, "two stamped publications fold as today" |
| - case first.stamp > 0 || second.stamp > 0: |
| - return first.stamp > 0, "a stamped publication beats any unstamped entry whatever its pair" |
| case first.pair == second.pair: |
| - return true, "equal pairs (two unstamped claims-on (0, 0) among them) fold as today" |
| + return true, "equal pairs fold as today" |
| case first.pair == (registry.Pair{}) || second.pair == (registry.Pair{}): |
| return second.pair == (registry.Pair{}), "an unstamped (0, 0) loses to a retained publication carrying a pair" |
| default: |
| @@ -2045,9 +1989,8 @@ func mixedHistory(first, second publication) (bool, string) { |
| } |
| } |
| -func TestPublicationUnderEveryClaimState(t *testing.T) { |
| +func TestPublicationUnderEveryLifetimesState(t *testing.T) { |
| const host = "shop.example.com" |
| - reads := []claimRead{readHAOff, readPositive, readAbsent, readFailed, readUndecided} |
| regs := map[registry.Pair]*registry.Registry{} |
| regFor := func(p registry.Pair) *registry.Registry { |
| if regs[p] == nil { |
| @@ -2057,44 +2000,35 @@ func TestPublicationUnderEveryClaimState(t *testing.T) { |
| return regs[p] |
| } |
| // publish runs the real writer as box under p and checks what it |
| - // published against p's stamp and pair. |
| + // published against p's pair. |
| publish := func(p publication, box string) []byte { |
| t.Helper() |
| - claims, book := claimsFor(p.read, box, host, p.claimStamp) |
| - body, hosts := publishLifetimes(t, regFor(p.row), box, claims, p.lifetimes) |
| + body, hosts := publishLifetimes(t, regFor(p.row), box, p.lifetimes) |
| h, ok := hosts[host] |
| if !ok { |
| t.Fatalf("%s as %s: host not published", p, box) |
| } |
| - if h.Stamp != p.stamp || h.Incarnation != p.pair.Incarnation || h.ServingSeq != p.pair.ServingSeq { |
| - t.Errorf("%s as %s: published stamp %d pair (%d, %d), want stamp %d pair (%d, %d)", |
| - p, box, h.Stamp, h.Incarnation, h.ServingSeq, p.stamp, p.pair.Incarnation, p.pair.ServingSeq) |
| - } |
| - if p.read == readUndecided && len(book.reads) != 0 { |
| - t.Errorf("%s: an undecided pass read the claim", p) |
| + if h.Stamp != 0 || h.Incarnation != p.pair.Incarnation || h.ServingSeq != p.pair.ServingSeq { |
| + t.Errorf("%s as %s: published stamp %d pair (%d, %d), want unstamped pair (%d, %d)", |
| + p, box, h.Stamp, h.Incarnation, h.ServingSeq, p.pair.Incarnation, p.pair.ServingSeq) |
| } |
| return body |
| } |
| - states := func(row registry.Pair, stamp int64) []publication { |
| + states := func(row registry.Pair) []publication { |
| var out []publication |
| for _, lifetimes := range []bool{false, true} { |
| - for _, r := range reads { |
| - p := publication{lifetimes: lifetimes, read: r, row: row, claimStamp: uint64(stamp)} |
| - if r == readPositive { |
| - p.stamp = stamp // the stamp only with a positive claim |
| - } |
| - if lifetimes { |
| - p.pair = row // the pair only with lifetimes |
| - } |
| - out = append(out, p) |
| + p := publication{lifetimes: lifetimes, row: row} |
| + if lifetimes { |
| + p.pair = row // the pair only with lifetimes |
| } |
| + out = append(out, p) |
| } |
| return out |
| } |
| - retained := states(registry.Pair{Incarnation: 1, ServingSeq: 3}, 41) |
| + retained := states(registry.Pair{Incarnation: 1, ServingSeq: 3}) |
| var fresh []publication |
| for _, seq := range []uint64{2, 3, 4} { |
| - fresh = append(fresh, states(registry.Pair{Incarnation: 1, ServingSeq: seq}, 57)...) |
| + fresh = append(fresh, states(registry.Pair{Incarnation: 1, ServingSeq: seq})...) |
| } |
| bodies := map[string][]byte{} // publication and box -> body |
| bodyOf := func(p publication, box string) []byte { |
| @@ -2130,9 +2064,7 @@ func TestPublicationUnderEveryClaimState(t *testing.T) { |
| } |
| // Every clause of the statement was exercised, in both orders. |
| for _, clause := range []string{ |
| - "two stamped publications fold as today", |
| - "a stamped publication beats any unstamped entry whatever its pair", |
| - "equal pairs (two unstamped claims-on (0, 0) among them) fold as today", |
| + "equal pairs fold as today", |
| "an unstamped (0, 0) loses to a retained publication carrying a pair", |
| "the higher pair wins (the design's moves)", |
| } { |
| @@ -2140,18 +2072,49 @@ func TestPublicationUnderEveryClaimState(t *testing.T) { |
| t.Errorf("no fold exercised %q", clause) |
| } |
| } |
| - // The statement's named case, spelled out: an unstamped claims-on |
| - // publication against a retained claims-off one carrying (1, 3) loses |
| - // to it in both orders, whatever its claim read was. |
| - for _, rr := range []claimRead{readHAOff, readAbsent, readFailed, readUndecided} { |
| - for _, fr := range []claimRead{readHAOff, readAbsent, readFailed, readUndecided} { |
| - ret := publication{lifetimes: true, read: rr, row: registry.Pair{Incarnation: 1, ServingSeq: 3}, claimStamp: 41, pair: registry.Pair{Incarnation: 1, ServingSeq: 3}} |
| - on := publication{lifetimes: false, read: fr, row: registry.Pair{Incarnation: 1, ServingSeq: 4}, claimStamp: 57} |
| - for _, boxes := range [][2]string{{"annie", "betty"}, {"betty", "annie"}} { |
| - files := map[string][]byte{edgesFileKey(boxes[0]): bodyOf(ret, boxes[0]), edgesFileKey(boxes[1]): bodyOf(on, boxes[1])} |
| - if box, _, _ := edge.FoldedHome(files, "carol", host); box != boxes[0] { |
| - t.Errorf("retained %s on %s against unstamped claims-on %s: fold chose %s", ret, boxes[0], on, box) |
| - } |
| + // The statement's named case, spelled out: a lifetimes-off publication |
| + // against a retained lifetimes-on one carrying (1, 3) loses to it in |
| + // both orders. |
| + ret := publication{lifetimes: true, row: registry.Pair{Incarnation: 1, ServingSeq: 3}, pair: registry.Pair{Incarnation: 1, ServingSeq: 3}} |
| + off := publication{lifetimes: false, row: registry.Pair{Incarnation: 1, ServingSeq: 4}} |
| + for _, boxes := range [][2]string{{"annie", "betty"}, {"betty", "annie"}} { |
| + files := map[string][]byte{edgesFileKey(boxes[0]): bodyOf(ret, boxes[0]), edgesFileKey(boxes[1]): bodyOf(off, boxes[1])} |
| + if box, _, _ := edge.FoldedHome(files, "carol", host); box != boxes[0] { |
| + t.Errorf("retained %s on %s against lifetimes-off %s: fold chose %s", ret, boxes[0], off, box) |
| + } |
| + } |
| +} |
| + |
| +// Moved from edgesclaims_test.go (region HA P1a Task 1): an alias and a |
| +// served catch-all publish as home with their primary, and no entry is |
| +// stamped, with or without the box's address source. |
| +func TestEdgesFilePublishesAliasesAndCatchAllsUnstamped(t *testing.T) { |
| + reg := edgesTestRegistry(t) |
| + if err := reg.Upsert(registry.Route{Host: "mine.bab.test", Kind: "instance", Socket: "/run/carlos/mine.bab.test.sock", |
| + Provisioned: true, App: "jam", Account: "bab", Status: "ready"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, a := range []registry.RouteAlias{ |
| + {Alias: "www.customer.com", Host: "mine.bab.test", Account: "bab", App: "jam", DNSStatus: "pointing"}, |
| + {Alias: "*.customer.com", Host: "mine.bab.test", Account: "bab", App: "jam", DNSStatus: "pointing"}, |
| + } { |
| + if err := reg.UpsertAlias(a); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if err := reg.UpsertWildcardDomain(registry.WildcardDomain{Host: "customer.com", Account: "bab", App: "jam"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, src := range []AddressSource{nil, staticAddresses{Public: "1.2.3.4"}} { |
| + st := release.NewDirStore(t.TempDir()) |
| + var last []byte |
| + if err := edgesFileWriteClaims(context.Background(), st, reg, testIdent("annie"), "1.2.3.4", &last, false, src, false, nil, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + hosts := readEdgesFile(t, st, "annie").Hosts |
| + for _, key := range []string{"mine.bab.test", "www.customer.com", "*.customer.com"} { |
| + if h, ok := hosts[key]; !ok || h.Stamp != 0 || h.Role != "home" { |
| + t.Errorf("address source %v: %s = %+v, %v; want home, unstamped", src != nil, key, h, ok) |
| } |
| } |
| } |
diff --git a/internal/host/edgesschedule.go b/internal/host/edgesschedule.go| new file mode 100644 |
| index 000000000..34e4df62b |
| --- /dev/null |
| +++ b/internal/host/edgesschedule.go |
| @@ -0,0 +1,41 @@ |
| +package host |
| + |
| +import "time" |
| + |
| +// edgesLoopState is edgesFileLoop's per-tick decision: the registry and |
| +// timer schedule, plus, with the asset cache armed, a pass whenever an |
| +// assets rewrite comes due. |
| +type edgesLoopState struct { |
| + sched *edgesFileSchedule |
| + schedDue bool |
| + assetDue bool |
| +} |
| + |
| +// due reports whether to run a pass on this tick. |
| +func (s *edgesLoopState) due(now time.Time, fp string, fpOK bool) bool { |
| + return s.dueWith(now, fp, fpOK, false) |
| +} |
| + |
| +// dueWith is due with the asset cache's own reason to publish: assetsDue is |
| +// assetPolicy.rewriteDue. An assets pass is a publication like any other: |
| +// it waits out the schedule's retry backoff after a failed write and moves |
| +// it with its own outcome, so a bucket that refuses every write is not |
| +// asked on every tick. It is never the timer's. |
| +func (s *edgesLoopState) dueWith(now time.Time, fp string, fpOK, assetsDue bool) bool { |
| + s.schedDue = s.sched.due(now, fp, fpOK) |
| + s.assetDue = assetsDue && !now.Before(s.sched.retryAt) |
| + return s.schedDue || s.assetDue |
| +} |
| + |
| +// timed reports whether the pass due just allowed is the timer's. |
| +func (s *edgesLoopState) timed() bool { return s.schedDue && s.sched.timed } |
| + |
| +// done records the pass's outcome. Every pass, assets passes included, |
| +// goes through the schedule: a failure advances its backoff, and a success |
| +// clears it and records the fingerprint the pass published. An assets pass |
| +// is never the timer's (due cleared timed), so the timer does not move. |
| +func (s *edgesLoopState) done(now time.Time, ok bool) { |
| + if s.schedDue || s.assetDue { |
| + s.sched.done(now, ok) |
| + } |
| +} |
diff --git a/internal/host/edgesschedule_test.go b/internal/host/edgesschedule_test.go| new file mode 100644 |
| index 000000000..f19eace26 |
| --- /dev/null |
| +++ b/internal/host/edgesschedule_test.go |
| @@ -0,0 +1,47 @@ |
| +package host |
| + |
| +import ( |
| + "testing" |
| + "time" |
| +) |
| + |
| +// Moved from edgesclaims_test.go (Astra plan R2-1), now on the loop's one |
| +// remaining extra pass: an assets pass is a publication. While the bucket |
| +// refuses every write, assets passes wait out the schedule's backoff and |
| +// their own failures move it; once writes succeed they run again on every |
| +// tick that has one due. |
| +func TestEdgesScheduleAssetPassesObeyTheRetryBackoff(t *testing.T) { |
| + t.Parallel() |
| + start := time.Date(2026, 10, 6, 9, 0, 0, 0, time.UTC) |
| + state := &edgesLoopState{sched: newEdgesFileSchedule(start, func() time.Duration { return 5*time.Minute + 30*time.Second })} |
| + failUntil := start.Add(20 * time.Minute) |
| + var during, after []time.Time |
| + for clock := start; clock.Before(failUntil.Add(8 * time.Minute)); clock = clock.Add(edgesFileWatchInterval) { |
| + // An assets rewrite is due on every tick; the registry never moves. |
| + if !state.dueWith(clock, "fp", true, true) { |
| + continue |
| + } |
| + if state.timed() && state.assetDue && !state.schedDue { |
| + t.Fatalf("%s: an assets-only pass counted as the timer's", clock) |
| + } |
| + ok := !clock.Before(failUntil) |
| + if ok { |
| + after = append(after, clock) |
| + } else { |
| + during = append(during, clock) |
| + } |
| + state.done(clock, ok) |
| + } |
| + // Unthrottled, an assets pass every tick would be 600 attempts in 20 |
| + // minutes. The backoff (2 s doubling to 5 min) plus the timer allows |
| + // about a dozen. |
| + t.Logf("%d attempts while failing, %d after", len(during), len(after)) |
| + if len(during) > 16 { |
| + t.Fatalf("%d publication attempts while every write failed, want at most 16 (first: %v)", len(during), during[:min(len(during), 5)]) |
| + } |
| + // Recovery waits out the backoff (at most five minutes), then the |
| + // assets passes resume on every tick. |
| + if len(after) < 3 || after[len(after)-1].Sub(after[len(after)-2]) != edgesFileWatchInterval { |
| + t.Fatalf("passes after writes recovered = %v, want an assets pass on every tick within eight minutes", after) |
| + } |
| +} |
diff --git a/internal/host/movesoffline_lifetime_test.go b/internal/host/movesoffline_lifetime_test.go| index 9aa37e7a5..7e2ac4df1 100644 |
| --- a/internal/host/movesoffline_lifetime_test.go |
| +++ b/internal/host/movesoffline_lifetime_test.go |
| @@ -103,7 +103,7 @@ func syntheticReadyPublication(t *testing.T, box string, pair registry.Pair) []b |
| t.Helper() |
| reg := edgesTestRegistry(t) |
| lifetimeRow(t, reg, offHost, pair.Incarnation, pair.ServingSeq) |
| - body, _ := publishLifetimes(t, reg, box, nil, true) |
| + body, _ := publishLifetimes(t, reg, box, true) |
| requirePublished(t, "the synthetic publication", body, pair) |
| return body |
| } |