Commit Graph
7 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 bb377502ea authority, master: filter superseded facts once at ingestion; record every unsupported pass; decide after the probe
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>
2026-11-15 12:10:10 -08:00
pingqiuandClaude Opus 5.5 4c84545c84 authority, master: decide boot grace from the newest fact; record unsupported ready ticks; cap at the effective window
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>
2026-11-15 11:50:53 -08:00
pingqiuandClaude Opus 5.5 b342e8f21f authority, master: keep a restarted primary through one bounded boot grace
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>
2026-11-15 11:10:32 -08:00
Ping Qiu 5c4f995c55 v0.2 alpha: Day-1 activation and first-volume loop (#48)
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.
2026-05-18 16:43:35 -07:00
pingqiu e7e3126d03 G9G: run lifecycle product loop into publisher 2026-05-03 06:09:20 -07:00
wzcheng99andClaude Opus 4.7 a837a67ec6 P14 S6: convergence institution (bounded wait + stuck evidence)
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>
2026-04-19 21:33:42 -07:00
wzcheng99andClaude Opus 4.7 60c5ff5db4 P14 S4: observation institution + multi-volume topology controller
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>
2026-04-19 16:36:17 -07:00