FA-75296 / CRDT convergence / Open access
State vector diff: a struct ending exactly at the remote clock is resent as an empty slice · case 01
Zero-length updates are sent for structs the peer already has.
ROOT CAUSE
The filter admits structs whose end equals the expected clock.
VERIFIED REPAIR
Send a struct only when its end is strictly beyond the expected clock.
Unsuccessful approach: Filtering on the struct start drops structs the peer knows only partially.
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, 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': [[1, 9, 0], [2, 2, 0], [7, 3, 0]], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | {'send': [], 'state_vector': [['1', 9], ['2', 2], ['7', 3]]} | Failed |
| boundary between structs | {'send': [[1, 3, 0], [1, 3, 2], [1, 5, 4], [2, 0, 2], [7, 2, 0], [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]]} | Failed |
| 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 / e5edff1397f85bde61da03c9aa24f90c765d04780452fb0de310de28bd6c7b14
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 >= 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, 5, 4], [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], [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': [[2, 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': [], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Failed |
SHA-256 / e56b3c83c478b5f5dde5d0312584eec5d1b9b509a999f04f70fc5c9e84b11ada
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.237810+00:00.
Case digest / f05e0119504a79f70c15bcba7edee82d76c821eb757278f41bf6aea317019f5e