The test waits out the real ~45 s horizon; a 60 s budget left ~15 s for
the takeover, cut, detach and delete, which load and -race exceeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A holder that exits never detaches or ACKs, so its live authority keeps
a volume delete refused. The existing path recovers it: after the lease
horizon plus skew a forced move grants epoch+1 on another host, which
claims HEAD, serves the last cut and writes past it, then detaches with
a clean ACK, after which the delete is admitted and later renewals and
moves are refused. Real master runtime and providers, in-memory remote.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The expiry case now waits until the host's own lease guard installed a new
deadline less than 1 s ahead (the 3 s grants install about 3 s ahead), read
under the guard's lock, before it stalls renewals; a blocked renewal then
follows. A completed renewal call is no longer taken as an accepted grant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- g2Refused's probe uses a fixed lineage above every test epoch, so it is
always admissible (probes are refused only below the active epoch) and
its answer cannot depend on what the mutation did. The lineage argument
is dropped. New TestG1_ProbeHandshakeClassifiesByEffect: an accepted ship
is visible after the answer, a refused lower-epoch ship never is.
- Host lease expiry case: after a 300 ms grant was served and renewals were
stalled, wait until a renewal arrived blocked; serial renewals make that
the witness that the client accepted the 300 ms grant and is not renewed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestWorkspaceHostLeaseExpiryAndRevokeCloseRealProvider ran every case under a
300 ms lease, so on a loaded runner the lease could expire before the write,
cut or detach steps (detach-then-revoke failed #248's CI). The setup now runs
under a 3 s lease; the expiry case shortens it to 300 ms, waits until one
300 ms grant was served, and only then stalls renewals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- master slow store: each held Put takes a generation; a renewal is credited
with the generation it read before its call, so a reply computed before
the hold never releases it. slow.release() runs as the first cleanup, so a
held Put cannot block the publisher/extender joins after a failure.
- authority WritersExtendersClose: only grants of calls that started after
the extension write was held count (flag set before the hold blocks).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- core/host/master TestWorkspaceLeaseGuardSurvivesSlowAuthorityStore: each
lease write is held until a renewal succeeded during the hold (slowness by
progress), three held writes must complete, a sampler records any fence;
replaces the 2.5 s sleeps and the 10 s watch. A renewal that waited for the
store would let the guard lapse and fail the test at once.
- TestWorkspaceHeldRenewalBoundary, TestWorkspaceMoveRestoresLazilyAndFencesOldHost:
the test context has no wall-clock bound (3 s / 10 s); each step completes
or the go test timeout reports the hang. The guard's own RPC timeout stays.
- core/authority TestWorkspaceLeaseConcurrentRenewalsWritersExtendersClose:
wait for the held extension write and for renewals under it by progress
(were 5 s / 2 s bounds); joins after release unchanged.
- waitExtenders joins the finite extenders without a 10 s bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Test-only hooks: DetachVolume's StopIO can be replaced (the repeat and
retry tests now force and observe the failed-drain branch instead of
racing a cancelled context against a finished drain); the detach's cut
and settlement deadlines are traced (the budget test checks 3/4 of the
freeze, then the bound); the backend signals an I/O passing its
readiness check right before the I/O lock (the drain test's arrival
handshake replaces a 100 ms non-completion window, with bounded
receives).
- The delayed detach CAS worker is joined, bounded, also on failure.
- chunkErrorCode: the detach sentinels decide before a catalog-error
cause; the table rows now discriminate that order (no storage CAS
sentinel behind them).
- Invariants: INV-WS-DETACH-ABORT-001 and INV-WS-DETACH-FREEZE-001, and
the M4 transition Holder (detaching) -> Holder.
- Mutants (declared, 10/10): plus a catalog cause deciding before the
sentinels; the whole-budget cut is now caught by the deadline check too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- P1: every failed detach is settled before anything resumes, a failed
drain included. A repeated detach after a successful one (or with a
cancelled context) returns the first result and stays stopped, and a
retry over an unresolved detach CAS stays stopped while the outcome is
unknown. The StopIO failure path used to resume unconditionally.
- P1: one freeze budget covers the drain, the final cut and the
settlement (the cut gets three quarters, the settlement the rest); the
settlement no longer adds 10 s of its own. The bound is cooperative
(contexts), as documented.
- P2: the resume does not restart the periodic cuts after a concurrent
Close (or a replaced layer); ErrDetachOutcomeUnknown maps to
outcome_unknown explicitly, before its cause.
- Tests: the two P1 cases and the budget case (red on 26426dd5: resumed a
detached volume, resumed over an unknown CAS, 10.4 s for a 400 ms bound);
a detach CAS genuinely delayed until after the cancel then fails its
precondition; the drain test now checks that the resumed write queues
behind the admitted one and that recovery succeeds.
- Mutants (declared, 9/9): plus a failed StopIO resuming without the
settle, the settlement with time of its own, the cut taking the whole
budget.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DetachVolume stopped guest I/O, then ran the whole final cut; on any
error I/O stayed stopped for the process, even when nothing was
published, and the only bound was the caller's context (up to 5 min).
Now:
- The freeze (drain + final cut) is bounded by DetachFreezeTimeout
(default 20 s, below the host's 30 s I/O timeout); a freeze past the
5 s target is logged as an ALARM.
- A detach that provably did not publish (the drain or the cut failed
before its CAS, the CAS was refused, or an unresolved detach CAS was
cancelled) resumes serving: periodic cuts restart, the stop is lifted,
and ErrDetachAborted (HTTP detach_aborted, 409, retryable) is returned.
The dirty set stays dirty, so the next cut publishes it.
- The new ChunkLayer.SettleDetach decides an unresolved detach CAS: if
HEAD is still that CAS's base, a CAS at the same base to the
non-detached base image (this holder, this epoch) cancels it, so the
detach can never land afterwards; HEAD carrying the detach means it
applied (the detached result is returned, I/O stays stopped); a newer
holder means fenced (stays stopped); HEAD unreadable leaves it
undecided: ErrDetachOutcomeUnknown, I/O stays stopped. Never resume on
top of a possibly detached HEAD.
Tests: failed upload, refused CAS, lost unapplied CAS (cancelled, HEAD one
generation on, not detached) resume and the next cut publishes the dirty
blocks; an applied CAS whose reply was lost (found by the cut's re-read or
only by the settle) stays detached; undecidable and fenced stay stopped; a
hung CAS ends at the freeze bound, is settled and resumes; the old
drain-timeout test flips (it asserted I/O stays stopped). Six declared
mutants each turn exactly their declared tests red.
Known limit: after an abort whose drain is still pending (an admitted I/O
stuck), new I/O queues behind that admitted I/O (the drain holds a pending
ioMu.Lock); serving resumes once it completes, not instantly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BarrierPauseNs started after captureMu.Lock returned, so the wait for
writers already holding the capture barrier shared (e.g. parked in WAL
admission) was not counted, although a pending Lock already blocks new
writers: the reported guest pause understated it.
The pause is now timed from the Lock request, and LockWaitNs reports the
wait for the shared holders on its own (also in the /chunk/cut body).
Tests: a cut whose barrier is held shared for 300 ms reports a pause that
includes the wait (red on main: about 24 ms) and a LockWaitNs of about the
hold, inside the pause before the sync. Three declared mutants (pause timed
after the Lock, lock wait unset, body drops the field) each turn exactly
their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix H and candidates under the short barrier; save pending chunks before mutation.
Drain owners and waiters before cleanup, recovery, reset and close. Preserve
intent/CAS and local durability contracts. Include native caller controls,
existing model correspondence and a real-mount rehearsal note.
GREEN-gating controls for the memory-only renewal:
- grants clamp to the durable horizon under a permanently stalled
store, renewals without host validity or at the horizon are refused,
and a real guard fences by horizon - skew/2;
- a restart honours the persisted horizon in the forced barrier;
- an extension whose rename landed but whose directory sync failed
latches uncertainty, refuses the next renewal, and reloads with the
landed horizon barring a forced move until horizon + skew;
- an extender held inside its write orders a same-volume revocation or
forced move after it;
- same-volume renewals during held revocation and forced-move writes;
- the lease view equals derive(published) after every writer kind;
- N volumes renew concurrently with apply, revocation, ACK, a clean
move, extenders and Close (run with -race);
- Close joins a held extender, and an extender admitted before closing
writes nothing;
- lifecycle snapshots follow every records change, stay immutable, are
read without the store mutex, and keep a protective unknown outcome;
- through the services layer, query and revoke replies report the
grant, and a renewal during a held same-volume reservation returns
the revoking lease.
The r1-r3 slow-store wrappers count the delayed writes and require at
least one, so a green cannot bypass the injected stall. Tests that own
a Publisher directly join its extenders before their store closes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A renewal of a live workspace lease persisted the new expiry with a
temp-file fsync under the publisher's global lock, and the renewal RPC
also read two lifecycle stores whose mutexes writers hold across file
I/O. A slow or busy master disk therefore made the host's 2 s renewal
RPC time out, the guard fence and the volume shut down.
Renewal now takes only a small leaf lock (leaseMu) over a per-volume
lease view and does no I/O:
- grant = min(now+TTL, durable horizon), where the horizon is the
published Lease.ExpiresAtNS; the deadline is raised to the grant.
- It refuses stale, pending-move, expired, uncertain or storeless
state as before (never bypasses INV-AUTH-UNCERTAIN-001), and refuses
with an error when the grant would leave no positive host validity.
- The first grant of a lease still writes synchronously under p.mu and
persists horizon = now + 1.5*TTL.
- A per-volume single-flight extender is an ordinary p.mu writer: it
writes horizon = trigger + 1.5*TTL through persistWorkspaceLocked, so
its write and publication are one p.mu section; any write error
latches uncertainty as before.
Writers keep persist-before-publish and refresh the view (p.mu ->
leaseMu, the only new lock edge) at every derive-input change.
Revocation and query replies report the granted expiry, never the
horizon. Host.Close joins extenders before the store closes.
The renewal RPC reads lock-free immutable snapshots of the Volumes and
deletion-reservation stores, republished at every records change
(including load, delete and the protective unknown outcome).
Behaviour change: a forced move now waits for the durable horizon plus
skew, at most TTL/2 later than before. Existing tests that read the
persisted lease as the grant, or waited only grant + skew, are updated
with that reason. The store-write boundary guard now skips _test.go
files: a test double that delays and delegates Put is not a production
write caller.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add DeletionReservationStore.SetPersistHookForTest, an instance-local
test seam that installs the existing write-fault hook under the store
mutex (nil by default).
r5: while the deletion-reservation write of an unrelated volume is held
in that hook, a renewal through the services layer must return within
2 s. On main it waits on the reservation store's mutex.
r4 and r5 now release held writes first and settle every worker with
bounded waits before clearing hooks or closing fixtures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fold for #207: a valid reply that lands after the renewal call's
context ended, while the old lease and the new grant are still valid, was
recorded as "arrived after the lease deadline". The refusal is unchanged;
the cause now says which limit the reply missed: the lease deadline, its
own grant, or the call's context (with the lease's remaining validity).
Adds a bounded regression where the reply lands just after the 2s call
timeout with a 20s lease.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A renewal of a live workspace lease persists the new expiry with a
temp-file fsync under the publisher's global lock. When the master's
disk is slow, the host's 2 s renewal RPC times out, the guard fences
and the volume shuts down.
- r1: one renewal behind a 2.5 s store write must return within 2 s.
- r2: six concurrent renewals behind 0.5 s writes must not serialize.
- r3: a real WorkspaceLeaseGuard must not fence while the store takes
2.5 s per write (TTL 6 s).
Tests only; no fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fold for #207:
- A failed renewal now logs whether the call reached the lease deadline,
the 2s per-call timeout, or neither, so a slow master is told apart from
a lease that ran out.
- A stop that fails after a fence returns an error that names the fence
cause and wraps the stop error; after a renewal expiry or an invalid
reply both the renewal error and the stop error are kept (errors.Is).
- Tests assert the first cause wins, the fence is logged once, the cause
carries the exact deadline, and a late revoking reply keeps the
late-reply cause.
- The #205 test comment states the renewal-failure trigger as a hypothesis
that matches the code path, not a diagnosis the logs proved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard fenced silently: when renewals kept failing until the lease
expired, it drained the volume through blockvolume's lease-stop path, which
logged nothing, and returned the raw RPC error (issue #205).
- Every fence records its first cause: lease expired without a successful
renewal, expired after a failed renewal (with the renewal's latency and
error), an invalid reply, a reply that arrived after the deadline,
revocation by the master, or shutdown. The guard logs it once as
"workspace lease: fenced ...", FenceCause() returns it, and the non-ACK
drain error carries it.
- Every failed renewal is logged with its latency and the lease deadline,
also when the lease is still valid: a run of them is the warning before
an expiry fence.
- An expiry after a failed renewal returns "workspace lease expired:
renewal failed after <d>: <err>", wrapping the RPC error.
- blockvolume logs when it stops because the guard requested the drain.
The fence behaviour itself is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue #205: under sustained write load a volume fenced because its lease
renewals kept failing until the lease expired, and nothing said so. The
shutdown path logged nothing; the only trace was the raw RPC error printed
at closeout. The fence itself is correct.
Two tests fail on main:
- a renewal that times out past the lease deadline fences (as today), but
the returned error must say the lease expired and keep the RPC error,
and the fence and its cause must be logged;
- a renewal that fails while the lease is still valid must be logged with
its latency (it does not fence).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chunk layer fills chunkCutStats for every cut, but the /chunk/cut body
dropped them (the W2 placeholder said "added when W3 fills them"). The body
now carries a "stats" object that mirrors storage.ChunkCutStats field for
field: barrier pause, sync, copy, candidate/uploaded/zeroed/unchanged chunks,
uploaded bytes, upload and CAS time and result, total time, and the staging
counters. A reflection test keeps the body in step with the layer's struct,
so a new layer statistic cannot be dropped silently.
This lets a caller (the CLI, a test harness) see what one cut cost without
reading logs: the barrier pause against the chunks it copied, and the bytes
each cut uploaded to the store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chunk layer now measures every cut (barrier pause, chunks and bytes
uploaded, unchanged chunks, staging), but the /chunk/cut body still
omits them, so a caller cannot see what one cut cost. Both tests fail on
main: the body has no "stats" field.
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>
- .github/workflows/test.yml, job 'go test (linux)': on pull_request and on
push to main; Go from go.mod; go build ./..., go vet ./..., and
go test -short -count=1 -timeout 10m ./... with CGO_ENABLED=0. Actions are
pinned by commit SHA, permissions are contents: read, and a new push to a
PR cancels the older run.
- core/ops/surface_test.go: fix the two go vet warnings (resp used before
the error check), so vet covers the whole module.
- cmd/blockvolume: a withdrawn port no longer has to answer ECONNREFUSED.
A successful connect still fails; any other dial error passes only if the
address can be bound again.
- core/host/volume: probe tests dial a listener they opened and closed,
not the fixed 127.0.0.1:1.
- core/replication/component: on failure, the G5-5C and G9A catch-up tests
log frontiers, peer status and the engine trace. Assertions and timeouts
are unchanged.
Test files and the workflow only; no product code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comments in source and tests named individual reviewers and carried the
time a decision was taken (for example "(name's ruling, 06:47Z)"). Those
are review bookkeeping, not design rationale. Remove the names and the
dates/timestamps; keep the rationale, issue and PR references (#51, #82,
#83, #142, #159) and spec section references as plain text.
Comment-only: no code, test logic or string literal changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex01's review of f8d43653 (V:/share/rdma/codex01-block155-review-
20261116T0644Z/REVIEW.md) and claude05's ruling (A), 06:47Z. Against the
reviewed production code (its replay cutoff and positional smartwal
fail-closed; smartwal warning accessors stubbed so the tests build):
- a damaged STALE record in a released range drops retained, synced
LSN 3 (TestWALStoreRecoverStaleReleasedGarbageKeepsRetainedData);
- a torn smartwal slot accepted by one recovery becomes wal_corrupt
after a frontier jump and a new sync
(TestSmartWALTornSlotSurvivesAFrontierJump);
- a smartwal mid-history hole is an outage instead of a warning
(TestDurableStartup_Issue51_SmartWALHoleIsAWarningNotAnOutage);
- plus codex01's advisory: a healthy primary stays healthy with a
warning (TestStatusServer_StatusCarriesRecoveryWarnings..., which
passes either way: the plumbing never forced health).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue #51, claude05's rulings (2026-11-16 06:10Z, 06:14Z).
walstore (interim; no fail-closed: a plain power loss must never become
an outage):
- recovery decodes every range first and replays by LSN, not by scan
order (a persisted head/tail can predate a wrap). A non-zero bad entry
bounds the replay: its LSN is above its circular predecessor's, so
nothing at or above that bound is replayed in any range.
- a bad entry followed by any valid later entry is a suspected hole:
logged, counted (HolesSuspected) and reported as the typed warning
wal_hole_suspected (WALStore.RecoveryWarnings), surfaced in the
durable status and on /status without changing Healthy or readiness.
- trailing zeros still just end a range; a torn tail recovers silently.
smartwal: a corrupted committed slot (magic present, record CRC bad)
behind the highest valid LSN's slot is a mid-history hole: WAL
integrity failure (wal_corrupt). The slot right after it is the torn-
tail position and still recovers.
The durable synced watermark that tells a corrupted synced record from
an unsynced torn one is the post-M4 format change, not this.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude05's rulings (2026-11-16 06:10Z, 06:14Z). Controls with real
corrupted WALs, failing against stubs that restore today's behaviour:
walstore (interim: a power loss must never become an outage):
- (a) a corrupted mid-history synced entry: recovery succeeds to the
prefix, but no wal_hole_suspected warning, no count
(TestWALStoreRecoverWarnsOnMidHistoryHole);
- (c) the newer batch wrapped to offset 0 is replayed past a corrupted
older entry (TestWALStoreRecoverNoReplayPastAHoleAcrossWrappedRanges);
- the durable status and /status carry no warning
(TestDurableStartup_Issue51_WALStoreHoleIsAWarningNotAnOutage,
TestStatusServer_StatusCarriesRecoveryWarningsWithoutChangingHealth).
- controls that pass either way: (b) an out-of-order unsynced tail
recovers, a torn tail recovers.
smartwal (fail closed on a mid-history hole):
- a corrupted committed slot with later valid records starts Ready
(TestDurableStartup_Issue51_SmartWALMidHistoryHoleIsWALCorrupt);
- controls: the issue's exact mutation is wal_corrupt (ea1faf6a), a
torn tail recovers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fork's early replay of a completed request refuses (volume_deleted)
a target whose HEAD is deleting, purging or deleted, also before its
VOLUME is marked, like the later publication path.
- Host.ImportLifecycleVolume registers a cluster-spec volume under the
CreateVolume RPC's boundary (workspaceMu, reservation check through
the create); blockmaster startup uses it, skipping (and logging) a
reserved id, and the placement import skips reserved ids too.
Unreserved ids keep importing idempotently.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex01's r4 review (V:/share/rdma/codex01-block152-r4-review-
20261116T0445Z/REVIEW.md). Controls failing against stubs:
- Fork's early replay reports success for a target past the delete mark
(deleting, purging, HEAD deleted before VOLUME is marked)
(TestCatalog_ForkReplayRefusesADeletingTarget);
- the cluster-spec import re-creates and places a reserved id after a
restart with the original spec (TestClusterSpecImportSkipsAReserved
Volume).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>