Expand description
Undo list / planning domain (inspection + batch selection + apply preflight + human labels).
Owns the read-side and pure apply-path preflight of heddle undo:
- listing user-facing oplog batches for the current checkout scope
- pure batch summarization for stable machine JSON field names
- selecting the next N undo/redo batches
- shared domain refusals for mode conflict and empty history
- pure redaction / thread-worktree / state-reachability preflights given caller-supplied batch facts (no FS / store I/O in the decision layer)
- apply step order (reverse within batch for undo; forward for redo) and preview / completed message strings
Locks, store lookups, dirty-worktree checks, git-checkpoint simulation, and
the apply engine remain CLI-owned (undo.rs + undo_apply/*).
Structs§
- Live
Thread Worktree - A hazard whose materialized path still exists (caller-resolved FS fact).
- Purge
OpRef - A
Purgeop participating in undo redaction safety. - Redact
OpRef - A
Redactop participating in undo redaction safety. - Redaction
Undo Batch Facts - Batch-derived redaction facts (no store I/O).
- Required
State Ref - State the apply inverse/replay must load, tagged with the owning op id.
- Thread
Worktree Hazard - ThreadCreate in the undo chain that can orphan a materialized worktree.
- Undo
Apply Plan - Pure apply plan after batch selection: step order + stable messages.
- Undo
Apply Step - One entry as the apply engine will visit it (batch order fixed; entry order depends on undo vs redo).
- Undo
Batch Summary - One oplog batch as surfaced by undo list / preview / completed payloads.
- Undo
List Report - Machine JSON for
heddle undo --list(stable field names). - Undo
Operation Summary - One operation inside an undo batch summary.
- Undo
Plan - Result of selecting batches for a multi-step undo/redo plan.
- Unsupported
Redo Op - A redo-unsupported redaction-adjacent op (
Redact/Purge).
Enums§
- Undo
Apply Preflight Error - Typed apply-path preflight refusals (CLI maps to recovery advice).
- Undo
History Action - Whether empty-history advice refers to undo or redo.
Functions§
- batch_
status (all_undone, partial)for a batch — pure status flags for machine output.- check_
redaction_ redo_ supported - Pure redo redaction support preflight.
- check_
redaction_ undo_ safe - Pure redaction-undo safety given batch facts + caller-resolved purge status.
- check_
states_ reachable - Pure: refuse when caller-resolved missing states are non-empty.
- check_
thread_ worktree_ undo_ safe - Pure worktree-orphan preflight: refuse when any live materialized path remains.
- collect_
redaction_ undo_ facts - Collect purge/redact ops from a planned undo chain (pure scan).
- collect_
redo_ required_ states - Collect states required for redo reachability (pure scan of batches).
- collect_
thread_ worktree_ hazards - Collect ThreadCreate worktree-orphan hazards from batches (pure; no FS).
- collect_
undo_ required_ states - Collect states required for undo reachability (pure scan of batches).
- collect_
unsupported_ redo_ ops - Collect redo-unsupported ops from batches (pure).
- empty_
history_ refusal - Shared advice: no undo/redo-eligible batch in the current checkout lane.
- human_
operation_ description - Soften git-checkpoint batch descriptions for human undo listing.
- human_
post_ undo_ trust_ status - Soften post-undo verification status for operators.
- human_
undo_ redo_ message - Human text status line for undo/redo preview or completed output.
- list_
undo_ history - List user-facing undo history for the current checkout scope.
- list_
undo_ history_ ctx - List undo history via an
ExecutionContext(embeddable facade entry). - live_
materialized_ path_ blocks_ undo - Pure: whether a materialized worktree path still on disk blocks ThreadCreate undo.
- machine_
undo_ redo_ message - Machine JSON
messagefield for undo/redo preview or completed payloads. - plan_
redo_ apply_ steps - Redo apply order: each batch in selection order, entries forward within batch.
- plan_
redo_ batches - Select the next
stepsredoable batches for the current checkout scope. - plan_
undo_ apply - Build an apply plan from a selected
UndoPlan(pure; no preflight). - plan_
undo_ apply_ steps - Undo apply order: each batch in selection order, entries reverse within batch.
- plan_
undo_ batches - Select the next
stepsundoable batches for the current checkout scope. - require_
nonempty_ history - Refuse when a plan selected zero batches.
- summarize_
batch - Summarize one
OpBatchinto stable list/preview JSON fields. - undo_
mode_ conflict - Shared advice:
undo --listcombined with--preview. - validate_
undo_ list_ preview_ modes - Pure mode preflight:
--listand--previeware mutually exclusive.