{"abstract":"Transaction coalescing retains the first after-image.","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":"Using the intermediate before-image stops one update short.","family":"s3-data-systems-cdc-transaction-coalesce-last-after","id":"FA-45516","implementations":{"attempt":{"sha256":"a11eb47e5b6ac5abd5fa294e789531a798b1e62c0cbdd23cc33ae7bb6156513b","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]=before\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"},"broken":{"sha256":"1ad2f7673dc3b5e2b7b87f14d8863f51dac05d28182639de8abe3ae7c191fd10","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                pass\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"},"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-last-after","generated_at":"2026-09-29T14:44:23.041698+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 retains the first after-image.","sha256":"050568ce2f130251e09e81a3d3ae0df3ef9b883670ae5481e94ef3e4c1b24f77","title":"Transaction coalescing retains the first after-image · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":45.69,"exit_code":1,"observations":[{"actual":[[10,1,2]],"check":"two updates","expected":[[10,1,3]],"passed":false},{"actual":[[10,null,1]],"check":"insert delete","expected":[],"passed":false},{"actual":[[10,1,2]],"check":"change revert","expected":[],"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two updates\", \"actual\": [[10, 1, 2]], \"expected\": [[10, 1, 3]], \"passed\": false}, {\"check\": \"insert delete\", \"actual\": [[10, null, 1]], \"expected\": [], \"passed\": false}, {\"check\": \"change revert\", \"actual\": [[10, 1, 2]], \"expected\": [], \"passed\": false}, {\"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\": false}\n"},"broken":{"elapsed_ms":50.944,"exit_code":1,"observations":[{"actual":[[10,1,2]],"check":"two updates","expected":[[10,1,3]],"passed":false},{"actual":[[10,null,1]],"check":"insert delete","expected":[],"passed":false},{"actual":[[10,1,2]],"check":"change revert","expected":[],"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two updates\", \"actual\": [[10, 1, 2]], \"expected\": [[10, 1, 3]], \"passed\": false}, {\"check\": \"insert delete\", \"actual\": [[10, null, 1]], \"expected\": [], \"passed\": false}, {\"check\": \"change revert\", \"actual\": [[10, 1, 2]], \"expected\": [], \"passed\": false}, {\"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\": false}\n"},"fixed":{"elapsed_ms":48.979,"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"}