{"abstract":"Transaction coalescing sorts IDs instead of preserving first-touch order.","category":"Data systems","checks":7,"contract":"Coalesce an ordered transaction of [id,before,after] changes to one net before/after per identity. Keep the first before-image and last after-image, order identities by first touch, suppress equal net states including insert-then-delete, and retain None as absence.","evaluation_group":"s3-data-systems-cdc-transaction-coalesce","failed_approach":"Reversing identities is also not transaction encounter order.","family":"s3-data-systems-cdc-transaction-coalesce-first-touch-order","id":"FA-45526","implementations":{"attempt":{"sha256":"b40ec9b7a7f960c44c940627e442e808ca13d9d64947ebb360d66e2e1d1a5cb5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        changes=d\n        state={}; order=[]\n        for ident,before,after in changes:\n            if ident not in state:\n                state[ident]=[before,after]; order.append(ident)\n            else:\n                state[ident][1]=after\n        return [[ident,state[ident][0],state[ident][1]] for ident in reversed(order) if state[ident][0]!=state[ident][1]]\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])\n    check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])\n    check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])\n    check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])\n    check('delete', solve([[10, 1, None]]), [[10, 1, None]])\n    check('insert', solve([[10, None, 1]]), [[10, None, 1]])\n    check('no transaction', solve([]), [])\nelif N == 2:\n    check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])\n    check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])\n    check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])\n    check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])\n    check('delete', solve([[10, 2, None]]), [[10, 2, None]])\n    check('insert', solve([[10, None, 2]]), [[10, None, 2]])\n    check('no transaction', solve([]), [])\nelif N == 3:\n    check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])\n    check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])\n    check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])\n    check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])\n    check('delete', solve([[10, 3, None]]), [[10, 3, None]])\n    check('insert', solve([[10, None, 3]]), [[10, None, 3]])\n    check('no transaction', solve([]), [])\nelif N == 4:\n    check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])\n    check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])\n    check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])\n    check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])\n    check('delete', solve([[10, 4, None]]), [[10, 4, None]])\n    check('insert', solve([[10, None, 4]]), [[10, None, 4]])\n    check('no transaction', solve([]), [])\nelif N == 5:\n    check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])\n    check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])\n    check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])\n    check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])\n    check('delete', solve([[10, 5, None]]), [[10, 5, None]])\n    check('insert', solve([[10, None, 5]]), [[10, None, 5]])\n    check('no transaction', solve([]), [])\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":"65d75dc31fbf15ec59fe2f7a8af335a3670169a6244dd99ef2fd79b28437eb1d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        changes=d\n        state={}; order=[]\n        for ident,before,after in changes:\n            if ident not in state:\n                state[ident]=[before,after]; order.append(ident)\n            else:\n                state[ident][1]=after\n        return [[ident,state[ident][0],state[ident][1]] for ident in sorted(order) if state[ident][0]!=state[ident][1]]\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])\n    check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])\n    check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])\n    check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])\n    check('delete', solve([[10, 1, None]]), [[10, 1, None]])\n    check('insert', solve([[10, None, 1]]), [[10, None, 1]])\n    check('no transaction', solve([]), [])\nelif N == 2:\n    check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])\n    check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])\n    check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])\n    check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])\n    check('delete', solve([[10, 2, None]]), [[10, 2, None]])\n    check('insert', solve([[10, None, 2]]), [[10, None, 2]])\n    check('no transaction', solve([]), [])\nelif N == 3:\n    check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])\n    check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])\n    check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])\n    check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])\n    check('delete', solve([[10, 3, None]]), [[10, 3, None]])\n    check('insert', solve([[10, None, 3]]), [[10, None, 3]])\n    check('no transaction', solve([]), [])\nelif N == 4:\n    check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])\n    check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])\n    check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])\n    check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])\n    check('delete', solve([[10, 4, None]]), [[10, 4, None]])\n    check('insert', solve([[10, None, 4]]), [[10, None, 4]])\n    check('no transaction', solve([]), [])\nelif N == 5:\n    check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])\n    check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])\n    check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])\n    check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])\n    check('delete', solve([[10, 5, None]]), [[10, 5, None]])\n    check('insert', solve([[10, None, 5]]), [[10, None, 5]])\n    check('no transaction', solve([]), [])\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"},"fixed":{"sha256":"839bb75bbe57fb86088cc99852e5a86ced2878c151442de50eb9894c6ffe83d1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        changes=d\n        state={}; order=[]\n        for ident,before,after in changes:\n            if ident not in state:\n                state[ident]=[before,after]; order.append(ident)\n            else:\n                state[ident][1]=after\n        return [[ident,state[ident][0],state[ident][1]] for ident in order if state[ident][0]!=state[ident][1]]\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])\n    check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])\n    check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])\n    check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])\n    check('delete', solve([[10, 1, None]]), [[10, 1, None]])\n    check('insert', solve([[10, None, 1]]), [[10, None, 1]])\n    check('no transaction', solve([]), [])\nelif N == 2:\n    check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])\n    check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])\n    check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])\n    check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])\n    check('delete', solve([[10, 2, None]]), [[10, 2, None]])\n    check('insert', solve([[10, None, 2]]), [[10, None, 2]])\n    check('no transaction', solve([]), [])\nelif N == 3:\n    check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])\n    check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])\n    check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])\n    check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])\n    check('delete', solve([[10, 3, None]]), [[10, 3, None]])\n    check('insert', solve([[10, None, 3]]), [[10, None, 3]])\n    check('no transaction', solve([]), [])\nelif N == 4:\n    check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])\n    check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])\n    check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])\n    check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])\n    check('delete', solve([[10, 4, None]]), [[10, 4, None]])\n    check('insert', solve([[10, None, 4]]), [[10, None, 4]])\n    check('no transaction', solve([]), [])\nelif N == 5:\n    check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])\n    check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])\n    check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])\n    check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])\n    check('delete', solve([[10, 5, None]]), [[10, 5, None]])\n    check('insert', solve([[10, None, 5]]), [[10, None, 5]])\n    check('no transaction', solve([]), [])\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":"Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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":"s3-data-systems-cdc-transaction-coalesce-first-touch-order","generated_at":"2026-09-29T14:44:23.089331+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A bounded deterministic data engine model makes representation and changelog faults reproducible.","repair":"Preserve the stated physical representation and operation order: Coalesce an ordered transaction of [id,before,after] changes to one net before/after per identity. Keep the first before-image and last after-image, order identities by first touch, suppress equal net states including insert-then-delete, and retain None as absence.","root_cause":"cdc-transaction-coalesce: Transaction coalescing sorts IDs instead of preserving first-touch order.","sha256":"c6cdfd9b6584eea31ccc2375e7078cb6cc3140e36fa3fafe4f51509b40ef4bc2","title":"Transaction coalescing sorts IDs instead of preserving first-touch order · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":49.086,"exit_code":1,"observations":[{"actual":[[10,1,3]],"check":"two updates","expected":[[10,1,3]],"passed":true},{"actual":[],"check":"insert delete","expected":[],"passed":true},{"actual":[],"check":"change revert","expected":[],"passed":true},{"actual":[[10,3,4],[20,1,2]],"check":"touch order","expected":[[20,1,2],[10,3,4]],"passed":false},{"actual":[[10,1,null]],"check":"delete","expected":[[10,1,null]],"passed":true},{"actual":[[10,null,1]],"check":"insert","expected":[[10,null,1]],"passed":true},{"actual":[],"check":"no transaction","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two updates\", \"actual\": [[10, 1, 3]], \"expected\": [[10, 1, 3]], \"passed\": true}, {\"check\": \"insert delete\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"change revert\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"touch order\", \"actual\": [[10, 3, 4], [20, 1, 2]], \"expected\": [[20, 1, 2], [10, 3, 4]], \"passed\": false}, {\"check\": \"delete\", \"actual\": [[10, 1, null]], \"expected\": [[10, 1, null]], \"passed\": true}, {\"check\": \"insert\", \"actual\": [[10, null, 1]], \"expected\": [[10, null, 1]], \"passed\": true}, {\"check\": \"no transaction\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":51.137,"exit_code":1,"observations":[{"actual":[[10,1,3]],"check":"two updates","expected":[[10,1,3]],"passed":true},{"actual":[],"check":"insert delete","expected":[],"passed":true},{"actual":[],"check":"change revert","expected":[],"passed":true},{"actual":[[10,3,4],[20,1,2]],"check":"touch order","expected":[[20,1,2],[10,3,4]],"passed":false},{"actual":[[10,1,null]],"check":"delete","expected":[[10,1,null]],"passed":true},{"actual":[[10,null,1]],"check":"insert","expected":[[10,null,1]],"passed":true},{"actual":[],"check":"no transaction","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two updates\", \"actual\": [[10, 1, 3]], \"expected\": [[10, 1, 3]], \"passed\": true}, {\"check\": \"insert delete\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"change revert\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"touch order\", \"actual\": [[10, 3, 4], [20, 1, 2]], \"expected\": [[20, 1, 2], [10, 3, 4]], \"passed\": false}, {\"check\": \"delete\", \"actual\": [[10, 1, null]], \"expected\": [[10, 1, null]], \"passed\": true}, {\"check\": \"insert\", \"actual\": [[10, null, 1]], \"expected\": [[10, null, 1]], \"passed\": true}, {\"check\": \"no transaction\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":45.691,"exit_code":0,"observations":[{"actual":[[10,1,3]],"check":"two updates","expected":[[10,1,3]],"passed":true},{"actual":[],"check":"insert delete","expected":[],"passed":true},{"actual":[],"check":"change revert","expected":[],"passed":true},{"actual":[[20,1,2],[10,3,4]],"check":"touch order","expected":[[20,1,2],[10,3,4]],"passed":true},{"actual":[[10,1,null]],"check":"delete","expected":[[10,1,null]],"passed":true},{"actual":[[10,null,1]],"check":"insert","expected":[[10,null,1]],"passed":true},{"actual":[],"check":"no transaction","expected":[],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two updates\", \"actual\": [[10, 1, 3]], \"expected\": [[10, 1, 3]], \"passed\": true}, {\"check\": \"insert delete\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"change revert\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"touch order\", \"actual\": [[20, 1, 2], [10, 3, 4]], \"expected\": [[20, 1, 2], [10, 3, 4]], \"passed\": true}, {\"check\": \"delete\", \"actual\": [[10, 1, null]], \"expected\": [[10, 1, null]], \"passed\": true}, {\"check\": \"insert\", \"actual\": [[10, null, 1]], \"expected\": [[10, null, 1]], \"passed\": true}, {\"check\": \"no transaction\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}