Skip to main content

MergeTxn

Struct MergeTxn 

Source
pub struct MergeTxn {
    pub op_id: String,
    pub source_branch: String,
    pub worker_branch: String,
    pub expected_source_oid: String,
    pub worker_oid: String,
    pub base_sha: Option<String>,
    pub driver_pid: Option<i32>,
    pub driver_pid_start_secs: Option<u64>,
    pub driver_pid_start_identity: Option<String>,
    pub caller_authority: Option<CallerMergeLink>,
    pub started_at: DateTime<Utc>,
}
Expand description

A durable, in-flight run merge transaction recorded by merge.started BEFORE the git mutation, and the sole input to deterministic merge-crash recovery (design.md §2.1b / A2, issue merge-transaction-recovery).

run merge spans git refs and the event log and is not atomic across them. Recording the transaction — the exact source ref it will move, the OID it expects that ref to be at (expected_source_oid, the compare half of the compare-and-swap), and the worker’s tip — lets the supervisor (or a retried run merge) resolve the ONE recorded transaction by OID after a crash:

  • source ref still at expected_source_oid → the mutation never landed → REJECT (merge.aborted), preserving the worker’s branch + work.
  • source ref moved off expected_source_oid AND the worker’s content is integrated (rebase-robust content verification) → COMPLETE (append the explicit-merge node.report the crash prevented).
  • source ref moved unexpectedly but the worker’s content is not integrated → fail closed (REJECT), preserving the work.

Fields§

§op_id: String

Opaque unique id for this merge attempt. A fresh id per run merge invocation (each attempt re-reads expected_source_oid), so recovery can name exactly which transaction it resolved in the merge.aborted audit.

§source_branch: String

The source/target ref this merge moves — manifest.source_branch (main, or an integration branch). Recovery reads this ref’s current OID to decide the transaction’s fate.

§worker_branch: String

The worker branch whose commits are being merged (node.branch). Its content is what recovery verifies is integrated into source_branch.

§expected_source_oid: String

The OID source_branch was at when the transaction was recorded — the compare half of the compare-and-swap. If the ref is still here at recovery time, the git mutation never landed.

§worker_oid: String

The worker branch tip at record time. Retained for the audit trail and as a secondary landing signal; the authoritative completion check is content-based (rebase-robust) against source_branch.

§base_sha: Option<String>

The worker branch’s fork point (node.base_sha), used to bound the content check to the worker’s own commits. None when unrecorded.

§driver_pid: Option<i32>

PID of the run merge process driving the transaction, so recovery can tell a still-in-progress merge (driver alive — leave it) from a crashed one (driver gone — resolve it), never racing a live merge. None when unrecorded.

§driver_pid_start_secs: Option<u64>

Start time of driver_pid in Unix seconds (the same representation the pid-file liveness check records), guarding against PID reuse the way the agent/supervisor liveness checks do — a recycled PID must not look alive. None when the platform could not read it. Decides PID reuse only when driver_pid_start_identity is absent.

§driver_pid_start_identity: Option<String>

Kernel start identity of driver_pid (the same token the agent and supervisor identity checks compare exactly). Unlike the seconds value it does not move when the wall clock is stepped. Absent on transactions recorded before the field existed.

§caller_authority: Option<CallerMergeLink>

Caller-only provenance tying the transaction to the sticky intent and the exact writer inode held by the merge driver. Absent on normal merges.

§started_at: DateTime<Utc>

When the transaction was recorded.

Trait Implementations§

Source§

impl Clone for MergeTxn

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MergeTxn

Source§

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

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

impl<'de> Deserialize<'de> for MergeTxn

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 Eq for MergeTxn

Source§

impl PartialEq for MergeTxn

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MergeTxn

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
Source§

impl StructuralPartialEq for MergeTxn

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more