pub struct BranchDiff {
pub first_divergent_seq: Option<u64>,
pub added: Vec<RunEvent>,
pub removed: Vec<RunEvent>,
pub step_diffs: Vec<StepDiff>,
pub base_totals: BranchTotals,
pub branch_totals: BranchTotals,
}Expand description
The structural diff between two journal snapshots — typically two branches forked from a common point: one replayed an existing history, the other continued differently.
Events are compared logically: kind, node, sequence, effect class,
resolved input/output payloads, latency, tokens, cost, and status must
match, while identity and timing fields (id, run_id, thread_id,
parent, recorded_at) are excluded — two branches are separate runs,
so their identity-bearing fields legitimately differ even when their
evidence is the same. The first logically-unequal sequence position is the
divergence point; everything after it is reported as removed (base) or
added (branch).
Fields§
§first_divergent_seq: Option<u64>The first sequence number where the branches’ evidence differs, or
None when they are logically identical.
added: Vec<RunEvent>Events present in the branch at and after the divergence point (the branch’s new work relative to the base).
removed: Vec<RunEvent>Events present in the base at and after the divergence point (the work the branch replaced).
step_diffs: Vec<StepDiff>State-channel differences at each super-step, in step order. Only steps with at least one differing channel appear.
base_totals: BranchTotalsTotals over the whole base journal.
branch_totals: BranchTotalsTotals over the whole branch journal.
Implementations§
Source§impl BranchDiff
impl BranchDiff
Sourcepub fn between(base: &JournalSnapshot, branch: &JournalSnapshot) -> BranchDiff
pub fn between(base: &JournalSnapshot, branch: &JournalSnapshot) -> BranchDiff
Diff branch against base. When both snapshots share a common
history (a fork), the shared prefix compares equal and the divergence
point is where the fork’s branches parted; fork_seq-style explicit
fork points are unnecessary — the evidence carries the cut.
Sourcepub fn is_identical(&self) -> bool
pub fn is_identical(&self) -> bool
true when the two branches are logically identical (no divergence
point, nothing added or removed).