test(remote): Fetch acceptance-path unit floor (S13 Step 7, part 3/4)

📦 What this MR does

Part 3 of 4 of S13 Step 7 (Fetch cache-fill pipeline): the acceptance-path unit-test floor for part 2's pipeline, plus the shared test doubles every Fetch test uses.

  • Shared helpers and fakes: fakeSession (scriptable write/commit/cancel failures, partial-accept self-termination, context capture), fakeBlobStore, closeTrackingReadCloser, breakingReader, cancelBeforeEOFReader, newFetchRequest, upstreamETagHeader (canonicalizing — a raw "ETag" map key is invisible to Header.Get).
  • Nine tests covering the step's acceptance criteria: miss/200 tee-and-stream (bytes reach caller and cache, commit-before-upsert order pinned), legitimate 304 → FreshFromCache (bump only, no session), bare 304 → FetchError, ETag-differs full refetch, mid-stream read failure and early Close both discarding staging, the two context-detachment guarantees (mid-stream cancel still discards; post-last-byte cancel still upserts), and non-2xx status propagation (401/404/502).

Part 4 completes the floor with the error-injection/edge-case tests and the real-Postgres integration tests, reusing this part's helpers.

⚙️ Why stacked

Step 7's full diff is ~2.7k reviewable LoC, so it ships as 4 stacked MRs, reviewed and merged bottom-up.

  • Plan: docs/plans/2026-07-16-s13-virtual-remote-foundation.md — Step 7
  • Spec: docs/specs/S13-virtual-remote-foundation.md — Fetch, cache freshness model

🔬 e2e scenarios

No scenario added or affected: S13 remote fetch has no e2e catalog yet (test-only MR).

Related to #328 (closed)

📚 Stacked MRs (review/merge bottom-up)

Edited by David Fernandez

Merge request reports

Loading
Loading