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 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_oidAND the worker’s content is integrated (rebase-robust content verification) → COMPLETE (append theexplicit-mergenode.reportthe crash prevented). - source ref moved unexpectedly but the worker’s content is not integrated → fail closed (REJECT), preserving the work.
Fields§
§op_id: StringOpaque 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: StringThe 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: StringThe worker branch whose commits are being merged (node.branch). Its
content is what recovery verifies is integrated into source_branch.
expected_source_oid: StringThe 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: StringThe 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.
started_at: DateTime<Utc>When the transaction was recorded.