Integration seam ruling (Claude01, hub 10:22Z): v3 lives inside the real
*WALStore with version-dispatched internals, selected only through a
test-only create/open; production Create/Open stay v2 until row 12b.
The parallel walStoreV3 type from row 5 is removed; its logic is now the
store's v3 internals.
- walstore.go: a v3 field, set before the committer and flusher start
(openInitializedInternal init hook). Dispatch at the v2-coupled points:
Write appends through walWriterV3 with DurableLSN = Wack; Read uses the
v3 record layout; Recover runs recoverV3 (R < W*, replay <= R into the
dirty map, the exact fence, head = E, writer restored to E);
syncWALBatch runs the C/A modes through the row-3 publisher under the
v3 leader role; persistCheckpointReleasing publishes through it.
WriteBatch, ApplyEntry, WriteExtentDirect refuse (errV3NotYet) and
AdvanceFrontier is a no-op on v3 until their rows.
- flusher.go: readDirtyRecord decodes and validates v3 records.
- The v3 checkpoint/tail publication takes a map candidate hook for row
7; without it the checkpoint and tail do not move (no fabricated
coverage; the WAL stays retained).
codex01 row 5 review (40b7614f, AMEND):
- P1: the batch acknowledgement rechecks the store fault under s.mu
before advancing Wack, closing the window where a queued append latches
after the publisher's check. Held control in both modes.
- P1 (LSN order): recovery keeps the physical-prefix rule, which DESIGN
r16 makes canonical (the WAL is LSN-strictly-increasing); a
contradictory chain while installing is wrapped as ErrBaseIncomplete.
The ErrWALLSNOrder writer refusal is codex03's row-4 change.
- P2: fence ranges use interval length, never floor+WALSize; a history
ending at the last representable cursor recovers.
- P2: SetWMode evidence: a held C batch acks under C before the mode
changes; no batch acks under a stale mode; crash cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DESIGN r15 sections 6.1 to 6.6 (f2122d66), PLAN row 5 (b870a569). Dark:
the only constructor is createWALStoreV3ForTest; the v2 path is unchanged.
- recovery_v3.go (pure): scan start max(BaseCursor, retainedTail) (G2),
floor F, contiguous prefix R and its end E over the row-4 trusted chain,
the R < W* decision (wal_corrupt when serving; ErrBaseIncomplete, plus
ErrInstallSuffixDamaged and WALIntegrity when damaged, while installing),
and the exact fence ranges over [E, floor+WALSize), split at the wrap.
- walstore_v3.go: open selects a slot, scans (row 4), decides, replays the
records <= R last-writer-wins, fences and fsyncs the exact ranges through
the leaf, publishes retainedHead = E, restores the writer to E, and only
then admits. Sync mode C publishes the previous batch's W, so one fsync
covers WAL and slot; mode A fsyncs the WAL, then publishes W = H.
refreshW, and SetWMode under the group-commit leader role, publish
W = Wack. An append pwrite error latches the store-global fault.
- Tests: I1 across reopen in both modes; the C window (newest batch
truncated in C, wal_corrupt in A; second-newest wal_corrupt in both);
refresh and SetWMode(A) close it; a torn unsynced tail is never corrupt;
the G1 resurrection schedule (and its no-fence counterexample); a
byte-exact fence at an unaligned E; the append write-error latch.
- invariants.md: INV-WAL-V3-W-001 and INV-WAL-V3-FENCE-001 (STUB).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex01 row 3 round 2 (092784eb, AMEND, one P1): the store fault for a
slot write error was latched after syncFile released fileSyncMu, so an
independent store Sync queued on fileSyncMu could fsync and acknowledge
through the uncertain slot. The write callback now latches before it
returns, inside the leaf. Control: a store Sync queued behind a failing
full or partial slot write is refused without fsync, with the harness
running it right after the unlock and before the publisher resumes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex01 row 3 review (c9790ac4, AMEND):
- P1: a slot pwrite error (full or partial), like an fsync error, now
latches a publisher failure (ErrDescriptorPublishUncertain) and the store
fault through descriptorIOV3.latch, retains the uncertain candidate, and
refuses every further publication, rollover and reuse with no further
I/O until reopen reads the slots back (DESIGN 5 failure rule). The v2
syncFile leaf is unchanged.
- P2: publication-side counter checks return ErrCounterExhausted before
any write; installed -> installing is refused (not an 8.5 edge).
- Tests: full and partial slot write then error (refusals, no further
writes, no reuse, store fault latched, reopen selects the previous gen
after a torn write and the new gen after a complete one); counter
exhaustion for W, checkpoint, head and map generation; the extra edge.
- invariants.md: INV-WAL-V3-PUBLISH-001 statement and tests updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DESIGN r15 sections 4, 5 and 5.1 (f2122d66), PLAN row 3 (b870a569).
Dark: used by no production path yet; the v2 checkpoint path is
unchanged (retired in row 14a). Wiring into the v3 store follows rows 4/5.
- descriptor_v3.go: publish takes WALStore.mu (snapshot only) then descMu,
releases the store lock before slot I/O, and writes the fallback slot
with slotGen+1 through the syncFile leaf. It rebases onto the
authoritative descriptor, max-merges W and the checkpoint, refuses
identity/geometry/nonce changes, tail regression, map root changes
without a higher generation and BASE edges outside 8.5, validates the
whole slot, and rechecks the sticky fault at the success boundary.
reuseFloor is min of both tails within one nonce (none across nonces);
rolloverIfPinned republishes unchanged when the fallback pins reuse.
- Tests: alternation and reopen selection, monotonic merge, 40 concurrent
publishers, a lock-order recorder, sticky fsync and success-boundary
refusals, full-ring rollover and its failure, mixed nonces, BASE edges.
- invariants.md: INV-WAL-V3-PUBLISH-001 (STUB until activation).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DESIGN r15 section 2 (f2122d66), PLAN row 1 (b870a569). Dark: no
production open or create path reaches the v3 codec until activation
(row 12b); v2 superblock.go is unchanged.
- superblock_v3.go: 4096-byte slots A@0/B@4096, WAL at 8192; CRC32C
(Castagnoli) over [0,4092); reserved bytes, flags, impl acceptance,
slotGen/nonce, checked geometry, BASE per-state rules (installed may
have BaseCursor below retainedTail, r15), WMode, MigrationPhase, and the
slot-local map coverage CheckpointLSN <= C <= W. Selection: the valid
selectable slot with the higher slotGen; a prepared slot is never
selected (ErrMigrationIncomplete when it is the only one); equal
generation with different bytes or identity/geometry mismatch refuse.
Counters stop at 2^64-2 (ErrCounterExhausted).
- Tests decode 25 vectors from an independent stdlib generator with its
own CRC32C (testdata/format_v3/slot), re-encode the positives
byte-exact, and cover selection, exhaustion and the r15 installed rule.
- invariants.md: INV-WAL-V3-DESCRIPTOR-001 (STUB until activation).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Known frontier: durable >= required. Unknown frontier under a quorum
profile: promote only with P-K+1 fresh ready peers in the same tick.
Limits: no frontier source (#192) and no primary lease (#195).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same-tick probes are snapshots, not a fence: the rule covers the
acknowledgements their sampled frontiers represent, not one the old
primary gives after the sample.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Publisher checked IntentBind against the (volume, replica) key only,
so Bind(v,r1) then Bind(v,r2) published two epoch-1 lines for one
volume. After a restart the file store reloads only the current slot,
so a Bind for an earlier slot was accepted the same way.
A Bind is now refused with ErrBindAlreadyBound when any slot of the
volume already holds an authority line. Moving to another slot stays
IntentReassign. Same-key double Bind and Bind of a fresh volume are
unchanged.
Fixes#183.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new peer starts Healthy and Unknown is only set by Close, after which
Invalidate returns early.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invalidate stored Degraded directly, so a NeedsRebuild peer could be
invalidated to Degraded and then set Healthy, escaping the terminal
state. Invalidate now checks replicaStateTransitionAllowed like
SetState: from NeedsRebuild the state is kept and the reason is still
logged; every other state still moves to Degraded.
Fixes#182.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
State the survivor rule for an unknown required frontier in the design
doc and keep the missing acknowledged-frontier source as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Known frontier covered/behind, known zero, unknown with all, some or
stale survivors, sync_all, best_effort, provider knownness, observation
freshness, and RF2 not consulting the gate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The boot-grace and recovery-watchdog tests fail over to r2 while r3 is
silent. With an unknown frontier that promotion is no longer provable
(#181), so their fixtures now state a known required frontier that r2
covers. Their assertions are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unknown required acknowledgement frontier was read as zero, so the
highest durable ready candidate was promoted even when only some peers
were seen; an acknowledged write could live only on an unseen peer.
The probe result now says whether the required frontier is known. With a
known frontier the candidate must cover it, as before. With an unknown
frontier under a quorum ack profile, the highest durable candidate is
promoted only when enough peers are probed ready and fresh to intersect
every acknowledgement quorum (peerCount-K+1, K from waitForSyncAcks):
RF3 sync_quorum needs both peers, sync_all needs one. Otherwise nothing
is promoted. best_effort is unchanged.
Fixes#181.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agent-workspace-design.md (measured results) adds the post-#173 guest fsync
medians; block-design.md's known-issues entry says #173 removed the idle
group-commit wait (about 5.5 ms to 3.23 ms against 2.74 ms local) and keeps
the remaining lead (the checkpoint superblock fsync under the store lock).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The backend Sync figure is the mean over the gate window, and the gate that
every guest fsync reaches the backend sync ran on the four Seaweed Block
setups (not on the local disk).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up:
- INV-WAL-SYNC-FRONTIER-001: Sync never reports an uncovered write durable;
it returns the global synced frontier, at or above the caller's own write,
covered by a completed fsync (TestWALGenerationFirstCallerReturnOrdering).
- INV-AUTH-PERSIST-BEFORE-PUBLISH-001 and the M2 row: store-backed only; a
failed write publishes nothing but its outcome may be unknown, and the
workspace path latches that uncertainty.
- INV-FE-LINEAGE-GATE-001: the volume-ID facet is marked as code reading.
- INV-CUT-READMISS-001, the M4 row and agent-workspace-design.md: a HEAD
fill never overwrites a newer local extent version; a WAL-only write wins
on reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each gap noted in docs/design/invariants.md is now confirmed by a red test
and tracked as an open issue: #181 (RF=3 promotion admitted with required
LSN zero), #182 (Invalidate bypasses the NeedsRebuild terminal state) and
#183 (a genesis Bind for a second slot of a bound volume).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README, the agent-workspace diagram and docs/workspace-measurements.md
still said guest fsync was about 7 ms against 3 ms local. A rerun after #173
(same lab pack and host, the same four setups, fio 4 KiB random write one at
a time with fsync after every write, median of 3 boots) measured a median of
3.23 ms (ublk, walstore-chunk) against 2.74 ms local. The original runs stay
as history in docs/workspace-measurements.md.
Documentation only; no code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>