pub async fn fold_run_when(
state: &mut RunState,
home: &Path,
decide: &(dyn Fn(&RunState) -> Result<bool, FoldRefusal> + Sync),
) -> Result<Vec<String>>Expand description
fold_run for the automatic callers, which decide whether the run may be
folded at all, and whether its winner goes too, from the run record.
decide is called on the caller’s earlier read by the caller itself, and
again here on the record reloaded after taking the run’s owner lock and
execution lease. A handover (handover::release) records released_to /
released_branches under that owner lock and removes the old worktree while
keeping the branch; a fold that acted on a record read before the handover
would delete the branch already given to the successor and save the stale
record over the handover. A run no longer eligible under the fresh record
is left alone and the refusal says why. The reload is tolerant of older
schemas, as clean::fold_due always was; the explicit entry points
(fold_run, fold_run_overriding_recovery_retention) use the
migrating loader.