pingqiuandClaude Opus 4.7 cc457c06c4 test(recovery): C3 fault-injection — BASE/WAL goroutine pair termination
Three table-shaped subtests covering the failure paths of Sender.Run's
BASE ∥ WAL goroutine pair (§6.8 #6 / P6 / G3). Companion to the
existing TestC3_BaseWalParallel_FramesInterleave (happy path /
overlap claim).

  #1  BASE error → WAL exits via groupCtx.Done
      Faulty store fails primaryStore.Read after N reads; streamBase
      returns a Substrate failure; groupCancel from BASE goroutine
      unblocks DrainBacklog parked on ctx; spy sink confirms
      drainCtxErrSeen != nil; lifecycle counters StartSession=1,
      EndSession=1; Run returns within 2s.

  #3  Outer ctx cancel → both lanes wind down
      Caller cancels parent ctx mid-session after WAL goroutine has
      entered DrainBacklog. Run returns within 2s; coord.EndSession
      defer fires (Phase back to Idle); sink.EndSession defer fires
      exactly once; DrainBacklog observed ctx cancellation.

  #2A WAL error → Run terminates (variant A — narrow)
      Spy sink returns synthetic error from DrainBacklog. BASE
      goroutine runs to completion (small store; streamBase is not
      ctx-aware). Run returns the WAL failure with PhaseBacklog;
      errors.Is unwraps to the synthetic; lifecycle counters correct.

      NOT asserted: prompt BASE stop on WAL failure. streamBase has
      no ctx-check today; variant B (future follow-up) would pair a
      periodic groupCtx.Err() check inside streamBase's loop with a
      strict prompt-stop assertion. Test header documents this.

Spy WalShipperSink: structural-typing match (no exported types added);
records StartSession / DrainBacklog / EndSession call counts; per-test
drainBehavior selects immediate / block-until-ctx / synthetic-error.

Refs: v3-recovery-wal-shipper-mini-plan.md §11.7 pillar 2 (dual-line
execution); architect-recommended scope #1 + #3 + #2A.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 11:15:45 -07:00
Languages
Go 84.5%
Rust 7.9%
Shell 2.7%
templ 1.6%
Java 1%
Other 2%