FA-45516 / Data systems / Open access
Transaction coalescing retains the first after-image · case 01
Transaction coalescing retains the first after-image.
ROOT CAUSE
cdc-transaction-coalesce: Transaction coalescing retains the first after-image.
VERIFIED 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.
Unsuccessful approach: Using the intermediate before-image stops one update short.
Case 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.
Why this case matters
A bounded deterministic data engine model makes representation and changelog faults reproducible.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
changes=d
state={}; order=[]
for ident,before,after in changes:
if ident not in state:
state[ident]=[before,after]; order.append(ident)
else:
pass
return [[ident,state[ident][0],state[ident][1]] for ident in order if state[ident][0]!=state[ident][1]]
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])
check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])
check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])
check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])
check('delete', solve([[10, 1, None]]), [[10, 1, None]])
check('insert', solve([[10, None, 1]]), [[10, None, 1]])
check('no transaction', solve([]), [])
elif N == 2:
check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])
check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])
check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])
check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])
check('delete', solve([[10, 2, None]]), [[10, 2, None]])
check('insert', solve([[10, None, 2]]), [[10, None, 2]])
check('no transaction', solve([]), [])
elif N == 3:
check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])
check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])
check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])
check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])
check('delete', solve([[10, 3, None]]), [[10, 3, None]])
check('insert', solve([[10, None, 3]]), [[10, None, 3]])
check('no transaction', solve([]), [])
elif N == 4:
check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])
check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])
check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])
check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])
check('delete', solve([[10, 4, None]]), [[10, 4, None]])
check('insert', solve([[10, None, 4]]), [[10, None, 4]])
check('no transaction', solve([]), [])
elif N == 5:
check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])
check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])
check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])
check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])
check('delete', solve([[10, 5, None]]), [[10, 5, None]])
check('insert', solve([[10, None, 5]]), [[10, None, 5]])
check('no transaction', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| two updates | [[10, 1, 2]] | [[10, 1, 3]] | Failed |
| insert delete | [[10, None, 1]] | [] | Failed |
| change revert | [[10, 1, 2]] | [] | Failed |
| touch order | [[20, 1, 2], [10, 3, 4]] | [[20, 1, 2], [10, 3, 4]] | Passed |
| delete | [[10, 1, None]] | [[10, 1, None]] | Passed |
| insert | [[10, None, 1]] | [[10, None, 1]] | Passed |
| no transaction | [] | [] | Passed |
SHA-256 / 1ad2f7673dc3b5e2b7b87f14d8863f51dac05d28182639de8abe3ae7c191fd10
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
changes=d
state={}; order=[]
for ident,before,after in changes:
if ident not in state:
state[ident]=[before,after]; order.append(ident)
else:
state[ident][1]=before
return [[ident,state[ident][0],state[ident][1]] for ident in order if state[ident][0]!=state[ident][1]]
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])
check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])
check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])
check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])
check('delete', solve([[10, 1, None]]), [[10, 1, None]])
check('insert', solve([[10, None, 1]]), [[10, None, 1]])
check('no transaction', solve([]), [])
elif N == 2:
check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])
check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])
check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])
check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])
check('delete', solve([[10, 2, None]]), [[10, 2, None]])
check('insert', solve([[10, None, 2]]), [[10, None, 2]])
check('no transaction', solve([]), [])
elif N == 3:
check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])
check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])
check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])
check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])
check('delete', solve([[10, 3, None]]), [[10, 3, None]])
check('insert', solve([[10, None, 3]]), [[10, None, 3]])
check('no transaction', solve([]), [])
elif N == 4:
check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])
check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])
check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])
check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])
check('delete', solve([[10, 4, None]]), [[10, 4, None]])
check('insert', solve([[10, None, 4]]), [[10, None, 4]])
check('no transaction', solve([]), [])
elif N == 5:
check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])
check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])
check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])
check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])
check('delete', solve([[10, 5, None]]), [[10, 5, None]])
check('insert', solve([[10, None, 5]]), [[10, None, 5]])
check('no transaction', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| two updates | [[10, 1, 2]] | [[10, 1, 3]] | Failed |
| insert delete | [[10, None, 1]] | [] | Failed |
| change revert | [[10, 1, 2]] | [] | Failed |
| touch order | [[20, 1, 2], [10, 3, 4]] | [[20, 1, 2], [10, 3, 4]] | Passed |
| delete | [[10, 1, None]] | [[10, 1, None]] | Passed |
| insert | [[10, None, 1]] | [[10, None, 1]] | Passed |
| no transaction | [] | [] | Passed |
SHA-256 / a11eb47e5b6ac5abd5fa294e789531a798b1e62c0cbdd23cc33ae7bb6156513b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
changes=d
state={}; order=[]
for ident,before,after in changes:
if ident not in state:
state[ident]=[before,after]; order.append(ident)
else:
state[ident][1]=after
return [[ident,state[ident][0],state[ident][1]] for ident in order if state[ident][0]!=state[ident][1]]
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('two updates', solve([[10, 1, 2], [10, 2, 3]]), [[10, 1, 3]])
check('insert delete', solve([[10, None, 1], [10, 1, None]]), [])
check('change revert', solve([[10, 1, 2], [10, 2, 1]]), [])
check('touch order', solve([[20, 1, 2], [10, 3, 4]]), [[20, 1, 2], [10, 3, 4]])
check('delete', solve([[10, 1, None]]), [[10, 1, None]])
check('insert', solve([[10, None, 1]]), [[10, None, 1]])
check('no transaction', solve([]), [])
elif N == 2:
check('two updates', solve([[10, 2, 3], [10, 3, 4]]), [[10, 2, 4]])
check('insert delete', solve([[10, None, 2], [10, 2, None]]), [])
check('change revert', solve([[10, 2, 3], [10, 3, 2]]), [])
check('touch order', solve([[20, 2, 3], [10, 4, 5]]), [[20, 2, 3], [10, 4, 5]])
check('delete', solve([[10, 2, None]]), [[10, 2, None]])
check('insert', solve([[10, None, 2]]), [[10, None, 2]])
check('no transaction', solve([]), [])
elif N == 3:
check('two updates', solve([[10, 3, 4], [10, 4, 5]]), [[10, 3, 5]])
check('insert delete', solve([[10, None, 3], [10, 3, None]]), [])
check('change revert', solve([[10, 3, 4], [10, 4, 3]]), [])
check('touch order', solve([[20, 3, 4], [10, 5, 6]]), [[20, 3, 4], [10, 5, 6]])
check('delete', solve([[10, 3, None]]), [[10, 3, None]])
check('insert', solve([[10, None, 3]]), [[10, None, 3]])
check('no transaction', solve([]), [])
elif N == 4:
check('two updates', solve([[10, 4, 5], [10, 5, 6]]), [[10, 4, 6]])
check('insert delete', solve([[10, None, 4], [10, 4, None]]), [])
check('change revert', solve([[10, 4, 5], [10, 5, 4]]), [])
check('touch order', solve([[20, 4, 5], [10, 6, 7]]), [[20, 4, 5], [10, 6, 7]])
check('delete', solve([[10, 4, None]]), [[10, 4, None]])
check('insert', solve([[10, None, 4]]), [[10, None, 4]])
check('no transaction', solve([]), [])
elif N == 5:
check('two updates', solve([[10, 5, 6], [10, 6, 7]]), [[10, 5, 7]])
check('insert delete', solve([[10, None, 5], [10, 5, None]]), [])
check('change revert', solve([[10, 5, 6], [10, 6, 5]]), [])
check('touch order', solve([[20, 5, 6], [10, 7, 8]]), [[20, 5, 6], [10, 7, 8]])
check('delete', solve([[10, 5, None]]), [[10, 5, None]])
check('insert', solve([[10, None, 5]]), [[10, None, 5]])
check('no transaction', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| two updates | [[10, 1, 3]] | [[10, 1, 3]] | Passed |
| insert delete | [] | [] | Passed |
| change revert | [] | [] | Passed |
| touch order | [[20, 1, 2], [10, 3, 4]] | [[20, 1, 2], [10, 3, 4]] | Passed |
| delete | [[10, 1, None]] | [[10, 1, None]] | Passed |
| insert | [[10, None, 1]] | [[10, None, 1]] | Passed |
| no transaction | [] | [] | Passed |
SHA-256 / 839bb75bbe57fb86088cc99852e5a86ced2878c151442de50eb9894c6ffe83d1
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:44:23.041698+00:00.
Case digest / 050568ce2f130251e09e81a3d3ae0df3ef9b883670ae5481e94ef3e4c1b24f77