huskies: merge 986

This commit is contained in:
dave
2026-05-13 15:57:24 +00:00
parent 91fbad568a
commit 430079ecbc
13 changed files with 377 additions and 81 deletions
+52 -11
View File
@@ -48,10 +48,19 @@ pub(crate) fn run_squash_merge(
.parse()
.unwrap_or(1); // parse failure → don't false-positive; let merge proceed
if ahead == 0 {
return Err(format!(
"{story_id}: no commits to merge — feature branch '{branch}' \
has 0 commits ahead of '{base_branch}'"
));
return Ok(SquashMergeResult {
success: false,
had_conflicts: false,
conflicts_resolved: false,
conflict_details: None,
output: format!(
"{story_id}: no commits to merge — feature branch '{branch}' \
has 0 commits ahead of '{base_branch}'"
),
gates_passed: false,
gate_failure_kind: None,
no_commits: true,
});
}
}
@@ -125,6 +134,8 @@ pub(crate) fn run_squash_merge(
conflict_details,
output: all_output,
gates_passed: false,
gate_failure_kind: None,
no_commits: false,
});
}
let had_conflicts = false;
@@ -165,6 +176,8 @@ pub(crate) fn run_squash_merge(
conflict_details: None,
output: all_output,
gates_passed: true,
gate_failure_kind: None,
no_commits: false,
});
}
cleanup_merge_workspace(project_root, &merge_wt_path, &merge_branch);
@@ -175,6 +188,8 @@ pub(crate) fn run_squash_merge(
conflict_details,
output: all_output,
gates_passed: false,
gate_failure_kind: None,
no_commits: false,
});
}
@@ -207,6 +222,8 @@ pub(crate) fn run_squash_merge(
),
output: all_output,
gates_passed: false,
gate_failure_kind: None,
no_commits: false,
});
}
}
@@ -251,13 +268,13 @@ pub(crate) fn run_squash_merge(
// Run gates in the merge worktree so that failures abort before master moves.
all_output.push_str("=== Running quality gates before fast-forward ===\n");
match run_merge_quality_gates(&merge_wt_path) {
Ok((true, gate_out)) => {
all_output.push_str(&gate_out);
Ok(outcome) if outcome.passed => {
all_output.push_str(&outcome.output);
all_output.push('\n');
all_output.push_str("=== Quality gates passed ===\n");
}
Ok((false, gate_out)) => {
all_output.push_str(&gate_out);
Ok(outcome) => {
all_output.push_str(&outcome.output);
all_output.push('\n');
all_output.push_str(
"=== Quality gates FAILED — aborting fast-forward, master unchanged ===\n",
@@ -270,6 +287,8 @@ pub(crate) fn run_squash_merge(
conflict_details,
output: all_output,
gates_passed: false,
gate_failure_kind: outcome.failure_kind,
no_commits: false,
});
}
Err(e) => {
@@ -282,6 +301,8 @@ pub(crate) fn run_squash_merge(
conflict_details,
output: all_output,
gates_passed: false,
gate_failure_kind: None,
no_commits: false,
});
}
}
@@ -323,6 +344,8 @@ pub(crate) fn run_squash_merge(
)),
output: all_output,
gates_passed: true,
gate_failure_kind: None,
no_commits: false,
});
}
@@ -358,6 +381,8 @@ pub(crate) fn run_squash_merge(
)),
output: all_output,
gates_passed: true,
gate_failure_kind: None,
no_commits: false,
});
}
@@ -392,6 +417,8 @@ pub(crate) fn run_squash_merge(
),
output: all_output,
gates_passed: true,
gate_failure_kind: None,
no_commits: false,
});
}
@@ -410,6 +437,8 @@ pub(crate) fn run_squash_merge(
conflict_details,
output: all_output,
gates_passed: true,
gate_failure_kind: None,
no_commits: false,
})
}
@@ -435,7 +464,11 @@ pub(crate) fn cleanup_merge_workspace(
.output();
}
fn run_merge_quality_gates(project_root: &Path) -> Result<(bool, String), String> {
fn run_merge_quality_gates(
project_root: &Path,
) -> Result<crate::agents::gates::GateOutcome, String> {
use crate::agents::gates::GateOutcome;
let mut all_output = String::new();
let mut all_passed = true;
@@ -449,7 +482,11 @@ fn run_merge_quality_gates(project_root: &Path) -> Result<(bool, String), String
if !success {
all_passed = false;
}
return Ok((all_passed, all_output));
return if all_passed {
Ok(GateOutcome::pass(all_output))
} else {
Ok(GateOutcome::fail(all_output))
};
}
// No script/test — fall back to cargo gates for Rust projects.
@@ -481,7 +518,11 @@ fn run_merge_quality_gates(project_root: &Path) -> Result<(bool, String), String
}
}
Ok((all_passed, all_output))
if all_passed {
Ok(GateOutcome::pass(all_output))
} else {
Ok(GateOutcome::fail(all_output))
}
}
#[cfg(test)]