Skip to main content

Module direct_fix

Module direct_fix 

Source
Expand description

The direct fix: converge corrections in memory, then install them. What: git cli-git fix: run policy passes over the selected files, apply the corrections they propose in memory until a pass proposes none, then install the corrected files into the worktree when that last pass is clean. Why: The installed wrapper’s direct-fix.ts and direct-fix-convergence.ts decide the behaviour: only the last pass is reported, a fix summary follows it only when a file changed, nothing reaches the worktree unless the last pass exits 0, and a fix that cycles or keeps changing ends with one engine failure. The bounded loop itself is policy_convergence::converge; this module supplies its passes. Corrections replace whole file contents in memory instead of being staged into the private index, so a pass starts no Git process for them.

In TS you’d write (pseudocode):

// const result = await runDirectFix({ gitGlobalArgs, pathspecs, policyOptions });

Structs§

DirectFixPasses
What: The passes of one direct fix, as the bounded loop sees them. 'a names how long the borrowed request and checks last. Why: The loop owns the control flow; this owns running a pass, applying its corrections and remembering each changed state.

Constants§

DIRECT_FIX_CYCLE_MESSAGE
The message of a fix whose corrections returned to an earlier state, as the installed wrapper’s direct fix words it.
NO_WORKTREE_MESSAGE
The message of a fix that has no worktree to install into.

Functions§

convergence_pass
What: How the loop reads a pass’s ending. Why: A proposal asks for another pass; a pass that could not decide blocks the fix; a completed or stopped pass proposes nothing, so the content is stable.
finish_fix
What: What a fix reports once the loop ended: convergence says how, pass is the last pass run. Why: A settled fix may install; a blocked fix reports the pass that could not decide; a cycle and a pass limit report one engine failure each, as the installed wrapper’s fixCycleFailure and fixPassLimitFailure do.
fix_failure
What: A fix result made of one engine failure of the fix, as the installed wrapper reports a cycle, a pass limit or an installation failure: earlier events are dropped. &[std::ffi::OsString] borrows the command’s arguments. Why: The person sees why nothing was installed, and nothing else.
run_direct_fix
What: Run a whole direct fix and return what it reports. root is the worktree’s top level, where corrected files are installed. Why: See the module comment.
settled_fix
What: The result of a settled fix: the last pass as it is, or that pass followed by a fix summary once its corrections were installed. Option<&Path> is the worktree’s top level or nothing. Why: Only a last pass that exits 0 installs anything, and the summary is reported only after a file changed.