pub fn write_completion(
workdir: &Path,
outcome: &DelegationOutcome,
) -> Result<(), String>Expand description
Write outcome to COMPLETION_FILE, replacing whatever was there.
Written to a sibling temporary file and renamed into place, never truncated in place. The
parent reads this file once the completion has reached the delegating task, and
report_completion rewrites it immediately after posting that completion — so a plain
truncating write leaves a window in which the parent reads an empty or half-written file and
records the delegation’s outcome as unknown. The rename makes every reader see either the
whole previous content or the whole new content. The temporary name is unique because the
child and the watcher behind it can both reach this function.