A rebalance moves the primary while it is alive, so it is a planned move,
yet it needed only the gate's promotion evidence. Under RF3 sync_quorum
the old primary can be acknowledged by the other replica alone while the
target adopts. The gate now marks a slot PlannedMoveAllowed from the same
plannedMoveAllowed(profile, replicas) a failback uses, and the controller
publishes a rebalance only to such a slot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The promotion gate (one function: the probe round's answers -> the allowed
replica and its evidence) now covers every replicated volume, RF2
included: on main RF2 and every observation-fed failover promoted on
heartbeat readiness with no evidence of the candidate's data. The gate
puts its evidence on the slot it allows; the controller's failover and
rebalance carry it and publish nothing without it. The legacy PolicyOwner
(no production caller) is deleted. Failback is the operator's planned move
through the gate: the target is probed by the round, and the move is
allowed only when the target is in every acknowledgement set (sync_all at
any replica count, sync_quorum with RF2); RF3 sync_quorum (needs a seal)
and best_effort (forced only) are refused with typed errors.
About forty tests encoded the evidence-free decision. Their subjects are
unchanged; each now gets the candidate's evidence the way the gate gives
it (the controller's candidate helper, the convergence snapshots, a
stand-in gate sink for the observation-fed routes, a static round answer
for the RF2 and failback tests). None is skipped or loosened. New: ready
replicas without the gate's evidence promote nothing; RF2 promotes on a
ready answer and not without one; the planned-move guard, one row per ack
profile and replica count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r3 (three P2s; the same class as r1/r2, so fixed
structurally rather than per branch):
- Controller: a supported snapshot that carries any superseded slot
fact (older than the newest recorded for that replica, or equal-time
with another incarnation) is a stale snapshot. It records nothing and
no decision branch runs on it (readiness, endpoint refresh, rebalance,
failover, fallback); any existing desired is kept, as for a stale
authority basis. Fresh facts, including fresh unhealthy and expiry
decisions, are unchanged.
- Unsupported-volume gate: the current primary's own fresh slot fact is
recorded for every unsupported volume, before the promotion-reason
allow-list and concrete-placement filters, so ready reports and starts
under any reason are counted. The promotion rules are unchanged.
- Both gates decide after the blocking probe from the current primary's
fresh slot read at that point (primaryBootGraceHoldsNow), so a newer
unhealthy report or a heartbeat that expired during the probe is seen;
the unsupported gate also skips if the authority line moved during the
probe.
Lock order unchanged: state under TopologyController.mu; the gates read
the publisher line and the store snapshot (their own locks, released)
before calling the controller; no new locks.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r2 (three P2s):
- The unsupported-volume gate records the current primary's own fresh
slot fact on every pass (RecordPrimaryBootFact), not only when a
promotion is considered, so a ready report ends the grace and ready
restarts count toward flap history.
- The grace decision is ordered like the history: a superseded fact
(older than the newest recorded one, or equal-time with another
incarnation) is not a decision input. The decision follows the newest
recorded fact (its incarnation, placeability and grace clock), and a
superseded fact's endpoint is never used for a refresh. A fresh fact
still needs to be placeable and not ready.
- The cap uses the observation store's effective freshness window
(FreshnessConfig.EffectiveFreshnessWindow), so an omitted window caps
at its 10s default; an unset or nonpositive grace takes the window.
Lock order unchanged: state under TopologyController.mu; the gate reads
the store snapshot (its own lock, released) before calling the
controller; no new locks.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A freshly started volume reports ReadyForPrimary=false until its engine
has a promotion fact, so any restart of the current primary failed over
at the first heartbeat whenever a ready peer existed (#128; T1/T2).
The controller now keeps the current primary while it is placeable and
inside its boot grace: the grace starts at the first heartbeat of a new
incarnation and lasts PrimaryBootGrace (the master sets it to its
freshness window). Only its endpoint may be refreshed meanwhile. The
grace never covers an explicit unhealthy report (unreachable,
ineligible, withdrawn); ends for good once the replica reports ready or
the grace expires (no extension by repeated not-ready heartbeats); and
is refused to a replica with PrimaryBootFlapRestarts process starts
within PrimaryBootFlapWindow (defaults 3 in 10 min). No incarnation (an
older volume binary) means no grace.
The promotion gate's direct reassign skips a current primary that is
placeable by its own report and inside its boot grace.
Lock order: grace state lives under TopologyController.mu, written only
by observeIncarnationsLocked inside the existing snapshot path; the
controller calls nothing outward while holding it. The gate calls
PrimaryInBootGrace (takes c.mu) holding no controller-visible lock, the
same direction as its existing controller calls.
Fixes#128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Package the Kubernetes alpha into a script-based Day-1 activation loop: activate the stack, create the first PVC-backed volume, verify writer/reader data, collect product-owned observation evidence, render a local read-only report, and clean up.
Includes multi-node-safe activation defaults, first-volume example automation, read-only ops report output, README/quickstart/release note updates, and review-driven hardening for fail-fast configuration, promotion evidence, inventory fail-closed behavior, and test guards.
Validated by Day-1 activation run 20260517-205252-04e9 and read-only report run 20260517-212358-bfba. Local targeted tests passed.
Turns controller desired assignments into a bounded-fate closure:
confirmed, retried (passively), superseded, or surfaced as stuck
evidence — without minting new authority.
- DesiredAssignment: +ProposedBasis/DesiredAt/LastRetryAt/Stuck.
- TopologyControllerConfig: +RetryWindow (default 5s).
- convergence.go: ConvergenceStuckEvidence (distinct map from
UnsupportedEvidence), supersedeDesiredLocked (case 1 only:
publisher epoch > ProposedBasis AND different target — case 2
dropped because it misclassified every in-flight Reassign),
evaluateStuckLocked (passive; does NOT re-emit).
- controller.go: unified processSupportedVolumeLocked; confirm
routes through clearDesiredLocked so late post-Stuck
confirmations drop stuck evidence; supported-recovery clears
prior UnsupportedEvidence.
L0 (convergence_test.go): 15 targeted proofs — confirmation
(both-sources, stale-observation guard), stuck (after window,
no Reassign churn, clears on late confirm), supersede
(publisher moved elsewhere, normal-lag is NOT supersede,
decision-table differs), pending/unsupported clearing,
per-volume isolation, supported-recovery evidence cleanup.
L1 (convergence_route_test.go): 3 component-route proofs through
ObservationHost -> TopologyController -> Publisher ->
VolumeBridge -> Consumer: observation-fed failover confirms,
publish-but-not-observed reaches Stuck with no duplicate
bridge delivery, supersede drops stale desired.
No engine/adapter/transport changes. S2 non-forgeability and
S5 store-write guards still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lands two related pieces that make late-Phase-14 observation-to-
authority truth system-owned:
1. Multi-volume TopologyController (accepted P14 topology set:
per-volume three-slot on distinct servers). This was the
"consumer baseline" staged earlier as full-topology
scaffolding and is committed here as the foundation S4 feeds.
2. Observation institution: heartbeat / inventory -> stable
ClusterSnapshot producer, per the S4 assignment
(sw-block/design/v3-phase-14-s4-assignment.md and
v3-phase-14-s4-sketch.md).
Load-bearing boundary held across both pieces:
* observation institution may withhold supportability, but it
may NOT mint authority (sketch §3)
* Publisher stays the sole minter of Epoch/EndpointVersion
* adapter.OnAssignment stays the one and only consumer ingress
* no new engine event, command, or projection field
Observation-side deliverables (core/authority/):
* observation_types.go — Observation, ServerFact, SlotFact,
LocalRoleClaim, FreshnessConfig, Supportability enum
(pending / supported / unsupported kept VISIBLY distinct per
architect execution note), AcceptedTopology, six reason
constants.
* observation_store.go — push-ingest latest-wins per ServerID,
derived ServerFreshness (never-observed / bootstrapping /
missing / fresh / expired), immutable storeSnapshot for
builder input, configurable GC.
* observation_wire.go — V2 heartbeat wire shape port
(block_heartbeat / block_heartbeat_proto /
block_heartbeat_loop analogues) as mechanism only.
HeartbeatToObservation is a pure field-shape copy.
* unsupported_evidence.go — per-volume VolumeUnsupportedEvidence
(latest-wins per VolumeID), separate VolumePendingStatus,
SupportabilityReport with Pending + Unsupported as distinct
maps, BuildResult.
* snapshot_builder.go — pure BuildSnapshot(store, topology,
reader) -> BuildResult. Reads publisher's current per-volume
line via the read-only AuthorityBasisReader and stamps it in
VolumeTopologySnapshot.Authority for supported volumes, so
the controller's stale-resistance check can match on
subsequent feeds. Observation never mints authority.
* observation_host.go — owns store lifecycle, push-ingest
entry points, reactive rebuild (build-on-change + coalescing
wake), GC sweep honoring configured retain window,
ControllerSink atomic submission (snapshot + report
together so supportability transitions propagate even when
supported volumes drop to zero).
Controller-side intake (core/authority/controller.go):
* SubmitClusterSnapshot kept as the test-scaffolding entry.
* NEW SubmitObservedState(snap, report) — the observation-fed
intake. Mirrors SubmitClusterSnapshot's convergence
discipline line-for-line (stale-basis preserves desired,
no-emit clears desired, same-ask dedupe prevents authority
churn) and adds pending/unsupported transition handling.
Under this intake, the controller hears every supportability
transition, including "zero supported volumes now", which
clears stale desired state.
V2 muscles ported (mechanism only):
* block_heartbeat / block_heartbeat_proto field layout
(observation_wire.go)
* block_heartbeat_loop shape concept (host owns the loop)
Explicitly NOT ported (per assignment denylist):
* weed/storage/blockvol/promotion.go
* old HandleAssignment / promote / demote ownership
* master_block_plan / master_block_failover / master_block_registry /
master_block_assignment_queue (reference only for S5/S6)
* any V2 path where heartbeat timing or local status becomes
failover truth
Proof matrix (observation_test.go — 35 tests covering all sketch
§16 rows + architect-round regressions):
Authoring:
- PartialInventory_PendingThenUnsupported
- MissingServerObservation_NeverOrdinaryIneligible
- EndToEnd_SystemFedSnapshotReachesController
- ConflictingPrimaryClaim_Unsupported
- ConflictingPrimaryClaim_NoWinnerEverChosen
- ExpiredFact_SemanticallyIneligible
- ExpiredDoesNotReachController
- BadVolumeDoesNotBlockHealthyVolume_Isolation
- VolumeUnsupportedEvidence_IsolatedPerVolume
- DuplicateServerTopology_UnsupportedAndEvidenceRecorded
- DuplicateServerTopology_NotControllerInput
Host-level:
- IngestMutation_TriggersSnapshotRebuild
- FreshnessWindowHonored_NotTickMultiples
- GCRetainWindow_Honored
Boundary (AST-based, sketch §16a):
- NeverMintsAuthority_BoundaryGuard
- SupportabilityDoesNotReadClusterSnapshotOutput
Architect round-2 regressions:
- BuilderStampsAuthorityFromReader
- SupportabilityCollapsePropagatesToController
- SupportabilityCollapseClearsControllerDesired
- UnknownObservedVolume_ProducesUnsupportedEvidence
Architect round-3 regressions:
- IdenticalSupportedSnapshots_NoDuplicateAsks
- VolumeRecovers_ClearsStaleDesired
No changes to engine, adapter, transport, ops, storage, or
sparrow. 91 authority tests pass. Full module: 12 packages pass.
Design docs in sw-block/design/ external repo:
* v3-phase-14-s4-assignment.md
* v3-phase-14-s4-observation-institution.md
* v3-phase-14-s4-sketch.md
* v3-phase-14-s4-closure-gaps.md (architect-round boundary notes)
* v3-phase-14-full-topology-design.md
* v3-phase-14-placement-rebalance-policy.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>