feat(storage): same-ID BASE resume after an installing reopen (row 11b)

DESIGN r17.4 section 8.3, "Resume (same ID)", store level and dark (no
current caller resumes: both receivers begin fresh install IDs). Under
installMu exclusive the resume appends nothing until all three hold:

1. trusted-through-W: the recovered suffix is intact (R >= W*) and E is
   at or past the persisted retainedHead;
2. the 6.6 fence of [E, floor + WALSize) with fsync;
3. a publication of retainedHead = E (G3).

Otherwise it refuses with ErrInstallSuffixDamaged, writing nothing, and
the volume stays installing. The writer continues at E (forward only)
and the reopen's trusted install-lane records are replayed so the
completed image serves them. The installing Recover now keeps those
records with its recovered bounds.

Controls: an intact resume that serves the recovered LSN 11 and fences
the dropped LSN 13; a damaged suffix refused; E below the persisted head
refused, while a covering supersession anchors at P = that head and stays
resumable across a crash. Mutants: no fence, ignoring the damage, no
E >= head check, anchoring the supersession at P = E.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-17 14:20:31 -08:00
1 parent be0c988b80
commit 3c67ee5681
4 files changed
+210 -3

No files matched your search

@@ -0,0 +1,121 @@
package storage
import (
"bytes"
"errors"
"testing"
)
// Plan row 11b controls (DESIGN r17.4 sections 6.6 and 8.3; owner claude03):
// the same-ID resume after an installing reopen.
// An intact reopen (W 2 <= R 11; record 12 damaged, 13 beyond the gap)
// resumes the same ID: the recovered LSN 11 is kept and served after
// completion, the resumed session's LSN 12 lands at E, and the old 13 does
// not re-chain behind it (the fence). Mutant: a resume without the fence
// serves the old LSN 13 at LBA 3 and fails here.
func TestBaseInstallV3ResumeAfterReopenFencesAndServesTheSuffix(t *testing.T) {
r, path, err := installThenCrashV3(t, false)
if !errors.Is(err, ErrBaseIncomplete) || errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("reopen: err = %v, want an intact ErrBaseIncomplete", err)
}
h, err := r.resumeBaseInstallV3(idA)
if err != nil {
t.Fatalf("resume: %v", err)
}
if d := r.v3.pub.current(); d.BaseState != BaseInstalling || d.BaseInstallID != idA {
t.Fatalf("after resume: state %d", d.BaseState)
}
if err := h.ApplyInstallEntry(2, blk(0x99), 12); err != nil {
t.Fatal(err)
}
if err := h.MarkBaseComplete(); err != nil {
t.Fatal(err)
}
q := reopenServingV3(t, r, path)
if got := readV3(t, q, 3); bytes.Equal(got, blk(13)) {
t.Fatal("the dropped LSN 13 resurrected after the resume (no fence)")
}
for lba, want := range map[uint32]byte{1: 11, 2: 0x99} {
if got := readV3(t, q, lba); !bytes.Equal(got, blk(want)) {
t.Fatalf("LBA %d = %x..., want %x", lba, got[0], want)
}
}
}
// A damaged suffix (W* 13 > R 11) refuses the resume with
// ErrInstallSuffixDamaged, writing nothing; the volume stays installing.
// Mutant: a resume that ignores the damage fails here.
func TestBaseInstallV3ResumeRefusesADamagedSuffix(t *testing.T) {
r, path, err := installThenCrashV3(t, true)
if !errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("reopen: err = %v, want ErrInstallSuffixDamaged", err)
}
t.Cleanup(func() { crashRecoveryHardeningStore(t, r) })
a0, b0 := slotsV3(t, path)
if _, err := r.resumeBaseInstallV3(idA); !errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("resume over a damaged suffix: err = %v, want ErrInstallSuffixDamaged", err)
}
if a, b := slotsV3(t, path); a != a0 || b != b0 {
t.Fatal("a refused resume wrote a slot")
}
if st := r.v3.pub.current().BaseState; st != BaseInstalling {
t.Fatalf("state %d, want installing", st)
}
}
// E below the persisted retainedHead (codex03 r17 check): the head was
// published past LSN 13 (white-box, as an earlier same-open recovery
// would), then 13 is damaged, so the reopen's E ends after 12, below the
// head. The resume is refused (E >= head is part of trusted-through-W). A
// covering supersession anchors at P = the persisted head; a crash right
// after it reopens with E = P = head and resumes. Mutants: a resume
// without the E >= head check, and a supersession anchored at P = E (its
// reopen then has E below the head and cannot resume), fail here.
func TestBaseInstallV3EBelowThePersistedHead(t *testing.T) {
s, path := newStoreV3(t, WModeStrict)
writeSynced(t, s, 1, 2)
h := beginV3(t, s, 10, idA)
for lsn := uint64(11); lsn <= 13; lsn++ {
if err := h.ApplyInstallEntry(uint32(lsn-10), blk(byte(lsn)), lsn); err != nil {
t.Fatal(err)
}
}
head := s.v3.w.logicalHeadV3()
if _, err := s.v3.pub.publish(&s.mu, nil, func(n *descriptorV3) error { n.RetainedHead = head; return nil }); err != nil {
t.Fatal(err)
}
crashRecoveryHardeningStore(t, s)
damageRecord(t, path, 13)
r, err := openUnmappedWALStoreV3ForTest(path)
if err != nil {
t.Fatal(err)
}
r.DisableAutoFlushForRecoveryTest()
if _, err := r.Recover(); !errors.Is(err, ErrBaseIncomplete) || errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("reopen: err = %v, want an intact ErrBaseIncomplete (R 12 >= W* 2)", err)
}
if ro := r.v3.installReopen; ro == nil || ro.E >= head {
t.Fatalf("setup: E %v not below the persisted head %d", ro, head)
}
if _, err := r.resumeBaseInstallV3(idA); !errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("resume with E below the persisted head: err = %v, want ErrInstallSuffixDamaged", err)
}
beginV3(t, r, 12, idB)
if d := r.v3.pub.current(); d.BaseCursor != head || d.RetainedHead != head {
t.Fatalf("supersession anchored at %d (head %d), want P = the persisted head %d", d.BaseCursor, d.RetainedHead, head)
}
crashRecoveryHardeningStore(t, r)
q, err := openUnmappedWALStoreV3ForTest(path)
if err != nil {
t.Fatal(err)
}
q.DisableAutoFlushForRecoveryTest()
t.Cleanup(func() { crashRecoveryHardeningStore(t, q) })
if _, err := q.Recover(); !errors.Is(err, ErrBaseIncomplete) || errors.Is(err, ErrInstallSuffixDamaged) {
t.Fatalf("reopen after the supersession: err = %v, want an intact ErrBaseIncomplete", err)
}
if _, err := q.resumeBaseInstallV3(idB); err != nil {
t.Fatalf("resume of the covering install: %v", err)
}
}
@@ -41,6 +41,83 @@ type installReopenV3 struct {
id [16]byte
E, R uint64
damaged bool
walSize uint64
records []walScannedRecordV3 // the trusted write records <= R, for a resume
}
// resumeBaseInstallV3 resumes the installing ID after a reopen (DESIGN
// 8.3, "Resume (same ID)"). Under installMu exclusive it appends nothing
// until all three hold: the trusted-through-W check (the recovered suffix
// is intact, R >= W*, and E >= the persisted retainedHead), the 6.6 fence
// of [E, floor + WALSize) with fsync, and a publication of retainedHead = E
// (G3). Otherwise it refuses with ErrInstallSuffixDamaged, writing nothing;
// the volume stays installing and not ready. The writer continues at E,
// the live position after this open's recovery; the recovered install-lane
// records are replayed so the completed image serves them.
func (s *WALStore) resumeBaseInstallV3(id [16]byte) (*installHandleV3, error) {
v := s.v3
if v == nil {
return nil, errors.New("storage: v3 BASE resume on a non-v3 store")
}
v.installMu.Lock()
defer v.installMu.Unlock()
s.captureMu.Lock()
defer s.captureMu.Unlock()
s.lifecycleMu.RLock()
defer s.lifecycleMu.RUnlock()
v.syncMu.Lock()
defer v.syncMu.Unlock()
s.mu.Lock()
defer s.mu.Unlock()
if s.closed {
return nil, errors.New("storage: BASE resume after Close")
}
if err := s.stickyIOFault(); err != nil {
return nil, err
}
d := v.pub.current()
ro := v.installReopen
if d.BaseState != BaseInstalling || d.BaseInstallID != id {
return nil, ErrInstallSuperseded
}
if ro == nil || ro.id != id || v.w == nil {
return nil, fmt.Errorf("%w: resume without this open's recovered bounds", errV3NotYet)
}
if ro.damaged || ro.E < d.RetainedHead {
return nil, fmt.Errorf("%w: R %d, E %d, persisted retainedHead %d", ErrInstallSuffixDamaged, ro.R, ro.E, d.RetainedHead)
}
v.recoverGen.Add(1)
defer v.recoverGen.Add(1)
floor, sameNonce := v.pub.reuseFloor()
if err := s.fenceV3(ro.E, floor, d.WALSize, sameNonce, d.WALOffset); err != nil {
return nil, err
}
if _, err := v.pub.publish(nil, nil, func(n *descriptorV3) error {
if n.BaseState != BaseInstalling || n.BaseInstallID != id {
return ErrInstallSuperseded
}
n.RetainedHead = ro.E
return nil
}); err != nil {
return nil, err
}
if err := v.w.advanceHeadV3(ro.E); err != nil {
return nil, err
}
for _, r := range ro.records {
e := r.Entry
size := uint64(walEntryHeaderSizeV3 + len(e.Data))
s.dm.putAtIfNewer(e.LBA, (r.End-size)%ro.walSize, 0, e.LSN, d.BlockSize)
s.recordMapWriteV3(e.LBA, e.LSN)
}
v.installReopen = nil
v.liveInstallID = id
v.installEpoch++
v.preBaseHighest = 0 // every recovered record is of this install
if err := v.pub.invalidateMapProofV3(); err != nil {
return nil, err
}
return &installHandleV3{s: s, id: id, epoch: v.installEpoch}, nil
}
// installHandleV3 is the only path for BASE extent writes and install-lane
+10 -1
View File
@@ -387,7 +387,16 @@ func (s *WALStore) recoverV3() (uint64, error) {
// Nothing is fenced, published or admitted here; the allocator
// state continues above every trusted record so a later install
// never reuses an LSN the WAL still holds.
v.installReopen = &installReopenV3{id: d.BaseInstallID, E: o.E, R: o.R, damaged: o.Damaged}
ro := &installReopenV3{id: d.BaseInstallID, E: o.E, R: o.R, damaged: o.Damaged, walSize: d.WALSize}
for _, r := range scan.Records {
if r.Entry.LSN > o.R {
break
}
if r.Entry.Type == walEntryWrite {
ro.records = append(ro.records, r)
}
}
v.installReopen = ro
v.appended.Store(max(v.appended.Load(), o.R))
s.nextLSN = max(s.nextLSN, o.R+1)
s.walHead = max(s.walHead, o.R)
+2 -2
View File
@@ -289,7 +289,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
| `INV-WAL-V3-W-001` | v3 Sync acknowledges only after an fsync covers the batch. In mode C (the default) the slot carries the previous batch's acknowledged W and the batch's single fsync covers WAL and slot; in mode A the WAL fsync precedes a slot publication with W = H. Recovery refuses (`wal_corrupt`) when the contiguous prefix R above max(CheckpointLSN, BaseLSN) is below W* = max(slot W, max trusted DurableLSN). Mode C's only unprotected acknowledged data is the newest batch, against media corruption before the next Sync or the idle refresh; `SetWMode` and the refresh close that window. Flushed entries above the published checkpoint remain retry work, so a later Sync plus cycle can advance checkpoint and map coverage together. | M1 Recovering → Serving \| RecoveryFailed; M1 write lifecycle: Appended → Synced (v3) | `core/storage/walstore_v3.go` `WALStore.syncWALBatchV3`, `refreshW`, `SetWMode`, `recoverV3`, `appendWriteV3`; `core/storage/recovery_v3.go` `decideRecoveryV3`, `contiguousPrefixV3`; `core/storage/flusher.go` `flushOnceInternal` | `TestWALStoreV3CloseKeepsTheNewestSlotAAndItsW`, `TestWALStoreV3LegacySuperblockWritersRefuse` (`core/storage/walstore_close_v3_test.go`); `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3ModeCWindowIsExactlyTheNewestBatch`, `TestWALStoreV3RefreshAndSetWModeCloseTheWindow`, `TestWALStoreV3TornUnsyncedTailIsNeverAFalseCorrupt`, `TestWALStoreV3AppendWriteErrorLatchesTheStore`, `TestWALStoreV3FlusherWritesTheExtentButHoldsTheCheckpointUntilTheMap`, `TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary`, `TestWALStoreV3SetWModeWaitsForAHeldBatch`, `TestWALStoreV3NoBatchAcksUnderAStaleModeAfterSetWMode`, `TestWALStoreV3SetWModeCrashCases`, `TestWALStoreV3SameOpenRecoverResetsTheAcknowledgedFrontier`, `TestWALStoreV3InstallingScanErrorIsTypedNotReady`, `TestWALStoreV3FlusherCycleRunsTheIdleRefresh`, `TestWALStoreV3RefreshDuringRecoverWaitsAndPublishesNothing`, `TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut`, `TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery`, `TestWALStoreV3FlusherCheckpointIsClampedToTheAcknowledgedW`, `TestWALStoreV3FlusherEmptyCycleRunsTheIdleRefresh` (`core/storage/walstore_v3_test.go`); `TestRecoveryV3Decision`, `TestRecoveryV3ContiguousPrefix` (`core/storage/recovery_v3_test.go`); `TestWALStoreV3_FlushedProgressRetriesAfterLaterSync` (`core/storage/walstore_flushed_progress_v3_test.go`) | `WALFormat` composed model (claude05, r14 run) | STUB |
| `INV-WAL-V3-FENCE-001` | Before any append after a v3 recovery, the store zeroes exactly the logical WAL interval [E, floor+WALSize) (floor = both slots' same-nonce reuse floor) split at the physical wrap, fsyncs it through the leaf, then publishes retainedHead = E; no byte before E or outside the interval changes, so records dropped by one recovery never resurface after a second crash. | M1 Recovering → Serving (v3) | `core/storage/walstore_v3.go` `WALStore.fenceV3`, `recoverV3`; `core/storage/recovery_v3.go` `fenceRangesV3` | `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestWALStoreV3NoFenceResurrectsInBothModes`, `TestWALStoreV3FenceTouchesNoByteBeforeTheHead`, `TestWALStoreV3RecoversAHistoryEndingAtTheLastRepresentableCursor` (`core/storage/walstore_v3_test.go`); `TestRecoveryV3FenceRangesAreExact` (`core/storage/recovery_v3_test.go`) | `WALFormat` `NoResurrection` (claude05) | STUB |
| `INV-WAL-V3-RESET-001` | A v3 nonce/position reset is refused, writing nothing, unless the dirty map is empty (no entry names an old-incarnation WAL position) and every appended LSN is checkpointed (CheckpointLSN >= appended, hence = acknowledged W). It publishes the new nonce with an empty cursor space into one slot and then the other, and is successful only after both. A crash between the two opens the new incarnation; no reuse floor exists across the two nonces, and no writer binds until Recover's head publication completes the other slot. LSNs, W and the map root are unchanged. A read holds no lock across its WAL read; it validates the whole record it read (CRC, footer, type, LBA, LSN) against the resolving dirty entry and re-resolves on a mismatch, so a position reused by the new incarnation never serves another block (LSN allocation runs on across a reset; no nonce is checked). It reports WAL damage only for an unchanged entry with the same recovery generation before and after the attempt (bumped at the start and the end of every recovery and reset); a failed pread is substrate I/O. | M1 Serving → Serving (reset, dark) | `core/storage/reset_v3.go` `WALStore.resetIncarnationV3`, `descriptorPublisherV3.resetIncarnationV3`, `halfResetV3`; `core/storage/descriptor_v3.go` `mergeDescriptorV3Mode`; `core/storage/walstore_v3.go` open and `recoverV3` | `TestResetV3RefusesWhileUncheckpointed`, `TestResetV3RefusesTheCurrentOrAZeroNonce`, `TestResetV3RetainedButCheckpointedBytesDoNotBlock`, `TestResetV3PublishesBothSlotsAndOnlyThenHasAFloor`, `TestResetV3CrashOutcomes`, `TestResetV3OrdinaryPublicationsCannotChangeTheNonce` (`core/storage/reset_v3_test.go`); `TestWALStoreV3ResetRefusesUncheckpointedOrUnacknowledgedData`, `TestWALStoreV3ResetPublishesBothSlotsAndWritesRecoverAcrossACrash`, `TestWALStoreV3ResetCrashOutcomes`, `TestWALStoreV3HalfResetRefusesWritesUntilRecover`, `TestWALStoreV3ReadParkedAcrossAResetAndOverwriteReturnsItsOwnBlock`, `TestWALStoreV3ReadMissRecheckParkedAcrossAResetReturnsItsOwnBlock`, `TestWALStoreV3ReadOfADamagedLiveRecordIsAnIntegrityFault`, `TestWALStoreV3ReadAcrossARecoveryThatReusesTheSamePositionAndLSNIsNotDamage`, `TestWALStoreV3ReadIOErrorsAreSubstrateIONotWALIntegrity`, `TestWALStoreV3ReadAdmittedBetweenRecoverBumpAndClearIsNotDamage` (`core/storage/reset_store_v3_test.go`) | `WALFormat` reset (claude05 r4.5, pending) | STUB |
| `INV-WAL-V3-BASE-001` | A v3 BASE install begins only under `installMu` exclusive (draining the old ID's admitted mutations) and only when BaseLSN covers the acknowledged W (published or not yet), the checkpoint and every appended LSN (an unacknowledged record above BaseLSN would leave a hole behind BaseCursor; codex01 row 9a P1-1); otherwise it is refused, writing nothing, with `ErrInstallBaseUncovered` or `ErrInstallSupersedeUncovered`. It publishes installing (BaseLSN, BaseCursor = the writer head P, the ID) into both slots before the first BASE mutation. BASE extent writes and install-lane applies go only through the handle, under `installMu` shared: a handle lives until the next begin (an install epoch), `WriteBase` needs installing under its ID, and an install-lane apply is also admitted after the handle's own completion while installed or retired, because the session's WAL lane can outlive its BaseDone (DESIGN r17.4; `ErrInstallSuperseded` otherwise); the install lane keeps the order and gap rules. Complete validates the ID under `installMu` exclusive, fsyncs the BASE bytes and the suffix, runs the checkpoint's metadata and chunk barriers and publishes installed with retainedTail >= BaseCursor together with a fresh owned-map candidate carrying the BASE writes' UNKNOWN (codex01 row 9a P1-2) and stops serving the superseded pre-BASE records. installing -> none is refused (no abort); installed -> none retires only once the checkpoint covers BaseLSN and both slots carry a tail at or past BaseCursor. | M1 Serving → Installing → Serving (dark) | `core/storage/base_install_v3.go` `WALStore.beginBaseInstallV3`, `installHandleV3.WriteBase`, `installHandleV3.ApplyInstallEntry`, `WALStore.markBaseCompleteV3`; `core/storage/descriptor_v3.go` `baseTransitionAllowedV3`, `retireBaseV3` | `TestBaseInstallV3BeginPublishesInstallingIntoBothSlots`, `TestBaseInstallV3BeginRefusesBelowW`, `TestBaseInstallV3BeginCoversTheAcknowledgedNotYetPublishedW`, `TestBaseInstallV3BeginRefusals`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash`, `TestBaseInstallV3InstallingToNoneIsRefused`, `TestBaseInstallV3RetiresOnlyOnceTheCheckpointCoversBaseLSN`, `TestBaseInstallV3ApplyInstallEntryOrderAndGap`, `TestBaseInstallV3HeldOldWriteDrainsBeforeANewBegin`, `TestBaseInstallV3ParkedOldFrameIsRefusedAfterASupersession`, `TestBaseInstallV3BeginRefusesBelowTheHighestAppendedLSN`, `TestBaseInstallV3CompletePersistsTheMapUnknownOfBaseWrites`, `TestBaseInstallV3BeginRefusesWithAnAttachedChunkLayer`, `TestBaseInstallV3CompletedHandleAppliesUntilTheNextBegin` (`core/storage/base_install_v3_test.go`); `TestBaseInstallV3SupersessionAfterReopenFencesTheOldSuffix`, `TestBaseInstallV3CoveringSupersessionOverADamagedSuffix` (`core/storage/base_install_reopen_v3_test.go`); `TestDescriptorV3BaseTransitionTable`; tagged `swblock_format_v3_test`: `TestReceiverV3InstallThroughTheHandle`, `TestReceiverV3HeldOldBaseWriteDrainsBeforeANewSession`, `TestReceiverV3ParkedOldFrameIsRefusedAfterANewSession`, `TestReceiverV3SupersededBaseDoneFailsWithoutAnAck`, `TestReceiverV3WALAfterBaseDoneStillApplies`, `TestReceiverV3WALAfterBaseDoneSurvivesACrash` (`core/recovery/receiver_install_format_v3_test.go`) | `WALFormat` handle and BASE configs (claude05 R17c, pending) | STUB |
| `INV-WAL-V3-BASE-001` | A v3 BASE install begins only under `installMu` exclusive (draining the old ID's admitted mutations) and only when BaseLSN covers the acknowledged W (published or not yet), the checkpoint and every appended LSN (an unacknowledged record above BaseLSN would leave a hole behind BaseCursor; codex01 row 9a P1-1); otherwise it is refused, writing nothing, with `ErrInstallBaseUncovered` or `ErrInstallSupersedeUncovered`. It publishes installing (BaseLSN, BaseCursor = the writer head P, the ID) into both slots before the first BASE mutation. BASE extent writes and install-lane applies go only through the handle, under `installMu` shared: a handle lives until the next begin (an install epoch), `WriteBase` needs installing under its ID, and an install-lane apply is also admitted after the handle's own completion while installed or retired, because the session's WAL lane can outlive its BaseDone (DESIGN r17.4; `ErrInstallSuperseded` otherwise); the install lane keeps the order and gap rules. Complete validates the ID under `installMu` exclusive, fsyncs the BASE bytes and the suffix, runs the checkpoint's metadata and chunk barriers and publishes installed with retainedTail >= BaseCursor together with a fresh owned-map candidate carrying the BASE writes' UNKNOWN (codex01 row 9a P1-2) and stops serving the superseded pre-BASE records. installing -> none is refused (no abort); installed -> none retires only once the checkpoint covers BaseLSN and both slots carry a tail at or past BaseCursor. | M1 Serving → Installing → Serving (dark) | `core/storage/base_install_v3.go` `WALStore.beginBaseInstallV3`, `installHandleV3.WriteBase`, `installHandleV3.ApplyInstallEntry`, `WALStore.markBaseCompleteV3`; `core/storage/descriptor_v3.go` `baseTransitionAllowedV3`, `retireBaseV3` | `TestBaseInstallV3BeginPublishesInstallingIntoBothSlots`, `TestBaseInstallV3BeginRefusesBelowW`, `TestBaseInstallV3BeginCoversTheAcknowledgedNotYetPublishedW`, `TestBaseInstallV3BeginRefusals`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash`, `TestBaseInstallV3InstallingToNoneIsRefused`, `TestBaseInstallV3RetiresOnlyOnceTheCheckpointCoversBaseLSN`, `TestBaseInstallV3ApplyInstallEntryOrderAndGap`, `TestBaseInstallV3HeldOldWriteDrainsBeforeANewBegin`, `TestBaseInstallV3ParkedOldFrameIsRefusedAfterASupersession`, `TestBaseInstallV3BeginRefusesBelowTheHighestAppendedLSN`, `TestBaseInstallV3CompletePersistsTheMapUnknownOfBaseWrites`, `TestBaseInstallV3BeginRefusesWithAnAttachedChunkLayer`, `TestBaseInstallV3CompletedHandleAppliesUntilTheNextBegin` (`core/storage/base_install_v3_test.go`); `TestBaseInstallV3SupersessionAfterReopenFencesTheOldSuffix`, `TestBaseInstallV3CoveringSupersessionOverADamagedSuffix` (`core/storage/base_install_reopen_v3_test.go`); `TestBaseInstallV3ResumeAfterReopenFencesAndServesTheSuffix`, `TestBaseInstallV3ResumeRefusesADamagedSuffix`, `TestBaseInstallV3EBelowThePersistedHead` (`core/storage/base_install_resume_v3_test.go`); `TestDescriptorV3BaseTransitionTable`; tagged `swblock_format_v3_test`: `TestReceiverV3InstallThroughTheHandle`, `TestReceiverV3HeldOldBaseWriteDrainsBeforeANewSession`, `TestReceiverV3ParkedOldFrameIsRefusedAfterANewSession`, `TestReceiverV3SupersededBaseDoneFailsWithoutAnAck`, `TestReceiverV3WALAfterBaseDoneStillApplies`, `TestReceiverV3WALAfterBaseDoneSurvivesACrash` (`core/recovery/receiver_install_format_v3_test.go`) | `WALFormat` handle and BASE configs (claude05 R17c, pending) | STUB |
| `INV-WAL-V3-INSTALL-ACK-001` | While a v3 volume is installing, the logical `Sync` returns exactly (0, `ErrBaseInstalling`), runs no batch and acknowledges no new W, rechecked at its completion. The receiver's durable progress ack is `SyncInstallLog(installID)` on the narrow `InstallLogSyncer` (not on `LogicalStorage`; named only by `core/storage` and `core/recovery`): under `installMu` shared it refuses outside an install (`ErrNotInstalling`) or for another ID (`ErrInstallIDMismatch`), freezes H, fsyncs the WAL and publishes W = max(W, H) with BaseState still installing, always mode A, and acknowledges H only if no fault latched by its final check under `WALStore.mu` (the #172 ack boundary). It attests log durability only. After the session's own completion the receiver acks through the ordinary `Sync`. A v2 store's `SyncInstallLog` is its `Sync`. | M1 Installing (dark) | `core/storage/install_log_v3.go` `WALStore.SyncInstallLog`; `core/storage/walstore.go` `WALStore.Sync`; `core/recovery/receiver.go` `sendAck` | `TestInstallLogV3SyncIsGatedWhileInstalling`, `TestInstallLogV3Refusals`, `TestInstallLogV3IsModeAAndSurvivesACrash`, `TestInstallLogV3AFaultLatchedBeforeTheAckRefusesIt` (`core/storage/install_log_v3_test.go`); `TestInstallLogSyncerIsReceiverOnly` (`core/recovery/install_log_boundary_test.go`); tagged `TestReceiverV3ProgressAckIsTheInstallLog` | `WALFormat` install-log ack (claude05) | STUB |
| `INV-FE-FUA-SYNC-001` | A FUA write completes only after `Sync` succeeds. | M1 Serving (frontend) | `core/frontend/nvme/io.go` `IOHandler.write`; `core/frontend/ublk/dispatch.go` `handler.serve` | `TestNVMeWriteFUACompletion` (`core/frontend/nvme/fua_test.go`); `TestDispatch_WriteFUASyncsBeforeCompleting` (`core/frontend/ublk/dispatch_test.go`) | — | ACTIVE |
| `INV-FE-FLUSH-SYNC-001` | A flush is a `Sync` of the backend, and a failed `Sync` fails the command instead of acknowledging it. | M1 Serving (frontend) | `core/frontend/nvme/io.go` `IOHandler.Handle`; `core/frontend/ublk/dispatch.go` `handler.serve` | `TestT3b_NVMe_Flush_DispatchesToBackend` (`core/frontend/nvme/t3b_flush_test.go`); `TestDispatch_FlushSyncs`, `TestDispatch_BackendFailuresAreReportedNotAcknowledged` (`core/frontend/ublk/dispatch_test.go`) | — | ACTIVE |
@@ -307,7 +307,7 @@ Notes:
- `INV-WAL-CHECKPOINT-SNAPSHOT-001`: The SIGKILL test is Linux only.
- `INV-FE-FLUSH-SYNC-001`: The failed-`Sync` case is asserted for ublk; for NVMe/TCP only the dispatch to `Sync` is asserted here.
- `INV-WAL-V3-RESET-001`: Format bump v3, plan row 8 (DESIGN 8.6). Dark: no production path calls the reset, and it must not be activated before the reset model (r4.5) passes. No v3 tail release exists yet, so the precondition is CheckpointLSN >= W rather than an empty retained range: retained old-incarnation bytes at or below the checkpoint are preserved in the extent. The map root is unchanged by a reset, so no map page is retired.
- `INV-WAL-V3-BASE-001`: Format bump v3, plan row 9a (DESIGN r17.3.1 sections 8.1, 8.2, 8.4, 8.5, 8.7). Dark: only tests reach it. Row 9b makes the seam `BaseInstallPreparer.BeginBaseInstall(baseLSN, installID) (InstallHandle, error)`: the dual-lane `Receiver` begins at SessionStart (BaseLSN = FromLSN, a fresh random ID) and its `RebuildSession` writes, applies and completes only through the handle, propagating the `MarkBaseComplete` error; stores without the seam keep their exact pre-seam behaviour through the lazy legacy handle (parallelwal's staging is now `BaseStager.BeginBaseStage`). Since row 10b the legacy single-lane caller (`core/transport/replica.go`) is on the handle too: the first admitted `MsgRebuildBlock` (or an empty rebuild's `MsgRebuildDone`) begins one install per connection at the lineage's frontier hint under a fresh random ID, blocks go through `WriteBase`, a different hint on the connection is refused, and done completes and then Syncs, closing the connection with no `MsgBarrierResp` when either fails; a reconnect is a superseding install under the coverage rule (tagged controls in `core/transport/replica_install_format_v3_test.go`). Until the chunk layer's side of the v3 install protocol lands (codex03), a v3 begin with an attached chunk layer is refused (`errV3NotYet`), writing nothing; since row 9c the v3 `SeedChunkFrontier` publishes CheckpointLSN = W = map coverage = lsn through the one checkpoint publication (`publishCheckpointV3`: data fsync, metadata and chunk barriers, owned-map candidate, the sole slot publisher under syncMu with the lifetime check), moves the volatile frontier only after it, publishes nothing on failure, and refuses local writes, an install, an attached layer or a store without an owned map; a HEAD restore onto a dark v3 store still refuses in the provider (`errV3RestoreNotYet`) until codex03's v3 FreshFromHead restore lands; since row 11a an installing reopen keeps its recovered bounds (E, R, intact or damaged) without fencing, publishing or admitting, and a covering superseding begin after it fences [E, floor + WALSize) and fsyncs before its two-slot installing publication, anchors at P = max(E, the persisted retainedHead) without lowering retainedHead, and restarts the writer at P (forward only); the same-ID resume after a reopen is row 11b. A begin while installed is refused until retirement (8.5 has no installed -> installing edge).
- `INV-WAL-V3-BASE-001`: Format bump v3, plan row 9a (DESIGN r17.3.1 sections 8.1, 8.2, 8.4, 8.5, 8.7). Dark: only tests reach it. Row 9b makes the seam `BaseInstallPreparer.BeginBaseInstall(baseLSN, installID) (InstallHandle, error)`: the dual-lane `Receiver` begins at SessionStart (BaseLSN = FromLSN, a fresh random ID) and its `RebuildSession` writes, applies and completes only through the handle, propagating the `MarkBaseComplete` error; stores without the seam keep their exact pre-seam behaviour through the lazy legacy handle (parallelwal's staging is now `BaseStager.BeginBaseStage`). Since row 10b the legacy single-lane caller (`core/transport/replica.go`) is on the handle too: the first admitted `MsgRebuildBlock` (or an empty rebuild's `MsgRebuildDone`) begins one install per connection at the lineage's frontier hint under a fresh random ID, blocks go through `WriteBase`, a different hint on the connection is refused, and done completes and then Syncs, closing the connection with no `MsgBarrierResp` when either fails; a reconnect is a superseding install under the coverage rule (tagged controls in `core/transport/replica_install_format_v3_test.go`). Until the chunk layer's side of the v3 install protocol lands (codex03), a v3 begin with an attached chunk layer is refused (`errV3NotYet`), writing nothing; since row 9c the v3 `SeedChunkFrontier` publishes CheckpointLSN = W = map coverage = lsn through the one checkpoint publication (`publishCheckpointV3`: data fsync, metadata and chunk barriers, owned-map candidate, the sole slot publisher under syncMu with the lifetime check), moves the volatile frontier only after it, publishes nothing on failure, and refuses local writes, an install, an attached layer or a store without an owned map; a HEAD restore onto a dark v3 store still refuses in the provider (`errV3RestoreNotYet`) until codex03's v3 FreshFromHead restore lands; since row 11a an installing reopen keeps its recovered bounds (E, R, intact or damaged) without fencing, publishing or admitting, and a covering superseding begin after it fences [E, floor + WALSize) and fsyncs before its two-slot installing publication, anchors at P = max(E, the persisted retainedHead) without lowering retainedHead, and restarts the writer at P (forward only); since row 11b the same-ID resume after a reopen (store level; no current caller resumes, both receivers begin fresh IDs) runs under `installMu` exclusive and appends nothing until the trusted-through-W check (intact suffix and E >= the persisted retainedHead), the fence of [E, floor + WALSize) with fsync and a retainedHead = E publication all held, refusing with `ErrInstallSuffixDamaged` and writing nothing otherwise; the writer continues at E and the recovered install-lane records are replayed. A begin while installed is refused until retirement (8.5 has no installed -> installing edge).
- `INV-WAL-V3-W-001`, `INV-WAL-V3-FENCE-001`: Format bump v3, plan rows 5 and 5b (DESIGN r15 sections 6.1 to 6.6). Since 5b the v3 format runs inside the real `WALStore`, through the shared committer, dirty map, flusher and leaf. It is reachable only through `createWALStoreV3ForTest`/`openWALStoreV3ForTest`. Without the row-7 map candidate the v3 checkpoint and tail do not advance. They are STUBs until activation (row 12b). The test "crash" closes the file without further writes, so the slot-before-records reordering that mode C's lagged W guards against is covered by the composed model (claude05), not by these tests. Installing recovery is row 11.
- `INV-WAL-V3-PUBLISH-001`: Format bump v3, plan row 3 (DESIGN r15 sections 4, 5 and 5.1). It is a STUB until the v3 store is wired in (rows 4 and 5) and activated (row 12b). The v2 checkpoint path (`persistCheckpointReleasing`) is unchanged and is retired in row 14a. The map coverage predicates against the root are added by row 7, and the conditions on BASE edges by rows 9 to 11.
- `INV-WAL-V3-DESCRIPTOR-001`: Format bump v3, plan row 1 (DESIGN r15 section 2). It is a STUB until the activation commit (plan row 12b): no production open or create path reaches the v3 codec before then. The map-dependency checks (root and pages present and hash-valid) are added by plan row 7. The tests decode vectors from an independent generator (`core/storage/testdata/format_v3/slot/gen_slot_vectors.py`).