huskies: merge 827

This commit is contained in:
dave
2026-04-28 12:57:28 +00:00
parent 1bd01eb9d4
commit 36ca8d5e3b
4 changed files with 223 additions and 5 deletions
@@ -119,6 +119,47 @@ pub(super) fn has_merge_failure(project_root: &Path, _stage_dir: &str, story_id:
.is_some()
}
/// Return `true` if the story's `merge_failure` contains a git content-conflict
/// marker (`"Merge conflict"` or `"CONFLICT (content):"`).
///
/// Used by the auto-assigner to decide whether to spawn mergemaster automatically.
pub(super) fn has_content_conflict_failure(
project_root: &Path,
_stage_dir: &str,
story_id: &str,
) -> bool {
use crate::io::story_metadata::parse_front_matter;
let contents = match read_story_contents(project_root, story_id) {
Some(c) => c,
None => return false,
};
parse_front_matter(&contents)
.ok()
.and_then(|m| m.merge_failure)
.map(|reason| reason.contains("Merge conflict") || reason.contains("CONFLICT (content):"))
.unwrap_or(false)
}
/// Return `true` if the story has `mergemaster_attempted: true` in its front matter.
///
/// Used to prevent the auto-assigner from repeatedly spawning mergemaster for
/// the same story after a failed mergemaster session.
pub(super) fn has_mergemaster_attempted(
project_root: &Path,
_stage_dir: &str,
story_id: &str,
) -> bool {
use crate::io::story_metadata::parse_front_matter;
let contents = match read_story_contents(project_root, story_id) {
Some(c) => c,
None => return false,
};
parse_front_matter(&contents)
.ok()
.and_then(|m| m.mergemaster_attempted)
.unwrap_or(false)
}
// ── Tests ──────────────────────────────────────────────────────────────────
#[cfg(test)]