FA-80726 / Bidirectional text layout / Open access
Per-line visual reordering: line-local indices · case 01
Visual orders for later lines refer to the first line.
ROOT CAUSE
Line-local visual positions are returned without mapping back to paragraph indices.
THE FAILURE
Line-local visual positions are returned without mapping back to paragraph indices.
Unsuccessful approach: Offsetting by the line length instead of the line start is still wrong.
Case contract
Input [paragraph levels, classes, paragraph level, line lengths]. For each logical line: reset trailing WS to the paragraph level, then reorder that line alone by level reversal (lowest odd level of the line). Return per line the paragraph indices in visual order.
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):
def reorder(lv):
vis = list(range(len(lv)))
odd = [l for l in lv if l % 2 == 1]
if not odd:
return vis
for lev in range(max(lv), min(odd) - 1, -1):
i = 0
while i < len(vis):
if lv[vis[i]] >= lev:
j = i
while j < len(vis) and lv[vis[j]] >= lev:
j += 1
vis[i:j] = vis[i:j][::-1]
i = j
else:
i += 1
return vis
levels, classes, para, line_lengths = x
out = []
start = 0
for ln in line_lengths:
idx = list(range(start, start + ln))
lv = [levels[i] for i in idx]
j = ln - 1
while j >= 0 and classes[idx[j]] == 'WS':
lv[j] = para
j -= 1
local = reorder(lv)
out.append(local)
start += ln
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[4, 4, 1, 1, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4], ['L', 'L', 'ON', 'R', 'WS', 'WS', 'WS', 'R', 'R', 'R', 'R', 'WS', 'L', 'WS'], 1, [3, 2, 5, 2, 1, 1]], [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]]), ('partial-repair probe', [[0, 0], ['L', 'L'], 0, [2]], [[0, 1]]), ('regression: line-local indices', [[1, 4, 4, 4, 3, 3, 3, 3, 2, 2], ['WS', 'R', 'R', 'ON', 'R', 'R', 'R', 'WS', 'WS', 'R'], 0, [3, 3, 2, 1, 1]], [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]]), ('regression: line-local indices', [[2, 2], ['L', 'L'], 1, [1, 1]], [[0], [1]]), ('regression: line-local indices', [[2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'L', 'ON', 'R', 'R', 'R', 'R', 'R', 'L', 'WS', 'WS'], 1, [4, 1, 5, 1]], [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]]), ('regression: line-local indices', [[2, 2, 2, 2, 3, 3, 3, 3], ['R', 'WS', 'L', 'WS', 'R', 'R', 'L', 'L'], 1, [5, 1, 2]], [[0, 1, 2, 3, 4], [5], [7, 6]]), ('regression: line-local indices', [[3, 3, 2], ['WS', 'L', 'R'], 1, [2, 1]], [[1, 0], [2]])], [('regression: line-local indices', [[2, 4, 4, 2, 2, 2, 1], ['R', 'WS', 'WS', 'WS', 'WS', 'ON', 'L'], 1, [4, 2, 1]], [[3, 2, 1, 0], [4, 5], [6]]), ('regression: line-local indices', [[0, 0, 0, 2, 2, 2, 2], ['R', 'L', 'ON', 'WS', 'L', 'L', 'R'], 0, [5, 2]], [[0, 1, 2, 3, 4], [5, 6]]), ('regression: line-local indices', [[2, 2, 2, 2, 2, 2], ['ON', 'WS', 'R', 'L', 'ON', 'WS'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: line-local indices', [[2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'L', 'ON', 'R', 'R', 'R', 'R', 'R', 'L', 'WS', 'WS'], 1, [4, 1, 5, 1]], [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[3, 0], ['ON', 'WS'], 1, [1, 1]], [[0], [1]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4], ['WS', 'R', 'L', 'R', 'WS', 'L', 'ON', 'ON', 'R', 'ON', 'WS'], 0, [4, 2, 1, 1, 1, 2]], [[3, 2, 1, 0], [5, 4], [6], [7], [8], [9, 10]]), ('regression: line-local indices', [[0, 0, 0, 0, 0, 0], ['ON', 'L', 'L', 'L', 'WS', 'L'], 0, [4, 2]], [[0, 1, 2, 3], [4, 5]])], [('regression: line-local indices', [[2, 2, 1, 0, 0], ['WS', 'WS', 'L', 'WS', 'L'], 0, [3, 1, 1]], [[2, 0, 1], [3], [4]]), ('regression: line-local indices', [[1, 2, 2, 2, 2, 2, 2, 2], ['WS', 'R', 'R', 'L', 'L', 'R', 'R', 'R'], 1, [1, 1, 5, 1]], [[0], [1], [2, 3, 4, 5, 6], [7]]), ('regression: line-local indices', [[1, 1, 1, 1, 0], ['R', 'L', 'R', 'L', 'L'], 1, [4, 1]], [[3, 2, 1, 0], [4]]), ('regression: line-local indices', [[2, 4, 4, 4, 2, 1, 1, 3, 1, 1, 1, 1], ['R', 'L', 'ON', 'L', 'L', 'L', 'R', 'ON', 'WS', 'R', 'R', 'L'], 0, [4, 1, 2, 4, 1]], [[0, 1, 2, 3], [4], [6, 5], [10, 9, 8, 7], [11]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[4, 4, 2, 2, 1, 1, 1, 3, 3], ['R', 'ON', 'L', 'R', 'L', 'R', 'WS', 'R', 'WS'], 0, [3, 1, 2, 1, 1, 1]], [[0, 1, 2], [3], [5, 4], [6], [7], [8]]), ('regression: line-local indices', [[1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 3, 3], ['WS', 'WS', 'L', 'WS', 'L', 'WS', 'L', 'R', 'WS', 'WS', 'WS', 'WS'], 0, [5, 5, 2]], [[4, 3, 2, 1, 0], [5, 6, 7, 8, 9], [10, 11]]), ('regression: line-local indices', [[0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 1], ['L', 'R', 'WS', 'R', 'WS', 'L', 'R', 'WS', 'WS', 'L', 'L', 'ON', 'R'], 1, [3, 5, 5]], [[0, 1, 2], [7, 6, 5, 4, 3], [8, 9, 10, 11, 12]])], [('regression: line-local indices', [[4, 3, 1, 1, 1, 3, 3, 3, 2], ['L', 'L', 'R', 'ON', 'ON', 'R', 'L', 'WS', 'WS'], 0, [2, 3, 2, 2]], [[1, 0], [4, 3, 2], [6, 5], [7, 8]]), ('regression: line-local indices', [[1, 2, 2, 2, 3, 3, 3, 1, 1, 1, 1, 0, 0], ['L', 'L', 'R', 'L', 'L', 'R', 'L', 'L', 'L', 'L', 'R', 'L', 'R'], 0, [1, 1, 3, 3, 1, 4]], [[0], [1], [2, 3, 4], [7, 6, 5], [8], [10, 9, 11, 12]]), ('regression: line-local indices', [[0, 0, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 3], ['L', 'WS', 'L', 'L', 'L', 'L', 'R', 'L', 'R', 'WS', 'L', 'WS', 'L', 'L'], 0, [3, 2, 2, 2, 5]], [[0, 1, 2], [4, 3], [6, 5], [8, 7], [13, 12, 9, 10, 11]]), ('regression: line-local indices', [[0, 0, 0, 0, 1, 1, 1, 2, 2], ['L', 'R', 'R', 'ON', 'WS', 'R', 'R', 'WS', 'L'], 1, [5, 2, 1, 1]], [[0, 1, 2, 3, 4], [6, 5], [7], [8]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[2, 2, 2, 2, 2, 2], ['ON', 'WS', 'R', 'L', 'ON', 'WS'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 3, 3, 2, 2], ['L', 'R', 'L', 'R', 'L', 'L', 'L', 'WS', 'ON'], 1, [3, 1, 1, 3, 1]], [[2, 1, 0], [3], [4], [7, 6, 5], [8]]), ('regression: line-local indices', [[1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3], ['WS', 'R', 'L', 'ON', 'R', 'R', 'R', 'L', 'L', 'L', 'R', 'L', 'WS', 'R'], 1, [1, 2, 2, 4, 4, 1]], [[0], [2, 1], [3, 4], [8, 7, 6, 5], [12, 11, 10, 9], [13]])], [('regression: line-local indices', [[1, 1, 1, 1, 1, 1], ['L', 'L', 'R', 'ON', 'ON', 'WS'], 1, [5, 1]], [[4, 3, 2, 1, 0], [5]]), ('regression: line-local indices', [[3, 3, 3, 3, 2, 2, 2, 2, 2], ['L', 'R', 'L', 'R', 'ON', 'L', 'ON', 'L', 'WS'], 1, [1, 1, 5, 1, 1]], [[0], [1], [3, 2, 4, 5, 6], [7], [8]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], ['R', 'R', 'WS', 'WS', 'L', 'ON', 'WS', 'WS', 'L', 'R', 'L'], 1, [3, 1, 5, 1, 1]], [[2, 1, 0], [3], [7, 6, 5, 4, 8], [9], [10]]), ('regression: line-local indices', [[2, 2, 3, 3, 3, 3, 4, 4, 4, 1, 1, 1], ['WS', 'L', 'R', 'WS', 'R', 'L', 'WS', 'L', 'R', 'R', 'R', 'R'], 0, [2, 4, 2, 2, 1, 1]], [[0, 1], [5, 4, 3, 2], [6, 7], [9, 8], [10], [11]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[1, 1, 1, 3, 3, 3, 2, 2], ['ON', 'WS', 'ON', 'WS', 'WS', 'L', 'R', 'R'], 1, [2, 4, 1, 1]], [[1, 0], [5, 4, 3, 2], [6], [7]]), ('regression: line-local indices', [[0, 0, 0, 0], ['L', 'R', 'WS', 'R'], 0, [3, 1]], [[0, 1, 2], [3]]), ('regression: line-local indices', [[4, 4, 4, 1, 1, 2, 2, 2, 3, 3], ['WS', 'R', 'L', 'ON', 'R', 'R', 'R', 'L', 'R', 'R'], 1, [4, 3, 2, 1]], [[3, 0, 1, 2], [5, 6, 4], [7, 8], [9]])]]
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 |
|---|---|---|---|
| RTL run split across lines | [[1, 0, 2], [2, 1, 0]] | [[1, 0, 2], [5, 4, 3]] | Failed |
| regression: line-local indices | [[2, 0, 1], [1, 0], [4, 3, 2, 0, 1], [1, 0], [0], [0]] | [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]] | Failed |
| partial-repair probe | [[0, 1]] | [[0, 1]] | Passed |
| regression: line-local indices | [[1, 2, 0], [2, 1, 0], [0, 1], [0], [0]] | [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]] | Failed |
| regression: line-local indices | [[0], [0]] | [[0], [1]] | Failed |
| regression: line-local indices | [[3, 0, 1, 2], [0], [4, 3, 2, 1, 0], [0]] | [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]] | Failed |
| regression: line-local indices | [[0, 1, 2, 3, 4], [0], [1, 0]] | [[0, 1, 2, 3, 4], [5], [7, 6]] | Failed |
| regression: line-local indices | [[1, 0], [0]] | [[1, 0], [2]] | Failed |
SHA-256 / c4e3f03e903d45a7656890d7e47e1d920f4a9d7b2113c7b1108926ecebe6d7e3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def reorder(lv):
vis = list(range(len(lv)))
odd = [l for l in lv if l % 2 == 1]
if not odd:
return vis
for lev in range(max(lv), min(odd) - 1, -1):
i = 0
while i < len(vis):
if lv[vis[i]] >= lev:
j = i
while j < len(vis) and lv[vis[j]] >= lev:
j += 1
vis[i:j] = vis[i:j][::-1]
i = j
else:
i += 1
return vis
levels, classes, para, line_lengths = x
out = []
start = 0
for ln in line_lengths:
idx = list(range(start, start + ln))
lv = [levels[i] for i in idx]
j = ln - 1
while j >= 0 and classes[idx[j]] == 'WS':
lv[j] = para
j -= 1
local = reorder(lv)
out.append([v + ln for v in local])
start += ln
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[4, 4, 1, 1, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4], ['L', 'L', 'ON', 'R', 'WS', 'WS', 'WS', 'R', 'R', 'R', 'R', 'WS', 'L', 'WS'], 1, [3, 2, 5, 2, 1, 1]], [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]]), ('partial-repair probe', [[0, 0], ['L', 'L'], 0, [2]], [[0, 1]]), ('regression: line-local indices', [[1, 4, 4, 4, 3, 3, 3, 3, 2, 2], ['WS', 'R', 'R', 'ON', 'R', 'R', 'R', 'WS', 'WS', 'R'], 0, [3, 3, 2, 1, 1]], [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]]), ('regression: line-local indices', [[2, 2], ['L', 'L'], 1, [1, 1]], [[0], [1]]), ('regression: line-local indices', [[2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'L', 'ON', 'R', 'R', 'R', 'R', 'R', 'L', 'WS', 'WS'], 1, [4, 1, 5, 1]], [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]]), ('regression: line-local indices', [[2, 2, 2, 2, 3, 3, 3, 3], ['R', 'WS', 'L', 'WS', 'R', 'R', 'L', 'L'], 1, [5, 1, 2]], [[0, 1, 2, 3, 4], [5], [7, 6]]), ('regression: line-local indices', [[3, 3, 2], ['WS', 'L', 'R'], 1, [2, 1]], [[1, 0], [2]])], [('regression: line-local indices', [[2, 4, 4, 2, 2, 2, 1], ['R', 'WS', 'WS', 'WS', 'WS', 'ON', 'L'], 1, [4, 2, 1]], [[3, 2, 1, 0], [4, 5], [6]]), ('regression: line-local indices', [[0, 0, 0, 2, 2, 2, 2], ['R', 'L', 'ON', 'WS', 'L', 'L', 'R'], 0, [5, 2]], [[0, 1, 2, 3, 4], [5, 6]]), ('regression: line-local indices', [[2, 2, 2, 2, 2, 2], ['ON', 'WS', 'R', 'L', 'ON', 'WS'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: line-local indices', [[2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'L', 'ON', 'R', 'R', 'R', 'R', 'R', 'L', 'WS', 'WS'], 1, [4, 1, 5, 1]], [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[3, 0], ['ON', 'WS'], 1, [1, 1]], [[0], [1]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4], ['WS', 'R', 'L', 'R', 'WS', 'L', 'ON', 'ON', 'R', 'ON', 'WS'], 0, [4, 2, 1, 1, 1, 2]], [[3, 2, 1, 0], [5, 4], [6], [7], [8], [9, 10]]), ('regression: line-local indices', [[0, 0, 0, 0, 0, 0], ['ON', 'L', 'L', 'L', 'WS', 'L'], 0, [4, 2]], [[0, 1, 2, 3], [4, 5]])], [('regression: line-local indices', [[2, 2, 1, 0, 0], ['WS', 'WS', 'L', 'WS', 'L'], 0, [3, 1, 1]], [[2, 0, 1], [3], [4]]), ('regression: line-local indices', [[1, 2, 2, 2, 2, 2, 2, 2], ['WS', 'R', 'R', 'L', 'L', 'R', 'R', 'R'], 1, [1, 1, 5, 1]], [[0], [1], [2, 3, 4, 5, 6], [7]]), ('regression: line-local indices', [[1, 1, 1, 1, 0], ['R', 'L', 'R', 'L', 'L'], 1, [4, 1]], [[3, 2, 1, 0], [4]]), ('regression: line-local indices', [[2, 4, 4, 4, 2, 1, 1, 3, 1, 1, 1, 1], ['R', 'L', 'ON', 'L', 'L', 'L', 'R', 'ON', 'WS', 'R', 'R', 'L'], 0, [4, 1, 2, 4, 1]], [[0, 1, 2, 3], [4], [6, 5], [10, 9, 8, 7], [11]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[4, 4, 2, 2, 1, 1, 1, 3, 3], ['R', 'ON', 'L', 'R', 'L', 'R', 'WS', 'R', 'WS'], 0, [3, 1, 2, 1, 1, 1]], [[0, 1, 2], [3], [5, 4], [6], [7], [8]]), ('regression: line-local indices', [[1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 3, 3], ['WS', 'WS', 'L', 'WS', 'L', 'WS', 'L', 'R', 'WS', 'WS', 'WS', 'WS'], 0, [5, 5, 2]], [[4, 3, 2, 1, 0], [5, 6, 7, 8, 9], [10, 11]]), ('regression: line-local indices', [[0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 1], ['L', 'R', 'WS', 'R', 'WS', 'L', 'R', 'WS', 'WS', 'L', 'L', 'ON', 'R'], 1, [3, 5, 5]], [[0, 1, 2], [7, 6, 5, 4, 3], [8, 9, 10, 11, 12]])], [('regression: line-local indices', [[4, 3, 1, 1, 1, 3, 3, 3, 2], ['L', 'L', 'R', 'ON', 'ON', 'R', 'L', 'WS', 'WS'], 0, [2, 3, 2, 2]], [[1, 0], [4, 3, 2], [6, 5], [7, 8]]), ('regression: line-local indices', [[1, 2, 2, 2, 3, 3, 3, 1, 1, 1, 1, 0, 0], ['L', 'L', 'R', 'L', 'L', 'R', 'L', 'L', 'L', 'L', 'R', 'L', 'R'], 0, [1, 1, 3, 3, 1, 4]], [[0], [1], [2, 3, 4], [7, 6, 5], [8], [10, 9, 11, 12]]), ('regression: line-local indices', [[0, 0, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 3], ['L', 'WS', 'L', 'L', 'L', 'L', 'R', 'L', 'R', 'WS', 'L', 'WS', 'L', 'L'], 0, [3, 2, 2, 2, 5]], [[0, 1, 2], [4, 3], [6, 5], [8, 7], [13, 12, 9, 10, 11]]), ('regression: line-local indices', [[0, 0, 0, 0, 1, 1, 1, 2, 2], ['L', 'R', 'R', 'ON', 'WS', 'R', 'R', 'WS', 'L'], 1, [5, 2, 1, 1]], [[0, 1, 2, 3, 4], [6, 5], [7], [8]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[2, 2, 2, 2, 2, 2], ['ON', 'WS', 'R', 'L', 'ON', 'WS'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 3, 3, 2, 2], ['L', 'R', 'L', 'R', 'L', 'L', 'L', 'WS', 'ON'], 1, [3, 1, 1, 3, 1]], [[2, 1, 0], [3], [4], [7, 6, 5], [8]]), ('regression: line-local indices', [[1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3], ['WS', 'R', 'L', 'ON', 'R', 'R', 'R', 'L', 'L', 'L', 'R', 'L', 'WS', 'R'], 1, [1, 2, 2, 4, 4, 1]], [[0], [2, 1], [3, 4], [8, 7, 6, 5], [12, 11, 10, 9], [13]])], [('regression: line-local indices', [[1, 1, 1, 1, 1, 1], ['L', 'L', 'R', 'ON', 'ON', 'WS'], 1, [5, 1]], [[4, 3, 2, 1, 0], [5]]), ('regression: line-local indices', [[3, 3, 3, 3, 2, 2, 2, 2, 2], ['L', 'R', 'L', 'R', 'ON', 'L', 'ON', 'L', 'WS'], 1, [1, 1, 5, 1, 1]], [[0], [1], [3, 2, 4, 5, 6], [7], [8]]), ('regression: line-local indices', [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], ['R', 'R', 'WS', 'WS', 'L', 'ON', 'WS', 'WS', 'L', 'R', 'L'], 1, [3, 1, 5, 1, 1]], [[2, 1, 0], [3], [7, 6, 5, 4, 8], [9], [10]]), ('regression: line-local indices', [[2, 2, 3, 3, 3, 3, 4, 4, 4, 1, 1, 1], ['WS', 'L', 'R', 'WS', 'R', 'L', 'WS', 'L', 'R', 'R', 'R', 'R'], 0, [2, 4, 2, 2, 1, 1]], [[0, 1], [5, 4, 3, 2], [6, 7], [9, 8], [10], [11]]), ('RTL run split across lines', [[1, 1, 1, 1, 1, 1], ['R', 'R', 'WS', 'R', 'R', 'R'], 0, [3, 3]], [[1, 0, 2], [5, 4, 3]]), ('regression: line-local indices', [[1, 1, 1, 3, 3, 3, 2, 2], ['ON', 'WS', 'ON', 'WS', 'WS', 'L', 'R', 'R'], 1, [2, 4, 1, 1]], [[1, 0], [5, 4, 3, 2], [6], [7]]), ('regression: line-local indices', [[0, 0, 0, 0], ['L', 'R', 'WS', 'R'], 0, [3, 1]], [[0, 1, 2], [3]]), ('regression: line-local indices', [[4, 4, 4, 1, 1, 2, 2, 2, 3, 3], ['WS', 'R', 'L', 'ON', 'R', 'R', 'R', 'L', 'R', 'R'], 1, [4, 3, 2, 1]], [[3, 0, 1, 2], [5, 6, 4], [7, 8], [9]])]]
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 |
|---|---|---|---|
| RTL run split across lines | [[4, 3, 5], [5, 4, 3]] | [[1, 0, 2], [5, 4, 3]] | Failed |
| regression: line-local indices | [[5, 3, 4], [3, 2], [9, 8, 7, 5, 6], [3, 2], [1], [1]] | [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]] | Failed |
| partial-repair probe | [[2, 3]] | [[0, 1]] | Failed |
| regression: line-local indices | [[4, 5, 3], [5, 4, 3], [2, 3], [1], [1]] | [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]] | Failed |
| regression: line-local indices | [[1], [1]] | [[0], [1]] | Failed |
| regression: line-local indices | [[7, 4, 5, 6], [1], [9, 8, 7, 6, 5], [1]] | [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]] | Failed |
| regression: line-local indices | [[5, 6, 7, 8, 9], [1], [3, 2]] | [[0, 1, 2, 3, 4], [5], [7, 6]] | Failed |
| regression: line-local indices | [[3, 2], [1]] | [[1, 0], [2]] | Failed |
SHA-256 / 8ad294efb4c308109bcfc72b82459432b2419fe1293eb62177085eb2a05e4907
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.673593+00:00.
Case digest / d8723aa1ce7d5589a839bea5e86f5cf27b94b8d0abf1f457b7a6916a9911e69f