FA-23401 / Client state / Open access
Optimistic patch journal: Pending retention · case 01
Pending retention.
ROOT CAUSE
The pending-retention client decision evaluates `patches` instead of `[(k,v) for k,v in patches if k not in confirmed and k not in rejected]`.
VERIFIED REPAIR
Apply the modeled pending-retention rule: `[(k,v) for k,v in patches if k not in confirmed and k not in rejected]`.
Unsuccessful approach: The partial repair `[(k,v) for k,v in patches if k not in confirmed]` still violates the explicit fixture contract.
Case contract
A client numeric patch journal retains insertion order. Accepted patches move to the base; rejected patches are removed and compensate in reverse order; pending patches remain visible. Identity and zero-valued patches are significant. Operation pending-retention has the six explicit input/output oracles below.
Why this case matters
An offline client lifecycle model that isolates a state-management defect without DOM rendering or network services.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(operation, s):
base, patches, rejected, confirmed = s
if operation == 'rejected-rebase':
return base+sum(v for k,v in patches if k not in rejected)
if operation == 'confirmed-base':
return base+sum(v for k,v in patches if k in confirmed)
if operation == 'pending-retention':
return patches
if operation == 'rollback-delta':
return sum(v for k,v in patches if k in rejected)
if operation == 'journal-order':
return [k for k,v in patches]
if operation == 'visible-total':
return base+sum(v for k,v in patches)
if operation == 'acknowledged-identities':
return [k for k,v in patches if k in confirmed]
if operation == 'failure-identities':
return [k for k,v in patches if k in rejected]
if operation == 'pending-flag':
return any(k not in confirmed and k not in rejected for k,v in patches)
if operation == 'next-compensating-actions':
return [(k,-v) for k,v in reversed(patches) if k in rejected]
raise ValueError('unknown modeled operation')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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 |
|---|---|---|---|
| rejected-rebase scenario 1 | 9 | 9 | Passed |
| rejected-rebase scenario 2 | 1 | 1 | Passed |
| rejected-rebase scenario 3 | 1 | 1 | Passed |
| rejected-rebase scenario 4 | 3 | 3 | Passed |
| rejected-rebase scenario 5 | 1 | 1 | Passed |
| rejected-rebase scenario 6 | 2 | 2 | Passed |
| confirmed-base scenario 1 | 9 | 9 | Passed |
| confirmed-base scenario 2 | 0 | 0 | Passed |
| confirmed-base scenario 3 | 1 | 1 | Passed |
| confirmed-base scenario 4 | 2 | 2 | Passed |
| confirmed-base scenario 5 | 1 | 1 | Passed |
| confirmed-base scenario 6 | 2 | 2 | Passed |
| pending-retention scenario 1 | [['p', 2], ['q', -1]] | [] | Failed |
| pending-retention scenario 2 | [['p', 1]] | [['p', 1]] | Passed |
| pending-retention scenario 3 | [] | [] | Passed |
| pending-retention scenario 4 | [['p', -3], ['q', 4], ['r', 1]] | [['r', 1]] | Failed |
| pending-retention scenario 5 | [['p', 0]] | [] | Failed |
| pending-retention scenario 6 | [['p', 1], ['q', 1]] | [] | Failed |
| rollback-delta scenario 1 | 2 | 2 | Passed |
| rollback-delta scenario 2 | 0 | 0 | Passed |
| rollback-delta scenario 3 | 0 | 0 | Passed |
| rollback-delta scenario 4 | 4 | 4 | Passed |
| rollback-delta scenario 5 | 0 | 0 | Passed |
| rollback-delta scenario 6 | 2 | 2 | Passed |
| journal-order scenario 1 | ['p', 'q'] | ['p', 'q'] | Passed |
| journal-order scenario 2 | ['p'] | ['p'] | Passed |
| journal-order scenario 3 | [] | [] | Passed |
| journal-order scenario 4 | ['p', 'q', 'r'] | ['p', 'q', 'r'] | Passed |
| journal-order scenario 5 | ['p'] | ['p'] | Passed |
| journal-order scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| visible-total scenario 1 | 11 | 11 | Passed |
| visible-total scenario 2 | 1 | 1 | Passed |
| visible-total scenario 3 | 1 | 1 | Passed |
| visible-total scenario 4 | 7 | 7 | Passed |
| visible-total scenario 5 | 1 | 1 | Passed |
| visible-total scenario 6 | 4 | 4 | Passed |
| acknowledged-identities scenario 1 | ['q'] | ['q'] | Passed |
| acknowledged-identities scenario 2 | [] | [] | Passed |
| acknowledged-identities scenario 3 | [] | [] | Passed |
| acknowledged-identities scenario 4 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 5 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 6 | [] | [] | Passed |
| failure-identities scenario 1 | ['p'] | ['p'] | Passed |
| failure-identities scenario 2 | [] | [] | Passed |
| failure-identities scenario 3 | [] | [] | Passed |
| failure-identities scenario 4 | ['q'] | ['q'] | Passed |
| failure-identities scenario 5 | [] | [] | Passed |
| failure-identities scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| pending-flag scenario 1 | False | False | Passed |
| pending-flag scenario 2 | True | True | Passed |
| pending-flag scenario 3 | False | False | Passed |
| pending-flag scenario 4 | True | True | Passed |
| pending-flag scenario 5 | False | False | Passed |
| pending-flag scenario 6 | False | False | Passed |
| next-compensating-actions scenario 1 | [['p', -2]] | [['p', -2]] | Passed |
| next-compensating-actions scenario 2 | [] | [] | Passed |
| next-compensating-actions scenario 3 | [] | [] | Passed |
| next-compensating-actions scenario 4 | [['q', -4]] | [['q', -4]] | Passed |
| next-compensating-actions scenario 5 | [] | [] | Passed |
| next-compensating-actions scenario 6 | [['q', -1], ['p', -1]] | [['q', -1], ['p', -1]] | Passed |
SHA-256 / b23a9427332bc979b9c827ed58f1dc657298b1ff6bcaba3656d74379c31cfe82
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(operation, s):
base, patches, rejected, confirmed = s
if operation == 'rejected-rebase':
return base+sum(v for k,v in patches if k not in rejected)
if operation == 'confirmed-base':
return base+sum(v for k,v in patches if k in confirmed)
if operation == 'pending-retention':
return [(k,v) for k,v in patches if k not in confirmed]
if operation == 'rollback-delta':
return sum(v for k,v in patches if k in rejected)
if operation == 'journal-order':
return [k for k,v in patches]
if operation == 'visible-total':
return base+sum(v for k,v in patches)
if operation == 'acknowledged-identities':
return [k for k,v in patches if k in confirmed]
if operation == 'failure-identities':
return [k for k,v in patches if k in rejected]
if operation == 'pending-flag':
return any(k not in confirmed and k not in rejected for k,v in patches)
if operation == 'next-compensating-actions':
return [(k,-v) for k,v in reversed(patches) if k in rejected]
raise ValueError('unknown modeled operation')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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 |
|---|---|---|---|
| rejected-rebase scenario 1 | 9 | 9 | Passed |
| rejected-rebase scenario 2 | 1 | 1 | Passed |
| rejected-rebase scenario 3 | 1 | 1 | Passed |
| rejected-rebase scenario 4 | 3 | 3 | Passed |
| rejected-rebase scenario 5 | 1 | 1 | Passed |
| rejected-rebase scenario 6 | 2 | 2 | Passed |
| confirmed-base scenario 1 | 9 | 9 | Passed |
| confirmed-base scenario 2 | 0 | 0 | Passed |
| confirmed-base scenario 3 | 1 | 1 | Passed |
| confirmed-base scenario 4 | 2 | 2 | Passed |
| confirmed-base scenario 5 | 1 | 1 | Passed |
| confirmed-base scenario 6 | 2 | 2 | Passed |
| pending-retention scenario 1 | [['p', 2]] | [] | Failed |
| pending-retention scenario 2 | [['p', 1]] | [['p', 1]] | Passed |
| pending-retention scenario 3 | [] | [] | Passed |
| pending-retention scenario 4 | [['q', 4], ['r', 1]] | [['r', 1]] | Failed |
| pending-retention scenario 5 | [] | [] | Passed |
| pending-retention scenario 6 | [['p', 1], ['q', 1]] | [] | Failed |
| rollback-delta scenario 1 | 2 | 2 | Passed |
| rollback-delta scenario 2 | 0 | 0 | Passed |
| rollback-delta scenario 3 | 0 | 0 | Passed |
| rollback-delta scenario 4 | 4 | 4 | Passed |
| rollback-delta scenario 5 | 0 | 0 | Passed |
| rollback-delta scenario 6 | 2 | 2 | Passed |
| journal-order scenario 1 | ['p', 'q'] | ['p', 'q'] | Passed |
| journal-order scenario 2 | ['p'] | ['p'] | Passed |
| journal-order scenario 3 | [] | [] | Passed |
| journal-order scenario 4 | ['p', 'q', 'r'] | ['p', 'q', 'r'] | Passed |
| journal-order scenario 5 | ['p'] | ['p'] | Passed |
| journal-order scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| visible-total scenario 1 | 11 | 11 | Passed |
| visible-total scenario 2 | 1 | 1 | Passed |
| visible-total scenario 3 | 1 | 1 | Passed |
| visible-total scenario 4 | 7 | 7 | Passed |
| visible-total scenario 5 | 1 | 1 | Passed |
| visible-total scenario 6 | 4 | 4 | Passed |
| acknowledged-identities scenario 1 | ['q'] | ['q'] | Passed |
| acknowledged-identities scenario 2 | [] | [] | Passed |
| acknowledged-identities scenario 3 | [] | [] | Passed |
| acknowledged-identities scenario 4 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 5 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 6 | [] | [] | Passed |
| failure-identities scenario 1 | ['p'] | ['p'] | Passed |
| failure-identities scenario 2 | [] | [] | Passed |
| failure-identities scenario 3 | [] | [] | Passed |
| failure-identities scenario 4 | ['q'] | ['q'] | Passed |
| failure-identities scenario 5 | [] | [] | Passed |
| failure-identities scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| pending-flag scenario 1 | False | False | Passed |
| pending-flag scenario 2 | True | True | Passed |
| pending-flag scenario 3 | False | False | Passed |
| pending-flag scenario 4 | True | True | Passed |
| pending-flag scenario 5 | False | False | Passed |
| pending-flag scenario 6 | False | False | Passed |
| next-compensating-actions scenario 1 | [['p', -2]] | [['p', -2]] | Passed |
| next-compensating-actions scenario 2 | [] | [] | Passed |
| next-compensating-actions scenario 3 | [] | [] | Passed |
| next-compensating-actions scenario 4 | [['q', -4]] | [['q', -4]] | Passed |
| next-compensating-actions scenario 5 | [] | [] | Passed |
| next-compensating-actions scenario 6 | [['q', -1], ['p', -1]] | [['q', -1], ['p', -1]] | Passed |
SHA-256 / 7229962c16075de07163526084c57ed3300067e7d65e35f353ce506892209806
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(operation, s):
base, patches, rejected, confirmed = s
if operation == 'rejected-rebase':
return base+sum(v for k,v in patches if k not in rejected)
if operation == 'confirmed-base':
return base+sum(v for k,v in patches if k in confirmed)
if operation == 'pending-retention':
return [(k,v) for k,v in patches if k not in confirmed and k not in rejected]
if operation == 'rollback-delta':
return sum(v for k,v in patches if k in rejected)
if operation == 'journal-order':
return [k for k,v in patches]
if operation == 'visible-total':
return base+sum(v for k,v in patches)
if operation == 'acknowledged-identities':
return [k for k,v in patches if k in confirmed]
if operation == 'failure-identities':
return [k for k,v in patches if k in rejected]
if operation == 'pending-flag':
return any(k not in confirmed and k not in rejected for k,v in patches)
if operation == 'next-compensating-actions':
return [(k,-v) for k,v in reversed(patches) if k in rejected]
raise ValueError('unknown modeled operation')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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 |
|---|---|---|---|
| rejected-rebase scenario 1 | 9 | 9 | Passed |
| rejected-rebase scenario 2 | 1 | 1 | Passed |
| rejected-rebase scenario 3 | 1 | 1 | Passed |
| rejected-rebase scenario 4 | 3 | 3 | Passed |
| rejected-rebase scenario 5 | 1 | 1 | Passed |
| rejected-rebase scenario 6 | 2 | 2 | Passed |
| confirmed-base scenario 1 | 9 | 9 | Passed |
| confirmed-base scenario 2 | 0 | 0 | Passed |
| confirmed-base scenario 3 | 1 | 1 | Passed |
| confirmed-base scenario 4 | 2 | 2 | Passed |
| confirmed-base scenario 5 | 1 | 1 | Passed |
| confirmed-base scenario 6 | 2 | 2 | Passed |
| pending-retention scenario 1 | [] | [] | Passed |
| pending-retention scenario 2 | [['p', 1]] | [['p', 1]] | Passed |
| pending-retention scenario 3 | [] | [] | Passed |
| pending-retention scenario 4 | [['r', 1]] | [['r', 1]] | Passed |
| pending-retention scenario 5 | [] | [] | Passed |
| pending-retention scenario 6 | [] | [] | Passed |
| rollback-delta scenario 1 | 2 | 2 | Passed |
| rollback-delta scenario 2 | 0 | 0 | Passed |
| rollback-delta scenario 3 | 0 | 0 | Passed |
| rollback-delta scenario 4 | 4 | 4 | Passed |
| rollback-delta scenario 5 | 0 | 0 | Passed |
| rollback-delta scenario 6 | 2 | 2 | Passed |
| journal-order scenario 1 | ['p', 'q'] | ['p', 'q'] | Passed |
| journal-order scenario 2 | ['p'] | ['p'] | Passed |
| journal-order scenario 3 | [] | [] | Passed |
| journal-order scenario 4 | ['p', 'q', 'r'] | ['p', 'q', 'r'] | Passed |
| journal-order scenario 5 | ['p'] | ['p'] | Passed |
| journal-order scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| visible-total scenario 1 | 11 | 11 | Passed |
| visible-total scenario 2 | 1 | 1 | Passed |
| visible-total scenario 3 | 1 | 1 | Passed |
| visible-total scenario 4 | 7 | 7 | Passed |
| visible-total scenario 5 | 1 | 1 | Passed |
| visible-total scenario 6 | 4 | 4 | Passed |
| acknowledged-identities scenario 1 | ['q'] | ['q'] | Passed |
| acknowledged-identities scenario 2 | [] | [] | Passed |
| acknowledged-identities scenario 3 | [] | [] | Passed |
| acknowledged-identities scenario 4 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 5 | ['p'] | ['p'] | Passed |
| acknowledged-identities scenario 6 | [] | [] | Passed |
| failure-identities scenario 1 | ['p'] | ['p'] | Passed |
| failure-identities scenario 2 | [] | [] | Passed |
| failure-identities scenario 3 | [] | [] | Passed |
| failure-identities scenario 4 | ['q'] | ['q'] | Passed |
| failure-identities scenario 5 | [] | [] | Passed |
| failure-identities scenario 6 | ['p', 'q'] | ['p', 'q'] | Passed |
| pending-flag scenario 1 | False | False | Passed |
| pending-flag scenario 2 | True | True | Passed |
| pending-flag scenario 3 | False | False | Passed |
| pending-flag scenario 4 | True | True | Passed |
| pending-flag scenario 5 | False | False | Passed |
| pending-flag scenario 6 | False | False | Passed |
| next-compensating-actions scenario 1 | [['p', -2]] | [['p', -2]] | Passed |
| next-compensating-actions scenario 2 | [] | [] | Passed |
| next-compensating-actions scenario 3 | [] | [] | Passed |
| next-compensating-actions scenario 4 | [['q', -4]] | [['q', -4]] | Passed |
| next-compensating-actions scenario 5 | [] | [] | Passed |
| next-compensating-actions scenario 6 | [['q', -1], ['p', -1]] | [['q', -1], ['p', -1]] | Passed |
SHA-256 / 53c8fe5976ce6b53333f469eed85f2ac9355fc74907e499a748d9d5dfe4e097d
Verification & scope
Only the explicitly specified operations and finite deterministic records are modeled; no browser or framework conformance is claimed. 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:40:47.349822+00:00.
Case digest / 467ee62c536f9e3e4ee363c427290d056304a990ac86159696ff0478d93b6e17