{"abstract":"After every stable line, their region looks changed and clean merges become conflicts or duplicate the anchor.","category":"Text diff and three-way merge","checks":9,"contract":"Match base against ours and against theirs with difflib.SequenceMatcher (autojunk off). Base lines matched on both sides are stable anchors. Between consecutive anchors (and after the last) compare the three regions: unchanged ours takes theirs, unchanged theirs takes ours, identical changes take ours, anything else is a conflict rendered as \"<<<<<<< ours\", ours, \"||||||| base\", base, \"=======\", theirs, \">>>>>>> theirs\". Return merged lines and the conflict count.","contract_signature":"base, ours, theirs","evaluation_group":"w2-text-diff-merge-diff3-chunk-merge","failed_approach":"Advancing the ours and theirs cursors but not the base cursor makes the base region include the anchor instead.","family":"w2-text-diff-merge-diff3-chunk-merge-anchor-advance","id":"FA-75451","implementations":{"attempt":{"sha256":"e5db7df2d64e16c8273f34f66c8c814498b760c639fd8722e5cdf82eb3316745","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport difflib\nN = 1\nobservations = []\ndef solve(base, ours, theirs):\n    def matches(x):\n        sm = difflib.SequenceMatcher(None, base, x, autojunk=False)\n        mp = {}\n        for i, j, size in sm.get_matching_blocks():\n            for t in range(size):\n                mp[i + t] = j + t\n        return mp\n    mo, mt = matches(ours), matches(theirs)\n    out = []\n    conflicts = 0\n    i = j = k = 0\n    anchors = [bi for bi in range(len(base)) if bi in mo and bi in mt] + [None]\n    for bi in anchors:\n        if bi is None:\n            i1, j1, k1 = len(base), len(ours), len(theirs)\n        else:\n            i1, j1, k1 = bi, mo[bi], mt[bi]\n        B, O, T = base[i:i1], ours[j:j1], theirs[k:k1]\n        if O == B:\n            out.extend(T)\n        elif T == B:\n            out.extend(O)\n        elif O == T:\n            out.extend(O)\n        else:\n            conflicts += 1\n            out.append('<<<<<<< ours')\n            out.extend(O)\n            out.append('||||||| base')\n            out.extend(B)\n            out.append('=======')\n            out.extend(T)\n            out.append('>>>>>>> theirs')\n        if bi is not None:\n            out.append(base[bi])\n            i, j, k = i1, j1 + 1, k1 + 1\n    return {'merged': out, 'conflicts': conflicts}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = {\n    1: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C1', 'd', 'e'], ['a', 'b', 'C1', 'd', 'e']], {'merged': ['a', 'b', 'C1', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    2: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C2', 'd', 'e'], ['a', 'b', 'C2', 'd', 'e']], {'merged': ['a', 'b', 'C2', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    3: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C3', 'd', 'e'], ['a', 'b', 'C3', 'd', 'e']], {'merged': ['a', 'b', 'C3', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    4: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C4', 'd', 'e'], ['a', 'b', 'C4', 'd', 'e']], {'merged': ['a', 'b', 'C4', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2', 'o3'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', 'o3', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    5: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C5', 'd', 'e'], ['a', 'b', 'C5', 'd', 'e']], {'merged': ['a', 'b', 'C5', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2', 'o3', 'o4'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', 'o3', 'o4', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3', 't4']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3', 't4'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n}[N]\nfor label, args, expected in cases:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"a62f5087305526c074265d7470e685078602ffa6b187a2e744679e5685c7025d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport difflib\nN = 1\nobservations = []\ndef solve(base, ours, theirs):\n    def matches(x):\n        sm = difflib.SequenceMatcher(None, base, x, autojunk=False)\n        mp = {}\n        for i, j, size in sm.get_matching_blocks():\n            for t in range(size):\n                mp[i + t] = j + t\n        return mp\n    mo, mt = matches(ours), matches(theirs)\n    out = []\n    conflicts = 0\n    i = j = k = 0\n    anchors = [bi for bi in range(len(base)) if bi in mo and bi in mt] + [None]\n    for bi in anchors:\n        if bi is None:\n            i1, j1, k1 = len(base), len(ours), len(theirs)\n        else:\n            i1, j1, k1 = bi, mo[bi], mt[bi]\n        B, O, T = base[i:i1], ours[j:j1], theirs[k:k1]\n        if O == B:\n            out.extend(T)\n        elif T == B:\n            out.extend(O)\n        elif O == T:\n            out.extend(O)\n        else:\n            conflicts += 1\n            out.append('<<<<<<< ours')\n            out.extend(O)\n            out.append('||||||| base')\n            out.extend(B)\n            out.append('=======')\n            out.extend(T)\n            out.append('>>>>>>> theirs')\n        if bi is not None:\n            out.append(base[bi])\n            i, j, k = i1 + 1, j1 + 1, k1\n    return {'merged': out, 'conflicts': conflicts}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = {\n    1: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C1', 'd', 'e'], ['a', 'b', 'C1', 'd', 'e']], {'merged': ['a', 'b', 'C1', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    2: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C2', 'd', 'e'], ['a', 'b', 'C2', 'd', 'e']], {'merged': ['a', 'b', 'C2', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    3: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C3', 'd', 'e'], ['a', 'b', 'C3', 'd', 'e']], {'merged': ['a', 'b', 'C3', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    4: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C4', 'd', 'e'], ['a', 'b', 'C4', 'd', 'e']], {'merged': ['a', 'b', 'C4', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2', 'o3'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', 'o3', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n    5: [('only ours changed', [['a', 'b', 'c', 'd', 'e'], ['a', 'B', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e']], {'merged': ['a', 'B', 'c', 'd', 'e'], 'conflicts': 0}), ('only theirs deleted a line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'd', 'e']], {'merged': ['a', 'b', 'd', 'e'], 'conflicts': 0}), ('both made the same change', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'C5', 'd', 'e'], ['a', 'b', 'C5', 'd', 'e']], {'merged': ['a', 'b', 'C5', 'd', 'e'], 'conflicts': 0}), ('both deleted the same line', [['a', 'b', 'c', 'd', 'e'], ['a', 'c', 'd', 'e'], ['a', 'c', 'd', 'e']], {'merged': ['a', 'c', 'd', 'e'], 'conflicts': 0}), ('conflicting edits', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'X', 'd', 'e'], ['a', 'b', 'Y', 'd', 'e']], {'merged': ['a', 'b', '<<<<<<< ours', 'X', '||||||| base', 'c', '=======', 'Y', '>>>>>>> theirs', 'd', 'e'], 'conflicts': 1}), ('changes after the last stable line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 'o0', 'o1', 'o2', 'o3', 'o4'], ['a', 'b', 'c', 'd', 'e', 'T']], {'merged': ['a', 'b', 'c', 'd', 'e', '<<<<<<< ours', 'o0', 'o1', 'o2', 'o3', 'o4', '||||||| base', '=======', 'T', '>>>>>>> theirs'], 'conflicts': 1}), ('appended by one side only', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3', 't4']], {'merged': ['a', 'b', 'c', 'd', 'e', 't0', 't1', 't2', 't3', 't4'], 'conflicts': 0}), ('changes on both sides in different places', [['a', 'b', 'c', 'd', 'e'], ['A', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'D', 'e']], {'merged': ['A', 'b', 'c', 'D', 'e'], 'conflicts': 0}), ('theirs changes the last base line', [['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'c', 'd', 'E']], {'merged': ['a', 'b', 'c', 'd', 'E'], 'conflicts': 0})],\n}[N]\nfor label, args, expected in cases:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic, bounded teaching model of one diff, patch or merge rule with stipulated conventions; it is not a production diff or version-control implementation and makes no claim of conformance to any specific tool. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-text-diff-merge-diff3-chunk-merge-anchor-advance","generated_at":"2026-09-29T14:49:06.695796+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Three-way merge tools classify each region between stable lines to decide between clean merges and conflicts.","root_cause":"After emitting an anchor the cursor into theirs is not moved past it.","sha256":"a8d39c11f7471c0577ae3ee03469a28f341ca907636459704a80d8af70658c06","title":"diff3 chunk merge: their copy of the anchor line leaks into the next region · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":45.931,"exit_code":1,"observations":[{"actual":{"conflicts":1,"merged":["a","<<<<<<< ours","B","||||||| base","a","b","=======","b",">>>>>>> theirs","c","d","e"]},"check":"only ours changed","expected":{"conflicts":0,"merged":["a","B","c","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","b","<<<<<<< ours","c","||||||| base","b","c","=======",">>>>>>> theirs","d","e"]},"check":"only theirs deleted a line","expected":{"conflicts":0,"merged":["a","b","d","e"]},"passed":false},{"actual":{"conflicts":0,"merged":["a","b","C1","d","e"]},"check":"both made the same change","expected":{"conflicts":0,"merged":["a","b","C1","d","e"]},"passed":true},{"actual":{"conflicts":0,"merged":["a","c","d","e"]},"check":"both deleted the same line","expected":{"conflicts":0,"merged":["a","c","d","e"]},"passed":true},{"actual":{"conflicts":1,"merged":["a","b","<<<<<<< ours","X","||||||| base","b","c","=======","Y",">>>>>>> theirs","d","e"]},"check":"conflicting edits","expected":{"conflicts":1,"merged":["a","b","<<<<<<< ours","X","||||||| base","c","=======","Y",">>>>>>> theirs","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","b","c","d","e","<<<<<<< ours","o0","||||||| base","e","=======","T",">>>>>>> theirs"]},"check":"changes after the last stable line","expected":{"conflicts":1,"merged":["a","b","c","d","e","<<<<<<< ours","o0","||||||| base","=======","T",">>>>>>> theirs"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","b","c","d","e","<<<<<<< ours","||||||| base","e","=======","t0",">>>>>>> theirs"]},"check":"appended by one side only","expected":{"conflicts":0,"merged":["a","b","c","d","e","t0"]},"passed":false},{"actual":{"conflicts":1,"merged":["A","b","c","<<<<<<< ours","d","||||||| base","c","d","=======","D",">>>>>>> theirs","e"]},"check":"changes on both sides in different places","expected":{"conflicts":0,"merged":["A","b","c","D","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","b","c","d","<<<<<<< ours","e","||||||| base","d","e","=======","E",">>>>>>> theirs"]},"check":"theirs changes the last base line","expected":{"conflicts":0,"merged":["a","b","c","d","E"]},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"only ours changed\", \"actual\": {\"merged\": [\"a\", \"<<<<<<< ours\", \"B\", \"||||||| base\", \"a\", \"b\", \"=======\", \"b\", \">>>>>>> theirs\", \"c\", \"d\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"B\", \"c\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"only theirs deleted a line\", \"actual\": {\"merged\": [\"a\", \"b\", \"<<<<<<< ours\", \"c\", \"||||||| base\", \"b\", \"c\", \"=======\", \">>>>>>> theirs\", \"d\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"both made the same change\", \"actual\": {\"merged\": [\"a\", \"b\", \"C1\", \"d\", \"e\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"a\", \"b\", \"C1\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": true}, {\"check\": \"both deleted the same line\", \"actual\": {\"merged\": [\"a\", \"c\", \"d\", \"e\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"a\", \"c\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": true}, {\"check\": \"conflicting edits\", \"actual\": {\"merged\": [\"a\", \"b\", \"<<<<<<< ours\", \"X\", \"||||||| base\", \"b\", \"c\", \"=======\", \"Y\", \">>>>>>> theirs\", \"d\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"<<<<<<< ours\", \"X\", \"||||||| base\", \"c\", \"=======\", \"Y\", \">>>>>>> theirs\", \"d\", \"e\"], \"conflicts\": 1}, \"passed\": false}, {\"check\": \"changes after the last stable line\", \"actual\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"<<<<<<< ours\", \"o0\", \"||||||| base\", \"e\", \"=======\", \"T\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"<<<<<<< ours\", \"o0\", \"||||||| base\", \"=======\", \"T\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"passed\": false}, {\"check\": \"appended by one side only\", \"actual\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"<<<<<<< ours\", \"||||||| base\", \"e\", \"=======\", \"t0\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"t0\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"changes on both sides in different places\", \"actual\": {\"merged\": [\"A\", \"b\", \"c\", \"<<<<<<< ours\", \"d\", \"||||||| base\", \"c\", \"d\", \"=======\", \"D\", \">>>>>>> theirs\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"A\", \"b\", \"c\", \"D\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"theirs changes the last base line\", \"actual\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"<<<<<<< ours\", \"e\", \"||||||| base\", \"d\", \"e\", \"=======\", \"E\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"E\"], \"conflicts\": 0}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.766,"exit_code":1,"observations":[{"actual":{"conflicts":1,"merged":["a","<<<<<<< ours","B","||||||| base","b","=======","a","b",">>>>>>> theirs","c","c","d","d","e","e"]},"check":"only ours changed","expected":{"conflicts":0,"merged":["a","B","c","d","e"]},"passed":false},{"actual":{"conflicts":0,"merged":["a","a","b","b","d","d","e","e"]},"check":"only theirs deleted a line","expected":{"conflicts":0,"merged":["a","b","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","a","b","<<<<<<< ours","C1","||||||| base","c","=======","b","C1",">>>>>>> theirs","d","d","e","e"]},"check":"both made the same change","expected":{"conflicts":0,"merged":["a","b","C1","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","<<<<<<< ours","||||||| base","b","=======","a",">>>>>>> theirs","c","c","d","d","e","e"]},"check":"both deleted the same line","expected":{"conflicts":0,"merged":["a","c","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","a","b","<<<<<<< ours","X","||||||| base","c","=======","b","Y",">>>>>>> theirs","d","d","e","e"]},"check":"conflicting edits","expected":{"conflicts":1,"merged":["a","b","<<<<<<< ours","X","||||||| base","c","=======","Y",">>>>>>> theirs","d","e"]},"passed":false},{"actual":{"conflicts":1,"merged":["a","a","b","b","c","c","d","d","e","<<<<<<< ours","o0","||||||| base","=======","e","T",">>>>>>> theirs"]},"check":"changes after the last stable line","expected":{"conflicts":1,"merged":["a","b","c","d","e","<<<<<<< ours","o0","||||||| base","=======","T",">>>>>>> theirs"]},"passed":false},{"actual":{"conflicts":0,"merged":["a","a","b","b","c","c","d","d","e","e","t0"]},"check":"appended by one side only","expected":{"conflicts":0,"merged":["a","b","c","d","e","t0"]},"passed":false},{"actual":{"conflicts":0,"merged":["A","b","b","c","c","D","e","e"]},"check":"changes on both sides in different places","expected":{"conflicts":0,"merged":["A","b","c","D","e"]},"passed":false},{"actual":{"conflicts":0,"merged":["a","a","b","b","c","c","d","d","E"]},"check":"theirs changes the last base line","expected":{"conflicts":0,"merged":["a","b","c","d","E"]},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"only ours changed\", \"actual\": {\"merged\": [\"a\", \"<<<<<<< ours\", \"B\", \"||||||| base\", \"b\", \"=======\", \"a\", \"b\", \">>>>>>> theirs\", \"c\", \"c\", \"d\", \"d\", \"e\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"B\", \"c\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"only theirs deleted a line\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"b\", \"d\", \"d\", \"e\", \"e\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"a\", \"b\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"both made the same change\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"<<<<<<< ours\", \"C1\", \"||||||| base\", \"c\", \"=======\", \"b\", \"C1\", \">>>>>>> theirs\", \"d\", \"d\", \"e\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"C1\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"both deleted the same line\", \"actual\": {\"merged\": [\"a\", \"<<<<<<< ours\", \"||||||| base\", \"b\", \"=======\", \"a\", \">>>>>>> theirs\", \"c\", \"c\", \"d\", \"d\", \"e\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"c\", \"d\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"conflicting edits\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"<<<<<<< ours\", \"X\", \"||||||| base\", \"c\", \"=======\", \"b\", \"Y\", \">>>>>>> theirs\", \"d\", \"d\", \"e\", \"e\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"<<<<<<< ours\", \"X\", \"||||||| base\", \"c\", \"=======\", \"Y\", \">>>>>>> theirs\", \"d\", \"e\"], \"conflicts\": 1}, \"passed\": false}, {\"check\": \"changes after the last stable line\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"b\", \"c\", \"c\", \"d\", \"d\", \"e\", \"<<<<<<< ours\", \"o0\", \"||||||| base\", \"=======\", \"e\", \"T\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"<<<<<<< ours\", \"o0\", \"||||||| base\", \"=======\", \"T\", \">>>>>>> theirs\"], \"conflicts\": 1}, \"passed\": false}, {\"check\": \"appended by one side only\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"b\", \"c\", \"c\", \"d\", \"d\", \"e\", \"e\", \"t0\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"t0\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"changes on both sides in different places\", \"actual\": {\"merged\": [\"A\", \"b\", \"b\", \"c\", \"c\", \"D\", \"e\", \"e\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"A\", \"b\", \"c\", \"D\", \"e\"], \"conflicts\": 0}, \"passed\": false}, {\"check\": \"theirs changes the last base line\", \"actual\": {\"merged\": [\"a\", \"a\", \"b\", \"b\", \"c\", \"c\", \"d\", \"d\", \"E\"], \"conflicts\": 0}, \"expected\": {\"merged\": [\"a\", \"b\", \"c\", \"d\", \"E\"], \"conflicts\": 0}, \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}