ce94dd0af4
The 1772-line merge.rs is split into: - conflicts.rs: try_resolve_conflicts + resolve_simple_conflicts + tests (351 lines) - squash.rs: run_squash_merge orchestrator + cleanup + run_merge_quality_gates + tests (1306 lines) - mod.rs: doc, types (MergeJobStatus, MergeJob, MergeReport, SquashMergeResult), re-exports (52 lines) Tests stay co-located. No behaviour change. All 20 merge tests pass; full suite green (2635 tests with --test-threads=1).
53 lines
1.6 KiB
Rust
53 lines
1.6 KiB
Rust
//! Merge operations — rebases agent work onto master and runs post-merge validation.
|
|
|
|
use serde::Serialize;
|
|
|
|
mod conflicts;
|
|
mod squash;
|
|
|
|
pub(crate) use squash::{cleanup_merge_workspace, run_squash_merge};
|
|
|
|
/// Status of an async merge job.
|
|
#[derive(Debug, Clone, Serialize)]
|
|
pub enum MergeJobStatus {
|
|
Running,
|
|
Completed(MergeReport),
|
|
Failed(String),
|
|
}
|
|
|
|
/// Tracks a background merge job started by `merge_agent_work`.
|
|
#[derive(Debug, Clone, Serialize)]
|
|
pub struct MergeJob {
|
|
pub story_id: String,
|
|
pub status: MergeJobStatus,
|
|
}
|
|
|
|
/// Result of a mergemaster merge operation.
|
|
#[derive(Debug, Serialize, 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,
|
|
pub gate_output: String,
|
|
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,
|
|
}
|