pingqiu 9ffc149293 T4c-pre-A POC walstore — wal_replay tier-1 mode validation (round 34)
Confirmatory POC for walstore substrate per memo §12 + §13.0a +
§5.1. Validates V2-faithful per-LSN tier-1 mode (`wal_replay`)
in contrast to smartwal's `state_convergence` mode.

Code (POC, NOT production):

  core/storage/walstore_recovery_poc.go (~240 LOC)
    New types:
      - RecoveryEntry{LSN, LBA, Flags, Data} — sibling to smartwal's
        type; same shape, different package; T4c-3 muscle port will
        unify behind LogicalStorage.ScanLBAs
      - ErrWALRecycled (sentinel; mirrors V2 walstore semantics)
    New methods on *WALStore:
      - ScanFrom(fromLSN, fn) error — walks WAL physical region
        between logicalTail and logicalHead, decodes each record,
        filters LSN >= fromLSN && < headLSN, emits in LSN-ascending
        order. Per-LSN, NOT deduped. Returns ErrWALRecycled if
        fromLSN <= checkpointLSN.
      - WALCapacityBytes() — POC retention characterization
      - CheckpointLSNForPOC() — sibling for retention boundary tests

  core/storage/walstore_recovery_poc_test.go (~440 LOC)
    8 POC tests, all pass:
      #1 — TestPOC_Walstore_ScanFrom_BasicRange
      #1 — TestPOC_Walstore_ScanFrom_FromHeadOrAbove_Empty (3 sub)
      #1 KEY PIN —
        TestPOC_Walstore_ScanFrom_PerLSNNotDeduped: 3 writes to
        LBA=0 → 3 entries with markers 0xA1/0xA2/0xA3. Pins
        V2-faithful per-LSN semantic and confirms
        INV-REPL-RECOVERY-STREAM-LBA-DEDUP is NOT applicable to
        walstore (smartwal-mode-scoped per memo §13.6 round-34).
      #1+#4 — TestPOC_Walstore_ScanFrom_ErrWALRecycled: boundary
        fires at fromLSN <= checkpointLSN
      #2 — TestPOC_Walstore_AllBlocks_DeterministicOrdering
      #3 — TestPOC_Walstore_ScanFrom_ConcurrentLiveWrite_Safe:
        no deadlock, no torn reads; emitted Data contemporaneous
        with emitted LSN (data-staleness from smartwal §3.2 does
        NOT apply to walstore — append-only WAL slots are
        immutable once written)
      #4 — TestPOC_Walstore_RetentionBoundary_Characterized:
        deterministic boundary at checkpointLSN
      sanity — TestPOC_Walstore_Sanity_ExistingAPIsUnchanged

Findings (per POC report §3.b):

  - V2-faithful per-LSN tier-1: walstore preserves entry data IN
    the WAL (LBA + LSN + Data), so 3 writes to same LBA produce
    3 emitted RecoveryEntry, each with the data that LSN actually
    wrote. Contrast with smartwal which emits 1 entry with current
    extent data.
  - ErrWALRecycled boundary: dynamic, advances with flusher
    activity. Contrast with smartwal's fixed walSlots window.
  - Concurrent live-write: walstore's append-only WAL records are
    immutable; concurrent live-write doesn't rewrite slots. Per-
    LSN data preservation makes data-staleness a non-issue. POC
    finds no torn reads, no deadlock, contemporaneous data
    labeling.
  - BUG-007 not exercised (Windows/dev-loop only); deferred to
    T4c-5 L3 m01 integration matrix per memo §5.

POC report (sw-block/design/v3-phase-15-t4c-pre-poc-report.md)
extended:
  - §1 executive summary expanded to 8-case 2-substrate matrix
  - New §3.b walstore findings section
  - §5 substrate-specific concerns: walstore concerns now ✅
    addressed (ring-buffer recycling consistency verified)
  - §6 acceptance: clean on both substrates
  - §7 next steps: T4c-pre-B in flight; T4c mini-plan follows
  - §8 sign + §9 change log entries for round-34 walstore POC

Verification: full 21-package repo suite green. POC code isolated
to walstore + smartwal POC files; no impact on production paths.

T4c-pre-A POC closed. T4c-pre-B engine command model upgrade
proceeds next.
2026-04-25 01:35:11 -07:00
Languages
Go 84.5%
Rust 7.9%
Shell 2.7%
templ 1.6%
Java 1%
Other 2%