Skip to content

docs: record the CAS decision where the code claims otherwise - #286

Merged
scttfrdmn merged 1 commit into
mainfrom
docs/cas-decision
Aug 3, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
docs/cas-decision

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Follow-through on the direction decision for #169: per-key S3 compare-and-swap replaces the Raft build-out.

Issue changes already made outside this PR: closed #128, #130, #133, #151 (resolution: wontfix, each with its specific reason); opened #282 (Backend.PutObjectIf + sentinels + capability probe), #283 (a lease whose every guarded action re-asserts the CAS), #284 (remove the fan-out, fix the taxonomy), #285 (verify MinIO/Wasabi against real endpoints); commented #129 and #144, both of which consume the taxonomy #284 removes, so they are not implemented as written.

What this PR changes

internal/distributed/doc.go and consensus.go both documented the Raft direction as live. Specifically:

was now
doc.go: "Whether that gets built out as Raft or replaced by per-key conditional writes is the open question" the question is answered; states the direction, the closed issues and the replacements
doc.go: leader handles "configuration changes" and "quorum decisions" neither is implemented — broadcastProposal slept and accepted its own proposal — and leadership is documented as a hint, not a guard
doc.go: future enhancements include "Multi-Raft for better scalability", "consistent snapshots" removed, with a line saying why: both presuppose the log there is nothing to put in
consensus.go: "implements a Raft-like consensus algorithm" elects leaders using Raft's election mechanics and replicates nothing, with the evidence

Removed rather than reworded wherever the claim presupposed the replicated log. A "planned for future releases" list is the easiest place for a dropped direction to survive, because nothing compiles against it.

Two corrections to the design doc

Both found by acting on it, and recorded in the doc rather than smoothed over:

  1. §5's closure list of four omitted A3-1: Implement BboltPersistentState and BboltConsensusLog #150 (BboltPersistentState/BboltConsensusLog), whose own Background says it implements the A1-1: Define ConsensusLog interface and in-memory implementation #128 and A1-3: Add PersistentState interface — Raft safety prerequisite #130 interfaces. It is left open and commented, not closed — it was outside the four-issue set that was approved, so closing it would be extending scope on my own inference. Recommendation on the issue is to close it alongside the others.
  2. The doc.go linearizability correction had already landed before adoption; §5 still listed it as owed.

The "If not adopted" section is kept, retitled "The road not taken," because the case against a decision is worth preserving beside it — and if CAS hits the §2 ceiling, the alternative is already costed there.

Worth knowing for #284

The taxonomy is not three levels differing in PUT count. It is three names for two behaviours: ConsistencySession and ConsistencyEventual are now nearly the same function — both execute on targetNodes[0] then replicateAsync the remainder — and session has no session state anywhere to make its "same node for related operations" comment true. ConsistencyStrong is the mislabeled fan-out. That is why #284 carries breaking change.

Note also that closing the issues stopped the build-out but did not remove the ~6,000 lines that already elect leaders and replicate nothing. #284 is where the first of that comes out.

Milestones retitled: v0.13.0 was "Cache Warming, Raft Persistence & Operational Excellence" — #150 and #151 were the Raft Persistence.

Gates

gate result
go build ./... / go vet ./... / gofmt -l . clean
go test -count=1 -race -covermode=atomic ./... exit 0, 0 races
coverage-gate.sh 35 packages at or above floor
golangci-lint --new-from-merge-base=origin/main 0 issues
gosec ./internal/distributed/ 2 findings, both the pre-existing G404s in the election-timeout jitter
doc/changelog gates (./internal/config/) ok
go test -race ./internal/distributed/ ok

Docs-only; no behaviour change.

#169's evaluation recommended per-key S3 compare-and-swap over the Raft
build-out. That recommendation is adopted: #128, #130, #133 and #151 are
closed as not-the-direction, and #282-#285 are filed in their place.

The code said otherwise in four places, and this is the commit that stops
it saying so. `internal/distributed/doc.go` called the direction "the open
question" and listed configuration changes, quorum decisions, Multi-Raft
and consistent snapshots as things the package does or will do — none of
which is true or going to be. `consensus.go` described ConsensusEngine as
"a Raft-like consensus algorithm" without mentioning that it replicates
nothing: applyLogEntry has three empty arms and no caller appends an
operation entry, so the log holds one bootstrap noop plus one entry per
election win.

Removed rather than reworded, in both files, where the claim presupposed
the replicated log. A "planned for future releases" list is the easiest
place in a repo for a dropped direction to survive, because nothing
compiles against it.

Two corrections to the design doc, found by acting on it and recorded in
the doc rather than smoothed over:

- Its closure list of four omitted #150, whose own Background states it
  implements the #128 and #130 interfaces in bbolt. Left open and
  commented, since it was outside the approved set.
- Its `doc.go` linearizability correction, listed as owed either way, had
  already landed.

Also noted for whoever picks up #284: the taxonomy is not three levels
differing in PUT count, it is three names for two behaviours.
ConsistencySession and ConsistencyEventual are now nearly the same
function — both execute on targetNodes[0] and then replicateAsync the
remainder — and session has no session state anywhere to make its
promise true.

Milestone titles updated: v0.13.0 was "Cache Warming, Raft Persistence &
Operational Excellence" and #150/#151 were the Raft Persistence.

Refs #169, #282, #283, #284, #285
@scttfrdmn scttfrdmn added type: documentation Documentation improvements or additions priority: medium Important but not urgent area: distributed Distributed coordination and consensus area: docs Documentation content and structure labels Aug 3, 2026
@scttfrdmn
scttfrdmn enabled auto-merge (squash) August 3, 2026 19:06
@scttfrdmn
scttfrdmn merged commit 791d3df into main Aug 3, 2026
32 checks passed
@scttfrdmn
scttfrdmn deleted the docs/cas-decision branch September 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: distributed Distributed coordination and consensus area: docs Documentation content and structure priority: medium Important but not urgent type: documentation Documentation improvements or additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant