Skip to main content

Crate choir_merge

Crate choir_merge 

Source
Expand description

Merge-strategy pipeline seam (DECISIONS.md D4/D19).

Ordered strategies, cheapest first; each maps (base, left, right) to Resolved or Conflict. LLM resolution and Mergiraf are just strategy slots, so widening or dropping them is configuration, not surgery. Mergiraf is GPLv3 (audited 2026-08-08): subprocess only, never linked (D4).

§Examples

use choir_merge::{MergeOutcome, Pipeline};

let pipeline = Pipeline::default_v1();
// Only the right side changed, so the merge resolves trivially.
let result = pipeline.merge("a\n", "a\n", "a\nb\n");
assert_eq!(result.strategy, "trivial");
match result.outcome {
    MergeOutcome::Resolved(text) => assert_eq!(text, "a\nb\n"),
    _ => unreachable!(),
}

§Where this sits

docs/architecture.md is the map of the whole workspace. This crate is the merge-strategy pipeline (D4/D19), cheapest strategy first.

It depends on no other crate in this workspace.

Modules§

safety
Merge-safety verdict: did a resolved merge stay inside what the author proposed? (internal/oak.md item 1.)
silent_revert
Falsification (c): how often does a landed merge remove work that neither side removed?

Structs§

LineMerge
Line-based 3-way merge (diffy), the histogram/ORT analog in the plan.
MergirafMerge
Structured (AST) merge via the mergiraf binary, subprocess only (GPLv3). CLI verified against mergiraf 0.18.0: mergiraf merge <BASE> <LEFT> <RIGHT> -o <OUT>; language is detected from the input file extension.
Pipeline
Runs strategies in order; first Resolved wins. If none resolves, returns the last Conflict (first-class conflict, never a silent pick).
PipelineResult
A Pipeline verdict plus which strategy produced it.
TrivialMerge
Cheapest checks: unchanged sides and identical edits.

Enums§

MergeOutcome
Result of one strategy’s attempt at a 3-way merge.

Traits§

MergeStrategy
The strategy seam: one slot in the Pipeline.

Functions§

normalized_diff
The position-independent content of a change: the deleted and inserted lines of its diff, with hunk positions and context stripped — the cheap analog of git patch-id --stable (DECISIONS.md D15: metadata, never a new merge substrate). Two authorings of the same edit on different bases — the change before and after the train rewrites or rebases it — normalize to the same string, which is what lets a queue or bridge recognize an already-landed change instead of re-merging it. It lives here because this crate already owns the diff dependency; callers hash the result.