huskies: merge 987
This commit is contained in:
@@ -6,6 +6,54 @@ mod squash;
|
||||
|
||||
pub(crate) use squash::run_squash_merge;
|
||||
|
||||
/// Typed outcome of a completed squash-merge operation.
|
||||
///
|
||||
/// Each variant captures only the fields relevant to that outcome, eliminating
|
||||
/// the four-bool soup of the old `MergeReport`.
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(tag = "kind")]
|
||||
pub enum MergeResult {
|
||||
/// Squash commit landed on the base branch and all quality gates passed.
|
||||
Success {
|
||||
/// `true` when conflicts were detected and automatically resolved.
|
||||
conflicts_resolved: bool,
|
||||
conflict_details: Option<String>,
|
||||
/// Human-readable output from the quality-gate run.
|
||||
gate_output: String,
|
||||
},
|
||||
/// Merge was aborted due to unresolvable conflicts; base branch is untouched.
|
||||
Conflict {
|
||||
details: Option<String>,
|
||||
output: String,
|
||||
},
|
||||
/// Squash commit produced but quality gates failed; base branch may carry the commit.
|
||||
GateFailure {
|
||||
output: String,
|
||||
#[serde(default)]
|
||||
failure_kind: Option<crate::agents::gates::GateFailureKind>,
|
||||
},
|
||||
/// Feature branch had zero commits ahead of the base branch.
|
||||
NoCommits { output: String },
|
||||
/// Unclassified failure (cherry-pick failed, git error, etc.).
|
||||
Other {
|
||||
output: String,
|
||||
conflict_details: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
impl MergeResult {
|
||||
/// Extract the human-readable output string from any variant.
|
||||
pub fn output(&self) -> &str {
|
||||
match self {
|
||||
Self::Success { gate_output, .. } => gate_output,
|
||||
Self::Conflict { output, .. }
|
||||
| Self::GateFailure { output, .. }
|
||||
| Self::NoCommits { output }
|
||||
| Self::Other { output, .. } => output,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Status of an async merge job.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub enum MergeJobStatus {
|
||||
@@ -33,40 +81,8 @@ pub struct MergeJob {
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct MergeReport {
|
||||
pub story_id: String,
|
||||
pub success: bool,
|
||||
pub had_conflicts: bool,
|
||||
/// `true` when conflicts were detected but automatically resolved.
|
||||
pub conflicts_resolved: bool,
|
||||
pub conflict_details: Option<String>,
|
||||
pub gates_passed: bool,
|
||||
/// Human-readable output from quality gates (display and retry-prompt injection only).
|
||||
pub gate_output: String,
|
||||
/// Typed classification of the gate failure, produced at the gate boundary.
|
||||
/// `None` when `gates_passed` is `true` or when there were no gate results.
|
||||
#[serde(default)]
|
||||
pub gate_failure_kind: Option<crate::agents::gates::GateFailureKind>,
|
||||
/// `true` when the feature branch had zero commits ahead of the base branch.
|
||||
#[serde(default)]
|
||||
pub no_commits: bool,
|
||||
/// Typed outcome of the merge operation.
|
||||
pub result: MergeResult,
|
||||
pub worktree_cleaned_up: bool,
|
||||
pub story_archived: bool,
|
||||
}
|
||||
|
||||
/// Result of a squash-merge operation.
|
||||
pub(crate) struct SquashMergeResult {
|
||||
pub(crate) success: bool,
|
||||
pub(crate) had_conflicts: bool,
|
||||
/// `true` when conflicts were detected but automatically resolved.
|
||||
pub(crate) conflicts_resolved: bool,
|
||||
pub(crate) conflict_details: Option<String>,
|
||||
pub(crate) output: String,
|
||||
/// Whether quality gates ran and passed. `false` when `success` is `false`
|
||||
/// due to a gate failure; callers can use this to distinguish gate failures
|
||||
/// from merge/commit/FF failures in the `MergeReport`.
|
||||
pub(crate) gates_passed: bool,
|
||||
/// Typed gate failure kind produced at the gate boundary. `None` when
|
||||
/// `gates_passed` is `true` or when failure was not from the gate step.
|
||||
pub(crate) gate_failure_kind: Option<crate::agents::gates::GateFailureKind>,
|
||||
/// `true` when the feature branch had zero commits ahead of the base branch.
|
||||
pub(crate) no_commits: bool,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user