fix: unblock command also clears merge_failure field
Previously unblock only checked for blocked=true. Stories stuck in merge with a merge_failure field were not considered "blocked" and unblock refused to act. Now it clears both blocked and merge_failure, and reports which fields were cleared. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,15 +98,27 @@ pub(crate) fn unblock_by_path(path: &Path, story_id: &str) -> String {
|
||||
|
||||
let story_name = meta.name.as_deref().unwrap_or(story_id).to_string();
|
||||
|
||||
if meta.blocked != Some(true) {
|
||||
let has_blocked = meta.blocked == Some(true);
|
||||
let has_merge_failure = meta.merge_failure.is_some();
|
||||
|
||||
if !has_blocked && !has_merge_failure {
|
||||
return format!(
|
||||
"**{story_name}** ({story_id}) is not blocked. Nothing to unblock."
|
||||
);
|
||||
}
|
||||
|
||||
// Clear the blocked flag (reads + writes the file).
|
||||
if let Err(e) = clear_front_matter_field(path, "blocked") {
|
||||
return format!("Failed to clear blocked flag on **{story_id}**: {e}");
|
||||
// Clear the blocked flag if present.
|
||||
if has_blocked {
|
||||
if let Err(e) = clear_front_matter_field(path, "blocked") {
|
||||
return format!("Failed to clear blocked flag on **{story_id}**: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
// Clear merge_failure if present.
|
||||
if has_merge_failure {
|
||||
if let Err(e) = clear_front_matter_field(path, "merge_failure") {
|
||||
return format!("Failed to clear merge_failure on **{story_id}**: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
// Reset retry_count to 0 (re-read the updated file, modify, write).
|
||||
@@ -119,7 +131,10 @@ pub(crate) fn unblock_by_path(path: &Path, story_id: &str) -> String {
|
||||
return format!("Failed to reset retry_count on **{story_id}**: {e}");
|
||||
}
|
||||
|
||||
format!("Unblocked **{story_name}** ({story_id}). Retry count reset to 0.")
|
||||
let mut cleared = Vec::new();
|
||||
if has_blocked { cleared.push("blocked"); }
|
||||
if has_merge_failure { cleared.push("merge_failure"); }
|
||||
format!("Unblocked **{story_name}** ({story_id}). Cleared: {}. Retry count reset to 0.", cleared.join(", "))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user