story-kit: merge 311_story_server_enforced_retry_limits_for_failed_merge_and_empty_diff_stories
This commit is contained in:
@@ -131,9 +131,11 @@ pub fn move_story_to_archived(project_root: &Path, story_id: &str) -> Result<(),
|
||||
std::fs::rename(&source_path, &done_path)
|
||||
.map_err(|e| format!("Failed to move story '{story_id}' to 5_done/: {e}"))?;
|
||||
|
||||
// Strip stale merge_failure from front matter now that the story is done.
|
||||
if let Err(e) = clear_front_matter_field(&done_path, "merge_failure") {
|
||||
slog!("[lifecycle] Warning: could not clear merge_failure from '{story_id}': {e}");
|
||||
// Strip stale pipeline fields from front matter now that the story is done.
|
||||
for field in &["merge_failure", "retry_count", "blocked"] {
|
||||
if let Err(e) = clear_front_matter_field(&done_path, field) {
|
||||
slog!("[lifecycle] Warning: could not clear {field} from '{story_id}': {e}");
|
||||
}
|
||||
}
|
||||
|
||||
let from_dir = if source_path == current_path {
|
||||
@@ -183,6 +185,14 @@ pub fn move_story_to_merge(project_root: &Path, story_id: &str) -> Result<(), St
|
||||
} else {
|
||||
"work/3_qa/"
|
||||
};
|
||||
// Reset retry count and blocked for the new stage.
|
||||
if let Err(e) = clear_front_matter_field(&merge_path, "retry_count") {
|
||||
slog!("[lifecycle] Warning: could not clear retry_count for '{story_id}': {e}");
|
||||
}
|
||||
if let Err(e) = clear_front_matter_field(&merge_path, "blocked") {
|
||||
slog!("[lifecycle] Warning: could not clear blocked for '{story_id}': {e}");
|
||||
}
|
||||
|
||||
slog!("[lifecycle] Moved '{story_id}' from {from_dir} to work/4_merge/");
|
||||
|
||||
Ok(())
|
||||
@@ -214,6 +224,14 @@ pub fn move_story_to_qa(project_root: &Path, story_id: &str) -> Result<(), Strin
|
||||
std::fs::rename(¤t_path, &qa_path)
|
||||
.map_err(|e| format!("Failed to move '{story_id}' to 3_qa/: {e}"))?;
|
||||
|
||||
// Reset retry count for the new stage.
|
||||
if let Err(e) = clear_front_matter_field(&qa_path, "retry_count") {
|
||||
slog!("[lifecycle] Warning: could not clear retry_count for '{story_id}': {e}");
|
||||
}
|
||||
if let Err(e) = clear_front_matter_field(&qa_path, "blocked") {
|
||||
slog!("[lifecycle] Warning: could not clear blocked for '{story_id}': {e}");
|
||||
}
|
||||
|
||||
slog!("[lifecycle] Moved '{story_id}' from work/2_current/ to work/3_qa/");
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user