Conflicts kept both sides: agent-workspace-design.md (restore diagram, then
attached-volume scheduling); invariants.md B.6 (the INV-MAINT-* rows, then the
INV-GC-REACHABLE-001 row with restore owner rooting). Part B summary recounted
from the tables: 131 rows, 112 ACTIVE, 17 STUB, 2 ARCHIVED, 116 new.
RestoreIndependence is now exhausted (breadth-first, complete graph): the spec
README row and the invariant rows drop the simulation tags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test now checks that the context the filer receives is live on entry (it
does not inherit the caller's cancellation) and ends with its own deadline
(context.DeadlineExceeded), not Canceled. Release and bounded join at cleanup
are kept. Mutants: inheriting the cancelled parent fails on entry; no deadline
fails on the deadline check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Walker tests that call HydrateAll synchronously run under a ctLocalBound
timeout, so a walker that never finishes fails instead of hanging.
- The dropIntent test releases and joins its worker at cleanup (an unbounded
delete, the failing case, no longer leaks a goroutine).
- invariants.md: INV-RESTORE-PARENT-HOLD-001 is Go only (the model does not
cover retention of an aborted target); new INV-CAT-INTENT-DROP-BOUNDED-001
row and M6 transition for the bounded catalog intent delete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comments in the restore code, tests and spec header now say what the code
guarantees, without review or design-note references. The real-limiter walker
test no longer asserts zero deferrals: a permit is released asynchronously
(when its flight settles, then closed by the limiter), so the next admission
can find every fill slot still closing; it now requires the limiter's skips to
equal the walker's deferrals (flaked 4 of 90 runs on Linux before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only conflict is the ledger summary line in docs/design/invariants.md,
which #318 and #320 both recounted. Recounted from the merged Part B tables:
126 rows (107 ACTIVE, 17 STUB, 2 ARCHIVED; 15 kept, 111 new).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- HydrateAll admits each fill as a background fill permit with no cut payload
(the real limiter refuses a payload for BackgroundFill, so no fill ever ran),
and the permit now belongs to the flight: the walker queues the shared flight
without becoming a waiter and a layer-owned goroutine releases the permit
when the flight's I/O is over (new settled signal, closed by the worker after
fillOnce or when an unrun flight is removed), also after an early return on
cancel, revocation or close. The limiter's abort callback stops the walker.
The flight lookup is factored into hydrationFlightLocked (shared with
OnReadMissContext, no behaviour change there).
- CreateSnapshot on a restore volume also checks the supplied image: a cut
saved before the marker that still names another volume's chunks is refused.
- dropIntent keeps outliving the caller's cancellation but is bounded by
dropIntentTimeout (it had no deadline at all).
- Tests: the real hostlimit limiter (fill permits, payload 0, all released),
permit held while a cancelled walker's Get is held, revocation, a witnessed
pause for guests, cancel returning while the Get is held, bounded joins;
stale pre-independence image refused; aborted first HEAD keeps the parent
as fork_parent until the target is deleted; dropIntent bounded.
- Docs: invariants.md M4/M6 rows and INV-RESTORE-* rows, GC owner rooting
recorded as load-bearing in INV-GC-REACHABLE-001; restore diagram in the
workspace design; RestoreIndependence in docs/spec/README.md (simulation).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TLA+ model of the restore: claim, two-step fork, hydrate, bounded batch cuts
(upload own fids under an intent, one HEAD CAS per batch), marker after the last
foreign ref, claim drop; GC, source delete, snapshot retention and crashes with a
resume from remote facts at any point. Invariants NoGap, Independent,
NoForeignList, ClaimUntilHead_Inv (option 1: today's fork claim semantics),
LifecycleFree, StateRemote. cfgs: option-1 safe at three sizes, the stricter
claim-until-independent variant, two witnesses, and one red cfg per mutant
(each red at its expected invariant in simulation). Simulation only so far:
no violation in about 0.81M states per safe cfg (3 seeds x 60000 traces, depth
40); not exhausted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A snapshot taken while a restore still names its source's chunks would keep that
lineage for its whole retention. CreateSnapshot on an Origin restore volume is
refused (restore_incomplete) until RESTORE-INDEPENDENT exists; a refused request
leaves no name or attempt. Test covers before, after own chunks without the
marker, and after the marker (the snapshot then names no foreign ref).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HydrateAll makes every HEAD-named chunk local, lowest index first, through the
same shared fill flights as guest read misses (one fetch per chunk; queue bound
and read-miss timeout apply). It yields while any flight has guest waiters and
admits each fill through the host limiter (cfg.Budget) with the caller's ctx, so
the restore driver sets hostlimit.BackgroundFill on it. A refused admission or a
pending fill backs off and retries; ctx cancel returns the remaining count.
ChunkLayerStats.AbsentChunks reports what is still to fetch (0 = fully local).
Tests: every chunk fetched exactly once and the HEAD image reads back, a second
walk does nothing; local writes (full and partial chunk) are never overwritten;
the walker issues no fetch while a guest waits and never fetches twice; each fill
is admitted once and released, refusals are deferred, the caller's class reaches
Admit; cancel reports the remaining count; AbsentChunks before/after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore is Fork recorded with Origin restore (same claim semantics: live until the
target has a HEAD). Every reader of the fork record accepts OriginRestore; a replay
onto a volume of the other origin is refused. MarkIndependent writes the write-once
RESTORE-INDEPENDENT entry only when the resolved HEAD holds no ref to another
volume (ForeignRefs: owner-qualified keys whose owner is not the volume).
Tests: restore records origin/fork record and attaches; replay and origin mismatch;
marker refused while foreign refs remain, write-once replay; source snapshot and
source volume deleted mid-restore (attach, replay and finish stay normal); GC keeps
every chunk the restored HEAD names with the snapshot and the source gone; a restore
without a live HEAD never attaches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A forced move whose issuing authority write may have reached the store
but reported an error (memory left unissued), or any move on a volume
whose workspace persistence is already uncertain, now fails with the
typed authority.ErrWorkspaceOutcomeUncertain. MoveWorkspace answers it
as Internal (UNKNOWN outcome: restart, then rerun with the same request
id) and logs it as unknown, never as a refusal; admission refusals and
failures before the issue stay FailedPrecondition.
FileAuthorityStore gets a test-only after-rename fault hook
(SetPutAfterRenameFaultForTest) for the durable-write-then-error control.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- S1: a failure after a forced move is issued (binding reconciliation,
or a publisher error with the move already issued) is answered as
Internal naming the move ISSUED, never FailedPrecondition; the client
reports it as unknown with the same-request-id recovery; the issued
forced grant is logged before anything after the issue can fail.
- S2: the client binds the grant to the request (request, volume,
expected holder and epoch, target replica and host, higher epoch) and
the range to the grant (volume, request, epochs, old replica, HEAD
gen, frontier); lost-range answers must name the asked volume/request.
- S3: the exit-4 recovery command carries --master, shell-quoted.
- S4: HEAD time labelled "(publishing host clock as recorded in the
filer, 1 s resolution)".
- T1: master test registers cleanup as soon as the master starts.
- Ledger: INV-WS-LOST-RANGE-READOUT-001 statement and tests, M2 issue row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sw-block ops workspace force-move (forced only, --confirm-forced
<volume>@<epoch>, --dry-run preview) and lost-range, over one shared
client package core/rpc/wsclient.
- WorkspaceGrant carries the stored lost range on issued forced grants
(also on replay), or lost_range_error when the record is missing or
fails its checks.
- New RPCs QueryWorkspaceLostRange (all stored ranges in issue order, or
one; DataLoss when unproven) and PreviewWorkspaceMove (read-only
forced admission; HEAD read only once admitted).
- The HEAD reader takes the HEAD entry's filer mtime from Last-Modified;
the lost range stores it beside the v1 ranges with its own checksum
(older binaries still verify the file; unknown when absent).
- The master logs every issued forced grant.
- Ledger: INV-WS-LOST-RANGE-READOUT-001, INV-WS-FORCED-CONFIRM-001; M2
forced and issue rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>