fleet restart wake: review round 1 P2 fixes
P2-1: a live record read that fails returns the store's error, so an always-on instance backs off as for any outage. An absent, stale, corrupt or foreign record refuses and is memoised per host for 30 s, so ticks and request wakes read it at most once per window; an index answer clears the memo. P2-2: a shared-secrets wait that wraps replicas.ErrFenced is not a replica fence refusal, so its member event is kept. P2-3, P2-4: the restart witnesses run as a fleet box (fleetWakeFor, labelled record and row), add the moved-to-another-box case refused at the gate through Fleet.Record, assert the recreated case's refusal class, and name the coordinator stand-in. CI fix: the copy_since inventory's pinned whole-record site moves from replicaRecordFacts to replicaRecordObservation with its body. Census overlay re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-fleet-restart-wake.md+3 −3internal/activator/maintenance.go+5 −2internal/activator/replica_fence_refusal_test.go+28 −0internal/console/copysince_paths_test.go+1 −1internal/host/agent.go+4 −3internal/host/fleet_restart_wake_test.go+241 −67internal/host/replicarecord.go+81 −8internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv+6 −6
CI cancelled — superseded by a newer push — run details
CI log
=== gate === go: downloading go1.26.10 (linux/arm64) go version go1.26.10 linux/arm64 .amadan/test-gate.sh go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0 go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0 go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5 go: downloading github.com/benbjohnson/litestream v0.5.14 go: downloading github.com/superfly/ltx v0.5.1 go: downloading golang.org/x/net v0.62.0 go: downloading modernc.org/sqlite v1.55.0 go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0 go: downloading golang.org/x/crypto v0.58.0 go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0 go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2 go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1 go: downloading golang.org/x/sys v0.49.0 go: downloading github.com/oschwald/maxminddb-golang v1.13.1 go: downloading github.com/pion/logging v0.2.4 go: downloading github.com/pion/stun/v3 v3.1.5 go: downloading github.com/pion/turn/v4 v4.1.4 go: downloading github.com/pierrec/lz4/v4 v4.1.22 go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.40 go: downloading github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.14 go: downloading github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.38 go: downloading github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.23 go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.40 go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.40 go: downloading github.com/klauspost/compress v1.20.2 go: downloading github.com/prometheus/client_golang v1.17.0 go: downloading golang.org/x/sync v0.24.0 go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18 go: downloading github.com/pion/transport/v4 v4.0.2 go: downloading github.com/pion/dtls/v3 v3.1.4 go: downloading github.com/wlynxg/anet v0.0.5 go: downloading golang.org/x/text v0.43.0 go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/prometheus/common v0.45.0 go: downloading github.com/cespare/xxhash/v2 v2.3.0 go: downloading github.com/prometheus/client_model v0.5.0 go: downloading github.com/prometheus/procfs v0.12.0 go: downloading google.golang.org/protobuf v1.36.10 go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 go: downloading modernc.org/sqlite v1.55.0 go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e go: downloading github.com/klauspost/compress v1.20.2 go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0 go: downloading github.com/pierrec/lz4/v4 v4.1.22 go: downloading modernc.org/libc v1.74.1 go: downloading modernc.org/libc v1.74.1 go: downloading modernc.org/mathutil v1.7.1 go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec amadan: job cancelled — a newer push superseded it
Intent
<task-notification> <task-id>b6al9m8lz</task-id> <tool-use-id>toolu_015EWyd2czoaMnXiFzhDQJuT</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/b6al9m8lz.output</output-file> <status>completed</status> <summary>Background command "W=/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-restart-wake/.superpowers/sdd/2026-11-21-fleet-restart-wake; head -3 $W/astra-review.sh | tail -1; $W/astra-review.sh $W/review-prompt.md $W/review-astra.md & a=$!; $W/fable-review.sh $W/review-prompt.md $W/review-fable.md & f=$!; wait $a $f; tail -1 $W/review-astra.md; tail -1 $W/review-fable.md" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>bsdss0ot6</task-id> <tool-use-id>toolu_01VAsg5a2kVjNKJL4vhnyGMY</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/bsdss0ot6.output</output-file> <status>completed</status> <summary>Background command "sleep 30; until s=$(amadan ci status carlos/platform -branch fleet-restart-wake 2>&1 | head -1); echo "$s" | grep -q c3733a2 && ! echo "$s" | grep -q "queued\|running"; do sleep 30; done; echo "$s"" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 18.5 g CO₂e (2,376,282 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-restart-wake, 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-fleet-restart-wake.md b/docs/superpowers/notes/census-proposal-fleet-restart-wake.md| index 79c4d568d..967fb1463 100644 |
| --- a/docs/superpowers/notes/census-proposal-fleet-restart-wake.md |
| +++ b/docs/superpowers/notes/census-proposal-fleet-restart-wake.md |
| @@ -10,7 +10,7 @@ Ruling `census-ruling-fleet-restart-wake`. The independent reviewer approves or |
| | `internal/activator/activator.go` `type Service` | body | unchanged (0) | Fleet restart wake Task 1: the per-host journal note maps (wakeFailLogged, heldSeen) move into the embedded wakeNotes struct in wakefaillog.go, which adds fenceSeen. In-memory only; no read added. | |
| | `internal/activator/stateless.go` `Service.statelessObservation` | body | unchanged (6) | Fleet restart wake Task 2: passes the wake ctx to cfg.ReplicaRecord, whose signature now takes a ctx. Same reads; the exec gate fresh record read (statelessFinalRecord, R1) is unchanged and still decides. | |
| | `internal/host/agent.go` `runAgent` | body | unchanged (8) | Fleet restart wake Task 2: cfg.ReplicaRecord = replicaRecordFacts(boxLifetimes, cfg.Record): hands the existing judged record read (haRecordFacts over openDeployStore and boxJudge) as the live read on a lifetime index miss. No read site added here; agent, not root. | |
| -| `internal/host/agent.go` `replicaRecordFacts` | sites | -registry:App, -registry:Host | Fleet restart wake Task 2: the body delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites move there. An index hit is answered as before with no read. On an index miss: one judged record read through cfg.Record (haRecordFacts, the deployment store, the same read the exec gate makes) for this wake; it refuses with replicas.ErrFenced when the read fails, is absent, names another instance, or the route is a sidecar. It never writes the lifetime index. Agent (uid carlos), not root. | |
| +| `internal/host/agent.go` `replicaRecordFacts` | sites | -registry:App, -registry:Host | Fleet restart wake Task 2 and review round 1 P2-1: the body makes one in-memory replicaMissMemo per closure and delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites moved there. An index hit is answered as before with no read. Agent (uid carlos), not root; no read added here. | |
| Envelopes re-pinned: `internal/activator`, `internal/host`. |
| @@ -28,8 +28,8 @@ Recorded dispositions, which each change must still satisfy: |
| New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| -- new `internal/host/replicarecord.go:replicaRecordObservation`: reads +registry:App ×2, +registry:Host ×2, +whole:Route ×2; written legacy, accepted-legacy, frozen |
| +- new `internal/host/replicarecord.go:replicaRecordObservation`: reads +registry:App ×2, +registry:Host ×7, +whole:Route ×2; written legacy, accepted-legacy, frozen |
| -Seal: `8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc` → `5b00311dfd1abdaacf3485e0edb8822871482111aaa41d5128ea3d4654737b2e`. |
| +Seal: `8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc` → `2967f0ba9722910621cedcfafc270cea3268a6de55738667574a20e67fd7f4e5`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/maintenance.go b/internal/activator/maintenance.go| index 883d34bac..89b0c5175 100644 |
| --- a/internal/activator/maintenance.go |
| +++ b/internal/activator/maintenance.go |
| @@ -36,9 +36,12 @@ func fenceRefusal(err error) bool { |
| // replicaFenceRefusal reports whether err is the replica record |
| // observation's refusal (replicas.ErrFenced) and not the activator's own |
| // fence: a wake it ends is journalled once per change of its text |
| -// (noteReplicaFence), with no member event. |
| +// (noteReplicaFence), with no member event. A wait for the instance's |
| +// shared secrets (errStatelessSecretsWaiting) that wraps one is not: the |
| +// member is told of that wait, and of its end past the bound (R21b), as |
| +// before (fleet restart wake, review round 1 P2-2). |
| func replicaFenceRefusal(err error) bool { |
| - return errors.Is(err, replicas.ErrFenced) && !errors.Is(err, ErrFenced) |
| + return errors.Is(err, replicas.ErrFenced) && !errors.Is(err, ErrFenced) && !errors.Is(err, errStatelessSecretsWaiting) |
| } |
| // StopEvidence records local process and replica closure. It grants no lease, |
diff --git a/internal/activator/replica_fence_refusal_test.go b/internal/activator/replica_fence_refusal_test.go| index 8535ed202..7b07890ef 100644 |
| --- a/internal/activator/replica_fence_refusal_test.go |
| +++ b/internal/activator/replica_fence_refusal_test.go |
| @@ -180,3 +180,31 @@ func TestResidentGenuineLaunchFailureStillBacksOff(t *testing.T) { |
| clk.advance(time.Nanosecond) |
| } |
| } |
| + |
| +// A wait for the instance's shared secrets that wraps a replica fence (the |
| +// console refused the coordinator outright, escrow_authority.go) keeps its |
| +// member event: it is not a replica fence refusal, so noteHeldWake tells |
| +// the caller to report it, and the member reads the wait's own words |
| +// (review round 1 P2-2). It is still no failure of the build. |
| +func TestSecretsWaitWrappingAReplicaFenceKeepsItsMemberEvent(t *testing.T) { |
| + err := fmt.Errorf("%w: %w", errStatelessSecretsWaiting, replicas.ErrFenced) |
| + if replicaFenceRefusal(err) { |
| + t.Fatal("a secrets wait is read as a replica fence refusal") |
| + } |
| + if residentFailure(err) { |
| + t.Fatal("a secrets wait counts as a failure") |
| + } |
| + a := &Service{now: time.Now} |
| + logs := captureLog(t) |
| + for i := 0; i < 2; i++ { |
| + if !a.noteHeldWake("shop.example.com", err) { |
| + t.Fatalf("wake %d: the caller is told not to report a secrets wait", i+1) |
| + } |
| + } |
| + if strings.Contains(logs.String(), "not started, refused") { |
| + t.Fatalf("a secrets wait was journalled as a replica fence refusal:\n%s", logs.String()) |
| + } |
| + if got := memberSafeWakeReason(err); got != errStatelessSecretsWaiting.Error() { |
| + t.Fatalf("member event %q, want the secrets wait's words", got) |
| + } |
| +} |
diff --git a/internal/console/copysince_paths_test.go b/internal/console/copysince_paths_test.go| index 21442c079..9cce0ed31 100644 |
| --- a/internal/console/copysince_paths_test.go |
| +++ b/internal/console/copysince_paths_test.go |
| @@ -530,7 +530,7 @@ var copyInventory = map[string]map[string]int{ |
| "internal/console.decideMoveRecovery": 1, |
| "internal/console.targetFenceStep": 1, |
| "internal/host.observedMove": 1, |
| - "internal/host.replicaRecordFacts": 1, |
| + "internal/host.replicaRecordObservation": 1, |
| "internal/provision.Reconcile": 2, |
| "internal/provision.SeedPublishDemoClaim": 1, |
| "internal/provision.importRow": 1, |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index dc2262688..81206e544 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -4355,11 +4355,12 @@ func haRecordFacts(open func(context.Context) (release.Store, error), judge *pro |
| } |
| // replicaRecordFacts is activator.Config.ReplicaRecord on this box: the |
| -// box's lifetime index, and live (Record) on an index miss |
| -// (replicaRecordObservation, replicarecord.go). |
| +// box's lifetime index, and live (Record) on an index miss, paced per host |
| +// while it finds nothing (replicaRecordObservation, replicarecord.go). |
| func replicaRecordFacts(index *provision.LifetimeIndex, live func(context.Context, registry.Route) (activator.RecordFacts, error)) func(context.Context, registry.Route) (activator.RecordFacts, error) { |
| + memo := &replicaMissMemo{} |
| return func(ctx context.Context, rt registry.Route) (activator.RecordFacts, error) { |
| - return replicaRecordObservation(ctx, index, live, rt) |
| + return replicaRecordObservation(ctx, index, live, memo, rt) |
| } |
| } |
diff --git a/internal/host/fleet_restart_wake_test.go b/internal/host/fleet_restart_wake_test.go| index 1973faebc..35ff5c477 100644 |
| --- a/internal/host/fleet_restart_wake_test.go |
| +++ b/internal/host/fleet_restart_wake_test.go |
| @@ -15,6 +15,7 @@ import ( |
| "net/http/httptest" |
| "os" |
| "path/filepath" |
| + "strings" |
| "sync" |
| "sync/atomic" |
| "testing" |
| @@ -37,8 +38,9 @@ func countedFacts(n *atomic.Int64, read func(context.Context, registry.Route) (a |
| // The observation: an index hit answers with no read; a miss reads the |
| // record once, as Record does, and leaves the index as it was; an absent |
| -// record, a failed read, another instance's record and a sidecar keep the |
| -// refusal. |
| +// record, another instance's record and a sidecar keep the refusal; a |
| +// failed read is the store's own error, not a refusal (review round 1 |
| +// P2-1), so an always-on instance backs off as for any store outage. |
| func TestReplicaRecordFactsReadsLiveOnIndexMiss(t *testing.T) { |
| ctx := context.Background() |
| store := release.NewDirStore(t.TempDir()) |
| @@ -95,11 +97,12 @@ func TestReplicaRecordFactsReadsLiveOnIndexMiss(t *testing.T) { |
| if _, ok := index.ReplicaRecord(absent.Host); ok { |
| t.Fatal("an absent record's read wrote the index") |
| } |
| + unreachable := errors.New("store unreachable") |
| failing := replicaRecordFacts(&provision.LifetimeIndex{}, func(context.Context, registry.Route) (activator.RecordFacts, error) { |
| - return activator.RecordFacts{}, errors.New("store unreachable") |
| + return activator.RecordFacts{}, unreachable |
| }) |
| - if _, err := failing(ctx, rt); !errors.Is(err, replicas.ErrFenced) { |
| - t.Fatalf("failed read: %v, want replicas.ErrFenced", err) |
| + if _, err := failing(ctx, rt); !errors.Is(err, unreachable) || errors.Is(err, replicas.ErrFenced) { |
| + t.Fatalf("failed read: %v, want the store's error and no refusal", err) |
| } |
| foreign := replicaRecordFacts(&provision.LifetimeIndex{}, func(context.Context, registry.Route) (activator.RecordFacts, error) { |
| f := want |
| @@ -116,6 +119,70 @@ func TestReplicaRecordFactsReadsLiveOnIndexMiss(t *testing.T) { |
| } |
| } |
| +// A record that stays absent is read at most once per replicaMissPace for |
| +// its host, however many wakes (resident ticks and requests alike, which |
| +// share the closure) ask meanwhile; another host is not held by it; an |
| +// index answer clears the memo, and a store error is never memoised. |
| +func TestReplicaRecordMissIsPacedPerHost(t *testing.T) { |
| + ctx := context.Background() |
| + now := time.Unix(1700000000, 0) |
| + memo := &replicaMissMemo{now: func() time.Time { return now }} |
| + index := &provision.LifetimeIndex{} |
| + var reads atomic.Int64 |
| + var storeDown atomic.Bool |
| + live := func(_ context.Context, rt registry.Route) (activator.RecordFacts, error) { |
| + reads.Add(1) |
| + if storeDown.Load() { |
| + return activator.RecordFacts{}, errors.New("store unreachable") |
| + } |
| + return activator.RecordFacts{}, fmt.Errorf("dirstore: %s: %w", rt.Host, os.ErrNotExist) |
| + } |
| + rt := registry.Route{Account: "bab", App: "shop", Host: "shop.example.com", Kind: "instance"} |
| + // 15 ticks 2 s apart (30 s), each with a request wake beside it. |
| + for i := 0; i < 15; i++ { |
| + for j := 0; j < 2; j++ { |
| + if _, err := replicaRecordObservation(ctx, index, live, memo, rt); !errors.Is(err, replicas.ErrFenced) { |
| + t.Fatalf("tick %d: %v, want the refusal", i, err) |
| + } |
| + } |
| + if i < 14 { |
| + now = now.Add(2 * time.Second) |
| + } |
| + } |
| + if reads.Load() != 1 { |
| + t.Fatalf("an absent record read %d times in one window, want 1", reads.Load()) |
| + } |
| + other := rt |
| + other.Host = "blog.example.com" |
| + replicaRecordObservation(ctx, index, live, memo, other) |
| + if reads.Load() != 2 { |
| + t.Fatalf("another host held by this one's memo: %d reads", reads.Load()) |
| + } |
| + now = now.Add(2 * time.Second) // 30 s since the first read |
| + replicaRecordObservation(ctx, index, live, memo, rt) |
| + if reads.Load() != 3 { |
| + t.Fatalf("no read once the window passed: %d reads", reads.Load()) |
| + } |
| + rec := provision.Record{Account: rt.Account, App: rt.App, Host: rt.Host, CreatedAt: now} |
| + index.Merge(map[string]provision.Record{rt.Host: rec}) |
| + if _, err := replicaRecordObservation(ctx, index, live, memo, rt); err != nil { |
| + t.Fatalf("index hit: %v", err) |
| + } |
| + if memo.held(rt.Host) { |
| + t.Fatal("an index answer left the host memoised") |
| + } |
| + index.Replace(nil) |
| + storeDown.Store(true) |
| + for i := 0; i < 3; i++ { |
| + if _, err := replicaRecordObservation(ctx, index, live, memo, rt); err == nil || errors.Is(err, replicas.ErrFenced) { |
| + t.Fatalf("store error %d: %v, want the error, not a refusal", i, err) |
| + } |
| + } |
| + if reads.Load() != 6 || memo.held(rt.Host) { |
| + t.Fatalf("a store error was memoised: %d reads, held %v", reads.Load(), memo.held(rt.Host)) |
| + } |
| +} |
| + |
| // barrierStore holds every call of the reconcile pass it serves until |
| // release closes or the call's context ends. entered closes on the first. |
| type barrierStore struct { |
| @@ -195,13 +262,16 @@ func (b *restartBackend) StartGenExe(ctx context.Context, rt registry.Route, n u |
| return p, g, err |
| } |
| -// restartRig is a single-copy, always-on, stateless rootfs instance on a |
| -// box wired as the agent wires it (agent.go): Record is haRecordFacts, |
| -// ReplicaRecord is replicaRecordFacts over the box's lifetime index with |
| -// Record as its live read, the ExecBackend's instance-control and rootfs |
| -// gates are ready, the rollout is armed (it gives the activator its |
| -// release book) and the coordinator client is the box's. Only the |
| -// processes are fakes. |
| +// restartRig is a single-copy, always-on, stateless rootfs instance |
| +// assigned to box "box" of fleet "pi", on that box, wired as the agent |
| +// wires it (agent.go): Record is haRecordFacts, ReplicaRecord is |
| +// replicaRecordFacts over the box's lifetime index with Record as its live |
| +// read, Fleet is fleetWakeFor's for a valid identity (so the exec gate |
| +// reads the record through Fleet.Record and checks its box label), the |
| +// ExecBackend's instance-control and rootfs gates are ready, and the |
| +// rollout is armed (it gives the activator its release book). Stand-ins: |
| +// the processes are fakes, and the coordinator client is one for the |
| +// whole test, kept across the restart (newRestartRig says why). |
| type restartRig struct { |
| t *testing.T |
| ctx context.Context |
| @@ -217,11 +287,22 @@ type restartRig struct { |
| pub string |
| events *failedReleaseEvents |
| open func(context.Context) (release.Store, error) |
| - // recordRead, when set, is told of every Record call (the live read's |
| - // and the exec gate's alike). |
| - recordRead func() |
| + // gateRead, when set, is told of every Fleet.Record read (the exec |
| + // gate's fresh record read on a fleet box). |
| + gateRead func() |
| + // liveErr, when set before runtime, is what every Record call answers |
| + // (a deployment store that cannot be read). |
| + liveErr error |
| } |
| +// rigFleet and rigLabel are the fleet and the box the rig's instance is |
| +// assigned to, and rigAssigned the assignment its record and row carry. |
| +const ( |
| + rigFleet = "pi" |
| + rigLabel = "box" |
| + rigAssigned = "assignment-1" |
| +) |
| + |
| func newRestartRig(t *testing.T) *restartRig { |
| prev := activator.GenerationsEnabled() |
| activator.SetGenerations(true) |
| @@ -240,7 +321,8 @@ func newRestartRig(t *testing.T) *restartRig { |
| r.reg = reg |
| r.store = release.NewDirStore(filepath.Join(r.dir, "store")) |
| hibernate := false |
| - r.rec = provision.Record{Hibernate: &hibernate, Schema: 1, Account: "bab", App: "shop", Host: "shop.example.com", Channel: "edge", Runtime: registry.RuntimeRootfsV1, CreatedAt: time.Now().UTC()} |
| + r.rec = provision.Record{Hibernate: &hibernate, Schema: 1, Account: "bab", App: "shop", Host: "shop.example.com", Channel: "edge", Runtime: registry.RuntimeRootfsV1, CreatedAt: time.Now().UTC(), |
| + FleetBox: rigLabel, FleetBoxAt: rigAssigned} |
| if err := provision.CreateRecord(ctx, r.store, r.rec); err != nil { |
| t.Fatal(err) |
| } |
| @@ -248,7 +330,7 @@ func newRestartRig(t *testing.T) *restartRig { |
| r.facts = haRecordFacts(r.open, nil) |
| r.eb = &activator.ExecBackend{ServedPools: testSharedPoolEvidence, DataDir: r.dir, OptDir: opt, RunDirOverride: filepath.Join(r.dir, "run"), Control: &rootfsWireControl{}, NestedOK: func() error { return nil }, RootfsOK: func(context.Context) error { return nil }, RootfsPlacement: func(context.Context, registry.Route) error { return nil }} |
| r.be = &restartBackend{failedReleaseBackend: &failedReleaseBackend{plannedBackend: &plannedBackend{socket: healthySocket(t)}, failedReleaseGates: failedReleaseGates{r.eb}}, started: make(chan string, 16)} |
| - r.rt = registry.Route{Host: r.rec.Host, Account: r.rec.Account, App: r.rec.App, Kind: "instance", Status: "ready", Channel: r.rec.Channel, Runtime: r.rec.Runtime, CreatedAt: r.rec.CreatedAt.Unix(), Version: "A", Stateless: true, DBPath: provision.NestedDBPath(r.dir, r.rec.Host), Socket: filepath.Join(r.eb.RunDirOverride, "instances", provision.InstanceID(r.rec.Host), "app.sock")} |
| + r.rt = registry.Route{Host: r.rec.Host, Account: r.rec.Account, App: r.rec.App, Kind: "instance", Status: "ready", Channel: r.rec.Channel, Runtime: r.rec.Runtime, CreatedAt: r.rec.CreatedAt.Unix(), Version: "A", Stateless: true, Assigned: rigAssigned, DBPath: provision.NestedDBPath(r.dir, r.rec.Host), Socket: filepath.Join(r.eb.RunDirOverride, "instances", provision.InstanceID(r.rec.Host), "app.sock")} |
| data := []byte("rootfs A") |
| if err := release.StageArtifact(opt, r.rec.Account, "A", r.rec.App, data); err != nil { |
| t.Fatal(err) |
| @@ -276,11 +358,14 @@ func newRestartRig(t *testing.T) *restartRig { |
| t.Fatal(err) |
| } |
| // The box's coordinator client, renewed by its own worker and shared |
| - // with the backend's escrow check, as the agent wires it. It is kept |
| - // across the restart below: this witness is about the record |
| + // with the backend's escrow check, as the agent wires it. A stand-in |
| + // across the restart: one client is kept for both lives, where a real |
| + // restart makes a fresh one. This witness is about the record |
| // observation, and a fresh client would need the files store and the |
| - // sealed copy a real box has to let the escrow check pass. |
| - r.coord = newCoordinatorClient(r.store, "", "", "box", "") |
| + // complete sealed copy a real box has to let the escrow check |
| + // (prepareStatelessEscrow) pass. The first real roll witnesses a fresh |
| + // client. |
| + r.coord = newCoordinatorClient(r.store, "", "", rigLabel, "") |
| t.Cleanup(func() { closeReplicaCoordinator(r.coord) }) |
| r.coord.Start(ctx) |
| r.eb.Coordination = r.coord |
| @@ -296,9 +381,10 @@ func newRestartRig(t *testing.T) *restartRig { |
| // wires it, with its rollout armed. Both are stopped at the test's end. |
| func (r *restartRig) runtime(index *provision.LifetimeIndex, reads *atomic.Int64) *activator.Service { |
| r.t.Helper() |
| + liveErr := r.liveErr |
| record := func(ctx context.Context, rt registry.Route) (activator.RecordFacts, error) { |
| - if r.recordRead != nil { |
| - r.recordRead() |
| + if liveErr != nil { |
| + return activator.RecordFacts{}, liveErr |
| } |
| return r.facts(ctx, rt) |
| } |
| @@ -307,6 +393,15 @@ func (r *restartRig) runtime(index *provision.LifetimeIndex, reads *atomic.Int64 |
| r.eb.Cfg = cfg |
| svc := activator.New(cfg, r.be, r.reg) |
| svc.Routes = r.reg |
| + fleet := fleetWakeFor(func(string) string { return "" }, FleetIdentity{Fleet: rigFleet, Label: rigLabel}, nil, r.store) |
| + gate := fleet.Record |
| + fleet.Record = func(ctx context.Context, rt registry.Route) (*provision.Record, error) { |
| + if r.gateRead != nil { |
| + r.gateRead() |
| + } |
| + return gate(ctx, rt) |
| + } |
| + svc.Fleet = fleet |
| svc.MarkRootfsSwept() |
| svc.Coordinator = r.coord |
| svc.ObserveReplicaRelease = activator.ObservedReplicaRelease |
| @@ -432,54 +527,133 @@ func TestRestartedAgentStartsAlwaysOnBeforeFirstScan(t *testing.T) { |
| } |
| } |
| -// TestRestartedAgentLiveReadStillMeetsTheExecGate is R1 after the live |
| -// read: the instance is deleted and created again (a new lifetime) between |
| -// the restarted agent's live record read and its exec gate. The gate's own |
| -// fresh record read refuses the launch: nothing starts, and the wake is a |
| -// refusal, not a failure. |
| +// notBackingOff fails the test if a request now is answered with the |
| +// resident backoff: the wake just refused counted as a failure. |
| +func (r *restartRig) notBackingOff(svc *activator.Service, what string) { |
| + r.t.Helper() |
| + if code, body := r.request(svc); code == http.StatusServiceUnavailable && strings.Contains(body, "instance is restarting") { |
| + r.t.Fatalf("%s: the next request meets the resident backoff: the refusal counted as a failure", what) |
| + } |
| +} |
| + |
| +// R1 after the live read, on a fleet box: between the restarted agent's |
| +// live record read and its exec gate, the record changes under it. The |
| +// gate's own fresh read (through Fleet.Record) refuses the launch and |
| +// nothing starts (review round 1 P2-3). |
| +// |
| +// The refusal's class (P2-4): a recreated record is the stateless final |
| +// check's ErrFenced, a refusal, so the next request meets no backoff. A |
| +// record labelled for another box is currentWakeRoute's |
| +// errRouteChangedUnderLease, which residentFailure counts as a failure on |
| +// main as before this branch (refusal false below); that classification |
| +// is not this change's, and is reported to the controller. |
| func TestRestartedAgentLiveReadStillMeetsTheExecGate(t *testing.T) { |
| - r := newRestartRig(t) |
| - r.firstLife() |
| + for _, tc := range []struct { |
| + name string |
| + refusal bool |
| + change func(r *restartRig) error |
| + }{ |
| + {"recreated", true, func(r *restartRig) error { |
| + // Deleted and created again: a new lifetime, still this box's. |
| + if err := provision.DeleteRecord(r.ctx, r.store, r.rec.Account, r.rec.App, r.rec.Host); err != nil { |
| + return err |
| + } |
| + again := r.rec |
| + again.CreatedAt = r.rec.CreatedAt.Add(time.Minute) |
| + return provision.CreateRecord(r.ctx, r.store, again) |
| + }}, |
| + {"moved to another box", false, func(r *restartRig) error { |
| + cur, etag, err := provision.GetRecordETag(r.ctx, r.store, r.rec.Account, r.rec.App, r.rec.Host) |
| + if err != nil { |
| + return err |
| + } |
| + cur.FleetBox, cur.FleetBoxAt = "other-box", "assignment-2" |
| + return provision.UpdateRecord(r.ctx, r.store, *cur, etag) |
| + }}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + r := newRestartRig(t) |
| + r.firstLife() |
| + var changed atomic.Bool |
| + r.be.beforeExec = func() { |
| + if !changed.CompareAndSwap(false, true) { |
| + return |
| + } |
| + if err := tc.change(r); err != nil { |
| + t.Error(err) |
| + } |
| + } |
| + var after atomic.Int64 |
| + r.gateRead = func() { |
| + if changed.Load() { |
| + after.Add(1) |
| + } |
| + } |
| + var reads atomic.Int64 |
| + svc := r.runtime(&provision.LifetimeIndex{}, &reads) |
| + if code, _ := r.request(svc); code != http.StatusServiceUnavailable { |
| + t.Fatalf("request across the change: %d, want 503", code) |
| + } |
| + if !changed.Load() { |
| + t.Fatal("the wake never reached its exec seam") |
| + } |
| + if reads.Load() != 1 { |
| + t.Fatalf("live record reads = %d, want 1", reads.Load()) |
| + } |
| + if after.Load() == 0 { |
| + t.Fatal("no Fleet.Record read after the change: the exec gate did not decide") |
| + } |
| + select { |
| + case build := <-r.be.started: |
| + t.Fatalf("%s started across the change", build) |
| + default: |
| + } |
| + if tc.refusal { |
| + r.notBackingOff(svc, tc.name) |
| + } |
| + }) |
| + } |
| +} |
| - var recreated atomic.Bool |
| - r.be.beforeExec = func() { |
| - if !recreated.CompareAndSwap(false, true) { |
| - return |
| - } |
| +// A restarted agent whose instance record is absent (an index miss the |
| +// live read cannot fill) is refused with one live read for many request |
| +// wakes, with no backoff; one whose deployment store cannot be read backs |
| +// off: the next request meets the resident backoff, and no read is made |
| +// for it (review round 1 P2-1). |
| +func TestRestartedAgentLiveReadMissPacedStoreErrorBacksOff(t *testing.T) { |
| + t.Run("absent record", func(t *testing.T) { |
| + r := newRestartRig(t) |
| + r.firstLife() |
| if err := provision.DeleteRecord(r.ctx, r.store, r.rec.Account, r.rec.App, r.rec.Host); err != nil { |
| - t.Error(err) |
| - return |
| + t.Fatal(err) |
| } |
| - again := r.rec |
| - again.CreatedAt = r.rec.CreatedAt.Add(time.Minute) |
| - if err := provision.CreateRecord(r.ctx, r.store, again); err != nil { |
| - t.Error(err) |
| + var reads atomic.Int64 |
| + svc := r.runtime(&provision.LifetimeIndex{}, &reads) |
| + for i := 0; i < 5; i++ { |
| + code, body := r.request(svc) |
| + if code != http.StatusServiceUnavailable || strings.Contains(body, "instance is restarting") { |
| + t.Fatalf("request %d: %d %q, want the fence's 503", i+1, code, body) |
| + } |
| } |
| - } |
| - var after atomic.Int64 |
| - r.recordRead = func() { |
| - if recreated.Load() { |
| - after.Add(1) |
| + if reads.Load() != 1 { |
| + t.Fatalf("live record reads = %d for five wakes, want 1", reads.Load()) |
| } |
| - } |
| - var reads atomic.Int64 |
| - svc := r.runtime(&provision.LifetimeIndex{}, &reads) |
| - code, _ := r.request(svc) |
| - if code != http.StatusServiceUnavailable { |
| - t.Fatalf("request across a recreated record: %d, want 503", code) |
| - } |
| - if !recreated.Load() { |
| - t.Fatal("the wake never reached its exec seam") |
| - } |
| - if reads.Load() != 1 { |
| - t.Fatalf("live record reads = %d, want 1", reads.Load()) |
| - } |
| - if after.Load() == 0 { |
| - t.Fatal("no record read after the recreation: the exec gate did not decide") |
| - } |
| - select { |
| - case build := <-r.be.started: |
| - t.Fatalf("%s started across a recreated record", build) |
| - default: |
| - } |
| + }) |
| + t.Run("store error", func(t *testing.T) { |
| + r := newRestartRig(t) |
| + r.firstLife() |
| + r.liveErr = errors.New("deployment store: unreachable") |
| + var reads atomic.Int64 |
| + svc := r.runtime(&provision.LifetimeIndex{}, &reads) |
| + if code, _ := r.request(svc); code != http.StatusServiceUnavailable { |
| + t.Fatalf("first request: %d, want 503", code) |
| + } |
| + code, body := r.request(svc) |
| + if code != http.StatusServiceUnavailable || !strings.Contains(body, "instance is restarting") { |
| + t.Fatalf("second request: %d %q, want the resident backoff", code, body) |
| + } |
| + if reads.Load() != 1 { |
| + t.Fatalf("live record reads = %d, want 1 (none inside the backoff)", reads.Load()) |
| + } |
| + }) |
| } |
diff --git a/internal/host/replicarecord.go b/internal/host/replicarecord.go| index ee6de5702..082e52fc0 100644 |
| --- a/internal/host/replicarecord.go |
| +++ b/internal/host/replicarecord.go |
| @@ -2,6 +2,11 @@ package host |
| import ( |
| "context" |
| + "errors" |
| + "fmt" |
| + "os" |
| + "sync" |
| + "time" |
| "github.com/carlosframework/platform/internal/activator" |
| "github.com/carlosframework/platform/internal/provision" |
| @@ -10,6 +15,58 @@ import ( |
| "github.com/carlosframework/platform/internal/replicas" |
| ) |
| +// replicaMissPace is how long a host whose live record read found no |
| +// record it may use (absent, judged stale, corrupt, or another instance's) |
| +// is refused with no read again (replicaMissMemo): its record is not |
| +// read more than once per window, by resident ticks and request wakes |
| +// together (fleet restart wake, review round 1 P2-1). |
| +const replicaMissPace = 30 * time.Second |
| + |
| +// replicaMissMemo is the agent's per-host negative memo of live record |
| +// reads that found nothing usable, by host: when the last one was. Cleared |
| +// for a host when the index answers for it or a live read succeeds. now |
| +// is time.Now when nil. |
| +type replicaMissMemo struct { |
| + mu sync.Mutex |
| + at map[string]time.Time |
| + now func() time.Time |
| + pace time.Duration |
| +} |
| + |
| +func (m *replicaMissMemo) clock() time.Time { |
| + if m.now != nil { |
| + return m.now() |
| + } |
| + return time.Now() |
| +} |
| + |
| +// held reports whether host missed within the pace window. |
| +func (m *replicaMissMemo) held(host string) bool { |
| + m.mu.Lock() |
| + defer m.mu.Unlock() |
| + at, ok := m.at[host] |
| + pace := m.pace |
| + if pace == 0 { |
| + pace = replicaMissPace |
| + } |
| + return ok && m.clock().Sub(at) < pace |
| +} |
| + |
| +func (m *replicaMissMemo) miss(host string) { |
| + m.mu.Lock() |
| + defer m.mu.Unlock() |
| + if m.at == nil { |
| + m.at = map[string]time.Time{} |
| + } |
| + m.at[host] = m.clock() |
| +} |
| + |
| +func (m *replicaMissMemo) forget(host string) { |
| + m.mu.Lock() |
| + defer m.mu.Unlock() |
| + delete(m.at, host) |
| +} |
| + |
| // replicaRecordObservation is a stateless launch's record observation for |
| // rt (replicaRecordFacts). The reconcile pass's lifetime index answers it |
| // with no read. On an index miss (a restarted agent before its first scan, |
| @@ -18,27 +75,43 @@ import ( |
| // the wake does not wait for the scan (fleet restart wake, 2026-11-21). |
| // |
| // The live read never writes the index: the index stays the scan's |
| -// observation, and the next scan replaces it whole. A live read that |
| -// fails, is absent (live nil), or names another instance, and any |
| -// sidecar's miss, refuse with replicas.ErrFenced, as every miss did |
| -// before. An index hit for another instance refuses with no read. |
| -// Whatever this observes, the exec gate reads the record again |
| +// observation, and the next scan replaces it whole. What the live read |
| +// finds decides the answer: |
| +// - the record, for rt's own account, app and host: its facts; |
| +// - no record it may use (absent or judged stale: os.ErrNotExist; |
| +// corrupt; another instance's facts): a refusal, replicas.ErrFenced, |
| +// as every miss was before, and memo holds the host for |
| +// replicaMissPace, refused with no read; |
| +// - any other error (the store unreachable, a lifetime it could not |
| +// judge): that error, which is not a refusal, so an always-on |
| +// instance backs off as for any store outage (residentFailure). |
| +// |
| +// A sidecar's miss, and a box with no live read (live nil), refuse with no |
| +// read. An index hit for another instance refuses with no read. Whatever |
| +// this observes, the exec gate reads the record again |
| // (statelessFinalRecord, R1) and refuses a launch whose record moved or |
| // was recreated since. |
| -func replicaRecordObservation(ctx context.Context, index *provision.LifetimeIndex, live func(context.Context, registry.Route) (activator.RecordFacts, error), rt registry.Route) (activator.RecordFacts, error) { |
| +func replicaRecordObservation(ctx context.Context, index *provision.LifetimeIndex, live func(context.Context, registry.Route) (activator.RecordFacts, error), memo *replicaMissMemo, rt registry.Route) (activator.RecordFacts, error) { |
| acct := release.RouteAccount(rt) |
| if rec, ok := index.ReplicaRecord(rt.Host); ok { |
| + memo.forget(rt.Host) |
| if rec.Account != acct || rec.App != rt.App { |
| return activator.RecordFacts{}, replicas.ErrFenced |
| } |
| return activator.RecordFactsOf(rec) |
| } |
| - if live == nil || rt.IsSidecar() { |
| + if live == nil || rt.IsSidecar() || memo.held(rt.Host) { |
| return activator.RecordFacts{}, replicas.ErrFenced |
| } |
| facts, err := live(ctx, rt) |
| - if err != nil || facts.Identity.Account != acct || facts.Identity.App != rt.App || facts.Identity.Host != rt.Host { |
| + switch { |
| + case errors.Is(err, os.ErrNotExist), errors.Is(err, provision.ErrRecordCorrupt), |
| + err == nil && (facts.Identity.Account != acct || facts.Identity.App != rt.App || facts.Identity.Host != rt.Host): |
| + memo.miss(rt.Host) |
| return activator.RecordFacts{}, replicas.ErrFenced |
| + case err != nil: |
| + return activator.RecordFacts{}, fmt.Errorf("%s: read the record on a lifetime index miss: %w", rt.Host, err) |
| } |
| + memo.forget(rt.Host) |
| return facts, nil |
| } |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index f594e7626..bebca095b 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -268,4 +268,4 @@ plan14-root-reads-edge-held-cap.tsv f06c832e5595b5a0c256639131d094a94da4505d0e64 |
| plan14-root-reads-fleet-seeded-create-1.tsv 5ce0990b80e0447439484d36a7a87af70708aa5ce113491aecc09d87167277f0 |
| plan14-root-reads-fleet-seeded-create-2.tsv 8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc |
| plan14-root-reads-fleet-seeded-create-3.tsv 8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc |
| -plan14-root-reads-fleet-restart-wake.tsv 5b00311dfd1abdaacf3485e0edb8822871482111aaa41d5128ea3d4654737b2e |
| +plan14-root-reads-fleet-restart-wake.tsv 2967f0ba9722910621cedcfafc270cea3268a6de55738667574a20e67fd7f4e5 |
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv b/internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv| index abc837b8b..7a90efd37 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-fleet-restart-wake.tsv |
| @@ -4,15 +4,15 @@ |
| @legacy 00223a60a908c79facee202b0efc314afc04e90e0cf3b386697af290312e9077 internal/activator/activator.go Service.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-hotfix281;basis=Startup repeats the existing Kind and Hibernate checks; error logging moved to serveWakeError. A request held through startup re-reads its own route's Socket and Addr and can only refuse (wake-timeout 503) when recovery moved them; agent-side, deny-only, no root decision.;rev3=census-ruling-edge-request-records;basis=passes the member request r to begin's new req parameter; no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance is the activator's; same deploy-safety for binary rows;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: a verified HA hop this box cannot serve gets the holder diagnostic; two new whole:Route sites pass the route to answerForwarded/noteNoHolder; no new kind of read;rev3=census-ruling-region-ha-g2-fixes;basis=Refuse latched HA lease loss before startup wait or proxy accounting, and schedule bounded recovery; reads supplied route, no new external read here.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 2: after begin succeeds, edge.ReleaseMoveTicket(r) ends the request's in-memory admission ticket; on the sidecar path the same after BeginSidecarRequest; no read added;rev3=census-ruling-held-move-speed;basis=after begin succeeds, wraps r with an edge.StreamEnd (a cancellable child context) and tracks it under rt.Host in the in-memory moveStreams until the request ends (+registry:Host: the supplied route's Host as the map key); no new kind of read, no root decision;rev3=census-ruling-retry-after-503;basis=the sidecar-asleep 503 is written through edge.Unavailable (Retry-After 5 unchanged, adds answer/box headers); no read added;rev3=census-ruling-stateless-replicas-4-drill3;basis=review round 1 (R27): its four refusals before the proxy runs (HA lease refusal, awaitStartup, the near-startup recheck, begin) call serveWakeErrorBeforeApp instead of serveWakeError; no read added, same 18 sites; the activator in the agent, no root decision;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: the sidecar request path answers the maintenance 503 for fenceRefusal (the activator ErrFenced or replicas.ErrFenced, bare or wrapped) where it named ErrFenced. No read added; agent, not root. registry:Addr@1149,registry:Addr@1163,registry:Host@1074,registry:Host@1283,registry:Host@3988,registry:Socket@1120,registry:Socket@1136,whole:Route@1099,whole:Route@1217,whole:Route@1351,whole:Route@198,whole:Route@261,whole:Route@2900,whole:Route@3001,whole:Route@307,whole:Route@3765,whole:Route@3837,whole:Route@544 d4ebd01b6ab7df47ebfc7141db4411afdf0c4139bd98239229a1594a7dcd5fcd |
| @legacy 1751711c51118973ae1a6adb45d4916b2e86ec6503c1978c92fd56ec19157ffd internal/activator/activator.go Service.wake legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-wake-storm-cap;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): waits for a box-wide wake slot (acquireWakeSlot, an in-memory buffered channel) before doWake; the fence/shutdown/retired/disabled refusals move into refuseWakeLocked and are asked again after admission (one fewer direct whole-Route read here: a.disabled(e.route) now runs inside refuseWakeLocked, same value); e.wakeStart is set at admission and e.admitted marks it. Only waits and refuses more; no new read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.;rev3=census-ruling-region-ha-g2-fixes;basis=Bind recovery wakes to the service lifetime; no new read.;rev3=census-ruling-edge-page-cache-1;basis=the generation-current call is now noteCurrent(e) instead of noteCurrent(e.host, e.gen.N), so the new noteCurrent can also publish the process's page cache launch inputs; read sites unchanged (16); no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: a failed wake that journalledWakeFailure counts as a real failure is logged through logWakeFailure (rate-limited per host, in memory); a successful wake calls clearWakeFailure. Agent, not root; reads the error already in hand; no read added;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11 log dedupe): before a failed wake's member event, noteHeldWake (in-memory, per host, under the leaf wakeFailMu) tells whether the failure is held by a release attempt with no backoff and is the same (attempt ID, error class) as the host's last one; a repeat writes no event, a first or changed one writes one journal line and the event. Reads only the error in hand; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501, activator-settle-wait) adds the background counter increment and deferred decrement at entry; this branch (Task 5) keeps its own changes. Both kept as-is; no read added.;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: a wakeReturned test seam (nil in production) after doWake; on a failed wake of an entry the write fence marked (e.writeFenced, in memory) e.err wraps ErrHALeaseUnavailable; at the awake transition a marked entry begins the existing StopLeaseLost stop before e.ready closes. Only refuses and stops more; no read added; no kill, no root call.;rev3=census-ruling-drain-quiesce-1062;basis=#1062: the failed-wake cleanup calls endHARecoveryLocked(e) as it removes the entry (in-memory, under a.mu); read sites unchanged, no read added;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: comment only. The said-already branch now also covers a replica fence refusal, which noteHeldWake journals once per change (noteReplicaFence) with no member event. No read added. registry:Socket@9337,registry:Socket@9498,registry:Stateless@11206,registry:Stateless@11954,whole:Route@11197,whole:Route@11252,whole:Route@11956,whole:Route@1811,whole:Route@3420,whole:Route@3790,whole:Route@3947,whole:Route@515,whole:Route@7599,whole:Route@9290,whole:Route@9339,whole:Route@9500 3ae7d593248c291799430f4788a56e2f541cb1f6f8aa124bb414c37ba3ababc8 |
| @legacy ba2a893b6c00d0202948b53ed25284230051fe2b873e2eb517a965d0874e8b7c internal/activator/stateless.go Service.statelessObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry the current attempt record facts and canonical target into the existing immutable observation carrier. Reuse a matching carrier, never lifetime-index or process-global release evidence. Fix 3a round 1 I2: obtain preparation facts from the existing reconcile snapshot, not another bucket read. Freeze the observation for this attempt; no snapshot grants launch permission. The final backend gate freshly validates record placement, identity and released deploy.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2: passes the wake ctx to cfg.ReplicaRecord, whose signature now takes a ctx. Same reads; the exec gate fresh record read (statelessFinalRecord, R1) is unchanged and still decides. whole:Route@201,whole:Route@337,whole:Route@389,whole:Route@496,whole:Route@714,whole:Route@765 54934202bd46b45496ee4aa7ed1e401d39f636411356f3567e4ac5613fdc18a5 |
| -@legacy 097dc63ee07d967fe443bf516d7b89d5eaa77b9b14e00e9c9ba83716299f2fb4 internal/host/replicarecord.go replicaRecordObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2, new: replicaRecordFacts logic. Index hit: the reconcile pass snapshot, account and app must match, no read. Index miss: one call of live (cfg.Record, haRecordFacts: a judged read of the host record from the deployment store, the same read the exec gate makes), only for a non-sidecar route; its facts must name rt account, app and host; any error or mismatch refuses with replicas.ErrFenced. Never writes the lifetime index. Agent (uid carlos), not root; root reads nothing new. registry:App@333,registry:App@636,registry:Host@279,registry:Host@669,whole:Route@240,whole:Route@558 b2863b149e268a21ed3e68e8f5d45ce51d4558bae7e0cf3409285630645b9d71 |
| -@legacy a1cd71170eb29fe964b5d31315d7adf0831e6ca964f52abce88d5a1d2d7a7d8f internal/host/agent.go replicaRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Fix 3a round 1 I2: read existing in-memory reconcile snapshot for release preparation, require account/app/host match, derive RecordFacts. Missing snapshot refuses until reconciliation; fresh final record check still required.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2: the body delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites move there. An index hit is answered as before with no read. On an index miss: one judged record read through cfg.Record (haRecordFacts, the deployment store, the same read the exec gate makes) for this wake; it refuses with replicas.ErrFenced when the read fails, is absent, names another instance, or the route is a sidecar. It never writes the lifetime index. Agent (uid carlos), not root. whole:Route@340 5daf86fc8f2b8c8710934c646ae4cc5c91d52a6918ab2ced6b864b26e5da91bc |
| +@legacy 8733d016dfa8cffeffb1fe4caf09cf5c6327422447bd6c5975c16bb3adc2c98c internal/host/replicarecord.go replicaRecordObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2, new; review round 1 P2-1. Index hit: the reconcile pass snapshot, account and app must match, no read, and the host memo is cleared. Index miss on a non-sidecar route not held by the memo: one call of live (cfg.Record, haRecordFacts: the judged read of the host record from the deployment store, the same read the exec gate makes). Its facts must name rt account, app and host. Absent, judged stale, corrupt or foreign: refuses with replicas.ErrFenced and memoises the host for 30 s (rt.Host keys an in-memory map: the added registry:Host sites), so no further read for it in that window. Any other read error is returned wrapped, not as a refusal, so an always-on instance backs off. Never writes the lifetime index. Agent (uid carlos), not root; root reads nothing new. registry:App@379,registry:App@795,registry:Host@1027,registry:Host@1057,registry:Host@302,registry:Host@331,registry:Host@534,registry:Host@828,registry:Host@850,whole:Route@263,whole:Route@626 417d767a42111287e35a2bced6d5af57cb072841eeb9c1bad417e91452c63fc5 |
| +@legacy e529c655081a82e9f84567d1d3172ab3a5f07796def72f19e3b720e930f7cb17 internal/host/agent.go replicaRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Fix 3a round 1 I2: read existing in-memory reconcile snapshot for release preparation, require account/app/host match, derive RecordFacts. Missing snapshot refuses until reconciliation; fresh final record check still required.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2 and review round 1 P2-1: the body makes one in-memory replicaMissMemo per closure and delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites moved there. An index hit is answered as before with no read. Agent (uid carlos), not root; no read added here. whole:Route@374 9dfbeb4f8231b6d15c937ad237dacf0d2dccb58b5229989a983da91af020348a |
| internal/activator/activator.go Service.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-hotfix281;basis=Startup repeats the existing Kind and Hibernate checks; error logging moved to serveWakeError. A request held through startup re-reads its own route's Socket and Addr and can only refuse (wake-timeout 503) when recovery moved them; agent-side, deny-only, no root decision.;rev3=census-ruling-edge-request-records;basis=passes the member request r to begin's new req parameter; no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance is the activator's; same deploy-safety for binary rows;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: a verified HA hop this box cannot serve gets the holder diagnostic; two new whole:Route sites pass the route to answerForwarded/noteNoHolder; no new kind of read;rev3=census-ruling-region-ha-g2-fixes;basis=Refuse latched HA lease loss before startup wait or proxy accounting, and schedule bounded recovery; reads supplied route, no new external read here.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 2: after begin succeeds, edge.ReleaseMoveTicket(r) ends the request's in-memory admission ticket; on the sidecar path the same after BeginSidecarRequest; no read added;rev3=census-ruling-held-move-speed;basis=after begin succeeds, wraps r with an edge.StreamEnd (a cancellable child context) and tracks it under rt.Host in the in-memory moveStreams until the request ends (+registry:Host: the supplied route's Host as the map key); no new kind of read, no root decision;rev3=census-ruling-retry-after-503;basis=the sidecar-asleep 503 is written through edge.Unavailable (Retry-After 5 unchanged, adds answer/box headers); no read added;rev3=census-ruling-stateless-replicas-4-drill3;basis=review round 1 (R27): its four refusals before the proxy runs (HA lease refusal, awaitStartup, the near-startup recheck, begin) call serveWakeErrorBeforeApp instead of serveWakeError; no read added, same 18 sites; the activator in the agent, no root decision;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: the sidecar request path answers the maintenance 503 for fenceRefusal (the activator ErrFenced or replicas.ErrFenced, bare or wrapped) where it named ErrFenced. No read added; agent, not root. registry:Addr@1149,registry:Addr@1163,registry:Host@1074,registry:Host@1283,registry:Host@3988,registry:Socket@1120,registry:Socket@1136,whole:Route@1099,whole:Route@1217,whole:Route@1351,whole:Route@198,whole:Route@261,whole:Route@2900,whole:Route@3001,whole:Route@307,whole:Route@3765,whole:Route@3837,whole:Route@544 d4ebd01b6ab7df47ebfc7141db4411afdf0c4139bd98239229a1594a7dcd5fcd |
| internal/activator/activator.go Service.serveWakeError diagnostic C,J4 rev3=PROPOSED-seed; incarnation-keyed missing-files diagnostics and indexed retry results; throttles output only and grants no retry, stop or launch;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more case, errLeaseRefused (a born-HA host outside the nested layout or an HA acquire's refusal): logged at most once per diagnostic window (allowFilesDiagnostic(rt.Host, ...)) and answered 503 with Retry-After: 10; the other cases unchanged; +registry:Host x2 are rt.Host in that call and the log line; it only answers;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: two new answers, a resident inside its backoff gets 503 with Retry-After (RFS-3-C16), and a rootfs row refused before the lease (errRootfsNotAdmitted) gets the existing wake-failed 503; no read added;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: for a verified HA hop, a held lease answers 503 Retry-After 1 with X-Carlos-Holder (answerForwarded) and every other refusal adds X-Carlos-Holder: none (noteNoHolder); legacy routes and cancellation unchanged; same reads;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: neutral admission 503 with Retry-After before forwarded-holder diagnostics; no new read, no holder identity. Fix R1: distinguish startup from drain/shutdown using the same admission state; retain 503, Retry-After, no-store and removal of holder identity. Read sites unchanged.;rev3=census-ruling-region-ha-g2-fixes;basis=Answer latched HA loss and pool refusal with the shared unavailable response; no new read.;rev3=census-ruling-region-ha-shutting-down-retry;basis=Task 0: errShuttingDown (a request met by Shutdown, #292) is answered with the existing admission unavailable 503 (Retry-After: 10, no-store, holder removed), before answerForwarded, instead of the default wake-failed 503 with no Retry-After and a wake log line; no new read, read sites unchanged.;rev3=census-ruling-retry-after-503;basis=every case answers through edge.Unavailable with its own site name; Retry-After values unchanged; rootfs-not-admitted and the default wake-failed answer now carry Retry-After 5 (#421); no read added;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: the fence case is fenceRefusal, so a replicas.ErrFenced refusal answers the maintenance 503 as ErrFenced does, not wake-failed. No read added; agent, not root. registry:Host@1918,registry:Host@1982,registry:Host@3484,registry:Host@3548,whole:Route@1111 ab4c2b11294a91e1de128ad0bf38d98ee3b20d89ee7b8b3ec205f4ae05229d94 |
| internal/activator/activator.go Service.wake legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-wake-storm-cap;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): waits for a box-wide wake slot (acquireWakeSlot, an in-memory buffered channel) before doWake; the fence/shutdown/retired/disabled refusals move into refuseWakeLocked and are asked again after admission (one fewer direct whole-Route read here: a.disabled(e.route) now runs inside refuseWakeLocked, same value); e.wakeStart is set at admission and e.admitted marks it. Only waits and refuses more; no new read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.;rev3=census-ruling-region-ha-g2-fixes;basis=Bind recovery wakes to the service lifetime; no new read.;rev3=census-ruling-edge-page-cache-1;basis=the generation-current call is now noteCurrent(e) instead of noteCurrent(e.host, e.gen.N), so the new noteCurrent can also publish the process's page cache launch inputs; read sites unchanged (16); no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: a failed wake that journalledWakeFailure counts as a real failure is logged through logWakeFailure (rate-limited per host, in memory); a successful wake calls clearWakeFailure. Agent, not root; reads the error already in hand; no read added;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11 log dedupe): before a failed wake's member event, noteHeldWake (in-memory, per host, under the leaf wakeFailMu) tells whether the failure is held by a release attempt with no backoff and is the same (attempt ID, error class) as the host's last one; a repeat writes no event, a first or changed one writes one journal line and the event. Reads only the error in hand; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501, activator-settle-wait) adds the background counter increment and deferred decrement at entry; this branch (Task 5) keeps its own changes. Both kept as-is; no read added.;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: a wakeReturned test seam (nil in production) after doWake; on a failed wake of an entry the write fence marked (e.writeFenced, in memory) e.err wraps ErrHALeaseUnavailable; at the awake transition a marked entry begins the existing StopLeaseLost stop before e.ready closes. Only refuses and stops more; no read added; no kill, no root call.;rev3=census-ruling-drain-quiesce-1062;basis=#1062: the failed-wake cleanup calls endHARecoveryLocked(e) as it removes the entry (in-memory, under a.mu); read sites unchanged, no read added;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: comment only. The said-already branch now also covers a replica fence refusal, which noteHeldWake journals once per change (noteReplicaFence) with no member event. No read added. registry:Socket@9337,registry:Socket@9498,registry:Stateless@11206,registry:Stateless@11954,whole:Route@11197,whole:Route@11252,whole:Route@11956,whole:Route@1811,whole:Route@3420,whole:Route@3790,whole:Route@3947,whole:Route@515,whole:Route@7599,whole:Route@9290,whole:Route@9339,whole:Route@9500 3ae7d593248c291799430f4788a56e2f541cb1f6f8aa124bb414c37ba3ababc8 |
| internal/activator/activator.go type Service authority B,C,D,F,J4 rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): one field, Fleet (activator.FleetWake: the box's fleet state, not on a fleet by default, on a fleet with a known label and a record reader, or on a fleet with an invalid identity), set by the agent before Start and read only by routeCurrentUnderLease. No read in the declaration. Agent, not root.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing; merge of origin/main 6f1f6ca6: main's one field, Fleet (activator.FleetWake), is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: one field, replicaPolicies (host to the newest observed replica deploy and this box label, under mu), set only by SetReplicaDeploy; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: one more in-memory field, replicaFailed (host to the permit whose successor failed here, under mu), so that step only proves what it kept; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 3 (#511 F11): two hook fields, MarkReplicaRelease and ReplicaReleaseMark (the failure book's per-host release mark on this box's disk). No read site.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11): one in-memory field, heldSeen (host to the last held release attempt, error class and when it was met), under the existing wakeFailMu. Declaration only, no read.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501) adds the background atomic.Int64 field that tests wait on; this branch keeps its replica fields. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: adds replicaSwitched, an in-memory map of the permit each set row switched under (host -> permit key, time, resident flag); no read added; #511 micro-fix P1b: adds replicaNoGen, an in-memory map (host -> permit key and when first seen) that is only the bound's clock for a restarted permit holder with no generation; no read added;rev3=census-ruling-stateless-replicas-4-drill1;basis=#511 drill 1 R20 bound (round 1: clock with start and last seen): one in-memory field, releaseConfigWaits (per host, a stateless release's config wait), under mu; no read;rev3=census-ruling-stateless-replicas-4-r28;basis=R28 review round 2 (#511): one field, retiringCopy, an atomic pointer to the edge's in-memory retired-copy check, handed over by edge.New (SetRetiringCopy); no read, no root decision;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: four fields, fenceWatchers (sync.WaitGroup of running write-fence watchers) and three test seams nil in production (fenceWatchStarted, retainDB, wakeReturned). Declaration only, no read.;rev3=census-ruling-fleet-record-labels-m1;basis=fleet record labels R1/R2: actEntry gains checkpoint state (busy while CloseProven runs, unproven, named-once flag for C45), in-memory under a.mu; the worker gains fence pacing apart from crash backoff; Service gains test seams nil in production; declarations only, no read;rev3=census-ruling-race-activator-1249;basis=adds two test-only fields: leaseWork (a WaitGroup counting lease watches and the one-shot stops a short lease starts) and leaseWatchStop (a channel, nil in production, that a test closes to end every lease watch); no read added and production never waits on or closes either;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 1: the per-host journal note maps (wakeFailLogged, heldSeen) move into the embedded wakeNotes struct in wakefaillog.go, which adds fenceSeen. In-memory only; no read added. 2f41351769081ca1f2c6b43f864d8ed6aa373adb556dc4a84b193e236b6e92f5 |
| internal/activator/stateless.go Service.statelessObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry the current attempt record facts and canonical target into the existing immutable observation carrier. Reuse a matching carrier, never lifetime-index or process-global release evidence. Fix 3a round 1 I2: obtain preparation facts from the existing reconcile snapshot, not another bucket read. Freeze the observation for this attempt; no snapshot grants launch permission. The final backend gate freshly validates record placement, identity and released deploy.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2: passes the wake ctx to cfg.ReplicaRecord, whose signature now takes a ctx. Same reads; the exec gate fresh record read (statelessFinalRecord, R1) is unchanged and still decides. whole:Route@201,whole:Route@337,whole:Route@389,whole:Route@496,whole:Route@714,whole:Route@765 54934202bd46b45496ee4aa7ed1e401d39f636411356f3567e4ac5613fdc18a5 |
| internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).;rev3=census-ruling-same-box-edge-fence;basis=Agent (uid carlos), not root. One added line: armEdgeFenceStatus(ctl.EdgeFence), beside the existing armExecSandboxStatus, so the layout report can ask root's /ready for the edge fence state over the control socket client the agent already holds. No read added.;rev3=census-ruling-platform-mail-submission;basis=Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Task 6: also sets the ExecBackend's ManifestOf, the same staged-manifest read as TierOf (rt.App and RouteAccount(rt), hence +registry:App and +whole:Route), for the spawn-time check of decision 10, which logs and emits an event and never refuses. Agent, not root. Fable final P2-2: eb.MailSwitch is the cache's State (three-valued: on, off, unknown) in place of On; an unreadable switch is unknown, never off. No read added.;rev3=census-ruling-fleet-drain-followups;basis=P3 (#1008 T9): one call after armChangeIndex, requestBootFullPass(v, &backstopFullDue), which stores true in the existing in-memory backstopFullDue flag only when no record view is armed, so the fast loop runs its existing full pass on its first tick instead of instancesLoop a minute later; armed boxes unchanged. No read added; read sites unchanged (8); agent, not root.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: runDuties builds a step logger (newStartupLog, which reads the in-memory agent start time) and logs one line after the wait on the activator startup latch and after each existing duty before go fastConvergeLoop. One newStartupLog().at line in the edge ready hook before go tunnelLoop. No read added; read sites unchanged (8). Agent, not root.;rev3=census-ruling-ha-1192;basis=sets the group drain driver's departed hook to armedPeerDeparted (the armed departure controller's PeerDeparted: local registry identity + departure journal); no new read;rev3=census-ruling-replica-wake-gap-r3;basis=Calls lease.SetContinuityDir(<data dir>/.continuity) beside the existing obligation store: the agent's own 0700 directory for clean records, outside every instance tree (#1290 round 3). No new read; failure is logged and every start then takes a full image.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2: cfg.ReplicaRecord = replicaRecordFacts(boxLifetimes, cfg.Record): hands the existing judged record read (haRecordFacts over openDeployStore and boxJudge) as the live read on a lifetime index miss. No read site added here; agent, not root. file:Exec@22002,file:Open@2191,file:Statfs@58408,registry:App@13299,registry:App@13677,whole:Route@13291,whole:Route@13669,whole:Route@51623 044f4950ae4a50748a44d3a624e251bcb0a9ec7fa627b84f92b6423ec983a101 |
| -internal/host/replicarecord.go replicaRecordObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2, new: replicaRecordFacts logic. Index hit: the reconcile pass snapshot, account and app must match, no read. Index miss: one call of live (cfg.Record, haRecordFacts: a judged read of the host record from the deployment store, the same read the exec gate makes), only for a non-sidecar route; its facts must name rt account, app and host; any error or mismatch refuses with replicas.ErrFenced. Never writes the lifetime index. Agent (uid carlos), not root; root reads nothing new. registry:App@333,registry:App@636,registry:Host@279,registry:Host@669,whole:Route@240,whole:Route@558 b2863b149e268a21ed3e68e8f5d45ce51d4558bae7e0cf3409285630645b9d71 |
| -internal/host/agent.go replicaRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Fix 3a round 1 I2: read existing in-memory reconcile snapshot for release preparation, require account/app/host match, derive RecordFacts. Missing snapshot refuses until reconciliation; fresh final record check still required.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2: the body delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites move there. An index hit is answered as before with no read. On an index miss: one judged record read through cfg.Record (haRecordFacts, the deployment store, the same read the exec gate makes) for this wake; it refuses with replicas.ErrFenced when the read fails, is absent, names another instance, or the route is a sidecar. It never writes the lifetime index. Agent (uid carlos), not root. whole:Route@340 5daf86fc8f2b8c8710934c646ae4cc5c91d52a6918ab2ced6b864b26e5da91bc |
| -@coverage internal/activator 308c2119b959f95c330b07aa593a78395bd1d94b29e8ed2872d080bf36ccd1cf |
| -@coverage internal/host 50967c314a92e807035cca0d6df99ce41f18679dbcdaafd9cf35f784bf516469 |
| +internal/host/replicarecord.go replicaRecordObservation legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2, new; review round 1 P2-1. Index hit: the reconcile pass snapshot, account and app must match, no read, and the host memo is cleared. Index miss on a non-sidecar route not held by the memo: one call of live (cfg.Record, haRecordFacts: the judged read of the host record from the deployment store, the same read the exec gate makes). Its facts must name rt account, app and host. Absent, judged stale, corrupt or foreign: refuses with replicas.ErrFenced and memoises the host for 30 s (rt.Host keys an in-memory map: the added registry:Host sites), so no further read for it in that window. Any other read error is returned wrapped, not as a refusal, so an always-on instance backs off. Never writes the lifetime index. Agent (uid carlos), not root; root reads nothing new. registry:App@379,registry:App@795,registry:Host@1027,registry:Host@1057,registry:Host@302,registry:Host@331,registry:Host@534,registry:Host@828,registry:Host@850,whole:Route@263,whole:Route@626 417d767a42111287e35a2bced6d5af57cb072841eeb9c1bad417e91452c63fc5 |
| +internal/host/agent.go replicaRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Fix 3a round 1 I2: read existing in-memory reconcile snapshot for release preparation, require account/app/host match, derive RecordFacts. Missing snapshot refuses until reconciliation; fresh final record check still required.;rev3=census-ruling-fleet-restart-wake;basis=Fleet restart wake Task 2 and review round 1 P2-1: the body makes one in-memory replicaMissMemo per closure and delegates to replicaRecordObservation (replicarecord.go), so its registry:App and registry:Host sites moved there. An index hit is answered as before with no read. Agent (uid carlos), not root; no read added here. whole:Route@374 9dfbeb4f8231b6d15c937ad237dacf0d2dccb58b5229989a983da91af020348a |
| +@coverage internal/activator 43c349e6eb9f1021503897baa360e2d2bc553894a3fc6c84b38629a3b1d36a7e |
| +@coverage internal/host 9110360c4d6e4b21119e4545f4814805a065e1e3690264bdcd69d73a1f12babb |