Skip to main content

MergeSession

Struct MergeSession 

Source
pub struct MergeSession {
    pub merge_id: MergeSessionId,
    pub src_head: Option<OpId>,
    pub dst_head: Option<OpId>,
    pub lca: Option<OpId>,
    pub auto_resolved: Vec<MergeOutcome>,
    /* private fields */
}
Expand description

Stateful merge in flight. Hold one per active merge between start and commit. Sessions are not thread-safe; the HTTP wrapper is expected to wrap them in a Mutex keyed by MergeSessionId.

Fields§

§merge_id: MergeSessionId§src_head: Option<OpId>§dst_head: Option<OpId>§lca: Option<OpId>§auto_resolved: Vec<MergeOutcome>

Outcomes the engine resolved unilaterally — Both (both sides agreed) and one-sided (Src / Dst). The agent sees these for audit but doesn’t need to act on them.

Implementations§

Source§

impl MergeSession

Source

pub fn start( merge_id: impl Into<MergeSessionId>, op_log: &OpLog, src_head: Option<&OpId>, dst_head: Option<&OpId>, ) -> Result<Self>

Start a merge session. Runs the engine in crate::merge and partitions the outcomes into auto-resolved and conflicts-needing-attention.

Source

pub fn remaining_conflicts(&self) -> Vec<&ConflictRecord>

Pending conflicts (those without a non-defer resolution).

Source

pub fn resolve( &mut self, resolutions: Vec<(ConflictId, Resolution)>, ) -> Vec<ResolveVerdict>

Submit resolutions in batch. Returns one verdict per input. Accepted resolutions are recorded; rejected ones leave the previous resolution (if any) in place so partial submissions don’t clobber earlier good work.

Source

pub fn resolve_checked( &mut self, resolutions: Vec<(ConflictId, Resolution)>, checker: &dyn ResolutionChecker, ) -> Vec<ResolveVerdict>

Submit resolutions in batch, type-checking each against the composed program before accepting it (#834).

This is the loop the session was built for — “submit N resolutions, see which broke type-checking, fix them, retry” — made real. Structural validation (Self::validate_resolution) runs first; a structurally-valid resolution is then overlaid on dst’s head together with every resolution accepted so far, and the injected ResolutionChecker type-checks the result. A resolution whose composed program doesn’t type-check is rejected with ResolutionRejection::TypeError and not recorded, so the session’s accepted set stays type-correct at every step.

Resolutions are processed in order and accumulate: a later resolution is checked against the program the earlier accepted ones already produced. Interdependent picks (two conflicts that only compose together) should therefore be submitted in dependency order, or a rejected one resubmitted after its partner lands — the same way git needs both halves of an intertwined conflict resolved before the tree builds. Unresolved conflicts contribute nothing to the projection: they leave dst’s (always-valid) side standing, so a partial batch still composes.

Source

pub fn validate_resolution( &self, conflict_id: &ConflictId, resolution: &Resolution, ) -> Result<(), ResolutionRejection>

Validate a single resolution against the session’s pending conflicts. Pure (no side effects); the caller decides whether to accept.

Source

pub fn commit(self) -> Result<Vec<(ConflictId, Resolution)>, CommitError>

Finalize the merge. On success returns the resolved resolutions in conflict_id order. The caller is responsible for synthesizing the final Operation::Merge op against the store and persisting it; this function returns the engine’s view of “what to land,” not the persisted op id.

Trait Implementations§

Source§

impl Debug for MergeSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MergeSession

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MergeSession

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.