From aad7a199066d31a7e2281bb2811483a7e2d2bc74 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 24 Nov 2026 12:32:05 -0800 Subject: [PATCH] docs: describe public rules in comments --- seaweed-block/cmd/blockvolume/frontend_gate.go | 2 +- .../cmd/blockvolume/frontend_start_signal_test.go | 4 ++-- .../cmd/blockvolume/head_size_integration_test.go | 2 +- .../cmd/blockvolume/iscsi_powerloss_replay_test.go | 2 +- seaweed-block/cmd/blockvolume/main.go | 2 +- .../blockvolume/procedure_crash_io_integration_test.go | 2 +- .../blockvolume/procedure_diskfull_integration_test.go | 2 +- .../procedure_diskfull_kernel_integration_test.go | 2 +- .../blockvolume/procedure_powerloss_integration_test.go | 2 +- .../blockvolume/procedure_store_down_integration_test.go | 4 ++-- .../snapshot_ladder_f1_health_integration_test.go | 2 +- .../blockvolume/snapshot_ladder_f1_integration_test.go | 5 ++--- seaweed-block/cmd/blockvolume/volume_lock_flag_test.go | 2 +- seaweed-block/core/authority/line_owner_snapshot_test.go | 2 +- seaweed-block/core/authority/observation_store.go | 2 +- .../core/authority/observation_store_slot_order_test.go | 2 +- seaweed-block/core/authority/snapshot_builder.go | 2 +- .../core/frontend/chunkstore/attach_lookup_error_test.go | 2 +- seaweed-block/core/frontend/durable/admits_io_test.go | 2 +- .../core/frontend/durable/cut_durable_before_cas_test.go | 2 +- .../core/frontend/durable/one_process_per_volume_test.go | 4 ++-- seaweed-block/core/frontend/durable/provider.go | 4 ++-- seaweed-block/core/frontend/durable/provider_chunk.go | 2 +- .../core/frontend/durable/recovery_permanent_test.go | 2 +- .../core/frontend/durable/rolled_back_copy_test.go | 2 +- seaweed-block/core/frontend/durable/storage_adapter.go | 2 +- .../core/frontend/durable/volume_lock_parent_mode_test.go | 2 +- seaweed-block/core/frontend/error_class.go | 4 ++-- .../core/frontend/iscsi/backend_error_class_test.go | 2 +- .../core/frontend/nvme/backend_error_class_test.go | 2 +- seaweed-block/core/host/volume/status_server.go | 4 ++-- .../core/host/volume/workspace_invalid_reply_test.go | 2 +- .../core/host/volume/workspace_lease_held_test.go | 4 ++-- seaweed-block/core/storage/chunk_cut_crash_test.go | 4 ++-- seaweed-block/core/storage/chunk_layer_takeover_test.go | 2 +- seaweed-block/docs/design/invariants.md | 8 ++++---- 36 files changed, 48 insertions(+), 49 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/frontend_gate.go b/seaweed-block/cmd/blockvolume/frontend_gate.go index c1d59ac2d2..8d7ae9628f 100644 --- a/seaweed-block/cmd/blockvolume/frontend_gate.go +++ b/seaweed-block/cmd/blockvolume/frontend_gate.go @@ -29,7 +29,7 @@ type servingBackend interface { } // frontendStartSignal is what the frontends wait for. A workspace chunk -// primary (V1-SPEC r2.37/r2.39) starts its targets only once the one "may +// primary starts its targets only once the one "may // serve" function (AdmitsIO) passes after the backend first admitted I/O; // any other volume (non-chunk, or a supporting replica) starts right after // open, as before: it never makes the claim a workspace primary waits for. diff --git a/seaweed-block/cmd/blockvolume/frontend_start_signal_test.go b/seaweed-block/cmd/blockvolume/frontend_start_signal_test.go index 2c4f3f646a..7a97a128cb 100644 --- a/seaweed-block/cmd/blockvolume/frontend_start_signal_test.go +++ b/seaweed-block/cmd/blockvolume/frontend_start_signal_test.go @@ -29,7 +29,7 @@ func closedWithin(ch <-chan struct{}, d time.Duration) bool { } } -// V1-SPEC r2.37/r2.39: a workspace chunk primary's targets start only once +// The frontend start-signal rule: a workspace chunk primary's targets start only once // AdmitsIO passes after the backend first admitted I/O; the stop ends the // wait without starting them. func TestFrontendStartSignal_WorkspacePrimaryWaitsForAdmitsIO(t *testing.T) { @@ -88,7 +88,7 @@ func TestFirstAdmittedStopEndsTheWorker(t *testing.T) { } } -// INV-WS-SERVE-LEASE-HELD-001 scope (V1-SPEC r2.39): a non-chunk volume or a supporting +// INV-WS-SERVE-LEASE-HELD-001 scope: a non-chunk volume or a supporting // replica starts its frontends right after open, as before: its start // signal is the backend's first-serving channel itself, not AdmitsIO. func TestFrontendStartSignal_OtherVolumesStartAfterOpenAsBefore(t *testing.T) { diff --git a/seaweed-block/cmd/blockvolume/head_size_integration_test.go b/seaweed-block/cmd/blockvolume/head_size_integration_test.go index 374db5c335..fec741db8e 100644 --- a/seaweed-block/cmd/blockvolume/head_size_integration_test.go +++ b/seaweed-block/cmd/blockvolume/head_size_integration_test.go @@ -19,7 +19,7 @@ import ( "time" ) -// HEAD size against volume size (V1-SPEC r2.94), informative: it measures, +// HEAD size against volume size, informative: it measures, // it does not judge. Runs only with HEADSZ_RUN=1, on a host booked for it. // // For each size in HEADSZ_SIZES (default 10G,100G,1T): one volume of that diff --git a/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go b/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go index 20e21e5ca9..21b87a9494 100644 --- a/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go +++ b/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Power loss with real binaries (V1-SPEC r2.55 gap 3, INV-FE-FLUSH-SYNC-001): +// Power loss with real binaries (INV-FE-FLUSH-SYNC-001): // blockvolume keeps its durable root on a dm-log-writes device. The guest // writes over iSCSI and issues SYNCHRONIZE CACHE; once the last sync returns, // the harness marks the log "acknowledged". Later writes and their sync must diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index 56ffda7836..9389777db2 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -680,7 +680,7 @@ func runVolume(f flags, exits *processExit) int { WALRetentionLSNs: f.walRetentionLSNs, WALMultiBlockRecords: f.durableWALMultiBlockRecords, WALRecoveryTestDisableFlusher: f.durableWALRecoveryTestDisableFlusher, - // V1-SPEC r2.45: one live process per volume per host. + // Host-lock rule: one live process per volume per host. HostVolumeLock: true, VolumeLockDirTestOnly: f.volumeLockDirTestOnly, } diff --git a/seaweed-block/cmd/blockvolume/procedure_crash_io_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_crash_io_integration_test.go index 4bb7226ae6..1d7e7eb38f 100644 --- a/seaweed-block/cmd/blockvolume/procedure_crash_io_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_crash_io_integration_test.go @@ -12,7 +12,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/frontend/nvme" ) -// Single-volume coverage, gap 1 (cell A2.4, V1-SPEC r2.55): kill -9 of the +// Guest I/O crash recovery: kill -9 of the // holder WITH guest I/O in flight, then a restart inside the lease. Every // write a Flush acknowledged must read back after the restart // (INV-WAL-SYNCED-RECOVERED-001); writes not yet acknowledged by a Flush may diff --git a/seaweed-block/cmd/blockvolume/procedure_diskfull_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_diskfull_integration_test.go index 9bbe671405..ba1e45a94b 100644 --- a/seaweed-block/cmd/blockvolume/procedure_diskfull_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_diskfull_integration_test.go @@ -15,7 +15,7 @@ import ( "time" ) -// Local disk full (V1-SPEC r2.55 round 2), with real binaries: blockmaster, a +// Local disk full, with real binaries: blockmaster, a // real filer (weed, its data elsewhere) and walstore-chunk blockvolumes whose // durable roots and --host-limit-dir are on small filesystems the harness // mounts (cmd/blockvolume/testdata/diskfull.sh). A filler file takes the free diff --git a/seaweed-block/cmd/blockvolume/procedure_diskfull_kernel_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_diskfull_kernel_integration_test.go index 710fe70ad5..35bf233c35 100644 --- a/seaweed-block/cmd/blockvolume/procedure_diskfull_kernel_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_diskfull_kernel_integration_test.go @@ -14,7 +14,7 @@ import ( ) // What a real Linux guest sees when the local disk under a volume's WAL fills -// (V1-SPEC r2.60, issue 484): the kernel NVMe/TCP initiator connects to the +// (issue #484): the kernel NVMe/TCP initiator connects to the // volume's own target on this host, the durable root's disk fills, and dd // writes with O_DIRECT. The test records, for the operator guide, whether dd // stalls or fails and with what, what the kernel logs, and what happens once diff --git a/seaweed-block/cmd/blockvolume/procedure_powerloss_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_powerloss_integration_test.go index e57919a320..622d96c4a0 100644 --- a/seaweed-block/cmd/blockvolume/procedure_powerloss_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_powerloss_integration_test.go @@ -12,7 +12,7 @@ import ( "time" ) -// Power loss on a chunk volume (V1-SPEC r2.55 gap 3, INV-FE-FLUSH-SYNC-001), +// Power loss on a chunk volume (INV-FE-FLUSH-SYNC-001), // with real binaries: blockmaster, a real filer (weed, its data off the // replayed device) and a walstore-chunk blockvolume whose durable root is on // a dm-log-writes device. Each power cut freezes the holder (SIGSTOP), so diff --git a/seaweed-block/cmd/blockvolume/procedure_store_down_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_store_down_integration_test.go index 01d50c05fe..ffbde08a48 100644 --- a/seaweed-block/cmd/blockvolume/procedure_store_down_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_store_down_integration_test.go @@ -14,8 +14,8 @@ import ( "time" ) -// The SeaweedFS side down during a cut, then back (V1-SPEC r2.61 addendum, -// round 2), with real binaries: image B is written and a cut starts; once +// The SeaweedFS side down during a cut, then back, +// with real binaries: image B is written and a cut starts; once // its uploads have begun, the filer (or the volume server) is killed. For a // minute the guest keeps writing and flushing over NVMe/TCP while the test // records how the cut answers and how much copy-on-write side data the diff --git a/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_health_integration_test.go b/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_health_integration_test.go index 2bb3b27df7..344d49fc7f 100644 --- a/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_health_integration_test.go +++ b/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_health_integration_test.go @@ -14,7 +14,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/rpc/link" ) -// Rung F1's heartbeat-ordering watch (V1-SPEC r2.53): with N processes under +// Rung F1's heartbeat-ordering watch: with N processes under // one server id, a volume's slot at the master can expire when its // heartbeats are dropped. The watch polls the master's view of every source // volume's replica each second and records each span where the master does diff --git a/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_integration_test.go b/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_integration_test.go index fc4bdc68e0..1f7d66e966 100644 --- a/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_integration_test.go +++ b/seaweed-block/cmd/blockvolume/snapshot_ladder_f1_integration_test.go @@ -24,7 +24,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/hostlimit" ) -// Snapshot ladder rung F1 (V1-SPEC r2.49, r2.52): N volumes on one host, +// Snapshot ladder rung F1: N volumes on one host, // every volume snapshotted at the same instant, round after round, under // write load. It must hold: every snapshot restores exactly; no write fails; // the host limiter paces the cuts and none starves (every snapshot commits @@ -194,8 +194,7 @@ func TestSnapshotLadderF1VolumesOneHost(t *testing.T) { func f1RestoreTarget(vol, round int) string { return fmt.Sprintf("v%dr%d", vol, round) } -// f1StartEnv is the procedure harness laid out as one host (V1-SPEC r2.52, -// the layout ruling): ONE server id, s1, and one blockvolume process per +// f1StartEnv is the procedure harness laid out as one host: ONE server id, s1, and one blockvolume process per // volume, each with its own replica id and its own data/ctrl/status/NVMe // ports. Source v is replica r; the restore target of v in round k // is replica r on the same server. The node record carries the first diff --git a/seaweed-block/cmd/blockvolume/volume_lock_flag_test.go b/seaweed-block/cmd/blockvolume/volume_lock_flag_test.go index ead0e331d9..d0cd8da6fc 100644 --- a/seaweed-block/cmd/blockvolume/volume_lock_flag_test.go +++ b/seaweed-block/cmd/blockvolume/volume_lock_flag_test.go @@ -8,7 +8,7 @@ import ( "time" ) -// V1-SPEC r2.45: the test lock directory override is refused under systemd +// The test lock directory override is refused under systemd // (INVOCATION_ID set), so it cannot reach a shipped unit. func TestVolumeLockDirTestOnlyRefusedUnderSystemd(t *testing.T) { args := append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore", "--volume-lock-dir-test-only="+t.TempDir()) diff --git a/seaweed-block/core/authority/line_owner_snapshot_test.go b/seaweed-block/core/authority/line_owner_snapshot_test.go index 5125f8462f..8f6e2dc575 100644 --- a/seaweed-block/core/authority/line_owner_snapshot_test.go +++ b/seaweed-block/core/authority/line_owner_snapshot_test.go @@ -16,7 +16,7 @@ func (r ownerReader) PublishedAuthorityLine(volume string) (PublishedLine, bool) return pl, ok } -// #425 (V1-SPEC r2.40, INV-AUTH-HOLDER-IDENTITY-001): after a forced move s1 -> s2 the accepted topology still names +// #425 (INV-AUTH-HOLDER-IDENTITY-001): after a forced move s1 -> s2 the accepted topology still names // s1 for r1. When s1 returns and reports r1 at its own endpoints, the controller's input for the line's replica must // come from the line's owner s2, never s1: otherwise an endpoint refresh republishes the line with s1's endpoints. func TestBuildSnapshotTakesTheMovedLinesReplicaFromItsOwner(t *testing.T) { diff --git a/seaweed-block/core/authority/observation_store.go b/seaweed-block/core/authority/observation_store.go index dbf1229678..3f03aad3d4 100644 --- a/seaweed-block/core/authority/observation_store.go +++ b/seaweed-block/core/authority/observation_store.go @@ -317,7 +317,7 @@ func (s *ObservationStore) ingest(obs Observation) ([]SlotHealthTransition, erro s.mu.Lock() prev, hadPrev := s.observations[obs.ServerID] // Health transitions, from this accepted report against the same - // slot's stored fact. INV-OBS-SLOT-ORDER-001 / V1-SPEC r2.53: + // slot's stored fact. INV-OBS-SLOT-ORDER-001: // timestamps order one sender's // slot only; a later report from another slot cannot supersede it. accepted := make([]SlotFact, 0, len(obs.Slots)) diff --git a/seaweed-block/core/authority/observation_store_slot_order_test.go b/seaweed-block/core/authority/observation_store_slot_order_test.go index e13d0ca8d5..bd46dd87e7 100644 --- a/seaweed-block/core/authority/observation_store_slot_order_test.go +++ b/seaweed-block/core/authority/observation_store_slot_order_test.go @@ -69,7 +69,7 @@ func TestObservationStore_SupersededSlotLogsAfterUnlock(t *testing.T) { } } -// INV-OBS-SLOT-ORDER-001 / V1-SPEC r2.53: processes on one server order only their +// INV-OBS-SLOT-ORDER-001: processes on one server order only their // own (volume, replica) reports; another slot's later timestamp is irrelevant. func TestObservationStore_InterleavedSendersOrderPerSlot(t *testing.T) { for _, n := range []int{10, 100} { diff --git a/seaweed-block/core/authority/snapshot_builder.go b/seaweed-block/core/authority/snapshot_builder.go index 9ad6d7a499..411352552b 100644 --- a/seaweed-block/core/authority/snapshot_builder.go +++ b/seaweed-block/core/authority/snapshot_builder.go @@ -483,7 +483,7 @@ type lineOwnerReader interface { } // expectOwnerForLine binds the expected slot of the line's replica to the line's owner (PublishedLine.Owner) when a -// move minted the line (#425, V1-SPEC r2.40, INV-AUTH-HOLDER-IDENTITY-001): a line carries its owner and that owner's +// move minted the line (#425, INV-AUTH-HOLDER-IDENTITY-001): a line carries its owner and that owner's // endpoints, so its replica's facts (health, endpoints, and any endpoint refresh) come only from that server, never // from the placement or topology server it was moved away from. A move-minted line whose owner is unknown is bound to // NO server (no fact from anyone, so no refresh) until the owner is known. Only a line no move minted keeps the diff --git a/seaweed-block/core/frontend/chunkstore/attach_lookup_error_test.go b/seaweed-block/core/frontend/chunkstore/attach_lookup_error_test.go index 59fb9245ed..95a762361b 100644 --- a/seaweed-block/core/frontend/chunkstore/attach_lookup_error_test.go +++ b/seaweed-block/core/frontend/chunkstore/attach_lookup_error_test.go @@ -21,7 +21,7 @@ func (attachLookupProjection) Projection() frontend.Projection { return frontend.Projection{VolumeID: "v1", ReplicaID: "r1", Epoch: 3, EndpointVersion: 1, Healthy: true} } -// V1-SPEC r2.55 gap 10; INV-WS-CLAIM-BEFORE-SERVE-001. +// Attach lookup errors fail closed; INV-WS-CLAIM-BEFORE-SERVE-001. // Real gRPC lookup errors pass through SWFS and a fresh durable provider. // An existing HEAD must never become a bootstrap claim or an I/O-ready volume. func TestAttachLookupUnavailableIsNotAnAbsentHead(t *testing.T) { diff --git a/seaweed-block/core/frontend/durable/admits_io_test.go b/seaweed-block/core/frontend/durable/admits_io_test.go index d44227f6a9..fab63ea8b3 100644 --- a/seaweed-block/core/frontend/durable/admits_io_test.go +++ b/seaweed-block/core/frontend/durable/admits_io_test.go @@ -7,7 +7,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/frontend" ) -// V1-SPEC r2.39: AdmitsIO is the one "may serve" function, the I/O gate +// The shared readiness rule: AdmitsIO is the one "may serve" function, the I/O gate // itself: an operational backend whose guarded projection is not this // lineage's healthy primary does not admit, nor does a backend that is not // operational; both together admit. diff --git a/seaweed-block/core/frontend/durable/cut_durable_before_cas_test.go b/seaweed-block/core/frontend/durable/cut_durable_before_cas_test.go index 3cbc0f5b1b..c79536b7d9 100644 --- a/seaweed-block/core/frontend/durable/cut_durable_before_cas_test.go +++ b/seaweed-block/core/frontend/durable/cut_durable_before_cas_test.go @@ -36,7 +36,7 @@ func (r *casObservedRemote) CASHead(ctx context.Context, expected storage.ChunkH return gen, err } -// V1-SPEC r2.45 (2) rests on this: a cut publishes only an LSN its root has +// The durable-reopen rule rests on this: a cut publishes only an LSN its root has // already made durable (the barrier sync before the HEAD CAS), so a crash // right after the CAS leaves a root at or above HEAD's remote_lsn. The // root's crash image taken at the CAS reattaches under that HEAD and serves diff --git a/seaweed-block/core/frontend/durable/one_process_per_volume_test.go b/seaweed-block/core/frontend/durable/one_process_per_volume_test.go index 98b3329fe1..05bf01e330 100644 --- a/seaweed-block/core/frontend/durable/one_process_per_volume_test.go +++ b/seaweed-block/core/frontend/durable/one_process_per_volume_test.go @@ -27,7 +27,7 @@ func lockedProvider(t *testing.T, root, lockDir string, remote storage.ChunkRemo return p } -// V1-SPEC r2.45 (1): one live process per volume per host. A second +// Host-lock rule: one live process per volume per host. A second // provider for the same volume id on the same host (another storage root, // the same host lock directory) is refused before its store opens; once the // first closes, the volume can be opened again. @@ -67,7 +67,7 @@ func TestOneLiveProcessPerVolumePerHost(t *testing.T) { } } -// V1-SPEC r2.45 (1): the provider creates a missing lock directory (0700) +// Host-lock rule: the provider creates a missing lock directory (0700) // and refuses, with the operator's cure, only when it cannot create it. func TestHostVolumeLockDirectoryCreatedOrRefused(t *testing.T) { newProvider := func(dir string) (*durable.DurableProvider, error) { diff --git a/seaweed-block/core/frontend/durable/provider.go b/seaweed-block/core/frontend/durable/provider.go index 850b0f1cff..474b37c88e 100644 --- a/seaweed-block/core/frontend/durable/provider.go +++ b/seaweed-block/core/frontend/durable/provider.go @@ -169,7 +169,7 @@ type ProviderConfig struct { // HostVolumeLock makes the provider hold an exclusive, nonblocking lock // on HostVolumeLockDir/.lock from before the volume's store // opens until Close: one host runs at most one live process per volume - // (V1-SPEC r2.45). NewDurableProvider creates the directory (0700) when + // under the host-lock rule. NewDurableProvider creates the directory (0700) when // missing and refuses when it cannot create or use it; the tmpfiles.d // entry in deploy/systemd creates it for the unit's user. blockvolume // sets this. @@ -535,7 +535,7 @@ func (p *DurableProvider) ensureHandle(volumeID string) (*volHandle, error) { } p.mu.Unlock() - // V1-SPEC r2.45: the host lock is taken before the store opens. + // Host-lock rule: the host lock is taken before the store opens. hostLock, err := p.lockVolumeOnHost(volumeID) if err != nil { return nil, err diff --git a/seaweed-block/core/frontend/durable/provider_chunk.go b/seaweed-block/core/frontend/durable/provider_chunk.go index 20cc310b70..fe0d46cbab 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk.go +++ b/seaweed-block/core/frontend/durable/provider_chunk.go @@ -515,7 +515,7 @@ func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h volumeID, h.path, head.Holder, head.Gen, head.Epoch, holder) return err } - // V1-SPEC r2.45: HEAD names this holder, but a root whose local + // The durable-reopen rule: HEAD names this holder, but a root whose local // durable LSN is below HEAD's remote_lsn is a rolled-back copy // (a backup taken before a later cut). Restarting cannot cure it. // A crash cannot cause it: a cut syncs its LSN locally before the diff --git a/seaweed-block/core/frontend/durable/recovery_permanent_test.go b/seaweed-block/core/frontend/durable/recovery_permanent_test.go index ed0ad1ff80..a45ada6517 100644 --- a/seaweed-block/core/frontend/durable/recovery_permanent_test.go +++ b/seaweed-block/core/frontend/durable/recovery_permanent_test.go @@ -12,7 +12,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/storage" ) -// INV-FE-ERROR-RETRY-CLASS-001 / V1-SPEC r2.55 side (d), coverage A9.1. +// Permanent recovery-fault classification: INV-FE-ERROR-RETRY-CLASS-001, coverage A9.1. // A real strict-W WAL integrity failure must survive recovery readiness gating // as a permanent cause. Ordinary awaiting-recovery readiness stays retryable. func TestRecoveryStoreFaultRemainsPermanentAtGuestIO(t *testing.T) { diff --git a/seaweed-block/core/frontend/durable/rolled_back_copy_test.go b/seaweed-block/core/frontend/durable/rolled_back_copy_test.go index b35f390871..a284a3045a 100644 --- a/seaweed-block/core/frontend/durable/rolled_back_copy_test.go +++ b/seaweed-block/core/frontend/durable/rolled_back_copy_test.go @@ -46,7 +46,7 @@ func copyRootFiles(t *testing.T, src, dst string) { } } -// V1-SPEC r2.45 (2): an existing root whose HEAD names this holder attaches +// The durable-reopen rule: an existing root whose HEAD names this holder attaches // only if its local durable LSN reaches HEAD's remote_lsn. A rolled-back // copy of the root (a backup taken before the last cut) is refused with the // stale-root refusal, as a no-retry (superseded) startup outcome, with the diff --git a/seaweed-block/core/frontend/durable/storage_adapter.go b/seaweed-block/core/frontend/durable/storage_adapter.go index 57ce1b1805..8edb46dd6b 100644 --- a/seaweed-block/core/frontend/durable/storage_adapter.go +++ b/seaweed-block/core/frontend/durable/storage_adapter.go @@ -913,7 +913,7 @@ func (b *StorageBackend) gate() error { return b.lineageCheck() } -// AdmitsIO is the one deciding function for "may serve" (V1-SPEC r2.39): +// AdmitsIO is the one deciding function for "may serve" under the shared readiness rule: // nil exactly when a Read, Write or Sync arriving now passes the I/O gate, // i.e. the backend admits I/O (open, operational, not chunk-fenced, no // pre-copy pause) AND the guarded projection names this backend's lineage as diff --git a/seaweed-block/core/frontend/durable/volume_lock_parent_mode_test.go b/seaweed-block/core/frontend/durable/volume_lock_parent_mode_test.go index ba85f454d9..cd6bee451f 100644 --- a/seaweed-block/core/frontend/durable/volume_lock_parent_mode_test.go +++ b/seaweed-block/core/frontend/durable/volume_lock_parent_mode_test.go @@ -11,7 +11,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/frontend/durable" ) -// V1-SPEC r2.45 (1), as the tmpfiles.d entry lays it out: a lock directory +// As the tmpfiles.d entry lays out the host-lock rule: a lock directory // the provider creates gets a traversable parent (0755) and is itself 0700, // whatever the umask. A 0700 parent created by root would keep the unit's // user out even after the locks directory is chowned to it. diff --git a/seaweed-block/core/frontend/error_class.go b/seaweed-block/core/frontend/error_class.go index 89e8a2670e..68cb9ffdfd 100644 --- a/seaweed-block/core/frontend/error_class.go +++ b/seaweed-block/core/frontend/error_class.go @@ -24,7 +24,7 @@ const ( var unclassifiedBackendErrorTypes sync.Map // reflect.Type -> struct{} -// ClassifyBackendError implements INV-FE-ERROR-RETRY-CLASS-001 and V1-SPEC r2.42. +// ClassifyBackendError implements the shared backend-error classification rule (INV-FE-ERROR-RETRY-CLASS-001). // Call only for a non-nil backend error. Known permanent causes win across the // entire wrapped/joined tree. Deliberate frontend markers decide otherwise; // a marker-free unknown error stays permanent and is logged once per leaf type. @@ -43,7 +43,7 @@ func ClassifyBackendError(ctx context.Context, err error) BackendErrorClass { case errors.Is(err, ErrNotReady), IsWriteDeadline(ctx, err): return BackendErrorNotReady default: - // M1 marker-free completion: amended V1-SPEC r2.42 retains the + // M1 marker-free completion: the error-classification rule retains the // permanent default. Backend owners must classify types seen in gates. logUnclassifiedBackendError(err) return BackendErrorPermanent diff --git a/seaweed-block/core/frontend/iscsi/backend_error_class_test.go b/seaweed-block/core/frontend/iscsi/backend_error_class_test.go index f308b45af7..0590bc84ce 100644 --- a/seaweed-block/core/frontend/iscsi/backend_error_class_test.go +++ b/seaweed-block/core/frontend/iscsi/backend_error_class_test.go @@ -157,7 +157,7 @@ type otherUnknownCompletionError struct{} func (otherUnknownCompletionError) Error() string { return "unknown completion B" } -// INV-FE-ERROR-RETRY-CLASS-001 / amended V1-SPEC r2.42: no marker means +// INV-FE-ERROR-RETRY-CLASS-001: no marker means // permanent. Unknown leaf types are logged once across wrappers and protocols. func TestUnclassifiedBackendErrorIsPermanentAndLoggedOncePerType(t *testing.T) { // The log-once cache is process-wide; give each test repetition a fresh diff --git a/seaweed-block/core/frontend/nvme/backend_error_class_test.go b/seaweed-block/core/frontend/nvme/backend_error_class_test.go index adc453a356..1629ea73ce 100644 --- a/seaweed-block/core/frontend/nvme/backend_error_class_test.go +++ b/seaweed-block/core/frontend/nvme/backend_error_class_test.go @@ -66,7 +66,7 @@ func (b *durabilityClassBackend) Sync(context.Context) error { return b.err } -// INV-FE-ERROR-RETRY-CLASS-001 / amended V1-SPEC r2.42: a failed durability +// INV-FE-ERROR-RETRY-CLASS-001: a failed durability // operation's latched permanent cause wins even beneath a deliberate busy marker. func TestSyncAndFUALatchedFaultOverridesBusy(t *testing.T) { for _, fua := range []bool{false, true} { diff --git a/seaweed-block/core/host/volume/status_server.go b/seaweed-block/core/host/volume/status_server.go index d642e14b6d..a811b9d247 100644 --- a/seaweed-block/core/host/volume/status_server.go +++ b/seaweed-block/core/host/volume/status_server.go @@ -517,7 +517,7 @@ func (s *StatusServer) handleStatusNVMe(w http.ResponseWriter, r *http.Request) } // NotReadyLeaseNotHeld: a workspace primary without a granted lease holds at -// the gate (no claim, no listen, not ready); V1-SPEC r2.37. +// the lease-readiness gate (no claim, no listen, not ready). const NotReadyLeaseNotHeld = "lease_not_held" func (s *StatusServer) statusProjection() StatusProjection { @@ -543,7 +543,7 @@ func (s *StatusServer) statusProjection() StatusProjection { p.Warnings = append(p.Warnings, st.Warnings...) } } - // V1-SPEC r2.39: the backend's one "may serve" function decides; an + // The frontend readiness rule: the backend's one "may serve" function decides; an // unopened volume fails closed. if err := src.AdmitsIO(p.VolumeID); err != nil { backendReason = "durable backend admits no I/O: " + err.Error() diff --git a/seaweed-block/core/host/volume/workspace_invalid_reply_test.go b/seaweed-block/core/host/volume/workspace_invalid_reply_test.go index 5dd3eda939..7635dbb9a7 100644 --- a/seaweed-block/core/host/volume/workspace_invalid_reply_test.go +++ b/seaweed-block/core/host/volume/workspace_invalid_reply_test.go @@ -9,7 +9,7 @@ import ( control "github.com/seaweedfs/seaweed-block/core/rpc/control" ) -// INV-WS-LEASE-001 / V1-SPEC r2.55 gap 9: invalid-reply fencing from a held, +// INV-WS-LEASE-001: invalid renewal replies fence a held, // unexpired lease, rather than passing because a synthetic deadline expired. func TestWorkspaceGuardFencesOnInvalidReply(t *testing.T) { for _, tc := range []struct { diff --git a/seaweed-block/core/host/volume/workspace_lease_held_test.go b/seaweed-block/core/host/volume/workspace_lease_held_test.go index 6bb07c16e8..24091a863b 100644 --- a/seaweed-block/core/host/volume/workspace_lease_held_test.go +++ b/seaweed-block/core/host/volume/workspace_lease_held_test.go @@ -12,7 +12,7 @@ import ( control "github.com/seaweedfs/seaweed-block/core/rpc/control" ) -// V1-SPEC r2.37: renewals refused before the first grant (a restart before the +// Lease-grant rule: renewals refused before the first grant (a restart before the // forced-move barrier) leave the lease not held; the first successful renewal // is logged as a re-grant after the refused ones, with its time. func TestWorkspaceLeaseGrantIsLoggedOnceAfterRefusedRenewals(t *testing.T) { @@ -90,7 +90,7 @@ func TestWorkspaceLeaseFirstRevokingReplyIsNotLoggedAsAGrant(t *testing.T) { } } -// V1-SPEC r2.37: a workspace primary reports NotReadyReason=lease_not_held, +// Lease-readiness rule: a workspace primary reports NotReadyReason=lease_not_held, // first, while its guard is missing or holds no granted lease, even with the // backend admitting I/O; ready once the lease is held; lease_not_held again // after the guard fences. diff --git a/seaweed-block/core/storage/chunk_cut_crash_test.go b/seaweed-block/core/storage/chunk_cut_crash_test.go index 4abd8439dd..fb346d9451 100644 --- a/seaweed-block/core/storage/chunk_cut_crash_test.go +++ b/seaweed-block/core/storage/chunk_cut_crash_test.go @@ -9,8 +9,8 @@ import ( "time" ) -// Single-volume coverage gap 2 (cells P5.4, P6.4, P8.7, P9.4, P10.4, P11.3; -// V1-SPEC r2.55): the holder dies (kill -9) in the middle of a cut, at each +// Cut-stage crash recovery (cells P5.4, P6.4, P8.7, P9.4, P10.4, P11.3): +// the holder dies (kill -9) in the middle of a cut, at each // stage, and restarts. Expected: HEAD is the old image (or, once the CAS // applied, the new one), never a mix; every synced local write reads back // after the restart; the next cut succeeds and publishes the volume as it diff --git a/seaweed-block/core/storage/chunk_layer_takeover_test.go b/seaweed-block/core/storage/chunk_layer_takeover_test.go index 4c6c0f5be8..0abe1c121e 100644 --- a/seaweed-block/core/storage/chunk_layer_takeover_test.go +++ b/seaweed-block/core/storage/chunk_layer_takeover_test.go @@ -1,4 +1,4 @@ -// V1-SPEC r2.55 side (a), coverage cell P10.6; +// Takeover data verification, coverage cell P10.6; // INV-WS-CLAIM-BEFORE-SERVE-001. The production attach path first claims // HEAD, then attaches the chunk layer against that exact claim. diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index cbe2b79d06..73c9d922b9 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -469,7 +469,7 @@ snapshot lifetime; local persistence does not bypass it. non-retryable mapping. This is a local pressure outcome, not a whole-I/O deadline; the broader budget gap is tracked separately in issue221. - Every frontend I/O error completion uses one shared retry class - (`INV-FE-ERROR-RETRY-CLASS-001`, amended V1-SPEC r2.42): (a) a known permanent + (`INV-FE-ERROR-RETRY-CLASS-001`, the shared backend-error classification rule): (a) a known permanent cause anywhere in the wrapped/joined tree wins: EIO, ENOSPC, EROFS, counter exhaustion, WAL integrity, prior fsync/append failure, invalid chunk maps, or RecoveryFailure with SubstrateIO/WALIntegrity kind (any cause). Bare short-read @@ -532,7 +532,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w | `INV-FE-NVME-READY-ANA-001` | An I/O that ends during the attachment-readiness wait because the backend closed or its lineage went stale keeps its ANA error, and a physical I/O fault keeps Internal Error. | M1 Opened / Recovering → Serving | `core/frontend/durable/storage_adapter.go` `attachReadyTimeout`; `core/frontend/nvme/io.go` `mapBackendError` | `TestSessionReadNotReadyIsRetryable` (`core/frontend/nvme/read_ready_retry_test.go`); `TestReadReadinessWaitDoesNotHoldAdmissionAndCloseWakesIt` (`core/frontend/durable/read_ready_wait_test.go`) | — | ACTIVE | | `INV-FE-PRIMARY-READY-OPERATIONAL-001` | FrontendPrimaryReady is reported only while the local durable backend admits I/O, and the frontend target listens only after it first does; attach-pending, fenced or no durable status reports not ready with the reason. | M1 Opened / Recovering → Serving; M2 process exit | `core/host/volume/status_server.go` `statusProjection`; `core/frontend/durable/storage_adapter.go` `FirstServing`; `cmd/blockvolume/frontend_gate.go` `awaitFrontendStart` (the iSCSI, NVMe and ublk targets in `cmd/blockvolume/main.go` `runVolume` start after it); `cmd/blockvolume/process_exit.go` `waitWorkspaceStop` | `TestStatusServer_ReadyOnlyWhileBackendOperational`, `TestStatusServer_NotReadyAlwaysHasAReason` (`core/host/volume/status_server_test.go`); `TestFrontendGateWaitsForTheStorageClaim`, `TestFrontendGateStopsWithoutStartingTheFrontends` (`cmd/blockvolume/frontend_gate_test.go`); `TestDurableProvider_NonChunkVolumeServesRightAfterOpen` (`core/frontend/durable/first_serving_test.go`) | — | ACTIVE | | `INV-FE-FENCE-EXIT-001` | A workspace chunk primary whose backend fences after its target listens ends the process within detection plus the 5 s cleanup bound: a lease expiry at the guard's own deadline, a HEAD fence within 50 ms. | M1 Serving → Closed; M2 process exit | `core/frontend/durable/provider_startup.go` `watchChunkFence` (HEAD fence: not operational with the evidence within 50 ms; I/O refused from the fence); `cmd/blockvolume/process_exit.go` `watchChunkRuntimeFence` (78 `head_fenced`) and `waitWorkspaceStop` (lease fence: 75 `lease_expired`); `superviseProcess` (the 5 s cleanup bound from the decision) | `TestWALStoreChunk_RuntimeHeadFenceLatchesNotOperational` (`core/frontend/durable/runtime_fence_test.go`); `TestRuntimeHeadFenceChoosesHeadFencedExit` (`cmd/blockvolume/runtime_fence_exit_test.go`); real-binary case C (lease expiry after listening: exit 75) | — | ACTIVE | -| `INV-WS-SERVE-LEASE-HELD-001` | A workspace primary claims HEAD, listens, reports ready and admits I/O only while its lease guard permits now; without a granted lease it holds at the gate and exits 75 when the startup wait runs out (`INV-WS-MASTER-WAIT-001`). | M1 Recovering → Serving; M2 process exit | `core/host/volume/workspace_lease.go` `WorkspaceLeaseGuard.Held` / `permits` (the one deciding function: the guarded projection gates the chunk claim, the per-I/O admit and `FrontendPrimaryReady`); `core/frontend/durable/storage_adapter.go` `AdmitsIO` (the one "may serve" function, the I/O gate: backend admits AND guarded projection names this lineage; V1-SPEC r2.39); `core/host/volume/status_server.go` `statusProjection` (`FrontendPrimaryReady` from `AdmitsIO`; `NotReadyReason=lease_not_held` first); `cmd/blockvolume/frontend_gate.go` `frontendStartSignal` / `awaitFrontendStart` (a workspace primary's frontends start once `AdmitsIO` passes; non-chunk and supporting replicas start after open as before); `cmd/blockvolume/process_exit.go` (exit 75 `assignment_timeout`) | `TestStatusServer_WorkspacePrimaryNotReadyWithoutHeldLease`, `TestWorkspaceLeaseGrantIsLoggedOnceAfterRefusedRenewals`, `TestWorkspaceLeaseFirstRevokingReplyIsNotLoggedAsAGrant` (`core/host/volume/workspace_lease_held_test.go`); `TestStorageBackend_AdmitsIOIsTheIOGate` (`core/frontend/durable/admits_io_test.go`); `TestFrontendStartSignal_WorkspacePrimaryWaitsForAdmitsIO`, `TestFrontendStartSignal_OtherVolumesStartAfterOpenAsBefore`, `TestFirstAdmittedStopEndsTheWorker` (`cmd/blockvolume/frontend_start_signal_test.go`); real-binary cases B-late (restart before the forced-move barrier, re-granted inside the wait: no claim, listen or ready before the re-grant), B75 (no grant inside the wait: no claim, listen or ready, exit 75; a restart after the barrier serves) and B0 (restart inside the lease serves at once) | — | ACTIVE | +| `INV-WS-SERVE-LEASE-HELD-001` | A workspace primary claims HEAD, listens, reports ready and admits I/O only while its lease guard permits now; without a granted lease it holds at the gate and exits 75 when the startup wait runs out (`INV-WS-MASTER-WAIT-001`). | M1 Recovering → Serving; M2 process exit | `core/host/volume/workspace_lease.go` `WorkspaceLeaseGuard.Held` / `permits` (the one deciding function: the guarded projection gates the chunk claim, the per-I/O admit and `FrontendPrimaryReady`); `core/frontend/durable/storage_adapter.go` `AdmitsIO` (the one "may serve" function, the I/O gate: backend admits AND guarded projection names this lineage; shared readiness rule); `core/host/volume/status_server.go` `statusProjection` (`FrontendPrimaryReady` from `AdmitsIO`; `NotReadyReason=lease_not_held` first); `cmd/blockvolume/frontend_gate.go` `frontendStartSignal` / `awaitFrontendStart` (a workspace primary's frontends start once `AdmitsIO` passes; non-chunk and supporting replicas start after open as before); `cmd/blockvolume/process_exit.go` (exit 75 `assignment_timeout`) | `TestStatusServer_WorkspacePrimaryNotReadyWithoutHeldLease`, `TestWorkspaceLeaseGrantIsLoggedOnceAfterRefusedRenewals`, `TestWorkspaceLeaseFirstRevokingReplyIsNotLoggedAsAGrant` (`core/host/volume/workspace_lease_held_test.go`); `TestStorageBackend_AdmitsIOIsTheIOGate` (`core/frontend/durable/admits_io_test.go`); `TestFrontendStartSignal_WorkspacePrimaryWaitsForAdmitsIO`, `TestFrontendStartSignal_OtherVolumesStartAfterOpenAsBefore`, `TestFirstAdmittedStopEndsTheWorker` (`cmd/blockvolume/frontend_start_signal_test.go`); real-binary cases B-late (restart before the forced-move barrier, re-granted inside the wait: no claim, listen or ready before the re-grant), B75 (no grant inside the wait: no claim, listen or ready, exit 75; a restart after the barrier serves) and B0 (restart inside the lease serves at once) | — | ACTIVE | | `INV-WAL-REPLAY-LWW-001` | Replay of the validated native prefix retains the highest admitted LSN per LBA; invalid cursor, nonce or LSN order is refused. | M1 Recovering | `core/storage/dirty_map.go` `putAtIfNewer` | `TestWALLSNOrderV3_RefusesDuplicateAndLower` (`core/storage/wal_lsn_order_v3_test.go`) | `WALRecovery` `ReplayLastWriter` | ACTIVE | | `INV-WAL-REUSE-PERSISTED-TAIL-001` | The WAL writer reuses only bytes that the both durable descriptor slots has already released. | M1 write lifecycle: Checkpointed → Reusable | `core/storage/wal_io_v3.go` `append`; `core/storage/walstore_map_checkpoint_v3.go` `publishCheckpointV3` | `TestWALIOV3_FloorAndPwriteFailureRefuse` (`core/storage/wal_io_v3_test.go`); `TestNativeReplacementCallerPublicationFaults` (`core/storage/legacy_replacement_v3_test.go`) | `WALRecovery` `I1` | ACTIVE | | `INV-WAL-CHECKPOINT-SNAPSHOT-001` | A checkpoint never passes a synced write that is not yet in the extent. | M1 write lifecycle: InExtent → Checkpointed | `core/storage/flusher.go` `flushOnceInternal` | `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` (`core/storage/walstore_map_recovery_lifetime_v3_test.go`); `TestNativeReplacementCheckpointSIGKILL` (`core/storage/legacy_checkpoint_replacement_v3_linux_test.go`) | `WALRecovery` `I1` | ACTIVE | @@ -991,7 +991,7 @@ Notes: | `INV-CSI-CONSUMES-AUTHORITY-001` | CSI never imports authority code or builds assignment facts; it takes the publish target from blockmaster and refreshes it before a stage, and blockmaster mints the IDs of the events CSI reports. | M2 (read side) | `core/csi/master_backend.go` `LookupPublishTarget`; `core/csi/node.go` `refreshPublishContext`; `core/host/master/observation_service.go` `ReportClusterEvent` | `TestG15a_CSI_DoesNotImportAuthorityOrConstructAssignmentFacts` (`core/csi/boundary_guard_test.go`); `TestG15e_CSIReattachUsesFreshPublishTargetAfterUnstage` (`core/csi/node_test.go`); `TestObservationService_ReportClusterEventAppearsInVolumeTimeline` (`core/host/master/observation_service_test.go`) | — | ACTIVE | | `INV-K8S-NONLOOPBACK-001` | Generated multi-node Helm values enable external iSCSI, external status and loopback rejection; with rejection enabled CSI never publishes a loopback target and fails closed when only loopback targets exist. | M2 (read side) | `cmd/sw-block/main.go` `runOpsGenerateHelmValues`; `core/csi/master_backend.go` `rejectFrontendAddr` | `TestOpsGenerateHelmValuesMultiNodeExternalISCSI` (`cmd/sw-block/main_test.go`); `TestNodeLoss_ControlStatusLookup_RejectsLoopbackPublishTargetsWhenEnabled`, `TestNodeLoss_ControlStatusLookup_FailClosedWhenOnlyLoopbackTargets` (`core/csi/master_backend_test.go`) | — | ACTIVE | | `INV-OBS-PRODUCT-EVENTS-001` | blockmaster records placement-verified, promotion-candidate-evaluation and authority-published events, and the CSI node reports `csi_reattach_observed` after a successful stage. | M3 promotion decision (observation) | `core/host/master/product_loop.go` `recordPlacementVerifiedEvents`, `recordPromotionEvaluationEvents`, `recordAuthorityPublishedEvent` | `TestMasterTimeline_RecordsPlacementVerified`, `TestMasterTimeline_RecordsPromotionCandidateEvaluation`, `TestMasterTimeline_RecordsAuthorityPublishedAfterMint` (`core/host/master/event_ring_test.go`); `TestNodeStage_ReportsCSIReattachObservedAfterSuccessfulStage` (`core/csi/node_test.go`) | — | ACTIVE | -| `INV-OBS-SLOT-ORDER-001` | A heartbeat slot (server, volume, replica) is ordered only against that slot's own previous heartbeat: a later-stamped heartbeat of another slot of the same server never supersedes it. | M2 heartbeat observations: per-slot refusal / mixed merge / all-superseded no mutation (V1-SPEC r2.53) | `core/authority/observation_store.go` `ingest` (per-slot comparison), `slotObservedAt`; `SupersededSlotCount` (diagnostic only) | `TestObservationStore_InterleavedSendersOrderPerSlot`, `TestObservationStore_MixedSlotReportKeepsOnlyNewerFacts`, `TestObservationStore_SupersededSlotLogsAfterUnlock` (`core/authority/observation_store_slot_order_test.go`) | 1.0 limit: a backward wall-clock step longer than the freshness window expires that host's slots; 1.0.1: per-process sequence. | ACTIVE | +| `INV-OBS-SLOT-ORDER-001` | A heartbeat slot (server, volume, replica) is ordered only against that slot's own previous heartbeat: a later-stamped heartbeat of another slot of the same server never supersedes it. | M2 heartbeat observations: per-slot refusal / mixed merge / all-superseded no mutation (per-slot ordering rule) | `core/authority/observation_store.go` `ingest` (per-slot comparison), `slotObservedAt`; `SupersededSlotCount` (diagnostic only) | `TestObservationStore_InterleavedSendersOrderPerSlot`, `TestObservationStore_MixedSlotReportKeepsOnlyNewerFacts`, `TestObservationStore_SupersededSlotLogsAfterUnlock` (`core/authority/observation_store_slot_order_test.go`) | 1.0 limit: a backward wall-clock step longer than the freshness window expires that host's slots; 1.0.1: per-process sequence. | ACTIVE | | `INV-OBS-SLOT-FROM-EXPECTED-SERVER-001` | A replica's slot in the assembled topology takes addresses and health only from a fresh fact reported by the server its expected slot names; another server's fact for the same replica is never used, so with none from that server the slot is a placeholder. | AUTHORITY/ORDER: observation to assignment line | `core/authority/snapshot_builder.go` `assembleVolumeTopology` | `TestAssembleVolumeTopology_SlotFactOnlyFromTheExpectedServer` (`core/authority/snapshot_slot_server_test.go`) | — (pure assembly; the unit test is the proof form) | ACTIVE | | `INV-HELM-RF-NODECOUNT-001` | Generated Helm values fail closed when the requested replication factor exceeds the selected Ready schedulable node count. | M3 (configuration) | `cmd/sw-block/main.go` `runOpsGenerateHelmValues`, `selectHelmValuesNodes` | `TestOpsGenerateHelmValuesRejectsRFAboveSelectedNodes` (`cmd/sw-block/main_test.go`) | — | ACTIVE | | `INV-HOSTPATH-TRANSPARENT-001` | The read model reports transparent host-path recovery only with a multipathed, Active/Optimized, stale-fenced path, writer and reader checks, and the same pod UID. | K8s readiness model | `core/ops/managed_volume_model.go` `classifyManagedVolume`, `deriveManagedVolumeStates` | `TestManagedVolumeProjection_TransparentISCSIALUARecovered`, `TestManagedVolumeProjection_MissingMultipathBlocksTransparentClaim` (`core/ops/managed_volume_model_test.go`) | — | ACTIVE | @@ -1129,7 +1129,7 @@ A row that names a function existing only on an open pull request says so ("on # | Term | Meaning | Field(s) | Deciding function (one per side) | Known second derivations to remove | Owner role | |---|---|---|---|---|---| | `TERM-LIVE-HOLDER-001` Live holder of a workspace volume | The line's holder at epoch e may have acknowledged guest writes and may publish exactly when: the authority line exists at e for its owner (`TERM-HOLDER-001`), no clean revocation ACK is recorded for (replica, e), and HEAD as read names `/` at e, active. HEAD below e means never started at e: no I/O is admitted before the claim. | the authority line, the recorded ACK, HEAD (`Epoch`, `Holder`, `Detached`) | `authority.WorkspaceHolderState` (pure): no line, drained, sealed, never started, live, unknown | the forced-move admission still reads the lease; a sealed HEAD without an ACK keeps the ACK rule | blockmaster | -| `TERM-HOLDER-001` Holder identity (the primary of a single-copy workspace volume only; supporting replicas are not holders) | The process that may act as primary of a single-copy workspace volume at an epoch is the pair (server id, replica id) at that epoch. A matching replica id or endpoint alone never names it, and a missing server id is refused. No local-root nonce joins it (V1-SPEC r2.45); one live process per volume on a host is the host lock (`TERM-ONE-PROCESS-001`). | `AssignmentFact` `server_id`, `replica_id`, `epoch` (`core/rpc/proto/control.proto`; `server_id` on [#411](https://github.com/seaweedfs/seaweed-block/pull/411)); `WorkspaceIdentity` `server_id`, `replica_id`, `epoch` (`core/rpc/proto/workspace.proto`; `server_id` on #411); the published line's `PublishedLine.IssuedHost` (`core/authority/workspace_lease_view.go`) and the move journal's `WorkspaceMoveRecord.NewHost` (`core/authority/workspace.go`); the volume's `Config.ServerID`, `Config.ReplicaID` (`core/host/volume/host.go`, from `--server-id`, `--replica-id`); the HEAD `Holder`, written as `/` (`cmd/blockvolume/chunk_remote.go` `chunkHolder`) | Master: `core/host/master/workspace_service.go` `services.holderMatches(volume, replica, server, epoch)`, on #411; it gates `RenewWorkspaceLease` and `AckWorkspaceRevoked`, after the host check of #416, and takes the line's owner server from `core/host/master/workspace_binding.go` `Host.workspaceLineOwner`, on #423, the one owner decision for current and historical lines (through `PublishedLine.Owner`, which the snapshot builder's `expectOwnerForLine` also calls). The line's owner server is carried in the published line; a move's line names the move's new host; placement names the owner only for the initial line; an unknown owner is sent empty and never adopted. A volume that has seen an epoch owned by one server never adopts that epoch for another (this covers replays). The safety rule is the refusal to adopt a line naming another server; fencing on a foreign line is defence in depth, and only a process that has adopted a lineage fences, on a strictly newer foreign line. Volume: `core/host/volume/assignment_holder.go` `Host.assignmentNamesSelf`, on #411; called by `applyFact` and `IsSuperseded`. | `Host.applyFact` adopts a fact on the replica id alone. `Host.IsSuperseded` ignores a same-replica line from another server. `Host.recordOtherLine` lets an older line overwrite a newer one. Lease renewals and revocation ACKs carry no server id. All four are removed by #411. The master's status frontends and CSI publish target take the freshest same-replica heartbeat from any server (`ObservationStore.SlotFact` via `statusFrontendsForAssignedVolume`), and the operator's primary node is the placement slot (`serverForReplica`). Both are removed by [#416](https://github.com/seaweedfs/seaweed-block/pull/416), stacked on #411. The master computed the line's owner server twice; #423 makes it one function. | authority (master side); volume host (volume side) | +| `TERM-HOLDER-001` Holder identity (the primary of a single-copy workspace volume only; supporting replicas are not holders) | The process that may act as primary of a single-copy workspace volume at an epoch is the pair (server id, replica id) at that epoch. A matching replica id or endpoint alone never names it, and a missing server id is refused. No local-root nonce joins it (holder identity rule); one live process per volume on a host is the host lock (`TERM-ONE-PROCESS-001`). | `AssignmentFact` `server_id`, `replica_id`, `epoch` (`core/rpc/proto/control.proto`; `server_id` on [#411](https://github.com/seaweedfs/seaweed-block/pull/411)); `WorkspaceIdentity` `server_id`, `replica_id`, `epoch` (`core/rpc/proto/workspace.proto`; `server_id` on #411); the published line's `PublishedLine.IssuedHost` (`core/authority/workspace_lease_view.go`) and the move journal's `WorkspaceMoveRecord.NewHost` (`core/authority/workspace.go`); the volume's `Config.ServerID`, `Config.ReplicaID` (`core/host/volume/host.go`, from `--server-id`, `--replica-id`); the HEAD `Holder`, written as `/` (`cmd/blockvolume/chunk_remote.go` `chunkHolder`) | Master: `core/host/master/workspace_service.go` `services.holderMatches(volume, replica, server, epoch)`, on #411; it gates `RenewWorkspaceLease` and `AckWorkspaceRevoked`, after the host check of #416, and takes the line's owner server from `core/host/master/workspace_binding.go` `Host.workspaceLineOwner`, on #423, the one owner decision for current and historical lines (through `PublishedLine.Owner`, which the snapshot builder's `expectOwnerForLine` also calls). The line's owner server is carried in the published line; a move's line names the move's new host; placement names the owner only for the initial line; an unknown owner is sent empty and never adopted. A volume that has seen an epoch owned by one server never adopts that epoch for another (this covers replays). The safety rule is the refusal to adopt a line naming another server; fencing on a foreign line is defence in depth, and only a process that has adopted a lineage fences, on a strictly newer foreign line. Volume: `core/host/volume/assignment_holder.go` `Host.assignmentNamesSelf`, on #411; called by `applyFact` and `IsSuperseded`. | `Host.applyFact` adopts a fact on the replica id alone. `Host.IsSuperseded` ignores a same-replica line from another server. `Host.recordOtherLine` lets an older line overwrite a newer one. Lease renewals and revocation ACKs carry no server id. All four are removed by #411. The master's status frontends and CSI publish target take the freshest same-replica heartbeat from any server (`ObservationStore.SlotFact` via `statusFrontendsForAssignedVolume`), and the operator's primary node is the placement slot (`serverForReplica`). Both are removed by [#416](https://github.com/seaweedfs/seaweed-block/pull/416), stacked on #411. The master computed the line's owner server twice; #423 makes it one function. | authority (master side); volume host (volume side) | | `TERM-LEASE-NOW-001` Lease valid now | The holder may act on its workspace lease at this instant only while the guard has not fenced and host monotonic time is before the start of its last successful renewal plus the granted validity. The granted validity is the master expiry less half the clock-skew bound, capped by the configured TTL. The takeover margin (half the skew bound) exceeds the configured fence-exit budget (watch cadence 50 ms + drain timeout 5 s), assuming normal scheduling; blockmaster refuses a smaller or equal margin at startup, deriving the budget from `durable.ChunkFenceWatchInterval` and `volume.WorkspaceDrainTimeout`. Safety premise for v1.0, alongside one live process per holder (`TERM-ONE-PROCESS-001`): blockmaster's host slews its wall clock, not steps it, while volumes are served; a step larger than the configured skew bound while a lease is live is unsupported (see `docs/operator-guide.md`, Clock safety requirement). This closes coverage gap 8 by a documented premise, not a wall-step test. | `WorkspaceLease` `ExpiresAtNS`, `MaxClockSkewNS`, and the lease view's durable horizon and granted deadline (`core/authority/workspace_lease_view.go`); `WorkspaceLeaseFact` `valid_for_ns`, `expires_at_ns`, `revoking` (`core/rpc/proto/workspace.proto`); `WorkspaceLeaseGuard` `until`, `fenced` (`core/host/volume/workspace_lease.go`) | Holder: `core/host/volume/workspace_lease.go` `WorkspaceLeaseGuard.permits`. Master: `core/authority/workspace_lease_view.go` `Publisher.WorkspaceLeaseValidity` / `workspaceLeaseValidityAt` is shared by renewal admission, `leaseFact` and `AckWorkspaceRevocation`. `WorkspaceLeaseValidity` reads the publisher clock; its leaf calculation uses the larger configured/persisted skew and configured TTL. `Publisher.RenewWorkspaceLease`. `firstWorkspaceGrant` and `regrantWorkspaceLease` are reached only from it, and only it starts the extender `extendWorkspaceLease`. | `WorkspaceLeaseGuard.drain` checks `now < until` again inline before the ACK, and `WorkspaceLeaseGuard.Refresh` repeats the expiry check of `permits`: open (both should call one predicate). The host reply sanity bound in `Refresh` still repeats the publisher's default 30 s TTL: open. Not a duplicate: `Publisher.forcedMoveBarrierLocked` decides the opposite term, "the lease is over for the master" (the horizon and the deadline each plus the full skew bound), which a forced move and a re-grant need. Follow-up for 1.0.1: split `workspaceNow` into wall and monotonic sources so the barrier for in-memory lines uses monotonic time, and add a real independent wall-step test. No new clock seam is added in v1.0. | authority (grant); volume host (guard) | | `TERM-SERVING-001` Serving / ready | A workspace primary claims HEAD, listens, reports ready and admits I/O only while its lease guard permits now and its durable backend is operational. Without a granted lease it holds at the gate and exits 75 when the startup wait runs out (`INV-WS-MASTER-WAIT-001`). | `frontend.Projection.Healthy`; the `StorageBackend` operational flag and its evidence, reported as `VolumeStatus.Operational` (`core/frontend/durable`); `StatusProjection.FrontendPrimaryReady` (and `NotReadyReason`, on [#410](https://github.com/seaweedfs/seaweed-block/pull/410)); the ALUA and ANA state; `HeartbeatSlot.frontends` | Authority side: `core/host/volume/projection_bridge.go` `AdapterProjectionView.projectionWithSupersede`, which ANDs in `WorkspaceLeaseGuard.permits` for workspace volumes. Storage side: the `StorageBackend` operational flag (`core/frontend/durable/storage_adapter.go`), written only by `SetOperational` and read by `readyCheck`. The one decision of both sides together is `StorageBackend.AdmitsIO` (the guarded AND), read by the status, the frontend start gate and every I/O: on #410 (today `StorageBackend.gate` on `main`). | `StatusServer.authorityProjection` derives `FrontendPrimaryReady` from the authority view alone, and it repeats the supersede and supporting tests that `Healthy` already contains. #410 adds the backend half in `statusProjection`; the repeated tests remain open. The frontends listen whether or not the backend admits I/O: #410 holds them in `awaitBackendAdmitsIO` until it does. #410 replaces its earlier `backendAdmitsIO` (which read only `VolumeStatus.Operational`) with `StorageBackend.AdmitsIO`. A later lease fence ends the process on [#409](https://github.com/seaweedfs/seaweed-block/pull/409). `projectionALUAProvider.ALUAState` and `projectionANAProvider.ANAState` (`cmd/blockvolume`) follow the projection only: open. The start-time wait (`chunkAuthorityWait`; `ProviderConfig.ChunkAssignmentTimeout`, 30 s by default) ends once, and the process then stays up without serving: #409 makes it exit 75. iSCSI reports a not-ready or busy backend as a medium error, while NVMe retries the same error: [#415](https://github.com/seaweedfs/seaweed-block/pull/415) (`frontend.ClassifyBackendError`). The heartbeat `Frontends` are set when the listeners start and cleared only at shutdown: open. | volume host | | `TERM-STOP-SUPERSEDED-001` Superseded | A newer published line for this volume names another holder (another replica, or the same replica on another server) at or above this process's epoch and endpoint version. From then on the process is not healthy. | `Host.lastOther` (an `AssignmentFact`); the process's own epoch and endpoint version | Volume: `core/host/volume/host.go` `Host.IsSuperseded`. Its same-replica branch, and the ordered `recordOtherLine` it reads, are on #411. | The status repeat listed under `TERM-SERVING-001`. `Host.IsCurrentReplicaSuperseded` (on #409) and `Host.promotionReady` call `IsSuperseded` with other lineages. They are wrappers, not second derivations. | volume host |