pingqiu c3d8907725 transport: WalShipper P0 cleanup per architect signoff
Architect 2026-04-29 P0 review: signed off, two doc-vs-impl mismatches
to fix + one dead-code cleanup. All comment / dead-field changes; zero
behavior change.

(1) EmitFunc docstring (line ~46-48):
    Was: "Returning an error transitions WalShipper to Backlog (or
          stays Backlog if already there) and aborts the current emit"
    Reality: NotifyAppend in Realtime returns the error AS-IS;
            mode does not flip; cursor is NOT advanced for the failed
            emit. Degraded decision belongs to executor/engine.
    Fix: docstring now accurately describes propagate-and-don't-flip
         semantic. Prevents next reader from "fixing" wal_shipper.go
         to flip to Backlog on emit error (which would be wrong per
         spec — degraded is upstream's call).

(2) sessionActive struct field comment (line ~154-155):
    Was: "EndSession returns to Idle"
    Reality: EndSession sets sessionActive=false + mode=Realtime
            (NOT Idle). Mode goes to Idle ONLY at NewWalShipper ctor;
            no API path returns to Idle from non-Idle once Activate
            or StartSession has run.
    Fix: docstring describes actual transition; flags Idle as
         ctor-only state.

(3) stopBacklog field — dead code:
    Was: chan struct{} created in StartSession, closed in
         EndSession, but no goroutine ever reads from it.
         DrainBacklog uses ctx for cancellation; stopBacklog is
         unreferenced.
    Fix: deleted the field + StartSession's make + EndSession's
         close. Architect option was "comment as P2-reserved OR
         delete"; deleted to match architect's "dead code is worse
         than missing code" principle. If P2 (or any future
         backlog-goroutine refactor) needs it, it'll be added then.

R2 test concurrency note (architect 2026-04-29):
    `OnSaturation` callback uses `t.Errorf` from non-test goroutine.
    P0 stress (count=20, multiple 1-second runs) is clean; future
    hardening could use channel + main-goroutine assert. NOT
    required for P0 merge per architect; logging here so reviewer
    knows it's a known soft spot.

Test sweep:
    go test ./core/transport/ -run "TestWalShipper_" -count=1 → all
    PASS (10 PASS + 1 SKIP for RegistrySingleton P1 placeholder).

Memories saved (cross-conversation rules from this round):
    feedback_lsn_from_allocator_not_boundaries.md — never derive
        "LSN of this Write" from Boundaries(); use Write's return.
    feedback_tdd_when_spec_locked.md — when spec is normative, write
        conformance tests FIRST against spec § references; impl-first
        is the pattern that caused 3 recovery-component rewrites.

Next: P1 — BlockExecutor registry + Ship delegate. TDD again.
2026-04-29 21:50:41 -07:00
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%