FA-80761 / Bidirectional text layout / Open access
Isolating run sequences: first-strong isolate chaining · case 01
Text around an FSI isolate is split into separate sequences.
ROOT CAUSE
FSI is not recognised as an initiator when chaining runs.
THE FAILURE
FSI is not recognised as an initiator when chaining runs.
Unsuccessful approach: Dropping LRI instead breaks a different isolate type.
Case contract
Input [classes, levels, paragraph level]. Split into maximal level runs; chain a run ending in a matched isolate initiator (LRI/RLI/FSI) with the run starting at its matching PDI (stack matching; unmatched PDI ignored). For each sequence sos = parity of max(level of first char, level of preceding char or paragraph level); eos = parity of max(level of last char, level of following char or paragraph level), using the paragraph level when the last char is an isolate initiator. Return [[indices, sos, eos]].
Why this case matters
Mixed right-to-left and left-to-right text must resolve levels and visual order exactly, or words, numbers and carets land in the wrong place.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
classes, levels, para = x
n = len(classes)
match = {}
stack = []
for i, c in enumerate(classes):
if c in ('LRI', 'RLI', 'FSI'):
stack.append(i)
elif c == 'PDI' and stack:
match[stack.pop()] = i
runs = []
for i in range(n):
if runs and levels[i] == levels[runs[-1][-1]]:
runs[-1].append(i)
else:
runs.append([i])
start_of = {r[0]: r for r in runs}
seqs = []
used = set()
for r in runs:
if r[0] in used:
continue
seq = list(r)
used.add(r[0])
while True:
tail = seq[-1]
if classes[tail] not in ('LRI', 'RLI') or tail not in match:
break
nxt = start_of.get(match[tail])
if nxt is None:
break
seq.extend(nxt)
used.add(nxt[0])
seqs.append(seq)
out = []
for seq in seqs:
first, last = seq[0], seq[-1]
lv = levels[first]
prev = levels[first - 1] if first > 0 else para
sos = 'R' if max(lv, prev) % 2 else 'L'
if classes[last] in ('LRI', 'RLI', 'FSI'):
nxt_lv = para
else:
nxt_lv = levels[last + 1] if last + 1 < n else para
eos = 'R' if max(levels[last], nxt_lv) % 2 else 'L'
out.append([seq, sos, eos])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: first-strong isolate chaining', [['EN', 'LRI', 'L', 'RLI', 'PDI', 'ON', 'FSI', 'R', 'R', 'R', 'ON', 'PDI', 'R', 'LRI'], [0, 0, 2, 2, 2, 2, 2, 4, 5, 5, 4, 2, 2, 2], 0], [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6, 11, 12, 13], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L']]), ('regression: first-strong isolate chaining', [['EN', 'L', 'L', 'FSI', 'R', 'PDI', 'L', 'EN', 'ON', 'PDI', 'L', 'L', 'EN', 'ON'], [1, 2, 2, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1], 1], [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('regression: first-strong isolate chaining', [['EN', 'EN', 'PDI', 'R', 'FSI', 'L', 'LRI', 'L', 'PDI', 'FSI', 'FSI', 'PDI', 'PDI'], [0, 0, 0, 0, 0, 2, 2, 4, 2, 2, 4, 4, 2], 0], [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6, 8, 9, 12], 'L', 'L'], [[7], 'L', 'L'], [[10, 11], 'L', 'L']]), ('partial-repair probe', [['L', 'FSI', 'LRI', 'ON', 'R', 'PDI', 'LRI', 'ON'], [2, 1, 2, 4, 4, 2, 2, 4], 1], [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2, 5, 6], 'L', 'L'], [[3, 4], 'L', 'L'], [[7], 'L', 'L']]), ('unmatched initiator at end', [['L', 'R', 'RLI'], [0, 1, 1], 0], [[[0], 'L', 'R'], [[1, 2], 'R', 'R']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('control layout', [['R', 'EN', 'L', 'L', 'R', 'R', 'PDI', 'EN', 'PDI', 'L', 'PDI', 'ON', 'ON'], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0], [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']]), ('control layout', [['EN', 'R', 'RLI'], [1, 1, 1], 1], [[[0, 1, 2], 'R', 'R']])], [('regression: first-strong isolate chaining', [['FSI', 'R', 'EN', 'R', 'PDI', 'R', 'EN', 'R', 'R', 'EN', 'RLI', 'L', 'EN'], [1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 4, 4], 1], [[[0, 4, 5, 6, 7, 8], 'R', 'L'], [[1, 2, 3], 'L', 'L'], [[9], 'L', 'L'], [[10], 'L', 'R'], [[11, 12], 'L', 'L']]), ('regression: first-strong isolate chaining', [['L', 'FSI', 'EN', 'FSI', 'PDI', 'PDI', 'ON', 'ON', 'RLI', 'EN', 'RLI', 'L'], [0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 1, 4], 0], [[[0, 1, 5, 6, 7, 8], 'L', 'L'], [[2, 3, 4], 'L', 'L'], [[9], 'L', 'L'], [[10], 'L', 'R'], [[11], 'L', 'L']]), ('regression: first-strong isolate chaining', [['ON', 'PDI', 'EN', 'FSI', 'L', 'R', 'LRI', 'L', 'PDI', 'PDI', 'PDI', 'EN', 'PDI'], [1, 1, 1, 1, 2, 3, 2, 4, 2, 1, 1, 2, 1], 1], [[[0, 1, 2, 3, 9, 10], 'R', 'L'], [[4], 'L', 'R'], [[5], 'R', 'R'], [[6, 8], 'R', 'L'], [[7], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'R']]), ('partial-repair probe', [['LRI', 'L', 'EN', 'R', 'PDI', 'EN'], [1, 2, 2, 2, 1, 2], 1], [[[0, 4], 'R', 'L'], [[1, 2, 3], 'L', 'L'], [[5], 'L', 'L']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['L', 'L', 'R', 'PDI', 'PDI', 'L', 'ON', 'L', 'PDI'], [0, 0, 1, 0, 0, 0, 0, 0, 0], 0], [[[0, 1], 'L', 'R'], [[2], 'R', 'R'], [[3, 4, 5, 6, 7, 8], 'R', 'L']]), ('control layout', [['L', 'ON', 'R'], [0, 0, 0], 0], [[[0, 1, 2], 'L', 'L']])], [('regression: first-strong isolate chaining', [['L', 'FSI', 'EN', 'PDI', 'EN', 'EN', 'ON', 'EN', 'PDI', 'L', 'FSI', 'FSI', 'ON', 'ON'], [2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 4, 4], 1], [[[0], 'L', 'L'], [[1, 3, 4], 'L', 'L'], [[2], 'L', 'L'], [[5], 'L', 'L'], [[6], 'L', 'L'], [[7], 'L', 'L'], [[8, 9, 10], 'L', 'R'], [[11], 'L', 'L'], [[12, 13], 'L', 'L']]), ('regression: first-strong isolate chaining', [['FSI', 'L', 'FSI', 'RLI', 'EN', 'ON', 'ON', 'R', 'PDI', 'L', 'PDI'], [0, 2, 2, 4, 6, 5, 5, 5, 4, 4, 2], 0], [[[0], 'L', 'L'], [[1, 2, 10], 'L', 'L'], [[3, 8, 9], 'L', 'L'], [[4], 'L', 'L'], [[5, 6, 7], 'L', 'R']]), ('partial-repair probe', [['FSI', 'RLI', 'EN', 'R', 'LRI', 'EN', 'ON', 'R', 'L', 'L', 'PDI', 'L', 'RLI'], [1, 2, 4, 3, 3, 4, 4, 4, 4, 4, 3, 4, 3], 1], [[[0], 'R', 'R'], [[1], 'L', 'L'], [[2], 'L', 'L'], [[3, 4, 10], 'L', 'L'], [[5, 6, 7, 8, 9], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'R']]), ('partial-repair probe', [['L', 'LRI', 'LRI', 'LRI', 'EN', 'PDI', 'R', 'FSI', 'EN', 'R', 'ON'], [2, 1, 2, 4, 6, 4, 4, 4, 6, 7, 6], 1], [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2], 'L', 'L'], [[3, 5, 6, 7], 'L', 'L'], [[4], 'L', 'L'], [[8], 'L', 'R'], [[9], 'R', 'R'], [[10], 'R', 'L']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('control layout', [['L', 'L', 'EN', 'PDI', 'R', 'EN', 'LRI', 'PDI', 'ON', 'ON', 'FSI', 'ON'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], 0], [[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'L', 'L'], [[11], 'L', 'L']]), ('control layout', [['RLI', 'EN', 'EN', 'L', 'ON'], [1, 3, 3, 4, 3], 1], [[[0], 'R', 'R'], [[1, 2], 'R', 'L'], [[3], 'L', 'L'], [[4], 'L', 'R']])], [('regression: first-strong isolate chaining', [['EN', 'FSI', 'ON', 'ON', 'PDI'], [2, 1, 2, 2, 1], 1], [[[0], 'L', 'L'], [[1, 4], 'L', 'R'], [[2, 3], 'L', 'L']]), ('regression: first-strong isolate chaining', [['PDI', 'RLI', 'FSI', 'ON', 'PDI', 'EN', 'PDI', 'R', 'EN', 'L', 'L', 'R', 'L', 'PDI'], [1, 1, 3, 4, 3, 4, 1, 1, 1, 1, 2, 1, 2, 1], 1], [[[0, 1, 6, 7, 8, 9], 'R', 'L'], [[2, 4], 'R', 'L'], [[3], 'L', 'L'], [[5], 'L', 'L'], [[10], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('partial-repair probe', [['RLI', 'ON', 'LRI', 'L', 'L', 'R', 'ON', 'L', 'EN', 'PDI', 'ON'], [0, 1, 1, 2, 2, 3, 2, 2, 2, 1, 1], 0], [[[0], 'L', 'L'], [[1, 2, 9, 10], 'R', 'R'], [[3, 4], 'L', 'R'], [[5], 'R', 'R'], [[6, 7, 8], 'R', 'L']]), ('partial-repair probe', [['PDI', 'R', 'R', 'ON', 'L', 'L', 'LRI', 'R', 'L', 'PDI', 'PDI', 'EN', 'PDI', 'ON'], [0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0], 0], [[[0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13], 'L', 'L'], [[7], 'R', 'R'], [[8], 'R', 'L']]), ('unmatched initiator at end', [['L', 'R', 'RLI'], [0, 1, 1], 0], [[[0], 'L', 'R'], [[1, 2], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['PDI', 'PDI', 'L', 'ON', 'ON', 'L', 'ON', 'ON', 'EN', 'PDI'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0], [[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'L', 'L']]), ('control layout', [['ON', 'PDI', 'RLI', 'L'], [0, 0, 0, 2], 0], [[[0, 1, 2], 'L', 'L'], [[3], 'L', 'L']])], [('regression: first-strong isolate chaining', [['EN', 'L', 'L', 'FSI', 'R', 'PDI', 'L', 'EN', 'ON', 'PDI', 'L', 'L', 'EN', 'ON'], [1, 2, 2, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1], 1], [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('regression: first-strong isolate chaining', [['PDI', 'R', 'PDI', 'R', 'EN', 'FSI', 'L', 'ON', 'EN', 'PDI'], [1, 1, 1, 1, 1, 1, 2, 2, 2, 1], 1], [[[0, 1, 2, 3, 4, 5, 9], 'R', 'R'], [[6, 7, 8], 'L', 'L']]), ('regression: first-strong isolate chaining', [['LRI', 'ON', 'FSI', 'R', 'RLI', 'PDI', 'RLI', 'ON', 'PDI', 'ON', 'EN', 'PDI', 'PDI'], [1, 2, 2, 5, 4, 4, 4, 5, 4, 4, 4, 2, 1], 1], [[[0, 12], 'R', 'R'], [[1, 2, 11], 'L', 'L'], [[3], 'R', 'R'], [[4, 5, 6, 8, 9, 10], 'R', 'L'], [[7], 'R', 'R']]), ('partial-repair probe', [['PDI', 'LRI', 'EN', 'LRI', 'R', 'EN', 'ON', 'R', 'PDI', 'PDI'], [0, 0, 2, 2, 5, 4, 4, 4, 2, 0], 0], [[[0, 1, 9], 'L', 'L'], [[2, 3, 8], 'L', 'L'], [[4], 'R', 'R'], [[5, 6, 7], 'R', 'L']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['L', 'EN', 'PDI', 'FSI', 'L', 'R'], [0, 0, 0, 0, 2, 3], 0], [[[0, 1, 2, 3], 'L', 'L'], [[4], 'L', 'R'], [[5], 'R', 'R']]), ('control layout', [['ON', 'EN', 'ON', 'EN', 'EN', 'LRI', 'RLI', 'EN', 'EN', 'EN', 'R', 'R', 'PDI'], [1, 1, 1, 1, 2, 1, 2, 3, 4, 3, 3, 3, 2], 1], [[[0, 1, 2, 3], 'R', 'L'], [[4], 'L', 'L'], [[5], 'L', 'R'], [[6, 12], 'L', 'L'], [[7], 'R', 'L'], [[8], 'L', 'L'], [[9, 10, 11], 'L', 'R']])]]
for label, args, expected in fixtures[N - 1]:
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 |
|---|---|---|---|
| regression: first-strong isolate chaining | [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L'], [[11, 12, 13], 'L', 'L']] | [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6, 11, 12, 13], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L']] | Failed |
| regression: first-strong isolate chaining | [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3], 'L', 'R'], [[4], 'R', 'R'], [[5], 'R', 'L'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']] | [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']] | Failed |
| regression: first-strong isolate chaining | [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6, 8, 9], 'L', 'L'], [[7], 'L', 'L'], [[10, 11], 'L', 'L'], [[12], 'L', 'L']] | [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6, 8, 9, 12], 'L', 'L'], [[7], 'L', 'L'], [[10, 11], 'L', 'L']] | Failed |
| partial-repair probe | [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2, 5, 6], 'L', 'L'], [[3, 4], 'L', 'L'], [[7], 'L', 'L']] | [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2, 5, 6], 'L', 'L'], [[3, 4], 'L', 'L'], [[7], 'L', 'L']] | Passed |
| unmatched initiator at end | [[[0], 'L', 'R'], [[1, 2], 'R', 'R']] | [[[0], 'L', 'R'], [[1, 2], 'R', 'R']] | Passed |
| nested isolates | [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']] | [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']] | Passed |
| control layout | [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']] | [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']] | Passed |
| control layout | [[[0, 1, 2], 'R', 'R']] | [[[0, 1, 2], 'R', 'R']] | Passed |
SHA-256 / b82dae52ff6ad1fe36982b111d71da7c5feb3339c30db8f1f16088d621b52792
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
classes, levels, para = x
n = len(classes)
match = {}
stack = []
for i, c in enumerate(classes):
if c in ('LRI', 'RLI', 'FSI'):
stack.append(i)
elif c == 'PDI' and stack:
match[stack.pop()] = i
runs = []
for i in range(n):
if runs and levels[i] == levels[runs[-1][-1]]:
runs[-1].append(i)
else:
runs.append([i])
start_of = {r[0]: r for r in runs}
seqs = []
used = set()
for r in runs:
if r[0] in used:
continue
seq = list(r)
used.add(r[0])
while True:
tail = seq[-1]
if classes[tail] not in ('RLI', 'FSI') or tail not in match:
break
nxt = start_of.get(match[tail])
if nxt is None:
break
seq.extend(nxt)
used.add(nxt[0])
seqs.append(seq)
out = []
for seq in seqs:
first, last = seq[0], seq[-1]
lv = levels[first]
prev = levels[first - 1] if first > 0 else para
sos = 'R' if max(lv, prev) % 2 else 'L'
if classes[last] in ('LRI', 'RLI', 'FSI'):
nxt_lv = para
else:
nxt_lv = levels[last + 1] if last + 1 < n else para
eos = 'R' if max(levels[last], nxt_lv) % 2 else 'L'
out.append([seq, sos, eos])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: first-strong isolate chaining', [['EN', 'LRI', 'L', 'RLI', 'PDI', 'ON', 'FSI', 'R', 'R', 'R', 'ON', 'PDI', 'R', 'LRI'], [0, 0, 2, 2, 2, 2, 2, 4, 5, 5, 4, 2, 2, 2], 0], [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6, 11, 12, 13], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L']]), ('regression: first-strong isolate chaining', [['EN', 'L', 'L', 'FSI', 'R', 'PDI', 'L', 'EN', 'ON', 'PDI', 'L', 'L', 'EN', 'ON'], [1, 2, 2, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1], 1], [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('regression: first-strong isolate chaining', [['EN', 'EN', 'PDI', 'R', 'FSI', 'L', 'LRI', 'L', 'PDI', 'FSI', 'FSI', 'PDI', 'PDI'], [0, 0, 0, 0, 0, 2, 2, 4, 2, 2, 4, 4, 2], 0], [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6, 8, 9, 12], 'L', 'L'], [[7], 'L', 'L'], [[10, 11], 'L', 'L']]), ('partial-repair probe', [['L', 'FSI', 'LRI', 'ON', 'R', 'PDI', 'LRI', 'ON'], [2, 1, 2, 4, 4, 2, 2, 4], 1], [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2, 5, 6], 'L', 'L'], [[3, 4], 'L', 'L'], [[7], 'L', 'L']]), ('unmatched initiator at end', [['L', 'R', 'RLI'], [0, 1, 1], 0], [[[0], 'L', 'R'], [[1, 2], 'R', 'R']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('control layout', [['R', 'EN', 'L', 'L', 'R', 'R', 'PDI', 'EN', 'PDI', 'L', 'PDI', 'ON', 'ON'], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0], [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']]), ('control layout', [['EN', 'R', 'RLI'], [1, 1, 1], 1], [[[0, 1, 2], 'R', 'R']])], [('regression: first-strong isolate chaining', [['FSI', 'R', 'EN', 'R', 'PDI', 'R', 'EN', 'R', 'R', 'EN', 'RLI', 'L', 'EN'], [1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 4, 4], 1], [[[0, 4, 5, 6, 7, 8], 'R', 'L'], [[1, 2, 3], 'L', 'L'], [[9], 'L', 'L'], [[10], 'L', 'R'], [[11, 12], 'L', 'L']]), ('regression: first-strong isolate chaining', [['L', 'FSI', 'EN', 'FSI', 'PDI', 'PDI', 'ON', 'ON', 'RLI', 'EN', 'RLI', 'L'], [0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 1, 4], 0], [[[0, 1, 5, 6, 7, 8], 'L', 'L'], [[2, 3, 4], 'L', 'L'], [[9], 'L', 'L'], [[10], 'L', 'R'], [[11], 'L', 'L']]), ('regression: first-strong isolate chaining', [['ON', 'PDI', 'EN', 'FSI', 'L', 'R', 'LRI', 'L', 'PDI', 'PDI', 'PDI', 'EN', 'PDI'], [1, 1, 1, 1, 2, 3, 2, 4, 2, 1, 1, 2, 1], 1], [[[0, 1, 2, 3, 9, 10], 'R', 'L'], [[4], 'L', 'R'], [[5], 'R', 'R'], [[6, 8], 'R', 'L'], [[7], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'R']]), ('partial-repair probe', [['LRI', 'L', 'EN', 'R', 'PDI', 'EN'], [1, 2, 2, 2, 1, 2], 1], [[[0, 4], 'R', 'L'], [[1, 2, 3], 'L', 'L'], [[5], 'L', 'L']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['L', 'L', 'R', 'PDI', 'PDI', 'L', 'ON', 'L', 'PDI'], [0, 0, 1, 0, 0, 0, 0, 0, 0], 0], [[[0, 1], 'L', 'R'], [[2], 'R', 'R'], [[3, 4, 5, 6, 7, 8], 'R', 'L']]), ('control layout', [['L', 'ON', 'R'], [0, 0, 0], 0], [[[0, 1, 2], 'L', 'L']])], [('regression: first-strong isolate chaining', [['L', 'FSI', 'EN', 'PDI', 'EN', 'EN', 'ON', 'EN', 'PDI', 'L', 'FSI', 'FSI', 'ON', 'ON'], [2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 4, 4], 1], [[[0], 'L', 'L'], [[1, 3, 4], 'L', 'L'], [[2], 'L', 'L'], [[5], 'L', 'L'], [[6], 'L', 'L'], [[7], 'L', 'L'], [[8, 9, 10], 'L', 'R'], [[11], 'L', 'L'], [[12, 13], 'L', 'L']]), ('regression: first-strong isolate chaining', [['FSI', 'L', 'FSI', 'RLI', 'EN', 'ON', 'ON', 'R', 'PDI', 'L', 'PDI'], [0, 2, 2, 4, 6, 5, 5, 5, 4, 4, 2], 0], [[[0], 'L', 'L'], [[1, 2, 10], 'L', 'L'], [[3, 8, 9], 'L', 'L'], [[4], 'L', 'L'], [[5, 6, 7], 'L', 'R']]), ('partial-repair probe', [['FSI', 'RLI', 'EN', 'R', 'LRI', 'EN', 'ON', 'R', 'L', 'L', 'PDI', 'L', 'RLI'], [1, 2, 4, 3, 3, 4, 4, 4, 4, 4, 3, 4, 3], 1], [[[0], 'R', 'R'], [[1], 'L', 'L'], [[2], 'L', 'L'], [[3, 4, 10], 'L', 'L'], [[5, 6, 7, 8, 9], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'R']]), ('partial-repair probe', [['L', 'LRI', 'LRI', 'LRI', 'EN', 'PDI', 'R', 'FSI', 'EN', 'R', 'ON'], [2, 1, 2, 4, 6, 4, 4, 4, 6, 7, 6], 1], [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2], 'L', 'L'], [[3, 5, 6, 7], 'L', 'L'], [[4], 'L', 'L'], [[8], 'L', 'R'], [[9], 'R', 'R'], [[10], 'R', 'L']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('control layout', [['L', 'L', 'EN', 'PDI', 'R', 'EN', 'LRI', 'PDI', 'ON', 'ON', 'FSI', 'ON'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], 0], [[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'L', 'L'], [[11], 'L', 'L']]), ('control layout', [['RLI', 'EN', 'EN', 'L', 'ON'], [1, 3, 3, 4, 3], 1], [[[0], 'R', 'R'], [[1, 2], 'R', 'L'], [[3], 'L', 'L'], [[4], 'L', 'R']])], [('regression: first-strong isolate chaining', [['EN', 'FSI', 'ON', 'ON', 'PDI'], [2, 1, 2, 2, 1], 1], [[[0], 'L', 'L'], [[1, 4], 'L', 'R'], [[2, 3], 'L', 'L']]), ('regression: first-strong isolate chaining', [['PDI', 'RLI', 'FSI', 'ON', 'PDI', 'EN', 'PDI', 'R', 'EN', 'L', 'L', 'R', 'L', 'PDI'], [1, 1, 3, 4, 3, 4, 1, 1, 1, 1, 2, 1, 2, 1], 1], [[[0, 1, 6, 7, 8, 9], 'R', 'L'], [[2, 4], 'R', 'L'], [[3], 'L', 'L'], [[5], 'L', 'L'], [[10], 'L', 'L'], [[11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('partial-repair probe', [['RLI', 'ON', 'LRI', 'L', 'L', 'R', 'ON', 'L', 'EN', 'PDI', 'ON'], [0, 1, 1, 2, 2, 3, 2, 2, 2, 1, 1], 0], [[[0], 'L', 'L'], [[1, 2, 9, 10], 'R', 'R'], [[3, 4], 'L', 'R'], [[5], 'R', 'R'], [[6, 7, 8], 'R', 'L']]), ('partial-repair probe', [['PDI', 'R', 'R', 'ON', 'L', 'L', 'LRI', 'R', 'L', 'PDI', 'PDI', 'EN', 'PDI', 'ON'], [0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0], 0], [[[0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13], 'L', 'L'], [[7], 'R', 'R'], [[8], 'R', 'L']]), ('unmatched initiator at end', [['L', 'R', 'RLI'], [0, 1, 1], 0], [[[0], 'L', 'R'], [[1, 2], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['PDI', 'PDI', 'L', 'ON', 'ON', 'L', 'ON', 'ON', 'EN', 'PDI'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0], [[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'L', 'L']]), ('control layout', [['ON', 'PDI', 'RLI', 'L'], [0, 0, 0, 2], 0], [[[0, 1, 2], 'L', 'L'], [[3], 'L', 'L']])], [('regression: first-strong isolate chaining', [['EN', 'L', 'L', 'FSI', 'R', 'PDI', 'L', 'EN', 'ON', 'PDI', 'L', 'L', 'EN', 'ON'], [1, 2, 2, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1], 1], [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']]), ('regression: first-strong isolate chaining', [['PDI', 'R', 'PDI', 'R', 'EN', 'FSI', 'L', 'ON', 'EN', 'PDI'], [1, 1, 1, 1, 1, 1, 2, 2, 2, 1], 1], [[[0, 1, 2, 3, 4, 5, 9], 'R', 'R'], [[6, 7, 8], 'L', 'L']]), ('regression: first-strong isolate chaining', [['LRI', 'ON', 'FSI', 'R', 'RLI', 'PDI', 'RLI', 'ON', 'PDI', 'ON', 'EN', 'PDI', 'PDI'], [1, 2, 2, 5, 4, 4, 4, 5, 4, 4, 4, 2, 1], 1], [[[0, 12], 'R', 'R'], [[1, 2, 11], 'L', 'L'], [[3], 'R', 'R'], [[4, 5, 6, 8, 9, 10], 'R', 'L'], [[7], 'R', 'R']]), ('partial-repair probe', [['PDI', 'LRI', 'EN', 'LRI', 'R', 'EN', 'ON', 'R', 'PDI', 'PDI'], [0, 0, 2, 2, 5, 4, 4, 4, 2, 0], 0], [[[0, 1, 9], 'L', 'L'], [[2, 3, 8], 'L', 'L'], [[4], 'R', 'R'], [[5, 6, 7], 'R', 'L']]), ('nested isolates', [['R', 'LRI', 'L', 'RLI', 'R', 'PDI', 'PDI', 'R'], [1, 1, 2, 2, 3, 2, 1, 1], 1], [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']]), ('isolate joins outer run', [['L', 'RLI', 'R', 'PDI', 'L'], [0, 0, 1, 0, 0], 0], [[[0, 1, 3, 4], 'L', 'L'], [[2], 'R', 'R']]), ('control layout', [['L', 'EN', 'PDI', 'FSI', 'L', 'R'], [0, 0, 0, 0, 2, 3], 0], [[[0, 1, 2, 3], 'L', 'L'], [[4], 'L', 'R'], [[5], 'R', 'R']]), ('control layout', [['ON', 'EN', 'ON', 'EN', 'EN', 'LRI', 'RLI', 'EN', 'EN', 'EN', 'R', 'R', 'PDI'], [1, 1, 1, 1, 2, 1, 2, 3, 4, 3, 3, 3, 2], 1], [[[0, 1, 2, 3], 'R', 'L'], [[4], 'L', 'L'], [[5], 'L', 'R'], [[6, 12], 'L', 'L'], [[7], 'R', 'L'], [[8], 'L', 'L'], [[9, 10, 11], 'L', 'R']])]]
for label, args, expected in fixtures[N - 1]:
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 |
|---|---|---|---|
| regression: first-strong isolate chaining | [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6, 11, 12, 13], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L']] | [[[0, 1], 'L', 'L'], [[2, 3, 4, 5, 6, 11, 12, 13], 'L', 'L'], [[7], 'L', 'R'], [[8, 9], 'R', 'R'], [[10], 'R', 'L']] | Passed |
| regression: first-strong isolate chaining | [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']] | [[[0], 'R', 'L'], [[1, 2], 'L', 'L'], [[3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'L'], [[8, 9, 10, 11], 'L', 'L'], [[12], 'L', 'L'], [[13], 'L', 'R']] | Passed |
| regression: first-strong isolate chaining | [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6], 'L', 'L'], [[7], 'L', 'L'], [[8, 9, 12], 'L', 'L'], [[10, 11], 'L', 'L']] | [[[0, 1, 2, 3, 4], 'L', 'L'], [[5, 6, 8, 9, 12], 'L', 'L'], [[7], 'L', 'L'], [[10, 11], 'L', 'L']] | Failed |
| partial-repair probe | [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2], 'L', 'L'], [[3, 4], 'L', 'L'], [[5, 6], 'L', 'L'], [[7], 'L', 'L']] | [[[0], 'L', 'L'], [[1], 'L', 'R'], [[2, 5, 6], 'L', 'L'], [[3, 4], 'L', 'L'], [[7], 'L', 'L']] | Failed |
| unmatched initiator at end | [[[0], 'L', 'R'], [[1, 2], 'R', 'R']] | [[[0], 'L', 'R'], [[1, 2], 'R', 'R']] | Passed |
| nested isolates | [[[0, 1], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R'], [[6, 7], 'L', 'R']] | [[[0, 1, 6, 7], 'R', 'R'], [[2, 3, 5], 'L', 'L'], [[4], 'R', 'R']] | Failed |
| control layout | [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']] | [[[0], 'R', 'R'], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 'R', 'L']] | Passed |
| control layout | [[[0, 1, 2], 'R', 'R']] | [[[0, 1, 2], 'R', 'R']] | Passed |
SHA-256 / 49ee0f14b4d21f608b6b09725ae891cd2781ce208e36f01409dedcbc8a1e758b
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy bidi model over stipulated class labels and integer levels; it is inspired by, but does not claim conformance to, any published algorithm. 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:56.758997+00:00.
Case digest / deb33e52aa8a2c8428b9eddc39f3b45d8f3f04b0b253688610e4d951d68a7b97