host: publish a stateless route's fleet binding for its record lifetime
Fix F8 from the stateless replicas Plan 1 dev smoke (#511). Unlabelled legacy stateless routes now publish through the existing fleet binding writer on successful wake and agent startup. Preserve startup's non-stealing rule, wake takeover and the existing CAS retry. Labelled, set and stateful publication retain their existing paths. Never label these records: labels would disable the edge's connected-box fallback after a one-box fleet replaces its box. Carry the resident registry row's monotonic incarnation in an additive record_incarnation binding field. Console authorization and both typed writer CAS callbacks require a nonzero exact lifetime match instead of comparing box BoundAt with console CreatedAt. Old bindings without the field refuse. Keep fleet/host/caller checks, request-local one-GET accounting, writer identity/term/assignment checks and default behaviour without evidence. First labelling's existing clock comparison is unchanged. The manager accepts one binding GET per five-minute coordinator renewal per held unlabelled stateless app (about 8640 GETs per 30-day month). There is no holder bypass and no new periodic binding publisher. The binding remains fleet-authenticated under the existing trust boundary. Exercise the production host publisher, stored registry lifetime, edge console route, acquire/renew and complete release result; include clock skew, old lifetime, missing field, other-box and CAS-conflict refusals. Refresh the root-read census proposal for independent controller review.
Co-Authored-By: Codex (gpt-6-astra) <noreply@openai.com>
docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md+64 −45internal/console/fleetrelabel.go+7 −7internal/console/replicacoordinator.go+2 −2internal/console/replicacoordinator_test.go+57 −11internal/host/fleetbind.go+34 −14internal/host/onebox_binding_test.go+113 −0internal/provision/onebox_coordinator_census_test.go+1 −1internal/provision/replica_binding_test.go+22 −12internal/provision/replicacoordinator.go+3 −3internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv+11 −4
Intent
<task-notification> <task-id>afe714ad97d68100d</task-id> <tool-use-id>toolu_01WVoHvELKdFkeQzDxoG2SuU</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/195ef15b-aac6-42d6-b49b-41ffb7a4abbc/tasks/afe714ad97d68100d.output</output-file> <status>completed</status> <summary>Agent "F8 census review" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**APPROVE** Seal: `59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82`, unchanged. The implementer is right that the overlay is envelope-only. **Why it is not a unit change:** - Neither writer is a root-read unit: no census row names either one, and `make census-card` reports the census clean. - The two writers gain no store reads. The new evidence check is pure, and the only new read (one binding GET) is in the console, which is outside root scope. - Root's own callers (`internal/host/replicacoordinator.go:36` and `:61`) pass no evidence. Every new condition only applies when evidence is passed, so root behaves exactly as on main. **Checks:** `make census-card` is clean at that seal (it had to run outside the sandbox because the go-build cache is read-only inside it). `go test ./internal/provision -run 'Census|RootReads|OneBox|Binding|RecordWrite'` passed in 17.6s. `review-r3.diff` has the same changed lines as `git diff 6209ce43 24e3687d`. **Findings (all P3, none blocking):** 1. Root-side readers (`internal/activator/replicaobservation.go:27`) can now see coordinator and release data on unlabelled one-box fleet records. This is data, not source. The writes are gated on fleet identity, region and a binding that is checked again on every write attempt. Root's binding publisher ignores unlabelled records (`internal/host/fleetbind.go:496`), so root opens or runs nothing new. 2. The binding object is written by boxes, and any fleet box may take one over (`internal/host/fleetbind.go:109-120`). The relabel worker already trusts this same object for labelling, which is a stronger act (`internal/console/fleetrelabel.go:34-40`), so trust stays within the fleet. 3. The binding check compares a time from the box's clock with one from the console's (`internal/provision/replicacoordinator.go:26`). Skew can refuse a legitimate box or accept a stale binding from a box in the same fleet. That is a reliability issue, not a census one. 4. The overlay's first line says "approved on #280 before the merge" while its last line says approval is pending (`plan14-root-reads-stateless-coordinator-oneboxfleet.tsv:1`). Recording this verdict on #280 with tip 24e3687d makes the first line true. Full review: `/home/paulca/.cache/sr-f8/census-review.md`</result> <usage><subagent_tokens>72431</subagent_tokens><tool_uses>16</tool_uses><duration_ms>162280</duration_ms></usage> </task-notification>
Attributed to this commit: 14.1 g CO₂e (1,742,696 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-coordinator-oneboxfleet, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md b/docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md| index 91c6289fe..082eeb267 100644 |
| --- a/docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md |
| +++ b/docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md |
| @@ -1,53 +1,72 @@ |
| -# Census approval: stateless-coordinator-oneboxfleet |
| +# Census proposal: stateless-coordinator-oneboxfleet |
| -Ruling `census-ruling-stateless-coordinator-oneboxfleet`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| +Ruling `census-ruling-stateless-coordinator-oneboxfleet`. The independent reviewer approves or rejects every change below, 3 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| -Envelopes re-pinned: `internal/provision`. |
| +Envelopes re-pinned: `internal/host`, `internal/provision`. |
| 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. |
| -Seal: `59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82` → `59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82`. |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/host/fleetbind.go:PublishFleetRouteBinding`: reads +registry:Assigned, +registry:Copies, +registry:FleetBox, +registry:FleetBoxes, +registry:FleetLabel, +registry:Host ×2, +registry:Incarnation ×2, +registry:Kind, +registry:Provisioned, +registry:Region, +registry:ReplicaIncarnation, +registry:ReplicaRevision, +registry:Stateless, +registry:Status; written legacy, accepted-legacy, frozen |
| +- reads `internal/host/fleetbind.go:fleetBindingHook`: -registry:Host, +whole:Route; keeps legacy, task accepted-legacy |
| +- reads `internal/host/fleetbind.go:publishResidentFleetBindings`: +registry:Host, +whole:Route; keeps legacy, task accepted-legacy |
| + |
| +Seal: `59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82` → `a281947807e484b1b26669df82bc967e1622899a9ec312da7fb1f43b7e30253d`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
| -## Author context — independent approval pending |
| - |
| -This is a proposal, not a #280 approval. The scanner reports only the |
| -`internal/provision` envelope; the new evidence helper and both writers |
| -must still be reviewed as authority code. Author notes are also retained |
| -as comments in `/home/paulca/.cache/sr-f8/claims.tsv`. |
| - |
| -The manager replaced the first-labelling design with explicit binding |
| -evidence. `da71d010` reverts `ad35f1a5`; fleet labelling, moves and their |
| -periodic read budget match `6209ce43`. The console reads one binding per |
| -unlabelled request after authenticating fleet identity and record region. |
| -It rechecks identity and the current record under the app lock, using |
| -that request's evidence rather than a second binding GET. |
| - |
| -Review `ReplicaBindingEvidence.matches`, `SetRecordCoordinator` and |
| -`SetRecordReplicaRelease` in the two provision files, and both console |
| -handlers in `internal/console/replicacoordinator.go`. Evidence is an |
| -explicit optional typed argument, never a client payload field. Each CAS |
| -attempt requires the current record to remain unlabelled, unassigned, |
| -for the same fleet and host, with the coordinating box matching the |
| -binding and BoundAt no older than CreatedAt. Lifetime checks remain. |
| -The release writer checks evidence before the committed-success replay |
| -shortcut. Neither writer assigns FleetBox. Calls without evidence keep |
| -the prior gates and replay behaviour. Record-write census fingerprints |
| -for these four writers/callers are in `onebox_coordinator_census_test.go`; |
| -their existing classifications and site kinds are retained. |
| - |
| -Known review history: `/home/paulca/.cache/sr-f8/review.md` rejected the |
| -labelling approach with C1 (authoritative labels prevent replacement-box |
| -fallback), I1 (lost-box outage window), I2 (recurring one-box bucket reads), |
| -and minor m3 (404 provenance). The revert removes the new label semantics |
| -and periodic reads. The new HTTP witness checks the console route's |
| -version header on refusals. No independent review of this replacement |
| -has been performed here; the controller owns the next review and must |
| -carry the existing round count, including any reviews not supplied here. |
| - |
| -Use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`: stop at the first |
| -round with no P1, fix that round's P2s without reopening it, and put P3s |
| -on the follow-up list. A fourth review needs Paul's go; a replacement |
| -brief does not reset the budget. Return READY, READY AFTER FIXES or NOT |
| -READY, with a verdict on this envelope and citations to the code read. |
| +## Round 4 author context; refreshed approval pending |
| + |
| +The supplied independent census review approved Round 3 at `24e3687d`. |
| +That approval does not cover the new host publication and lifetime checks. |
| +The controller owns refreshed review and #280 posting. The manager explicitly |
| +authorized Round 4 after review-r3 C1/I1; the review budget does not restart. |
| + |
| +C1: the existing wake/startup paths now call `PublishFleetRouteBinding` for |
| +ready, provisioned, unlabelled legacy stateless instance rows in their own |
| +fleet. The helper copies the registry row's monotonic incarnation counter |
| +into the additive `record_incarnation` binding field. It uses the existing |
| +binding object, writer and CAS/takeover guards. Startup remains non-stealing; |
| +a successful stateless wake can take over another box's binding. There is no |
| +new registry schema, record read, periodic publisher or record label. |
| +Labelled/set stateless rows retain their existing coordinator publisher; |
| +stateful publication is unchanged. |
| + |
| +The console and shared `ReplicaBindingEvidence.matches` predicate require |
| +a nonzero exact match with the current record's incarnation. Both typed |
| +writers invoke it on every CAS attempt; release checks it before replay. |
| +Old bindings without the field are refused. Rows with incarnation zero |
| +cannot publish evidence: the existing lifetime reconciliation must install |
| +a record incarnation first. Existing CreatedAt-derived request identity, |
| +term, assignment and CAS-retry checks remain; no-evidence calls are unchanged. |
| + |
| +I1 is accepted by the manager: each held unlabelled stateless app adds one |
| +binding GET per five-minute coordinator renewal, about 8,640 GETs per 30-day |
| +month. Each eligible HTTP request reads once after fleet identity/region |
| +checks and shares that snapshot with its locked recheck. Labelled/set rows |
| +add zero binding GETs. There is no holder bypass. Each new eligible |
| +wake/startup publication normally adds one binding GET and one conditional |
| +PUT; the existing conflict retry may repeat both once. |
| + |
| +Bindings are fleet-authenticated, not authenticated per box. Any box in a |
| +fleet can write that fleet's bindings under the existing store permissions. |
| +A transient binding GET failure can fence renewal or leave a release result |
| +uncertain. Unlabelled records on multi-box fleets with labelling paused can |
| +also use this evidence path. These are accepted existing-scope tradeoffs. |
| + |
| +Other readers are unchanged: first labelling still compares BoundAt with |
| +CreatedAt; the writer retains its same-box BoundAt ordering guard; hub |
| +routing retains its key/fleet/host/member checks. Coordinator authorization |
| +never uses BoundAt now. The set-binding Incarnation string keeps its own |
| +meaning; the new numeric field does not select set routing. |
| + |
| +The HTTP witness uses the production publisher and a stored box-registry |
| +row, then edge tunnel-host dispatch into the real console handler. Acquire |
| +and the complete release transition leave the record unlabelled, including |
| +box clocks twenty years behind/ahead. Host tests exercise the actual wake |
| +and startup callers, their refusal matrix and takeover rules. Provision |
| +tests cover both writers' evidence, CAS conflicts and replay. All three |
| +mutations failed and were reverted: writer lifetime equality, console |
| +caller-box equality, and labelled-row publication. Gate output and timings |
| +are recorded in Round 4 of the controller report. |
diff --git a/internal/console/fleetrelabel.go b/internal/console/fleetrelabel.go| index dc9a125ca..76e6455a1 100644 |
| --- a/internal/console/fleetrelabel.go |
| +++ b/internal/console/fleetrelabel.go |
| @@ -335,14 +335,14 @@ func (v fleetView) labelsPausedBy() (box, rel string) { |
| return "", "" |
| } |
| -// fleetBinding is the part of a box's binding object (internal/host's |
| -// FleetBinding, written by the box that won the host's lease) the first |
| -// labelling reads. |
| +// fleetBinding is the fleet-authenticated part of internal/host's binding |
| +// object read by first labelling and the replica coordinator. |
| type fleetBinding struct { |
| - Host string `json:"host"` |
| - Fleet string `json:"fleet"` |
| - Box string `json:"box"` |
| - BoundAt int64 `json:"bound_at"` // unix milliseconds |
| + RecordIncarnation uint64 `json:"record_incarnation,omitempty"` |
| + Host string `json:"host"` |
| + Fleet string `json:"fleet"` |
| + Box string `json:"box"` |
| + BoundAt int64 `json:"bound_at"` // unix milliseconds |
| } |
| // fleetBindingMaxBytes bounds a binding object's body. |
diff --git a/internal/console/replicacoordinator.go b/internal/console/replicacoordinator.go| index a7ab351cb..cef353552 100644 |
| --- a/internal/console/replicacoordinator.go |
| +++ b/internal/console/replicacoordinator.go |
| @@ -57,10 +57,10 @@ func (s *Server) replicaFleetRecord(r *http.Request, auth *replicaFleetRequest) |
| if err != nil || !ok { |
| return nil, "", false |
| } |
| - auth.binding = []provision.ReplicaBindingEvidence{{Fleet: b.Fleet, Host: b.Host, Box: b.Box, BoundAt: b.BoundAt}} |
| + auth.binding = []provision.ReplicaBindingEvidence{{Fleet: b.Fleet, Host: b.Host, Box: b.Box, RecordIncarnation: b.RecordIncarnation}} |
| } |
| b := auth.binding[0] |
| - if b.Fleet != fleet || b.Host != rec.Host || b.Box != box || b.BoundAt < rec.CreatedAt.UnixMilli() { |
| + if b.Fleet != fleet || b.Host != rec.Host || b.Box != box || b.RecordIncarnation == 0 || b.RecordIncarnation != rec.Incarnation { |
| return nil, "", false |
| } |
| } else if rec.FleetBox != box { |
diff --git a/internal/console/replicacoordinator_test.go b/internal/console/replicacoordinator_test.go| index 3c35661e1..bc672a2d5 100644 |
| --- a/internal/console/replicacoordinator_test.go |
| +++ b/internal/console/replicacoordinator_test.go |
| @@ -8,12 +8,14 @@ import ( |
| "io" |
| "net/http" |
| "net/http/httptest" |
| + "path/filepath" |
| "strings" |
| "sync/atomic" |
| "testing" |
| "time" |
| "github.com/carlosframework/platform/internal/edge" |
| + "github.com/carlosframework/platform/internal/host" |
| "github.com/carlosframework/platform/internal/provision" |
| "github.com/carlosframework/platform/internal/registry" |
| "github.com/carlosframework/platform/internal/replicas" |
| @@ -347,9 +349,11 @@ func TestReplicaCoordinatorOneBoxFleetBinding(t *testing.T) { |
| reads int32 |
| }{ |
| {name: "matching", want: 200, reads: 1}, |
| - {name: "newer", change: func(_ *provision.Record, b *fleetBinding) { b.BoundAt++ }, want: 200, reads: 1}, |
| + {name: "clock-ahead", change: func(_ *provision.Record, b *fleetBinding) { b.BoundAt = time.Now().AddDate(20, 0, 0).UnixMilli() }, want: 200, reads: 1}, |
| + {name: "clock-behind", change: func(_ *provision.Record, b *fleetBinding) { b.BoundAt = time.Now().AddDate(-20, 0, 0).UnixMilli() }, want: 200, reads: 1}, |
| {name: "other-box", change: func(_ *provision.Record, b *fleetBinding) { b.Box = "b2" }, want: 404, reads: 1}, |
| - {name: "older", change: func(_ *provision.Record, b *fleetBinding) { b.BoundAt-- }, want: 404, reads: 1}, |
| + {name: "earlier-lifetime", change: func(_ *provision.Record, b *fleetBinding) { b.RecordIncarnation-- }, want: 404, reads: 1}, |
| + {name: "no-lifetime", change: func(_ *provision.Record, b *fleetBinding) { b.RecordIncarnation = 0 }, want: 404, reads: 1}, |
| {name: "other-host", change: func(_ *provision.Record, b *fleetBinding) { b.Host = "other.example.com" }, want: 404, reads: 1}, |
| {name: "other-fleet", change: func(_ *provision.Record, b *fleetBinding) { b.Fleet = "away" }, want: 404, reads: 1}, |
| {name: "missing-binding", want: 404, reads: 1}, |
| @@ -389,7 +393,8 @@ func TestReplicaCoordinatorOneBoxFleetBinding(t *testing.T) { |
| t.Fatalf("active boxes = %d, want 1", active) |
| } |
| rec, _ := ixRecord(t, fx, ixHost) |
| - binding := fleetBinding{Fleet: "home", Host: ixHost, Box: "b1", BoundAt: rec.CreatedAt.UnixMilli()} |
| + rec = replicaBindingRecord(t, fx, rec) |
| + binding := fleetBinding{Fleet: "home", Host: ixHost, Box: "b1", BoundAt: time.Now().UnixMilli(), RecordIncarnation: rec.Incarnation} |
| if tc.change != nil { |
| tc.change(&rec, &binding) |
| ixPutRecord(t, fx, rec) |
| @@ -400,12 +405,35 @@ func TestReplicaCoordinatorOneBoxFleetBinding(t *testing.T) { |
| } |
| bindingKey := "fleets/home/bindings/" + ixHost + ".json" |
| if tc.name != "missing-binding" { |
| - body, err := json.Marshal(binding) |
| - if err != nil { |
| - t.Fatal(err) |
| - } |
| - if _, err := fx.rel.Put(context.Background(), bindingKey, body, ""); err != nil { |
| - t.Fatal(err) |
| + // Use the publisher called by the box's wake and startup paths. |
| + // Negative cases represent stale or invalid wire objects. |
| + rt := provision.RouteFor(rec, "", "", false, nil) |
| + rt.Stateless = true |
| + if tc.name == "matching" || tc.name == "clock-ahead" || tc.name == "clock-behind" || tc.name == "other-box" || tc.name == "earlier-lifetime" || tc.name == "binding-read-error" { |
| + rt.Incarnation = binding.RecordIncarnation |
| + boxRegistry, err := registry.Open(filepath.Join(t.TempDir(), "box.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { boxRegistry.Close() }) |
| + if err := boxRegistry.Upsert(rt); err != nil { |
| + t.Fatal(err) |
| + } |
| + resident, err := boxRegistry.Get(rt.Host) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := host.PublishFleetRouteBinding(context.Background(), fx.rel, "home", binding.Box, *resident, true, time.UnixMilli(binding.BoundAt)); err != nil { |
| + t.Fatal(err) |
| + } |
| + } else { |
| + body, err := json.Marshal(binding) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := fx.rel.Put(context.Background(), bindingKey, body, ""); err != nil { |
| + t.Fatal(err) |
| + } |
| } |
| } |
| var reads atomic.Int32 |
| @@ -474,6 +502,7 @@ func TestReplicaCoordinatorOneBoxFleetBinding(t *testing.T) { |
| if reply.Lease.Box != "b1" || reply.RemainingMS <= 0 { |
| t.Fatalf("coordinator reply: %+v", reply) |
| } |
| + post("coordinator", map[string]any{"incarnation": inc, "op": "renew", "boot_id": "boot", "term": reply.Lease.Term}) |
| var deploy replicas.Deploy |
| for _, op := range []string{"begin", "releasing", "released"} { |
| raw = post("release", map[string]any{"incarnation": inc, "op": op, "id": "onebox-deploy", "term": reply.Lease.Term, "revision": deploy.Revision, "target": replicas.Build{Version: "v2", Digest: "digest"}}) |
| @@ -494,13 +523,15 @@ func TestReplicaCoordinatorBindingRecheckedUnderLock(t *testing.T) { |
| t.Run(kind, func(t *testing.T) { |
| fx := newIxFx(t, "replica-binding-race") |
| token, _, _ := ixFleetWorld(t, fx, fx.acct) |
| - rec, before := ixRecord(t, fx, ixHost) |
| + rec, _ := ixRecord(t, fx, ixHost) |
| + rec = replicaBindingRecord(t, fx, rec) |
| + _, before := ixRecord(t, fx, ixHost) |
| inc, err := provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt) |
| if err != nil { |
| t.Fatal(err) |
| } |
| bindingKey := "fleets/home/bindings/" + ixHost + ".json" |
| - body, err := json.Marshal(fleetBinding{Fleet: "home", Host: ixHost, Box: "b1", BoundAt: rec.CreatedAt.UnixMilli()}) |
| + body, err := json.Marshal(fleetBinding{Fleet: "home", Host: ixHost, Box: "b1", RecordIncarnation: rec.Incarnation}) |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -530,6 +561,7 @@ func TestReplicaCoordinatorBindingRecheckedUnderLock(t *testing.T) { |
| rec.RecordSeq = 2 |
| rec.ReplicaAssignment = &replicas.Assignment{Revision: 1, Desired: 1, Boxes: []string{"b1"}} |
| case "recreated": |
| + rec.Incarnation++ |
| rec.CreatedAt = rec.CreatedAt.Add(time.Second) |
| case "region": |
| rec.Region = "fleet/away" |
| @@ -562,3 +594,17 @@ func TestReplicaCoordinatorBindingRecheckedUnderLock(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +func replicaBindingRecord(t *testing.T, fx *interactiveFx, rec provision.Record) provision.Record { |
| + t.Helper() |
| + rec.Incarnation = 2 |
| + ixPutRecord(t, fx, rec) |
| + body, err := json.Marshal(provision.HostIncarnation{Account: rec.Account, App: rec.App, Incarnation: rec.Incarnation, State: provision.SlotLive}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := fx.rel.Put(context.Background(), provision.HostIncarnationKey(rec.Host), body, ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + return rec |
| +} |
diff --git a/internal/host/fleetbind.go b/internal/host/fleetbind.go| index 6ed1efbcb..c233a0450 100644 |
| --- a/internal/host/fleetbind.go |
| +++ b/internal/host/fleetbind.go |
| @@ -31,6 +31,8 @@ import ( |
| // ReconcileFleetBindings is the platform-side reader that turns it back |
| // into registry.Route.FleetBox. |
| type FleetBinding struct { |
| + // RecordIncarnation is copied from the resident legacy row, never a clock. |
| + RecordIncarnation uint64 `json:"record_incarnation,omitempty"` |
| Boxes []string `json:"boxes,omitempty"` |
| Incarnation string `json:"incarnation,omitempty"` |
| AssignmentRevision uint64 `json:"assignment_revision,omitempty"` |
| @@ -77,9 +79,9 @@ func fleetBindingKey(fleet, host string) string { |
| // publishResidentFleetBindings — a bare "this box has this route |
| // resident" observation, not lease-backed) must never overwrite a |
| // binding that already names a DIFFERENT box. Only a wake-success write |
| -// (takeover=true) may take over — it is backed by having just won the |
| -// per-host S3 lease, which is the actual arbiter of who may serve a |
| -// host, so it is allowed to restamp regardless of who was there before. |
| +// (takeover=true) may take over. Stateful wakes hold the per-host S3 |
| +// lease; unlabelled legacy stateless wakes publish their resident record |
| +// lifetime after a successful start. |
| // - Logical clock, SAME BOX ONLY: a binding already stored FROM THE SAME |
| // BOX with a strictly greater BoundAt must never be overwritten by an |
| // older write from that same box — this holds regardless of takeover, |
| @@ -92,7 +94,7 @@ func fleetBindingKey(fleet, host string) string { |
| // comparing it across two DIFFERENT boxes compares clock skew, not |
| // recency. Before this scoping, a dead box A's stale binding stamped |
| // with a clock running ahead of surviving box B's would silently and |
| -// PERMANENTLY block B's lease-backed takeover write (the startup pass |
| +// PERMANENTLY block B's wake-success takeover write (the startup pass |
| // can't help either — it's non-stealing by the guard above), stranding |
| // the edge on its sorted-fallback channel instead of the real lease |
| // holder for as long as the skew persists. A cross-box binding is |
| @@ -141,7 +143,7 @@ func getExistingBinding(ctx context.Context, s release.Store, key string) (*Flee |
| // s must be an UNPREFIXED store handle — see fleetBindingKey's doc comment. |
| // |
| // takeover distinguishes the two callers: fleetBindingHook (the activator's |
| -// OnWake, a lease-backed wake success) passes true and may claim a binding |
| +// successful OnWake) passes true and may claim a binding |
| // away from any other box; publishResidentFleetBindings (the agent-startup |
| // pass, a bare "this route is resident here" observation with no lease |
| // behind it) passes false and must never steal a binding another box |
| @@ -360,9 +362,9 @@ func ReconcileFleetBindings(ctx context.Context, s release.Store, reg *registry. |
| // fleetBindingHook builds the activator's OnWake hook for a fleet box: on |
| // every successful wake, publish a FleetBinding naming this box (identified |
| // by fleet/box, resolveFleetIdentity's result — the channel label, never a |
| -// hashed pseudonym) as the current holder, with takeover=true since a |
| -// wake's lease acquisition is exactly the authority that may claim a |
| -// binding away from whoever held it before. activator.Service already |
| +// hashed pseudonym) as the current holder, with takeover=true. Stateful |
| +// wakes hold the serving lease; unlabelled legacy stateless wakes publish |
| +// their resident record lifetime without a serving lease. activator.Service already |
| // invokes OnWake in its own goroutine (see activator.go's wake), so this |
| // function runs off the wake path entirely — a slow or failing bucket Put |
| // can never delay or fail a request. Errors are logged only: a binding is |
| @@ -391,15 +393,13 @@ func fleetBindingHook(store release.Store, fleet, box string) func(rt registry.R |
| return func(rt registry.Route) { |
| if rt.Stateless { |
| backstopFullDue.Store(true) |
| - return |
| } |
| if rt.IsSidecar() { |
| return |
| } |
| ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
| defer cancel() |
| - b := FleetBinding{Host: rt.Host, Fleet: fleet, Box: box, BoundAt: time.Now().UnixMilli()} |
| - if err := WriteFleetBinding(ctx, store, b, true); err != nil { |
| + if err := PublishFleetRouteBinding(ctx, store, fleet, box, rt, true, time.Now()); err != nil { |
| log.Printf("agent: fleet binding for %s: %v", rt.Host, err) |
| } |
| } |
| @@ -433,21 +433,41 @@ func publishResidentFleetBindings(store release.Store, fleet, box string, reg *r |
| } |
| ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| defer cancel() |
| - now := time.Now().UnixMilli() |
| + now := time.Now() |
| for _, rt := range routes { |
| if rt.Stateless { |
| backstopFullDue.Store(true) |
| - break |
| + if err := PublishFleetRouteBinding(ctx, store, fleet, box, rt, false, now); err != nil { |
| + log.Printf("agent: fleet binding for %s: %v", rt.Host, err) |
| + } |
| } |
| } |
| for _, host := range residentBindingHosts(routes) { |
| - b := FleetBinding{Host: host, Fleet: fleet, Box: box, BoundAt: now} |
| + b := FleetBinding{Host: host, Fleet: fleet, Box: box, BoundAt: now.UnixMilli()} |
| if err := WriteFleetBinding(ctx, store, b, false); err != nil { |
| log.Printf("agent: fleet binding for %s: %v", host, err) |
| } |
| } |
| } |
| +// PublishFleetRouteBinding is the wake/startup publisher. Unlabelled legacy |
| +// stateless routes carry their registry lifetime through the existing binding |
| +// writer. Labelled and set stateless routes retain their coordinator publisher. |
| +func PublishFleetRouteBinding(ctx context.Context, store release.Store, fleet, box string, rt registry.Route, takeover bool, now time.Time) error { |
| + if rt.IsSidecar() { |
| + return nil |
| + } |
| + b := FleetBinding{Host: rt.Host, Fleet: fleet, Box: box, BoundAt: now.UnixMilli()} |
| + if rt.Stateless { |
| + if rt.Host == "" || !rt.Provisioned || rt.Kind != "instance" || rt.Status != "ready" || rt.Region != "fleet/"+fleet || rt.Incarnation == 0 || |
| + rt.Assigned != "" || rt.FleetBox != "" || rt.FleetLabel != "" || rt.FleetBoxes != "" || rt.Copies != 0 || rt.ReplicaRevision != 0 || rt.ReplicaIncarnation != "" { |
| + return nil |
| + } |
| + b.RecordIncarnation = rt.Incarnation |
| + } |
| + return WriteFleetBinding(ctx, store, b, takeover) |
| +} |
| + |
| // residentBindingHosts is the set of hosts this box advertises as served — |
| // the pure host-selection half of publishResidentFleetBindings, split out so |
| // the refusal below is directly testable. |
diff --git a/internal/host/onebox_binding_test.go b/internal/host/onebox_binding_test.go| new file mode 100644 |
| index 000000000..693d774bc |
| --- /dev/null |
| +++ b/internal/host/onebox_binding_test.go |
| @@ -0,0 +1,113 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +func TestFleetBindingUnlabelledStateless(t *testing.T) { |
| + prior := backstopFullDue.Load() |
| + t.Cleanup(func() { backstopFullDue.Store(prior) }) |
| + for _, path := range []string{"wake", "startup"} { |
| + for _, kind := range []string{"unlabelled", "labelled", "set", "no-lifetime", "other-fleet", "sidecar", "not-ready", "unprovisioned", "stateful"} { |
| + t.Run(path+"/"+kind, func(t *testing.T) { |
| + store := &statelessBindingStore{Store: release.NewDirStore(t.TempDir())} |
| + rec := provision.Record{Host: "shop.example.com", Account: "bab", App: "shop", Region: "fleet/pi", Incarnation: 2} |
| + rt := provision.RouteFor(rec, "", "", false, nil) |
| + rt.Stateless = true |
| + switch kind { |
| + case "labelled": |
| + rt.Assigned = time.Now().UTC().Format(time.RFC3339Nano) |
| + case "set": |
| + rt.FleetBoxes = `["box"]` |
| + rt.Copies = 1 |
| + rt.ReplicaRevision = 1 |
| + rt.ReplicaIncarnation = "life" |
| + case "no-lifetime": |
| + rt.Incarnation = 0 |
| + case "other-fleet": |
| + rt.Region = "fleet/away" |
| + case "sidecar": |
| + rt.Kind = "sidecar" |
| + case "not-ready": |
| + rt.Status = "moving" |
| + case "unprovisioned": |
| + rt.Provisioned = false |
| + case "stateful": |
| + rt.Stateless = false |
| + } |
| + reg := testRegistry(t) |
| + if err := reg.Upsert(rt); err != nil { |
| + t.Fatal(err) |
| + } |
| + stored, err := reg.Get(rt.Host) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if path == "wake" { |
| + fleetBindingHook(store, "pi", "box")(*stored) |
| + } else { |
| + publishResidentFleetBindings(store, "pi", "box", reg) |
| + } |
| + if kind != "unlabelled" && kind != "stateful" { |
| + if store.gets != 0 || store.puts != 0 { |
| + t.Fatalf("ineligible route published: get=%d put=%d", store.gets, store.puts) |
| + } |
| + return |
| + } |
| + if store.gets != 1 || store.puts != 1 { |
| + t.Fatalf("publication: get=%d put=%d", store.gets, store.puts) |
| + } |
| + raw, _, err := store.Store.Get(context.Background(), fleetBindingKey("pi", rt.Host)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var b FleetBinding |
| + if err := json.Unmarshal(raw, &b); err != nil { |
| + t.Fatal(err) |
| + } |
| + wantLifetime := uint64(2) |
| + if kind == "stateful" { |
| + wantLifetime = 0 |
| + } |
| + if b.RecordIncarnation != wantLifetime || b.Box != "box" || b.Fleet != "pi" || b.Host != rt.Host { |
| + t.Fatalf("binding: %+v", b) |
| + } |
| + }) |
| + } |
| + } |
| +} |
| + |
| +func TestFleetBindingStatelessTakeoverRules(t *testing.T) { |
| + ctx := context.Background() |
| + for _, takeover := range []bool{false, true} { |
| + t.Run(map[bool]string{false: "startup", true: "wake"}[takeover], func(t *testing.T) { |
| + store := release.NewDirStore(t.TempDir()) |
| + rt := registry.Route{Host: "shop.example.com", Kind: "instance", Account: "bab", App: "shop", Region: "fleet/pi", Status: "ready", Provisioned: true, Stateless: true, Incarnation: 2} |
| + old := FleetBinding{Host: rt.Host, Fleet: "pi", Box: "old", BoundAt: time.Now().AddDate(20, 0, 0).UnixMilli(), RecordIncarnation: 1} |
| + if err := WriteFleetBinding(ctx, store, old, true); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := PublishFleetRouteBinding(ctx, store, "pi", "new", rt, takeover, time.Now().AddDate(-20, 0, 0)); err != nil { |
| + t.Fatal(err) |
| + } |
| + raw, _, err := store.Get(ctx, fleetBindingKey("pi", rt.Host)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var b FleetBinding |
| + if err := json.Unmarshal(raw, &b); err != nil { |
| + t.Fatal(err) |
| + } |
| + if takeover && (b.Box != "new" || b.RecordIncarnation != 2) || !takeover && b.Box != "old" { |
| + t.Fatalf("takeover=%t: %+v", takeover, b) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/provision/onebox_coordinator_census_test.go b/internal/provision/onebox_coordinator_census_test.go| index 7b5cfaa2f..5bcec5cb2 100644 |
| --- a/internal/provision/onebox_coordinator_census_test.go |
| +++ b/internal/provision/onebox_coordinator_census_test.go |
| @@ -4,7 +4,7 @@ package provision |
| func oneBoxCoordinatorWriteCensusInventory() []censusEntry { |
| entries := append([]censusEntry(nil), statelessPlacementWriteCensusInventory()...) |
| for _, next := range []censusEntry{ |
| - // Evidence authorizes only the current unlabelled legacy record; every CAS attempt rechecks host, fleet, box and binding age. No-evidence rules and lease/lifetime checks remain unchanged. |
| + // Evidence authorizes only the current unlabelled legacy record; every CAS attempt rechecks host, fleet, box and record lifetime. No-evidence rules and lease/lifetime checks remain unchanged. |
| {"internal/provision/replicacoordinator.go", "SetRecordCoordinator", "record-writer", "key:SetRecordCoordinator,key:updateRecord", "4e7f81265c7a32e4e1e026e6999a260f4aae0337cab4b58391ce7a749c2d10e3"}, |
| // Evidence is rechecked inside CAS, before replay and release mutation; default replay, term, revision and assignment rules remain. No label is written. |
| {"internal/provision/replicadeploy.go", "SetRecordReplicaRelease", "record-writer", "key:SetRecordReplicaRelease,key:updateRecord", "669ccd055065c7742a4cd87e57c3a2b2117ee64f26d3a66b573bd3b799b0a014"}, |
diff --git a/internal/provision/replica_binding_test.go b/internal/provision/replica_binding_test.go| index ae663bcdb..5ec72daf3 100644 |
| --- a/internal/provision/replica_binding_test.go |
| +++ b/internal/provision/replica_binding_test.go |
| @@ -8,17 +8,18 @@ import ( |
| "testing" |
| "time" |
| + "github.com/carlosframework/platform/internal/release" |
| "github.com/carlosframework/platform/internal/replicas" |
| ) |
| func TestCoordinatorBindingEvidence(t *testing.T) { |
| for _, writer := range []string{"coordinator", "release"} { |
| - for _, kind := range []string{"matching", "newer", "older", "other-fleet", "other-host", "other-box", "empty-fleet", "empty-box", "missing", "duplicate"} { |
| + for _, kind := range []string{"matching", "earlier-lifetime", "no-lifetime", "other-fleet", "other-host", "other-box", "empty-fleet", "empty-box", "missing", "duplicate"} { |
| t.Run(writer+"/"+kind, func(t *testing.T) { |
| ctx, id := replicaFixture(t) |
| - s, rec := fleetBoxFixture(t) |
| + s, rec := bindingRecordFixture(t) |
| id.Incarnation, _ = Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt) |
| - proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", BoundAt: rec.CreatedAt.UnixMilli()} |
| + proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", RecordIncarnation: rec.Incarnation} |
| var deploy replicas.Deploy |
| if writer == "release" { |
| got, err := SetRecordCoordinator(ctx, s, id, replicas.CoordinatorChange{Op: "acquire", Box: "local", BootID: "boot"}, time.Now(), proof) |
| @@ -28,10 +29,10 @@ func TestCoordinatorBindingEvidence(t *testing.T) { |
| deploy = replicas.Deploy{ID: "deploy", Incarnation: id.Incarnation, Term: got.Coordinator.Term, Target: replicas.Build{Version: "v1", Digest: "digest"}, Phase: "pending"} |
| } |
| switch kind { |
| - case "newer": |
| - proof.BoundAt++ |
| - case "older": |
| - proof.BoundAt-- |
| + case "earlier-lifetime": |
| + proof.RecordIncarnation-- |
| + case "no-lifetime": |
| + proof.RecordIncarnation = 0 |
| case "other-fleet": |
| proof.Fleet = "away" |
| case "other-host": |
| @@ -60,7 +61,7 @@ func TestCoordinatorBindingEvidence(t *testing.T) { |
| } else { |
| got, err = SetRecordReplicaRelease(ctx, s, id, 0, deploy, binding...) |
| } |
| - if kind == "matching" || kind == "newer" { |
| + if kind == "matching" { |
| if err != nil || got.FleetBox != "" || got.FleetBoxAt != "" || got.FleetBoxMoved || got.ReplicaAssignment != nil { |
| t.Fatalf("accepted evidence: %+v, %v", got, err) |
| } |
| @@ -86,9 +87,9 @@ func TestCoordinatorBindingEvidenceRechecksCAS(t *testing.T) { |
| for _, kind := range []string{"labelled-same-box", "assigned-same-box", "recreated", "region"} { |
| t.Run(writer+"/"+kind, func(t *testing.T) { |
| ctx, id := replicaFixture(t) |
| - base, rec := fleetBoxFixture(t) |
| + base, rec := bindingRecordFixture(t) |
| id.Incarnation, _ = Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt) |
| - proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", BoundAt: rec.CreatedAt.UnixMilli()} |
| + proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", RecordIncarnation: rec.Incarnation} |
| var deploy replicas.Deploy |
| if writer == "release" { |
| got, err := SetRecordCoordinator(ctx, base, id, replicas.CoordinatorChange{Op: "acquire", Box: "local", BootID: "boot"}, time.Now(), proof) |
| @@ -147,9 +148,9 @@ func TestCoordinatorBindingEvidenceRechecksCAS(t *testing.T) { |
| func TestReplicaReleaseBindingEvidenceRechecksReplay(t *testing.T) { |
| ctx, id := replicaFixture(t) |
| - s, rec := fleetBoxFixture(t) |
| + s, rec := bindingRecordFixture(t) |
| id.Incarnation, _ = Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt) |
| - proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", BoundAt: rec.CreatedAt.UnixMilli()} |
| + proof := ReplicaBindingEvidence{Fleet: "pi", Host: rec.Host, Box: "local", RecordIncarnation: rec.Incarnation} |
| got, err := SetRecordCoordinator(ctx, s, id, replicas.CoordinatorChange{Op: "acquire", Box: "local", BootID: "boot"}, time.Now(), proof) |
| if err != nil { |
| t.Fatal(err) |
| @@ -180,3 +181,12 @@ func TestReplicaReleaseBindingEvidenceRechecksReplay(t *testing.T) { |
| t.Fatalf("refused replay changed record: %v", err) |
| } |
| } |
| + |
| +func bindingRecordFixture(t *testing.T) (release.Store, Record) { |
| + t.Helper() |
| + s, rec := fleetBoxFixture(t) |
| + rec.Incarnation = 2 |
| + judgePut(t, s, RecordKey(rec.Account, rec.App, rec.Host), rec) |
| + judgePut(t, s, HostIncarnationKey(rec.Host), HostIncarnation{Account: rec.Account, App: rec.App, Incarnation: rec.Incarnation, State: SlotLive}) |
| + return s, rec |
| +} |
diff --git a/internal/provision/replicacoordinator.go b/internal/provision/replicacoordinator.go| index 076f6f5a4..4b61dfaf4 100644 |
| --- a/internal/provision/replicacoordinator.go |
| +++ b/internal/provision/replicacoordinator.go |
| @@ -16,14 +16,14 @@ type replicaWriteKey struct{} |
| // ReplicaBindingEvidence is a binding verified by the console for this request. |
| // It authorizes only an unlabelled legacy record; each CAS attempt checks it again. |
| type ReplicaBindingEvidence struct { |
| - Fleet, Host, Box string |
| - BoundAt int64 |
| + Fleet, Host, Box string |
| + RecordIncarnation uint64 |
| } |
| func (b ReplicaBindingEvidence) matches(rec *Record, box string) bool { |
| return b.Fleet != "" && b.Box != "" && b.Host == rec.Host && |
| rec.FleetBox == "" && rec.ReplicaAssignment == nil && |
| - rec.Region == "fleet/"+b.Fleet && b.BoundAt >= rec.CreatedAt.UnixMilli() && box == b.Box |
| + rec.Region == "fleet/"+b.Fleet && b.RecordIncarnation != 0 && b.RecordIncarnation == rec.Incarnation && box == b.Box |
| } |
| func replicaIdentity(rec *Record, id replicas.Identity) error { |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 514f77001..cceeb43e6 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -82,4 +82,4 @@ plan14-root-reads-region-ha-followups.tsv cfb026f1f9d59f325937cbddf26df2d94d5240 |
| plan14-root-reads-region-ha-p3a.tsv f44d209a054eee55fdee54227d419b74c34a9b2fc174c7a0bb74d5c2711a68bb |
| plan14-root-reads-stateless-coordinator-route.tsv 7974cb078e82272605cbc8ef6809c9ae5e0b02edc22ca843cd2ef4b38d9e44e9 |
| plan14-root-reads-stateless-replicas-2.tsv 59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82 |
| -plan14-root-reads-stateless-coordinator-oneboxfleet.tsv 59c0891618b9befae27ebe04d0a67b08c7f7658bca9f1c78bf6d05eb7a708e82 |
| +plan14-root-reads-stateless-coordinator-oneboxfleet.tsv a281947807e484b1b26669df82bc967e1622899a9ec312da7fb1f43b7e30253d |
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv b/internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv| index c0b11ade5..0bfa31538 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-stateless-coordinator-oneboxfleet.tsv |
| @@ -1,4 +1,11 @@ |
| -# Census overlay stateless-coordinator-oneboxfleet, written by census-propose (#369). census-ruling-stateless-coordinator-oneboxfleet, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md. |
| -# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@coverage internal/provision 5f3d19183457f1e05acfa7ae85301731d4f9681732ef94f52c4f57fdf58822ff |
| -# Proposal only: independent #280 approval remains pending with the controller. |
| +# Census overlay stateless-coordinator-oneboxfleet, written by census-propose (#369). census-ruling-stateless-coordinator-oneboxfleet, independent #280 approval required before merge; the proposal card is docs/superpowers/notes/census-proposal-stateless-coordinator-oneboxfleet.md. |
| +# 0 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 new dispositions: 2 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 7869b0a6b0d9839c5fec41c1e72cc24aa08be99ef0f36d032ef6e0fa3b6a387e internal/host/fleetbind.go PublishFleetRouteBinding legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=New wake/startup helper reads the supplied resident Route. Only ready provisioned unlabelled legacy stateless instance rows in this fleet with a nonzero record incarnation publish through the existing WriteFleetBinding CAS path. Copies the registry incarnation into an additive binding field; labelled/set/sidecar rows skip, stateful path unchanged. No new record read or periodic work. registry:Assigned@435,registry:Copies@523,registry:FleetBox@456,registry:FleetBoxes@500,registry:FleetLabel@477,registry:Host@210,registry:Host@293,registry:Incarnation@409,registry:Incarnation@640,registry:Kind@329,registry:Provisioned@311,registry:Region@378,registry:ReplicaIncarnation@568,registry:ReplicaRevision@541,registry:Stateless@273,registry:Status@354 0ec675e80274558323b76e53d75da970fa539705f151af53ed4299693500ea7c |
| +@legacy 5c5e1de99a047f9393f610dc8b9d9f64c47fe2f03b1c407c4fb37df941d63633 internal/host/fleetbind.go fleetBindingHook legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3b: stateless wake skips direct binding I/O and signals the existing reconcile full pass; stateful hook unchanged.;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=Pass the existing wake Route to PublishFleetRouteBinding. Stateless unlabelled legacy rows can publish with the existing takeover=true path; keep signalling existing reconcile. No extra registry/bucket lookup beyond one existing binding GET and CAS PUT for each eligible wake. registry:Host@451,registry:Stateless@127,whole:Route@366 aa377a83ab189fbfb666d190af188724219672a5fbb93ccab4f96d0959ce8115 |
| +@legacy f32f8b181cd3a7df99bd20436235f0d01c0f8cd336f2e96fd4a5f79268d88a0e internal/host/fleetbind.go publishResidentFleetBindings legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3b: startup stateless rows signal the existing reconcile and are excluded by residentBindingHosts; existing registry read and stateful writes unchanged.;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=Pass each stateless resident Route from the existing startup List to PublishFleetRouteBinding, takeover=false. Non-stealing startup and stateful host-selection/write path preserved. No recurring pass and no additional list. registry:Host@560,registry:Stateless@372,whole:Route@358,whole:Route@480,whole:Route@629 5dd4cf0c313655bea95420ebaf0c6a7abf37e0bc2cfd7839bb2bbfb62134465f |
| +internal/host/fleetbind.go PublishFleetRouteBinding legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=New wake/startup helper reads the supplied resident Route. Only ready provisioned unlabelled legacy stateless instance rows in this fleet with a nonzero record incarnation publish through the existing WriteFleetBinding CAS path. Copies the registry incarnation into an additive binding field; labelled/set/sidecar rows skip, stateful path unchanged. No new record read or periodic work. registry:Assigned@435,registry:Copies@523,registry:FleetBox@456,registry:FleetBoxes@500,registry:FleetLabel@477,registry:Host@210,registry:Host@293,registry:Incarnation@409,registry:Incarnation@640,registry:Kind@329,registry:Provisioned@311,registry:Region@378,registry:ReplicaIncarnation@568,registry:ReplicaRevision@541,registry:Stateless@273,registry:Status@354 0ec675e80274558323b76e53d75da970fa539705f151af53ed4299693500ea7c |
| +internal/host/fleetbind.go fleetBindingHook legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3b: stateless wake skips direct binding I/O and signals the existing reconcile full pass; stateful hook unchanged.;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=Pass the existing wake Route to PublishFleetRouteBinding. Stateless unlabelled legacy rows can publish with the existing takeover=true path; keep signalling existing reconcile. No extra registry/bucket lookup beyond one existing binding GET and CAS PUT for each eligible wake. registry:Host@451,registry:Stateless@127,whole:Route@366 aa377a83ab189fbfb666d190af188724219672a5fbb93ccab4f96d0959ce8115 |
| +internal/host/fleetbind.go publishResidentFleetBindings legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3b: startup stateless rows signal the existing reconcile and are excluded by residentBindingHosts; existing registry read and stateful writes unchanged.;rev3=census-ruling-stateless-coordinator-oneboxfleet;basis=Pass each stateless resident Route from the existing startup List to PublishFleetRouteBinding, takeover=false. Non-stealing startup and stateful host-selection/write path preserved. No recurring pass and no additional list. registry:Host@560,registry:Stateless@372,whole:Route@358,whole:Route@480,whole:Route@629 5dd4cf0c313655bea95420ebaf0c6a7abf37e0bc2cfd7839bb2bbfb62134465f |
| +@coverage internal/host 1c21e0eaf7c9ec7bccc0b84f883a0076c052473810ad4bdcce2c167786f5c629 |
| +@coverage internal/provision 230d4c69956277b24d90a9b4d550a9fb1e2d6e2d3d8892779cbb8ded9a1c0fe9 |