Documentation
¶
Overview ¶
specscore: feature/cli/resolve/auto-resolve/record-merge
specscore: feature/cli/resolve/auto-resolve/record-merge
Package recordmerge implements the record-aware three-way merge engine for auto-resolving logically non-conflicting data-row conflicts.
specscore: feature/cli/resolve/auto-resolve/record-merge
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// SameRecord enables merging non-contested changes to the same record
// (cases DM-9..DM-11). When false, any record changed on both sides
// escalates.
SameRecord bool
}
Options controls which case classes the engine is allowed to auto-merge.
type Outcome ¶
Outcome is the result of a merge attempt. When Escalate is true the conflict is not auto-resolvable and Reason explains why; Merged is then nil.
func Merge ¶
Merge performs a three-way merge of keyed record sets. base/ours/theirs are the records parsed from the common ancestor and the two conflict sides.
It returns Escalate=true (with a reason) for any conflict that is not provably safe to auto-resolve; otherwise Merged holds the union, ordered as surviving base records first (in base order), then records added by ours, then records added by theirs.
func MergeFiles ¶
func MergeFiles(base, ours, theirs []byte, col *ingitdb.CollectionDef, opts Options) Outcome
MergeFiles parses the BASE/OURS/THEIRS bytes of a conflicted record file into typed records and runs the three-way merge. A nil or empty stage is treated as an absent record set (added on one side, or deleted).
It returns an Outcome whose Merged holds the union of non-conflicting changes on success, or Escalate=true (with a reason) when the conflict is not auto-resolvable — including unsupported record layouts and parse failures. Serialization of the merged records back to file bytes is the caller's responsibility.