FA-46521 / Bounded deques / Open access
Copy-on-write clone inherits the old sharing count · case 01
Copy-on-write clone inherits the old sharing count.
ROOT CAUSE
Copy-on-write clone inherits the old sharing count.
VERIFIED REPAIR
Restore the documented new refcount invariant in cow-write.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Write one logical deque position under copy-on-write. Shared storage is detached, leaving the old view unchanged and decrementing its reference count. Exclusive storage keeps identity. Every write advances the value epoch.
Why this case matters
Controlled bounded deque implementation model with explicit storage and lifecycle observations.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,refs,index,value,identity,fresh,epoch=x
shared=refs>1
new=a[:]
new[index]=value
old=a[:] if shared else new[:]
old_refs=refs-1 if shared else 1
new_refs=refs
new_id=fresh if shared else identity
next_id=fresh+1 if shared else fresh
return [old,new,old_refs,new_refs,new_id,next_id,epoch+1]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1],2,0,N+3,4,8,0]), {1: [[1, 2], [4, 2], 1, 1, 8, 9, 1], 2: [[2, 3], [5, 3], 1, 1, 8, 9, 1], 3: [[3, 4], [6, 4], 1, 1, 8, 9, 1], 4: [[4, 5], [7, 5], 1, 1, 8, 9, 1], 5: [[5, 6], [8, 6], 1, 1, 8, 9, 1]}[N])
check('1', solve([[N,N+1,N+2],3,1,N+4,5,9,2]), {1: [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3], 2: [[2, 3, 4], [2, 6, 4], 2, 1, 9, 10, 3], 3: [[3, 4, 5], [3, 7, 5], 2, 1, 9, 10, 3], 4: [[4, 5, 6], [4, 8, 6], 2, 1, 9, 10, 3], 5: [[5, 6, 7], [5, 9, 7], 2, 1, 9, 10, 3]}[N])
check('2', solve([[N],1,0,N+1,2,3,5]), {1: [[2], [2], 1, 1, 2, 3, 6], 2: [[3], [3], 1, 1, 2, 3, 6], 3: [[4], [4], 1, 1, 2, 3, 6], 4: [[5], [5], 1, 1, 2, 3, 6], 5: [[6], [6], 1, 1, 2, 3, 6]}[N])
check('3', solve([[N,N+1],1,1,N+4,6,8,1]), {1: [[1, 5], [1, 5], 1, 1, 6, 8, 2], 2: [[2, 6], [2, 6], 1, 1, 6, 8, 2], 3: [[3, 7], [3, 7], 1, 1, 6, 8, 2], 4: [[4, 8], [4, 8], 1, 1, 6, 8, 2], 5: [[5, 9], [5, 9], 1, 1, 6, 8, 2]}[N])
check('4', solve([[N,N+1,N+2],4,2,N+5,3,10,8]), {1: [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9], 2: [[2, 3, 4], [2, 3, 7], 3, 1, 10, 11, 9], 3: [[3, 4, 5], [3, 4, 8], 3, 1, 10, 11, 9], 4: [[4, 5, 6], [4, 5, 9], 3, 1, 10, 11, 9], 5: [[5, 6, 7], [5, 6, 10], 3, 1, 10, 11, 9]}[N])
check('5', solve([[N,N+1],2,1,N,1,7,4]), {1: [[1, 2], [1, 1], 1, 1, 7, 8, 5], 2: [[2, 3], [2, 2], 1, 1, 7, 8, 5], 3: [[3, 4], [3, 3], 1, 1, 7, 8, 5], 4: [[4, 5], [4, 4], 1, 1, 7, 8, 5], 5: [[5, 6], [5, 5], 1, 1, 7, 8, 5]}[N])
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 |
|---|---|---|---|
| 0 | [[1, 2], [4, 2], 1, 2, 8, 9, 1] | [[1, 2], [4, 2], 1, 1, 8, 9, 1] | Failed |
| 1 | [[1, 2, 3], [1, 5, 3], 2, 3, 9, 10, 3] | [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3] | Failed |
| 2 | [[2], [2], 1, 1, 2, 3, 6] | [[2], [2], 1, 1, 2, 3, 6] | Passed |
| 3 | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | Passed |
| 4 | [[1, 2, 3], [1, 2, 6], 3, 4, 10, 11, 9] | [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9] | Failed |
| 5 | [[1, 2], [1, 1], 1, 2, 7, 8, 5] | [[1, 2], [1, 1], 1, 1, 7, 8, 5] | Failed |
SHA-256 / e144c3d0639f2a110367ebc01b4840220a8029f71be11a34e26ed29ac00668b6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,refs,index,value,identity,fresh,epoch=x
shared=refs>1
new=a[:]
new[index]=value
old=a[:] if shared else new[:]
old_refs=refs-1 if shared else 1
new_refs=1 if refs==2 else refs
new_id=fresh if shared else identity
next_id=fresh+1 if shared else fresh
return [old,new,old_refs,new_refs,new_id,next_id,epoch+1]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1],2,0,N+3,4,8,0]), {1: [[1, 2], [4, 2], 1, 1, 8, 9, 1], 2: [[2, 3], [5, 3], 1, 1, 8, 9, 1], 3: [[3, 4], [6, 4], 1, 1, 8, 9, 1], 4: [[4, 5], [7, 5], 1, 1, 8, 9, 1], 5: [[5, 6], [8, 6], 1, 1, 8, 9, 1]}[N])
check('1', solve([[N,N+1,N+2],3,1,N+4,5,9,2]), {1: [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3], 2: [[2, 3, 4], [2, 6, 4], 2, 1, 9, 10, 3], 3: [[3, 4, 5], [3, 7, 5], 2, 1, 9, 10, 3], 4: [[4, 5, 6], [4, 8, 6], 2, 1, 9, 10, 3], 5: [[5, 6, 7], [5, 9, 7], 2, 1, 9, 10, 3]}[N])
check('2', solve([[N],1,0,N+1,2,3,5]), {1: [[2], [2], 1, 1, 2, 3, 6], 2: [[3], [3], 1, 1, 2, 3, 6], 3: [[4], [4], 1, 1, 2, 3, 6], 4: [[5], [5], 1, 1, 2, 3, 6], 5: [[6], [6], 1, 1, 2, 3, 6]}[N])
check('3', solve([[N,N+1],1,1,N+4,6,8,1]), {1: [[1, 5], [1, 5], 1, 1, 6, 8, 2], 2: [[2, 6], [2, 6], 1, 1, 6, 8, 2], 3: [[3, 7], [3, 7], 1, 1, 6, 8, 2], 4: [[4, 8], [4, 8], 1, 1, 6, 8, 2], 5: [[5, 9], [5, 9], 1, 1, 6, 8, 2]}[N])
check('4', solve([[N,N+1,N+2],4,2,N+5,3,10,8]), {1: [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9], 2: [[2, 3, 4], [2, 3, 7], 3, 1, 10, 11, 9], 3: [[3, 4, 5], [3, 4, 8], 3, 1, 10, 11, 9], 4: [[4, 5, 6], [4, 5, 9], 3, 1, 10, 11, 9], 5: [[5, 6, 7], [5, 6, 10], 3, 1, 10, 11, 9]}[N])
check('5', solve([[N,N+1],2,1,N,1,7,4]), {1: [[1, 2], [1, 1], 1, 1, 7, 8, 5], 2: [[2, 3], [2, 2], 1, 1, 7, 8, 5], 3: [[3, 4], [3, 3], 1, 1, 7, 8, 5], 4: [[4, 5], [4, 4], 1, 1, 7, 8, 5], 5: [[5, 6], [5, 5], 1, 1, 7, 8, 5]}[N])
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 |
|---|---|---|---|
| 0 | [[1, 2], [4, 2], 1, 1, 8, 9, 1] | [[1, 2], [4, 2], 1, 1, 8, 9, 1] | Passed |
| 1 | [[1, 2, 3], [1, 5, 3], 2, 3, 9, 10, 3] | [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3] | Failed |
| 2 | [[2], [2], 1, 1, 2, 3, 6] | [[2], [2], 1, 1, 2, 3, 6] | Passed |
| 3 | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | Passed |
| 4 | [[1, 2, 3], [1, 2, 6], 3, 4, 10, 11, 9] | [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9] | Failed |
| 5 | [[1, 2], [1, 1], 1, 1, 7, 8, 5] | [[1, 2], [1, 1], 1, 1, 7, 8, 5] | Passed |
SHA-256 / 34061066d8ed8ff1196d2267037b7691f6d1ef4260b1ba38f4dada615d45128d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,refs,index,value,identity,fresh,epoch=x
shared=refs>1
new=a[:]
new[index]=value
old=a[:] if shared else new[:]
old_refs=refs-1 if shared else 1
new_refs=1
new_id=fresh if shared else identity
next_id=fresh+1 if shared else fresh
return [old,new,old_refs,new_refs,new_id,next_id,epoch+1]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1],2,0,N+3,4,8,0]), {1: [[1, 2], [4, 2], 1, 1, 8, 9, 1], 2: [[2, 3], [5, 3], 1, 1, 8, 9, 1], 3: [[3, 4], [6, 4], 1, 1, 8, 9, 1], 4: [[4, 5], [7, 5], 1, 1, 8, 9, 1], 5: [[5, 6], [8, 6], 1, 1, 8, 9, 1]}[N])
check('1', solve([[N,N+1,N+2],3,1,N+4,5,9,2]), {1: [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3], 2: [[2, 3, 4], [2, 6, 4], 2, 1, 9, 10, 3], 3: [[3, 4, 5], [3, 7, 5], 2, 1, 9, 10, 3], 4: [[4, 5, 6], [4, 8, 6], 2, 1, 9, 10, 3], 5: [[5, 6, 7], [5, 9, 7], 2, 1, 9, 10, 3]}[N])
check('2', solve([[N],1,0,N+1,2,3,5]), {1: [[2], [2], 1, 1, 2, 3, 6], 2: [[3], [3], 1, 1, 2, 3, 6], 3: [[4], [4], 1, 1, 2, 3, 6], 4: [[5], [5], 1, 1, 2, 3, 6], 5: [[6], [6], 1, 1, 2, 3, 6]}[N])
check('3', solve([[N,N+1],1,1,N+4,6,8,1]), {1: [[1, 5], [1, 5], 1, 1, 6, 8, 2], 2: [[2, 6], [2, 6], 1, 1, 6, 8, 2], 3: [[3, 7], [3, 7], 1, 1, 6, 8, 2], 4: [[4, 8], [4, 8], 1, 1, 6, 8, 2], 5: [[5, 9], [5, 9], 1, 1, 6, 8, 2]}[N])
check('4', solve([[N,N+1,N+2],4,2,N+5,3,10,8]), {1: [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9], 2: [[2, 3, 4], [2, 3, 7], 3, 1, 10, 11, 9], 3: [[3, 4, 5], [3, 4, 8], 3, 1, 10, 11, 9], 4: [[4, 5, 6], [4, 5, 9], 3, 1, 10, 11, 9], 5: [[5, 6, 7], [5, 6, 10], 3, 1, 10, 11, 9]}[N])
check('5', solve([[N,N+1],2,1,N,1,7,4]), {1: [[1, 2], [1, 1], 1, 1, 7, 8, 5], 2: [[2, 3], [2, 2], 1, 1, 7, 8, 5], 3: [[3, 4], [3, 3], 1, 1, 7, 8, 5], 4: [[4, 5], [4, 4], 1, 1, 7, 8, 5], 5: [[5, 6], [5, 5], 1, 1, 7, 8, 5]}[N])
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 |
|---|---|---|---|
| 0 | [[1, 2], [4, 2], 1, 1, 8, 9, 1] | [[1, 2], [4, 2], 1, 1, 8, 9, 1] | Passed |
| 1 | [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3] | [[1, 2, 3], [1, 5, 3], 2, 1, 9, 10, 3] | Passed |
| 2 | [[2], [2], 1, 1, 2, 3, 6] | [[2], [2], 1, 1, 2, 3, 6] | Passed |
| 3 | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | [[1, 5], [1, 5], 1, 1, 6, 8, 2] | Passed |
| 4 | [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9] | [[1, 2, 3], [1, 2, 6], 3, 1, 10, 11, 9] | Passed |
| 5 | [[1, 2], [1, 1], 1, 1, 7, 8, 5] | [[1, 2], [1, 1], 1, 1, 7, 8, 5] | Passed |
SHA-256 / dac3ec1c9ff54112bb93b63790b0907005df142a078f69c83e507774417c0db6
Verification & scope
Offline finite deterministic model; no claim of production implementation or concurrent memory-model conformance. 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:32.901332+00:00.
Case digest / d9df8574158679804454604cba74aa8557390bf1c7855db2779352524bec837a