fix: retain marker-free permanent errors and log unknown types once

This commit is contained in:
pingqiu committed 2026-11-22 06:49:08 -08:00
1 parent 8e721baa3c
commit eb906bb4ff
12 files changed
+146 -63

No files matched your search

@@ -71,7 +71,7 @@ const (
// ErrReplicationAckUnavailable is returned when WriteAckRequireObserverAck
// cannot obtain the configured replication acknowledgement.
var ErrReplicationAckUnavailable = frontend.ErrReplicationAckUnavailable
var ErrReplicationAckUnavailable = errors.New("durable: replication ack unavailable")
// WriteObserver is the narrow seam StorageBackend uses to notify the
// replication layer of each successfully-applied local write and to
+28 -14
View File
@@ -5,7 +5,8 @@ import (
"errors"
"io"
"log"
"sync/atomic"
"reflect"
"sync"
"syscall"
"github.com/seaweedfs/seaweed-block/core/storage"
@@ -22,24 +23,19 @@ const (
BackendErrorClosed
)
var unclassifiedBackendErrors atomic.Uint64
// UnclassifiedBackendErrorCount reports completions using the unknown-cause
// fallback in V1-SPEC r2.42. It is cumulative for this process.
func UnclassifiedBackendErrorCount() uint64 { return unclassifiedBackendErrors.Load() }
var unclassifiedBackendErrorTypes sync.Map // reflect.Type -> struct{}
// ClassifyBackendError implements INV-FE-ERROR-RETRY-CLASS-001 and V1-SPEC r2.42.
// Call only for a non-nil backend error. Known permanent causes win across the
// entire wrapped/joined tree; unknown causes are counted and retryable.
// entire wrapped/joined tree. Deliberate frontend markers decide otherwise;
// a marker-free unknown error stays permanent and is logged once per leaf type.
func ClassifyBackendError(ctx context.Context, err error) BackendErrorClass {
// M1 I/O error completion: inspect permanent causes before any retry marker.
if hasPermanentBackendCause(err) {
return BackendErrorPermanent
}
switch {
case errors.Is(err, ErrBackendBusy), errors.Is(err, storage.ErrWALPressureTimeout),
errors.Is(err, storage.ErrChunkHydrationPending),
errors.Is(err, ErrReplicationAckUnavailable) && errors.Is(err, context.DeadlineExceeded):
case errors.Is(err, ErrBackendBusy):
return BackendErrorBusy
case errors.Is(err, ErrStalePrimary):
return BackendErrorStale
@@ -48,10 +44,10 @@ func ClassifyBackendError(ctx context.Context, err error) BackendErrorClass {
case errors.Is(err, ErrNotReady), IsWriteDeadline(ctx, err):
return BackendErrorNotReady
default:
// M1 unknown completion: V1-SPEC r2.42 bounds retry at the initiator.
count := unclassifiedBackendErrors.Add(1)
log.Printf("frontend: unclassified backend error count=%d: %v", count, err)
return BackendErrorNotReady
// M1 marker-free completion: amended V1-SPEC r2.42 retains the
// permanent default. Backend owners must classify types seen in gates.
logUnclassifiedBackendError(err)
return BackendErrorPermanent
}
}
@@ -67,3 +63,21 @@ func hasPermanentBackendCause(err error) bool {
}
return false
}
// Wrapper types are not backend error types: inspect each unknown leaf so one
// fmt wrapper cannot suppress the first diagnostic for a different cause type.
func logUnclassifiedBackendError(err error) {
if joined, ok := err.(interface{ Unwrap() []error }); ok && len(joined.Unwrap()) != 0 {
for _, cause := range joined.Unwrap() {
logUnclassifiedBackendError(cause)
}
return
}
if cause := errors.Unwrap(err); cause != nil {
logUnclassifiedBackendError(cause)
return
}
if _, logged := unclassifiedBackendErrorTypes.LoadOrStore(reflect.TypeOf(err), struct{}{}); !logged {
log.Printf("frontend: unclassified backend error type=%T: %v", err, err)
}
}
-4
View File
@@ -20,7 +20,3 @@ var ErrBackendClosed = errors.New("frontend: backend closed")
// ErrBackendBusy is a transient local admission timeout. Retry may succeed;
// it must not be used for a sticky persistence or integrity fault.
var ErrBackendBusy = errors.New("frontend: backend temporarily busy")
// ErrReplicationAckUnavailable means the configured replication acknowledgement
// was unavailable. It is retryable busy only together with a deadline cause.
var ErrReplicationAckUnavailable = errors.New("durable: replication ack unavailable")
@@ -7,6 +7,8 @@ import (
"fmt"
"io"
"log"
"os"
"os/exec"
"strings"
"syscall"
"testing"
@@ -41,11 +43,14 @@ func TestBackendErrorClassesAcrossFrontends(t *testing.T) {
{name: "wal-pressure", err: fmt.Errorf("%w: %w", frontend.ErrBackendBusy, storage.ErrWALPressureTimeout), status: 0x08, sct: 0, sc: 0x82},
{name: "hydration-pending", err: fmt.Errorf("%w: %w", frontend.ErrBackendBusy, storage.ErrChunkHydrationPending), status: 0x08, sct: 0, sc: 0x82},
{name: "observer-deadline", err: fmt.Errorf("%w: %w: %w", frontend.ErrBackendBusy, durable.ErrReplicationAckUnavailable, context.DeadlineExceeded), status: 0x08, sct: 0, sc: 0x82, deadline: true},
{name: "unknown", err: errors.New("unrecognized backend cause"), status: 0x02, key: 0x02, asc: 0x04, ascq: 0x01, sct: 0, sc: 0x82},
{name: "pressure-without-busy-marker", err: storage.ErrWALPressureTimeout, status: 0x08, sct: 0, sc: 0x82},
{name: "hydration-without-busy-marker", err: storage.ErrChunkHydrationPending, status: 0x08, sct: 0, sc: 0x82},
{name: "observer-deadline-without-busy-marker", err: errors.Join(durable.ErrReplicationAckUnavailable, context.DeadlineExceeded), status: 0x08, sct: 0, sc: 0x82, deadline: true},
{name: "unknown", err: errors.New("unrecognized backend cause"), status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
{name: "pressure-without-busy-marker", err: storage.ErrWALPressureTimeout, status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
{name: "hydration-without-busy-marker", err: storage.ErrChunkHydrationPending, status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
{name: "observer-deadline-without-busy-marker", err: errors.Join(durable.ErrReplicationAckUnavailable, context.DeadlineExceeded), status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6, deadline: true},
{name: "unknown-with-busy", err: errors.Join(errors.New("unrecognized backend cause"), frontend.ErrBackendBusy), status: 0x08, sct: 0, sc: 0x82},
{name: "unknown-with-not-ready", err: errors.Join(errors.New("unrecognized backend cause"), frontend.ErrNotReady), status: 0x02, key: 0x02, asc: 0x04, ascq: 0x01, sct: 0, sc: 0x82},
{name: "unknown-with-stale", err: errors.Join(errors.New("unrecognized backend cause"), frontend.ErrStalePrimary), status: 0x02, key: 0x02, asc: 0x04, ascq: 0x0a, sct: 3, sc: 3},
{name: "unknown-with-closed", err: errors.Join(errors.New("unrecognized backend cause"), frontend.ErrBackendClosed), status: 0x02, key: 0x02, asc: 0x04, ascq: 0x03, sct: 3, sc: 2},
{name: "unknown-with-physical", err: errors.Join(errors.New("unrecognized backend cause"), syscall.EIO), status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
{name: "fsync-fault", err: errors.Join(frontend.ErrBackendBusy, storage.ErrFsyncFailed), status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
{name: "append-fault", err: errors.Join(frontend.ErrBackendBusy, storage.ErrAppendFailed), status: 0x02, key: 0x03, asc: 0x11, sct: 0, sc: 6},
@@ -124,24 +129,45 @@ func TestBackendErrorClassesAcrossFrontends(t *testing.T) {
}
}
// INV-FE-ERROR-RETRY-CLASS-001 / V1-SPEC r2.42: unknown completions are
// retryable on both protocols, counted once per completion, and diagnosable.
func TestUnclassifiedBackendErrorIsRetryableAndCounted(t *testing.T) {
type unknownCompletionError struct{ message string }
func (e unknownCompletionError) Error() string { return e.message }
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
// 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
// process rather than exposing an implementation-only reset operation.
if os.Getenv("FRONTEND_UNCLASSIFIED_LOG_CHILD") != "1" {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestUnclassifiedBackendErrorIsPermanentAndLoggedOncePerType$", "-test.count=1")
cmd.Env = append(os.Environ(), "FRONTEND_UNCLASSIFIED_LOG_CHILD=1")
if output, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("log-once child: %v\n%s", err, output)
}
return
}
var logs bytes.Buffer
previous := log.Writer()
log.SetOutput(&logs)
t.Cleanup(func() { log.SetOutput(previous) })
before := frontend.UnclassifiedBackendErrorCount()
b := classifiedErrorBackend{Backend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v"}), err: errors.New("unknown completion cause")}
scsi := iscsi.NewSCSIHandler(iscsi.HandlerConfig{Backend: b}).HandleCommand(context.Background(), [16]byte{iscsi.ScsiSyncCache10}, nil)
nv := nvme.NewIOHandler(nvme.HandlerConfig{Backend: b}).Handle(context.Background(), nvme.IOCommand{NSID: 1})
if scsi.Status != 0x02 || scsi.SenseKey != 0x02 || scsi.ASC != 0x04 || scsi.ASCQ != 0x01 || nv.SCT != 0 || nv.SC != 0x82 {
t.Fatalf("unknown completion not retryable: SCSI=%+v NVMe=%+v", scsi, nv)
for _, cause := range []error{
fmt.Errorf("wrapped: %w", unknownCompletionError{"unknown completion A"}),
errors.Join(unknownCompletionError{"same type, other value"}, otherUnknownCompletionError{}),
} {
b := classifiedErrorBackend{Backend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v"}), err: cause}
scsi := iscsi.NewSCSIHandler(iscsi.HandlerConfig{Backend: b}).HandleCommand(context.Background(), [16]byte{iscsi.ScsiSyncCache10}, nil)
nv := nvme.NewIOHandler(nvme.HandlerConfig{Backend: b}).Handle(context.Background(), nvme.IOCommand{NSID: 1})
if scsi.Status != 0x02 || scsi.SenseKey != 0x03 || scsi.ASC != 0x0c || nv.SCT != 0 || nv.SC != 6 {
t.Fatalf("marker-free completion not permanent: SCSI=%+v NVMe=%+v", scsi, nv)
}
}
if got := frontend.UnclassifiedBackendErrorCount() - before; got != 2 {
t.Fatalf("unclassified completions=%d want 2", got)
}
if strings.Count(logs.String(), "frontend: unclassified backend error count=") != 2 || !strings.Contains(logs.String(), "unknown completion cause") {
t.Fatalf("unclassified reason/count missing: %q", logs.String())
if strings.Count(logs.String(), "frontend: unclassified backend error type=") != 2 || !strings.Contains(logs.String(), "unknown completion A") || !strings.Contains(logs.String(), "unknown completion B") {
t.Fatalf("expected one log for each leaf type across both frontends: %q", logs.String())
}
}
@@ -3,8 +3,10 @@ package nvme
import (
"context"
"errors"
"fmt"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/testback"
"github.com/seaweedfs/seaweed-block/core/storage"
"syscall"
"testing"
"time"
@@ -27,7 +29,7 @@ func TestBackendRetryClassClearsWireDNR(t *testing.T) {
dnr bool
}{
{"not-ready", frontend.ErrNotReady, false},
{"unknown", errors.New("unrecognized backend cause"), false},
{"unknown", errors.New("unrecognized backend cause"), true},
{"busy", frontend.ErrBackendBusy, false},
{"permanent", syscall.EIO, true},
{"deadline-busy", errors.Join(context.DeadlineExceeded, frontend.ErrBackendBusy), false},
@@ -48,3 +50,53 @@ func TestBackendRetryClassClearsWireDNR(t *testing.T) {
}
}
}
type durabilityClassBackend struct {
frontend.Backend
err error
writes, syncs int
}
func (b *durabilityClassBackend) Write(_ context.Context, _ int64, p []byte) (int, error) {
b.writes++
return len(p), nil
}
func (b *durabilityClassBackend) Sync(context.Context) error {
b.syncs++
return b.err
}
// INV-FE-ERROR-RETRY-CLASS-001 / amended V1-SPEC r2.42: 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} {
for _, latched := range []bool{false, true} {
t.Run(fmt.Sprintf("fua=%t/latched=%t", fua, latched), func(t *testing.T) {
cause := errors.Join(frontend.ErrBackendBusy, errors.New("untyped durability cause"))
if latched {
cause = errors.Join(cause, storage.ErrFsyncFailed)
}
b := &durabilityClassBackend{Backend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v"}), err: cause}
cmd := IOCommand{Opcode: ioFlush, NSID: 1}
if fua {
cmd = IOCommand{Opcode: ioWrite, NSID: 1, NLB: 1, Data: make([]byte, 512), FUA: true}
}
got := NewIOHandler(HandlerConfig{Backend: b}).Handle(context.Background(), cmd)
want := MakeStatusField(SCTGeneric, SCNamespaceNotReady, false)
if latched {
want = MakeStatusField(SCTGeneric, SCInternalError, true)
}
if got.completionStatus() != want {
t.Fatalf("completion=%#x want %#x", got.completionStatus(), want)
}
writes := 0
if fua {
writes = 1
}
if b.writes != writes || b.syncs != 1 {
t.Fatalf("durability seam not reached once: writes=%d syncs=%d", b.writes, b.syncs)
}
})
}
}
}
@@ -3,12 +3,11 @@ package nvme
import (
"bytes"
"context"
"fmt"
"errors"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/testback"
"log"
"strings"
"syscall"
"testing"
)
@@ -21,7 +20,7 @@ func (b *flushErrorBackend) Sync(context.Context) error { return b.syncErr }
func TestSessionFlushLogsBackendReason(t *testing.T) {
var logs bytes.Buffer
b := &flushErrorBackend{Backend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v1"}), syncErr: fmt.Errorf("injected Sync failure: extent EIO: %w", syscall.EIO)}
b := &flushErrorBackend{Backend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v1"}), syncErr: errors.New("injected Sync failure: extent EIO")}
s := &Session{handler: NewIOHandler(HandlerConfig{Backend: b}), logger: log.New(&logs, "", 0), qid: 7, respCh: make(chan *response, 1), done: make(chan struct{})}
req := &Request{}
req.capsule.OpCode = ioFlush
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"sync/atomic"
"syscall"
"testing"
"time"
@@ -48,9 +47,9 @@ func TestNVMeWriteFUACompletion(t *testing.T) {
wantSC uint8
}{
{name: "FUA waits for Sync", fua: true},
{name: "Sync failure is not success", fua: true, syncErr: syscall.EIO, wantSC: nvme.SCInternalError},
{name: "Sync failure is not success", fua: true, syncErr: errors.New("sync failed"), wantSC: nvme.SCInternalError},
{name: "ordinary write does not Sync"},
{name: "failed write does not Sync", fua: true, writeErr: syscall.EIO, wantSC: nvme.SCInternalError},
{name: "failed write does not Sync", fua: true, writeErr: errors.New("write failed"), wantSC: nvme.SCInternalError},
} {
t.Run(tc.name, func(t *testing.T) {
b := &fuaBackend{RecordingBackend: testback.NewRecordingBackend(frontend.Identity{VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1}), entered: make(chan struct{}), release: make(chan struct{}), syncErr: tc.syncErr, writeErr: tc.writeErr}
@@ -2,9 +2,9 @@ package nvme
import (
"context"
"errors"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/testback"
"syscall"
"testing"
)
@@ -19,7 +19,7 @@ func TestSessionPressureTimeoutIsRetryableNamespaceNotReady(t *testing.T) {
s := &Session{handler: NewIOHandler(HandlerConfig{Backend: b}), respCh: make(chan *response, 1), done: make(chan struct{})}
for _, busy := range []bool{true, false} {
if !busy {
b.err = syscall.EIO
b.err = errors.New("sticky physical I/O fault")
}
req := &Request{payload: make([]byte, 512)}
req.capsule.OpCode = ioWrite
@@ -3,7 +3,6 @@ package nvme
import (
"context"
"errors"
"syscall"
"testing"
"time"
@@ -21,7 +20,7 @@ func (b *budgetReadBackend) Read(ctx context.Context, _ int64, p []byte) (int, e
b.deadline, _ = ctx.Deadline()
<-ctx.Done()
if b.physical {
return 0, errors.Join(ctx.Err(), syscall.EIO)
return 0, errors.Join(ctx.Err(), errors.New("physical read failure"))
}
return 0, frontend.ErrBackendBusy
}
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"syscall"
"testing"
"github.com/seaweedfs/seaweed-block/core/frontend"
@@ -28,7 +27,7 @@ func TestSessionReadNotReadyIsRetryable(t *testing.T) {
{"attach-pending", fmt.Errorf("awaiting HEAD attach: %w", frontend.ErrNotReady), SCTGeneric, SCNamespaceNotReady, false},
{"not-ready-closed", errors.Join(frontend.ErrNotReady, frontend.ErrBackendClosed), SCTPathRelated, SCPathAsymAccessInaccessible, true},
{"not-ready-stale", errors.Join(frontend.ErrNotReady, frontend.ErrStalePrimary), SCTPathRelated, SCPathAsymAccessTransition, true},
{"physical-fault", syscall.EIO, SCTGeneric, SCInternalError, true},
{"physical-fault", errors.New("physical read failure"), SCTGeneric, SCInternalError, true},
{"closed", frontend.ErrBackendClosed, SCTPathRelated, SCPathAsymAccessInaccessible, true},
{"stale", frontend.ErrStalePrimary, SCTPathRelated, SCPathAsymAccessTransition, true},
} {
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"syscall"
"testing"
"time"
@@ -50,7 +49,7 @@ type joinedBudgetBackend struct {
func (b *joinedBudgetBackend) result(ctx context.Context) error {
if b.physical {
return errors.Join(syscall.EIO, ctx.Err())
return errors.Join(errors.New("physical fsync failure"), ctx.Err())
}
return fmt.Errorf("durability wait: %w", ctx.Err())
}
+11 -11
View File
@@ -413,16 +413,16 @@ 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`, V1-SPEC r2.42): known permanent causes
anywhere in the wrapped/joined tree win over transient markers. These are
EIO, ENOSPC, EROFS, unexpected EOF, WAL integrity, prior fsync/append failure,
and invalid chunk maps. Busy, WAL pressure, hydration pending, and replication
ACK unavailable with a deadline map to SCSI BUSY or NVMe NotReady/DNR0.
Not-ready and pure command deadlines map to SCSI NOT READY04/01 or NVMe
NotReady/DNR0; stale lineage and closed retain distinct path meanings.
Otherwise the error is unclassified: increment the process counter, log the
error text, and return retryable not-ready. Initiators bound the retries.
Read, write and sync use the same classifier; no authority/storage state changes.
(`INV-FE-ERROR-RETRY-CLASS-001`, amended V1-SPEC r2.42): (a) a known permanent
cause anywhere in the wrapped/joined tree wins: EIO, ENOSPC, EROFS, unexpected
EOF, WAL integrity, prior fsync/append failure, or invalid chunk maps;
(b) otherwise a deliberate busy, not-ready, stale, closed or pure expired
command-deadline marker decides. Unknown causes under markers do not override
them; pressure/hydration/observer causes are not frontend classification atoms;
(c) no marker and no known permanent cause retains the permanent default,
logged once per unknown leaf error type. Backend owners must classify any
unclassified type seen in a gate before GO. Both frontend mappers consume
ClassifyBackendError; no storage/authority state changes on completion.
- A flusher cycle sorts native snapshot entries by record offset and reuses at
most one fully validated record (bounded by WALSize). Every block still checks
@@ -503,7 +503,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
| `INV-WAL-V3-ADMISSION-EXPIRY-STATE-001` | A v3 write refused for an expired deadline before its append leaves the WAL bytes, nextLSN and the dirty map unchanged. | M1 Serving (write admission) | `core/storage/walstore.go` `WALStore.WriteContext`, `WALStore.WriteBatchContext` | `TestStorageBackendExpiredWriteDoesNotAppend` | — | ACTIVE |
| `INV-WAL-V3-ADMISSION-PREFIX-ERR-001` | A write batch that returns a committed prefix with a storage error keeps that error in the error set the frontend classifies. | M1 Serving (write admission) | `core/frontend/durable/storage_adapter.go` `writeFullBlockBatch`, `withStorageCause`, `observeWriteCause` | `TestStorageBackendPartialBatchPhysicalFaultSurvivesObserverDeadline` | — | ACTIVE |
| `INV-WAL-V3-ADMISSION-RETRYABLE-001` | A write that fails only because the caller's deadline expired is reported retryable, also through a required write observer and on NVMe; a write whose error carries a physical cause is reported terminal. | M1 Serving (write admission) | `core/frontend/write_budget.go` `IsWriteDeadline`; `core/frontend/durable/storage_adapter.go` `StorageBackend.Write`, `replicationWriteError`; `core/frontend/nvme/io.go` `mapBackendError`; `core/frontend/nvme/session.go` `Session.handleWrite` | `TestStorageBackendRequiredObserverDeadlineStaysRetryable`, `TestStorageBackendPartialBatchPhysicalFaultSurvivesObserverDeadline`; `TestSessionWriteBudgetDeadlineIsRetryableIncludingFUA` (`core/frontend/nvme/write_command_budget_test.go`) | — | ACTIVE |
| `INV-FE-ERROR-RETRY-CLASS-001` | A backend error's retry class is decided once and every frontend reports it with its protocol's retryable form; only permanent errors become medium errors. | M1 I/O error completion (shared frontend classifier) | `core/frontend/error_class.go` `ClassifyBackendError`; `core/frontend/iscsi/scsi.go`, `core/frontend/nvme/io.go` `mapBackendError` | `TestBackendErrorClassesAcrossFrontends` (`core/frontend/iscsi/backend_error_class_test.go`); `TestBackendRetryClassClearsWireDNR` (`core/frontend/nvme/backend_error_class_test.go`); `TestUnclassifiedBackendErrorIsRetryableAndCounted` (`core/frontend/iscsi/backend_error_class_test.go`); `TestSessionWriteBudgetDeadlineIsRetryableIncludingFUA` (`core/frontend/nvme/write_command_budget_test.go`) | Protocol output only; existing backend states, no new automaton state | ACTIVE |
| `INV-FE-ERROR-RETRY-CLASS-001` | A backend error's retry class is decided once and every frontend reports it with its protocol's retryable form; only permanent errors become medium errors. | M1 I/O error completion (shared frontend classifier) | `core/frontend/error_class.go` `ClassifyBackendError`; `core/frontend/iscsi/scsi.go`, `core/frontend/nvme/io.go` `mapBackendError` | `TestBackendErrorClassesAcrossFrontends` (`core/frontend/iscsi/backend_error_class_test.go`); `TestBackendRetryClassClearsWireDNR`, `TestSyncAndFUALatchedFaultOverridesBusy` (`core/frontend/nvme/backend_error_class_test.go`); `TestUnclassifiedBackendErrorIsPermanentAndLoggedOncePerType` (`core/frontend/iscsi/backend_error_class_test.go`); `TestSessionWriteBudgetDeadlineIsRetryableIncludingFUA` (`core/frontend/nvme/write_command_budget_test.go`) | Protocol output only; existing backend states, no new automaton state | ACTIVE |
| `INV-WAL-V3-RECLAIM-001` | A mapped v3 checkpoint at cp moves retainedTail only to the end of a complete validated record whose last LSN is at most cp minus the retention window, and, while a BASE is installing, never past BaseCursor. | M1 checkpoint / existing two-slot retirement | `core/storage/walstore_map_checkpoint_v3.go` `WALStore.publishCheckpointV3`; `core/storage/wal_io_v3.go` `walWriterV3.reclaimThroughV3` | `TestWALStoreV3CheckpointReclaimsAcrossRingLaps`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention`, `TestWALStoreV3ReclaimAfterInstallingPhysicalReopen` | Existing dual-slot retirement and nonce/cursor contract; concrete index/recovery/caller wiring is a code-test obligation | STUB |
| `INV-WAL-V3-RECLAIM-INDEX-001` | A physical v3 recovery rebuilds the writer's volatile record-boundary index only from trusted write records of the kept scan; an installing reopen indexes them without moving the writer's cursor. | M1 checkpoint / existing two-slot retirement | `core/storage/wal_io_v3.go` `walWriterV3.restoreScanV3`, `walWriterV3.rememberReclaimScanV3`, `walWriterV3.indexReclaimScanLockedV3`; `core/storage/walstore_v3.go` `WALStore.recoverV3` | `TestWALStoreV3ReclaimRebuildsIndexAfterPhysicalRecovery`, `TestWALStoreV3ReclaimAfterInstallingPhysicalReopen` | — | STUB |
| `INV-WAL-V3-RECLAIM-PUBLISH-001` | A mapped v3 checkpoint publishes retainedTail, retainedHead, the map root, CheckpointLSN and W in one slot publication, followed by a metadata-only rollover when the fallback slot still pins a lower tail. | M1 checkpoint / existing two-slot retirement | `core/storage/walstore_map_checkpoint_v3.go` `WALStore.publishCheckpointV3`; `core/storage/descriptor_v3.go` `descriptorPublisherV3.rolloverIfPinned` | `TestWALStoreV3CheckpointReclaimsAcrossRingLaps`, `TestWALStoreV3ReclaimSecondSlotFailureKeepsOldPin` | — | STUB |