FA-75306 / CRDT convergence / Open access
State vector diff: clients unknown to the peer are never sent · case 01
A peer that has never heard from a client never receives its structs.
ROOT CAUSE
Clients missing from the remote vector are skipped instead of defaulting to clock 0.
VERIFIED REPAIR
Treat an absent client as expecting clock 0.
Unsuccessful approach: Defaulting to clock 1 drops the first clock of every unknown client.
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)
if str(client) not in remote:
continue
start = remote[str(client)]
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': [], '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]]} | Failed |
| 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], [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]], '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': [[2, 1, 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, 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]]} | Failed |
| single client store | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Passed |
SHA-256 / 15a76a9d0e92c6f46c07f9f959b064fe6a723cecd946226b3830626be0d0807d
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), 1)
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, 1, 2], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 1, 1], [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]]} | Failed |
| 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, 1, 1], [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, 1, 1], [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, 1, 2], [1, 3, 2], [1, 5, 4], [2, 1, 1], [7, 1, 1], [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, 2], [2, 1, 1], [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]]} | Failed |
| single client store | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | {'send': [[4, 1, 2]], 'state_vector': [['4', 3]]} | Passed |
SHA-256 / 70531acca9157be61752c394991307c3a30984c8f9c6c96e168bd2914d4728b0
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.277560+00:00.
Case digest / 2b5d62b3e179e4232411607d89d27ae194170bb61f0885bdb6aad2287d2a3de9