Skip to content

v0.0.6 — concurrency is part of the persistence contract, and single-codec stores are first-class

Choose a tag to compare

@antst antst released this 19 Aug 14:22
· 14 commits to main since this release
088163b

BREAKING, and deliberately so. Four exported conformance functions added on main
after v0.0.5 — PersistenceConcurrency, PersistenceCompactionConcurrency,
PersistenceFencingConcurrency, CheckpointPersistenceConcurrency — are removed.
They were never in a tag. Concurrency is not an optional capability of a
persistence store, and a suite a consumer could omit would let a store claim
conformance while skipping the rules hardest to satisfy. The behaviour now runs
inside Persistence, PersistenceCompaction, PersistenceFencing,
CheckpointPersistence and CheckpointPersistenceFencing, with no opt-out.

THE FIX MOST LIKELY TO AFFECT YOU. CheckpointPersistenceDeletion and
CheckpointPersistenceDeletionFencing hardcoded EncodingV1 in every seed, so a
store supporting only one codec failed them by construction — while
CheckpointPersistence in the same package carried an ErrUnsupportedEncoding skip
specifically to accommodate such a store. Two suites disagreeing about whether a
single-codec store is legitimate. Both now seed through the codec probe. If you
kept a codec alive only to satisfy those fixtures, you can delete it.

That survived because nothing in this repository had ever taken the shape. Every
fixture accepted both codecs and stored the vector it was handed, so the skip,
its guard, and the contract's permission to READ a checkpoint were carried with
no implementation to exercise them — correct, reviewed, and inert. There is now a
bare-update fixture: one codec, vector derived on load, run against every
checkpoint suite. It found two further defects within minutes of existing.

CONCURRENCY. The contract's concurrent clauses had no concurrent tests. Compactor
promises to preserve "concurrent appends after Basis" and its only test ran
entirely in program order. Store and CheckpointStore never said their methods
could be called concurrently at all — a Go type is not goroutine-safe unless it
says so — so the new suites were briefly imposing an interface stronger than the
one documented. Both profiles now state it: methods are safe for concurrent
invocation across documents, per-document revision, fence and replace decisions
are atomic, and a checkpoint is ONE value.

Certified: concurrent appends are durable with distinct increasing revisions,
appends racing a compaction survive, fence authority is decided by a single order
so a superseded owner never lands a write after its successor, and a load never
returns one save's update beside another save's vector.

Eight planted defects prove the suites reject rather than merely accept, and each
must fail AT ITS OWN ASSERTION — requiring only that the child failed repeats the
defect this whole exercise is about.

CONTRACT. Deleter's load-after-delete clause contradicted ErrNotFound's own rule
for any store whose delete leaves a pointer owned by another system dangling.
ErrNotFound wins, because reporting it there makes a caller treat a document that
HAD content as new and seed it with create-time content. Deleter now states that
its clause assumes the implementation owns everything that makes the document
findable; a partial owner's guarantee belongs to whatever owns the whole
document.