Version: 0.0.4
agrag.ingestion.merge.apply_merge
apply_merge(plan:MergePlan, *, graph_store:GraphStore, schema:GraphSchema, pending_job_id:str | None = None) -> None
Write a computed MergePlan to storage.
Every call runs inside one GraphStore transaction: it upserts the survivor and records a merge-key alias for its current name. A failure partway through leaves no half-written state: no survivor without its alias.
Destructive merging is retired: a plan with non-empty tombstone_ids is rejected before any write runs, and callers must persist the match through MATCHES edges and materialize a ResolvedEntity instead.
Parameters:
- plan (
MergePlan) – The merge to write. - graph_store (
GraphStore) – Where the merge is written. - schema (
GraphSchema) – The schema the survivor's label belongs to. - pending_job_id (
str | None) – The in-flight Cutover Job's id, tagging the survivor node and its aliases until that job commits. None writes untagged, for callers outside a job.
Raises:
ValueError– plan.tombstone_ids is non-empty.GraphStoreAliasConflictError– An accepted merge_key is already owned by a live entity outside this merge's own survivor id -- a concurrent writer accepted that name as an alias of, or created it as the canonical name of, a different entity.GraphStoreDataIntegrityError– A candidate conflicting alias owner's merged_into chain cycles, points at a missing node, or does not reach a live node within the hop limit.