Expand description
Pure thread materialization planning.
Owns decision logic for the heddle start / heddle thread start
materialization path once a concrete ThreadMode is known:
- checkout path layout (explicit
--pathvs managed default) - ordered materialize step sequence (create dir, copy tree, manifest, …)
- typed start-transaction effect kinds and reverse cleanup lists
- target-dir claim → checkout / self-created-dir rewind actions
- path safety vs
.heddle/threadslayout and relative-path normalization - empty-dir adoption / claim-intent pure validators
- effect staging preconditions (claim established, shared-target present)
- classification of mid-apply
anyhowfailures intoHeddleError - reflink vs full-copy policy for bytes-on-disk checkouts
- cargo
--shared-targetredirect and advisory flags
Filesystem clonefile/copy, mount RPCs, cargo-config writes, and the
start_atomic transaction stay CLI-owned. Callers resolve host/config
facts first, then invoke these helpers.
Structs§
- Checkout
Path Plan - Pure plan for where a new thread checkout should land.
- Start
Effect Staging Facts - Caller-supplied facts for pure start-effect staging gates.
- Start
Transaction Plan - Typed start-transaction plan: ordered effect kinds + mode flags.
- Thread
Materialize Plan - Structured pure plan for the start materialization path.
Enums§
- Checkout
Copy Policy - How a bytes-on-disk checkout should populate the tree.
- Checkout
Rewind Plan - Pure checkout-dir rewind action for a settled (or absent) target claim.
- Create
DirAttempt - Outcome of a pure-facing
create_dirattempt the caller reports. - Materialize
Step - One step in the atomic start materialization sequence.
- Relative
Path Normalize Error - Failures from pure relative-remainder normalization.
- Self
Created DirRewind Plan - Pure self-created target-dir removal action (the create-step inverse).
- Shared
Target Redirect Decision - Pure decision for whether
--shared-targetshould write a cargotarget-dirredirect after checkout materialize. - Start
Cleanup Step - One reverse-order cleanup action implied by a successfully applied effect.
- Start
Effect Kind - Payload-free kind of a durable effect the start transaction can stage.
- Start
Effect Precondition Error - Why a planned effect must not run its FS forward yet.
- Target
DirClaim Kind - What the target-dir claim established about the worktree leaf (pure).
- Target
DirCreate Intent - Plan-time intent for the create-target-dir step (before FS create/adopt).
- Target
Leaf Refusal - Why a leaf cannot be adopted as an empty directory claim.
- Target
Leaf Shape - Observed shape of the worktree leaf (caller supplies FS facts).
- Threads
Root Path Class - Pure classification of a candidate checkout path vs heddle layout.
- Threads
Root Path Safety Error - Failures from pure threads-root / heddle-storage path safety checks.
Constants§
- ADVISORY_
ACTIVE_ HEAVY_ THREAD_ THRESHOLD - Active heavy (solid/materialized) threads at or above which a
--shared-targetheads-up is emitted when starting another heavy thread in a Rust workspace without the flag.
Functions§
- append_
safe_ relative_ components - Append unresolved remainder components onto a resolved base.
- claim_
kind_ after_ empty_ dir_ adoption - Pure claim kind once empty-dir adoption is validated.
- claim_
kind_ for_ create_ attempt - Pure claim kind after a successful create or a successful empty-dir adopt.
- classify_
materialize_ error - Classify an
anyhowerror from a materialize/hydrate helper into theHeddleErrorthe start transaction’sResultrequires. - classify_
path_ vs_ threads_ root - Classify
pathrelative toheddle_dir/threads_root. - classify_
target_ leaf_ shape - Pure: classify metadata facts into a leaf shape (emptiness supplied when dir).
- effect_
requires_ established_ claim - Whether this effect writes through the claimed checkout leaf.
- mode_
is_ bytes_ on_ disk - Whether a mode materializes a real on-disk checkout (vs a virtual mount).
- path_
components_ are_ safe - Whether a path component sequence is free of
..escape segments. - path_
is_ nested_ in_ reserved_ region - Whether
candidatefalls insidereserved_dir, with optional exact exempt. - path_
is_ strict_ descendant - Lexical strict descent: under
rootbut not equal to it. - path_
is_ under_ or_ equal - Lexical containment:
pathisrootor a strict descendant. - plan_
checkout_ copy_ policy - Pure reflink-vs-copy policy from the planned thread mode.
- plan_
checkout_ path - Plan the checkout path for a start once mode is known.
- plan_
checkout_ rewind - Plan how the checkout rewind treats the target leaf for a claim outcome.
- plan_
hydrate - Whether
--hydrateshould run for this mode. - plan_
materialize_ steps - Convenience: ordered step list only.
- plan_
self_ created_ dir_ rewind - Plan the create-step inverse for a settled (or absent) target claim.
- plan_
shared_ target_ redirect - Plan the
--shared-targetcargo-config redirect from pure inputs. - plan_
start_ cleanup - Build reverse cleanup steps for effects that successfully applied.
- plan_
start_ transaction - Build the typed start-transaction plan from mode + post-decision flags.
- plan_
target_ dir_ create_ intent - Pure create-intent from the plan-time
target_dir_createdobservation. - plan_
thread_ materialize - Build the pure materialize plan from mode + post-decision flags.
- plan_
write_ manifest - Whether a materialized-thread manifest sidecar should be written.
- require_
established_ claim - Pure: whether a settled claim is present (writers/stage_checkout require it).
- shared_
target_ redirect_ applies - Whether
plan_shared_target_redirectselected an apply. - shared_
target_ workspace_ is_ busy - Whether the workspace looks busy enough for a
--shared-targetheads-up (Rust + active heavy-thread population), independent of the start flags. - should_
advise_ shared_ target - Whether start should print the
--shared-targetheads-up advisory. - should_
warn_ materialized_ without_ reflink - Whether start should warn that an explicit
--workspace materializedwill fall back to per-file copies on this host. - threads_
root_ path_ layout_ allowed - Whether
classify_path_vs_threads_rootaccepts the layout class. - validate_
empty_ dir_ adoption - Pure empty-dir adoption gate: only
TargetLeafShape::EmptyDirectoryok. - validate_
start_ effect_ preconditions - Pure preconditions an effect needs before its FS forward may run.
- validate_
threads_ root_ path_ safety - Pure layout + reserved-region validation for a worktree target under the threads root / heddle storage policy.