FA-75301 / CRDT convergence / Open access
State vector diff: a partly known struct is resent whole · case 01
Peers receive clocks they already integrated.
ROOT CAUSE
A struct straddling the expected clock is sent from its original start.
VERIFIED REPAIR
Slice the struct to begin at the expected clock and shorten it accordingly.
Unsuccessful approach: Starting at the expected clock but keeping the full length claims clocks beyond the struct's end.
Case contract
The local store holds structs [client, clock, length] covering clocks clock..clock+length-1. The remote state vector maps client ids (decimal strings, as decoded from JSON) to the next clock it expects; absent clients expect 0. Send, sorted by client then clock, every struct part the remote lacks, slicing a partly known struct to start at the expected clock. Also return the local state vector.
Why this case matters
Delta sync in sequence CRDTs exchanges state vectors to ship only the structs the peer is missing.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(structs, remote):
send = []
local = {}
for client, clock, length in sorted(structs):
local[str(client)] = max(local.get(str(client), 0), clock + length)
start = remote.get(str(client), 0)
if clock + length > start:
if clock < start:
send.append([client, clock, length])
else:
send.append([client, clock, length])
return {'send': send, 'state_vector': sorted([k, v] for k, v in local.items())}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
1: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 2, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 6, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 1}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('single client store', [[[4, 0, 3]], {'4': 1}], {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]})],
2: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 3, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 7, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 2}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 2, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 3], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('single client store', [[[4, 0, 4]], {'4': 1}], {'send': [[4, 1, 3]], 'state_vector': [['4', 4]]})],
3: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 4, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 8, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 3}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 3, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 4], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('single client store', [[[4, 0, 5]], {'4': 1}], {'send': [[4, 1, 4]], 'state_vector': [['4', 5]]})],
4: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 5, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 9, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 4}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 4, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 5], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('single client store', [[[4, 0, 6]], {'4': 1}], {'send': [[4, 1, 5]], 'state_vector': [['4', 6]]})],
5: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 6, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 10, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 5}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 5, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 6], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('single client store', [[[4, 0, 7]], {'4': 1}], {'send': [[4, 1, 6]], 'state_vector': [['4', 7]]})],
}[N]
for label, args, expected in cases:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| empty remote vector gets everything | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| remote caught up gets nothing | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| boundary between structs | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| partial struct is sliced | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| remote ahead of local | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| unknown remote clients count from zero | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| late struct partially known | {'send': [[1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| single client store | {'send': [[4, 0, 3]], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Failed |
SHA-256 / 8513c3f41fc6c48978528a9c210d0074d783089bd80abd10b734282affd7a970
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(structs, remote):
send = []
local = {}
for client, clock, length in sorted(structs):
local[str(client)] = max(local.get(str(client), 0), clock + length)
start = remote.get(str(client), 0)
if clock + length > start:
if clock < start:
send.append([client, start, length])
else:
send.append([client, clock, length])
return {'send': send, 'state_vector': sorted([k, v] for k, v in local.items())}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
1: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 2, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 6, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 1}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('single client store', [[[4, 0, 3]], {'4': 1}], {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]})],
2: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 3, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 7, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 2}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 2, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 3], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('single client store', [[[4, 0, 4]], {'4': 1}], {'send': [[4, 1, 3]], 'state_vector': [['4', 4]]})],
3: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 4, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 8, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 3}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 3, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 4], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('single client store', [[[4, 0, 5]], {'4': 1}], {'send': [[4, 1, 4]], 'state_vector': [['4', 5]]})],
4: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 5, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 9, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 4}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 4, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 5], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('single client store', [[[4, 0, 6]], {'4': 1}], {'send': [[4, 1, 5]], 'state_vector': [['4', 6]]})],
5: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 6, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 10, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 5}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 5, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 6], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('single client store', [[[4, 0, 7]], {'4': 1}], {'send': [[4, 1, 6]], 'state_vector': [['4', 7]]})],
}[N]
for label, args, expected in cases:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| empty remote vector gets everything | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| remote caught up gets nothing | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| boundary between structs | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| partial struct is sliced | {'send': [[1, 4, 2], [1, 5, 4], [2, 1, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| remote ahead of local | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| unknown remote clients count from zero | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| late struct partially known | {'send': [[1, 7, 4], [2, 0, 2], [7, 1, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| single client store | {'send': [[4, 1, 3]], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Failed |
SHA-256 / 2414c0f71ca511dd646d7d54e8f59ec9bd9e50fea1890b319b1ddf5c9485a026
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(structs, remote):
send = []
local = {}
for client, clock, length in sorted(structs):
local[str(client)] = max(local.get(str(client), 0), clock + length)
start = remote.get(str(client), 0)
if clock + length > start:
if clock < start:
send.append([client, start, clock + length - start])
else:
send.append([client, clock, length])
return {'send': send, 'state_vector': sorted([k, v] for k, v in local.items())}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
1: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 2, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 6, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 1}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 2], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]}), ('single client store', [[[4, 0, 3]], {'4': 1}], {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]})],
2: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 3, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 3], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 7, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 2}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 2, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 3], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 3], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 3], ['7', 3]]}), ('single client store', [[[4, 0, 4]], {'4': 1}], {'send': [[4, 1, 3]], 'state_vector': [['4', 4]]})],
3: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 4, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 4], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 3], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 8, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 3}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 3, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 4], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 4], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 4], ['7', 3]]}), ('single client store', [[[4, 0, 5]], {'4': 1}], {'send': [[4, 1, 4]], 'state_vector': [['4', 5]]})],
4: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 5, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 5], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 4], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 9, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 4}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 4, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 5], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 5], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 5], ['7', 3]]}), ('single client store', [[[4, 0, 6]], {'4': 1}], {'send': [[4, 1, 5]], 'state_vector': [['4', 6]]})],
5: [('empty remote vector gets everything', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote caught up gets nothing', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 9, '2': 6, '7': 3}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('boundary between structs', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 3, '7': 2}], {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 6], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('partial struct is sliced', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 4, '2': 1}], {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 5], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('remote ahead of local', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 20, '2': 10, '7': 9}], {'send': [], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('unknown remote clients count from zero', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'2': 5}], {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 5, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('late struct partially known', [[[1, 0, 3], [1, 3, 2], [2, 0, 6], [1, 5, 4], [7, 0, 2], [7, 2, 1]], {'1': 7, '7': 1}], {'send': [[1, 7, 2], [2, 0, 6], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 6], ['7', 3]]}), ('single client store', [[[4, 0, 7]], {'4': 1}], {'send': [[4, 1, 6]], 'state_vector': [['4', 7]]})],
}[N]
for label, args, expected in cases:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| empty remote vector gets everything | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| remote caught up gets nothing | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| boundary between structs | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| partial struct is sliced | {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 4, 1], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| remote ahead of local | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| unknown remote clients count from zero | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 0, 3], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 0, 2], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| late struct partially known | {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [[1, 7, 2], [2, 0, 2], [7, 1, 1], [7, 2, 1]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Passed |
| single client store | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Passed |
SHA-256 / 8153beb4fde141a6a70103d2f58d6274a88cc1c5cf41bf00ac0262016571309f
Verification & scope
A deterministic, bounded teaching model of one replicated data type with stipulated operation and merge rules; it is not a production CRDT library and makes no claim of conformance to any specific published design. 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:49:05.264452+00:00.
Case digest / 1f3a0ab660f01c686fb4df9f2d22a7c112f8f4473f18e36ac916acc92fa69324