Begin now writes through runTransition, the one read-apply-update path
every transition will use. A source-scan guard holds for the whole
series without edits: only runTransition calls UpdateHead and the store
cannot create a HEAD; every Run transition must have its closure and
interrupt tests; only a claim waits for the old lease; and no function
removes a store object until removal brings its own lease re-check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A source scan fails when UpdateHead is called anywhere but the shared
read-apply-update path, when a transition is added or removed without
being listed, when the HEAD store gains a way to create a HEAD, or when
the old-lease wait moves out of the claim. Every pure transition is
checked to refuse a holder below HEAD's epoch in every activity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BeginClean moves activity idle -> clean(session) and EndClean moves it
back to idle, each by one conditional update for the holder at HEAD's
epoch. A cleaning and a snapshot exclude each other through the one
activity field; a claim voids an open cleaning. Replays of a lost reply
write nothing. Removal of pool names inside the session comes
separately.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claim lets a holder granted a newer epoch take HEAD: epoch and holder
are set and any open session or cleaning is voided (activity idle); the
image and snapshots are unchanged. The wait for every older holder's
lease to end is an explicit guard, run after HEAD is read and before
the one conditional update, on every claim that changes HEAD. A HEAD
already held by the caller at that epoch is a replay; an older epoch,
or the same epoch held by another server, is refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commit ends a snapshot session: for the holder at HEAD's epoch with
snap(session) open, one conditional update sets the current root, the
position and an optional named snapshot and returns activity to idle.
Before it, every object the new root reaches must be written: the
chunks of this volume that are new against HEAD's current root, every
segment, and the root. The previous manifest must rebuild to HEAD's
current root, so what is new is checked, not trusted; unchanged and
foreign chunks are not looked up. A HEAD that already shows the commit
is a replay and nothing is written or looked up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Abort moves activity snap(session) -> idle for the holder at HEAD's
epoch by one conditional update and changes nothing else; it is also
how a holder rolls back the session HEAD names after its own crash.
Abort over idle is a replay of a lost reply and writes nothing; another
open session or a cleaning is refused. Begin and Abort share one
read-apply-update path that refuses an absent HEAD.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The harness constructor picks five ports; the target role now reserves
the data and ctrl ports from the handoff before it runs, so none of them
can be picked locally and then refused as a collision
(TestKnownZeroTargetReservesBeforeHarness). Comments name the steps
instead of internal document revisions.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
HEAD is the volume's one mutable entry: epoch and holder, the open
transaction (activity idle, snap(session) or clean(session)), the current
root and position, and the named snapshots with their dependents (at
most 100). Its encoding is canonical JSON; decoding refuses unknown
fields and any bytes Encode would not write.
Begin moves activity idle -> snap(session) for the holder at HEAD's
epoch, by one conditional update on HEAD's generation. Begin of the
session already open is a replay and writes nothing; another open
session, a cleaning, another epoch or another holder is refused; an
absent HEAD is refused and never created.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- device mode reads the first block of every written file (FIEMAP via
filefrag, 4 KiB blocks) through the user-space client and requires it to
equal what was written: the block witnesses step 4 reads before hydration
- step 1 passes only with 0 candidates in S0 and every chunk known-zero
(kzStep1Pass; a partial certification or any scan refuses)
- a file write fails on any writer error, also one with output, and on a
read-back sha256 that differs (kzCheckWrite)
- the target role reserves the handed-off data and ctrl ports before it
picks its own (kzReserve)
Table tests for all four in known_zero_checks_test.go (no build tags).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Reader opens a root of a volume and resolves a chunk index through the
shard's segment to its ref, then reads the bytes from the pool of the
volume the ref names (a restore's source for a foreign chunk). An index
the root does not name reads as zeros; a root, segment or chunk the root
reaches but the store lacks is ErrMissing, never zeros; bytes that do
not hash to their name, or a segment holding another shard, are
ErrCorrupt; a failed fetch is neither. DecodeRoot now checks the error
of its re-encoding as DecodeSegment does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI runs go test -short; the check builds blockvolume twice (a few
seconds) and must run there, not only in a full local run.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
TestKnownZeroAcceptance (tags subprocess chunkstore_integration, KZ_RUN=1)
runs the five acceptance steps on a fresh volume (KZ_SIZE, default
1T), each printing one "KZ STEP n PASS|FAIL" line with its counters into
KZ_REPORT:
1. the empty first snapshot stages and uploads nothing and HEAD names no
segment; the fresh attach certified the chunks known-zero;
2. mkfs (ext4 and xfs) or known blocks, sync, snapshot: the cut's work is
bounded by the chunks touched;
3. restore and fork of that snapshot on another server node: contents
equal, the first snapshot of each target without a full scan;
4. reads of snapshot-named blocks before hydration return data, never
zeros, and each read waits for its own fetch (AbsentChunks, Hydration);
5. the first start of a fresh volume killed before its attach commit: after
the restart nothing is certified known-zero, the first cut scans every
chunk once, the data reads back exactly.
KZ_ROLE source|target splits steps 3-4 onto a second host through a handoff
file; SWBLOCK_TEST_LISTEN_HOST (default 127.0.0.1) lets the test harness
bind a host address instead of loopback. KZ_DEVICE=1 uses the kernel
NVMe/TCP device, resolved only by the run's own NQN (kzResolve, with table
tests); a path given by name is never formatted.
Step 5 stops the process at the provider's existing boundary before the
fresh marker is retired, through a binary built with -tags kzhold
(HoldBeforeChunkFreshRetireForTest); a normal build contains none of it,
which TestKZHoldNeverInReleaseBuild checks.
The volume-size test's cluster and volume start move into shared helpers
(headSzStartCluster, headSzStartVolume) used by both tests.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A pure package for the content-named store layout: a chunk is named by
its index and the SHA-256 of its bytes and lives under
pool/<index/10000>/; a manifest is split into one segment per shard
(seg/<shard>-<sha256>) and a root naming them (root/<sha256>). Encodings
are canonical: decoding refuses any bytes Encode would not write, so an
object has one encoding and one name. Present and MissingOwn look names
up only: an entry that exists is complete, and a failed lookup is an
error, never absent. Nothing uses the package yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A source scan lists every non-test function in core/ and cmd/ that reads
a volume's HEAD (ReadHead, GetHead, GetHeadRoot, getHeadRoot, headExists,
or a LookupEntry of HEAD) and fails when a reader is added or removed
without classifying it. Each reader names what it does when HEAD is
absent and the probe that pins it; readers that take an absent HEAD for
an empty one are marked GAP, so a change to that behaviour flips their
probes on purpose.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trace-driven matrix: each command is run once through a recording
filer to enumerate its filer writes (its step boundaries); then for every
write it is killed before the write reaches the filer and after it
applied with its reply lost, the catalog restarted, and the command
re-run (twice) with the same request id. The end state and the data are
checked: the volume deleted and refused, or the fork's or restore's
image reading back byte for byte. A killed fork's copy intent may outlive
the replay; the test checks it is that request's and that the copy sweep
past the deadline settles it with the image intact. A step added to a
command is covered without editing the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unknown fact is not a failed one: the unsupported promotion path now
moves the line only on the current primary's own not-ready report, like
the supported path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 0, S6: AuditLog writes one JSON line per event: every operator and
admin call (accepted or refused, including a handler's RequireRole
refusal), refused node calls at most once a minute per (fingerprint,
result, method), and every role-file reload with its outcome; accepted
node calls are not recorded. blockmaster --audit-log turns it on (with
authentication only).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 0, S5: heartbeat, assignment stream (every volume), renewal and ACK
require the caller's certificate id to be the request's server id
(auth.RequireNode); the registered-host address checks stay beside it.
QueryVolumeStatus admits a node only for a volume whose line it
holds. A forced MoveWorkspace needs an admin. Development mode admits as
before. T2 starts its master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>