Skip to main content

Module commit_recovery

Module commit_recovery 

Source
Expand description

Startup recovery of interrupted commit transactions. What: Startup recovery of interrupted commit transactions for the invocation’s worktree. Why: Before configuration loads, and before read-only commands that already asked Git for the repository location, every dead owner’s transaction is recovered or fails closed; live owners are skipped. The legacy single-journal directory is not recovered here: the command stops and says how to recover it with the previous executable (the owner’s verdict, doc/planning/cli-git-rust-open-decisions.md, “Legacy single-journal directory”). An empty registry costs one directory read and no Git process (src/policy-engine/commit-transaction-recovery.ts).

In TS you’d write (pseudocode):

await recoverCommitTransaction({ args, gitPath, identity });

Enums§

RecoveryStop
What: Why recovery stopped the command. Why: The legacy directory and a recovery failure are reported differently.

Functions§

leaves_live_transactions
What: Whether outcomes leave a transaction another process may still be running. Why: Until index writers coordinate with live transactions, a guarded command beside one is refused instead of racing it. A dead owner’s kept staging candidate touched nothing and does not count; an unattributed one may still be written by a live owner.
legacy_notice
What: The message for the legacy single-journal directory. Why: The owner chose to stop with instructions instead of porting its recovery.
outcomes_json
What: The outcomes as the incumbent’s debug JSON. Why: JSON.stringify(outcomes) in the recovery debug line.
recover_commit_transactions
What: Recover every interrupted transaction of the invocation’s worktree; returns the outcomes, empty when there was nothing to do. Why: recoverCommitTransaction, with the legacy directory stopping the command.
recovery_directories
What: The Git directory whose registry this invocation recovers, or nothing outside a worktree and in a bare repository. Why: resolveCommitTransactionTargets: only worktrees hold transactions.