Loading
docs(storage): incorporate upload-session consistency model (#102)
What
Incorporates the strict crash-recovery model from work item #102 (closed) into the S06 storage-layer spec, replacing the optimistic "self-heal on offset divergence" prose with a terminate-on-divergence contract.
upload_sessions.dirtypoison-bit column;StorageDriver.Existsprobe;Writer(offset>0)offset-mismatch guard;FileWriterflush errors as terminal*PartialFlushError.- New typed errors:
OffsetDivergenceError,PartialFlushError,ErrSessionFinalizeOnly,ErrSessionUnrecoverable. ResumeSessionrecovery branches (normal / offset-divergence / finalize-only / DB-finalize-only / unrecoverable), keyed offWriter(PathNotFound)+Exists(staging/dest)probes; CAS onsize_bytes;Closeflushes then persists (DB never ahead of the backend); commit-timedirtyre-read; terminal-vs-recoverable Commit taxonomy.- New "Consistency & Crash-Recovery Model" section: flush lifecycle, 12 cross-cutting invariants, canonical cleanup, dirty poison-pill, and the full A/B/D/G failure scenario catalog.
- Acceptance criteria, observability (
upload_session_dirty_discard_totalmetric + outcome enums), error cases, testing, and resolutions updated. - Refreshes the storage-layer plan's offset-divergence test note to point at the S06 model and catalog.
Consumer-spec mapping (S12 OCI, S10 Maven) deferred to a follow-up.
Notes for reviewers
- Docs-only change (no Go). The failure scenario catalog (Groups A/B/D/G) is the conformance/integration test target for the follow-on implementation plan.
- The
dirtypoison-pill is explicitly defense-in-depth, not airtight: thedirty-read andMoveare not atomic, leaving a narrow B1 silent-corruption window on the content-addressed path. Closing it fully needs a durable-byte verify (streamed CRC vs native object checksum), scoped out here. Reachable only by a client that violates the OCI sequential-chunk contract with concurrent writes to oneupload_id. Flagging for explicit acceptance for MVP given cross-format dedup fan-out. - Diff is ~742 lines but is a single cohesive consistency model + scenario catalog that does not split cleanly.
Closes #102 (closed).