FA-80501 / Bidirectional text layout / Open access
Line-end whitespace level reset: segment separator reset · case 01
Tabs inside right-to-left text keep the embedded level.
ROOT CAUSE
Only paragraph separators trigger the reset.
VERIFIED REPAIR
Reset segment separators (S) and paragraph separators (B).
Unsuccessful approach: Treating every space as a separator resets interior whitespace.
Case contract
Input [original classes, resolved levels, paragraph level]. Reset to the paragraph level: every S and B; any run of WS and isolate formatting characters (FSI LRI RLI PDI) immediately before an S or B; and such a run at the end of the line. Return levels.
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
out = list(levels)
n = len(classes)
RESETTABLE = ('WS', 'FSI', 'LRI', 'RLI', 'PDI')
j = n - 1
while j >= 0 and classes[j] in RESETTABLE:
out[j] = para
j -= 1
for i, c in enumerate(classes):
if c == 'B':
out[i] = para
k = i - 1
while k >= 0 and classes[k] in RESETTABLE:
out[k] = para
k -= 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('regression: segment separator reset', [['S', 'R', 'WS', 'ON', 'S'], [0, 0, 0, 0, 3], 1], [1, 0, 0, 0, 1]), ('partial-repair probe', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('partial-repair probe', [['L', 'PDI', 'WS', 'ON', 'ON', 'PDI'], [3, 1, 1, 1, 1, 1], 0], [3, 1, 1, 1, 1, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['ON', 'LRI', 'EN', 'ON'], [1, 2, 2, 2], 0], [1, 2, 2, 2]), ('control layout', [['R', 'FSI', 'L'], [1, 3, 3], 0], [1, 3, 3])], [('regression: segment separator reset', [['R', 'LRI', 'L', 'S', 'R', 'ON', 'R', 'L'], [1, 3, 3, 3, 0, 2, 2, 2], 0], [1, 3, 3, 0, 0, 2, 2, 2]), ('regression: segment separator reset', [['S', 'S', 'PDI', 'WS', 'R', 'ON', 'LRI', 'WS', 'ON', 'R', 'WS', 'ON'], [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2], 1], [1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]), ('partial-repair probe', [['FSI', 'L', 'L', 'LRI', 'WS', 'ON', 'WS', 'RLI', 'WS', 'B', 'PDI', 'L'], [2, 2, 2, 2, 1, 0, 0, 1, 1, 1, 1, 1], 0], [2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 1, 1]), ('regression: segment separator reset', [['EN', 'S', 'RLI', 'EN', 'R', 'WS', 'R', 'FSI', 'ON', 'WS', 'WS', 'FSI'], [4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 1], 0], [4, 0, 4, 4, 4, 4, 4, 3, 3, 0, 0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R', 'L', 'R', 'WS'], [1, 1, 1, 1], 0], [1, 1, 1, 0]), ('control layout', [['L', 'RLI', 'ON', 'RLI'], [4, 4, 4, 4], 0], [4, 4, 4, 0])], [('regression: segment separator reset', [['WS', 'EN', 'RLI', 'WS', 'PDI', 'R', 'EN', 'WS', 'S'], [2, 2, 2, 2, 3, 3, 3, 0, 0], 1], [2, 2, 2, 2, 3, 3, 3, 1, 1]), ('regression: segment separator reset', [['L', 'WS', 'B', 'ON', 'WS', 'R', 'S', 'WS', 'WS', 'L', 'PDI', 'S'], [1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4], 0], [1, 0, 0, 2, 2, 2, 0, 2, 2, 4, 0, 0]), ('partial-repair probe', [['EN', 'R', 'B', 'WS', 'R', 'L', 'L', 'ON', 'LRI', 'ON', 'EN'], [2, 2, 4, 4, 4, 1, 1, 1, 4, 1, 3], 1], [2, 2, 1, 4, 4, 1, 1, 1, 4, 1, 3]), ('partial-repair probe', [['L', 'WS', 'B', 'WS', 'ON'], [0, 0, 0, 2, 2], 1], [0, 1, 1, 2, 2]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['ON', 'WS'], [2, 2], 1], [2, 1]), ('control layout', [['RLI', 'ON'], [2, 2], 1], [2, 2])], [('regression: segment separator reset', [['LRI', 'EN', 'WS', 'WS', 'R', 'RLI', 'S', 'WS', 'ON', 'L', 'EN', 'PDI'], [2, 2, 1, 2, 2, 2, 1, 1, 3, 3, 1, 3], 0], [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0]), ('regression: segment separator reset', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('partial-repair probe', [['WS', 'R', 'LRI'], [0, 0, 1], 1], [0, 0, 1]), ('partial-repair probe', [['L', 'B', 'WS', 'PDI', 'L', 'B', 'L', 'L', 'RLI'], [2, 2, 2, 2, 3, 3, 3, 2, 2], 1], [2, 1, 2, 2, 3, 1, 3, 2, 1]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['L', 'FSI'], [1, 4], 0], [1, 0]), ('control layout', [['WS', 'L', 'EN', 'R', 'R'], [1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1])], [('regression: segment separator reset', [['S', 'RLI', 'B', 'L', 'WS', 'L', 'WS'], [1, 1, 1, 2, 2, 2, 0], 0], [0, 0, 0, 2, 2, 2, 0]), ('regression: segment separator reset', [['EN', 'LRI', 'LRI', 'S', 'B', 'FSI', 'R', 'ON', 'PDI', 'B'], [2, 2, 2, 2, 2, 2, 2, 2, 2, 3], 1], [2, 1, 1, 1, 1, 2, 2, 2, 1, 1]), ('partial-repair probe', [['WS', 'PDI', 'L', 'L'], [1, 1, 1, 1], 0], [1, 1, 1, 1]), ('partial-repair probe', [['R', 'ON', 'LRI', 'L', 'WS', 'WS', 'PDI', 'ON'], [1, 3, 3, 3, 2, 4, 4, 4], 0], [1, 3, 3, 3, 2, 4, 4, 4]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['EN', 'R', 'ON', 'R', 'WS'], [1, 1, 1, 1, 3], 0], [1, 1, 1, 1, 0]), ('control layout', [['FSI', 'RLI', 'B', 'R', 'ON', 'RLI', 'LRI', 'ON', 'WS'], [2, 2, 2, 2, 2, 1, 2, 0, 0], 1], [1, 1, 1, 2, 2, 1, 2, 0, 1])]]
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 |
|---|---|---|---|
| space before tab | [1, 1, 1, 1] | [1, 0, 0, 1] | Failed |
| regression: segment separator reset | [0, 0, 0, 0, 3] | [1, 0, 0, 0, 1] | Failed |
| partial-repair probe | [3, 3] | [3, 3] | Passed |
| partial-repair probe | [3, 1, 1, 1, 1, 0] | [3, 1, 1, 1, 1, 0] | Passed |
| all whitespace line | [0, 0] | [0, 0] | Passed |
| trailing isolate and space | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| control layout | [1, 2, 2, 2] | [1, 2, 2, 2] | Passed |
| control layout | [1, 3, 3] | [1, 3, 3] | Passed |
SHA-256 / e88e693af66242f4311820f1868855fb722b4d6c023e30438317d264e0163b3f
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
out = list(levels)
n = len(classes)
RESETTABLE = ('WS', 'FSI', 'LRI', 'RLI', 'PDI')
j = n - 1
while j >= 0 and classes[j] in RESETTABLE:
out[j] = para
j -= 1
for i, c in enumerate(classes):
if c in ('S', 'B', 'WS'):
out[i] = para
k = i - 1
while k >= 0 and classes[k] in RESETTABLE:
out[k] = para
k -= 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('regression: segment separator reset', [['S', 'R', 'WS', 'ON', 'S'], [0, 0, 0, 0, 3], 1], [1, 0, 0, 0, 1]), ('partial-repair probe', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('partial-repair probe', [['L', 'PDI', 'WS', 'ON', 'ON', 'PDI'], [3, 1, 1, 1, 1, 1], 0], [3, 1, 1, 1, 1, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['ON', 'LRI', 'EN', 'ON'], [1, 2, 2, 2], 0], [1, 2, 2, 2]), ('control layout', [['R', 'FSI', 'L'], [1, 3, 3], 0], [1, 3, 3])], [('regression: segment separator reset', [['R', 'LRI', 'L', 'S', 'R', 'ON', 'R', 'L'], [1, 3, 3, 3, 0, 2, 2, 2], 0], [1, 3, 3, 0, 0, 2, 2, 2]), ('regression: segment separator reset', [['S', 'S', 'PDI', 'WS', 'R', 'ON', 'LRI', 'WS', 'ON', 'R', 'WS', 'ON'], [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2], 1], [1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]), ('partial-repair probe', [['FSI', 'L', 'L', 'LRI', 'WS', 'ON', 'WS', 'RLI', 'WS', 'B', 'PDI', 'L'], [2, 2, 2, 2, 1, 0, 0, 1, 1, 1, 1, 1], 0], [2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 1, 1]), ('regression: segment separator reset', [['EN', 'S', 'RLI', 'EN', 'R', 'WS', 'R', 'FSI', 'ON', 'WS', 'WS', 'FSI'], [4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 1], 0], [4, 0, 4, 4, 4, 4, 4, 3, 3, 0, 0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R', 'L', 'R', 'WS'], [1, 1, 1, 1], 0], [1, 1, 1, 0]), ('control layout', [['L', 'RLI', 'ON', 'RLI'], [4, 4, 4, 4], 0], [4, 4, 4, 0])], [('regression: segment separator reset', [['WS', 'EN', 'RLI', 'WS', 'PDI', 'R', 'EN', 'WS', 'S'], [2, 2, 2, 2, 3, 3, 3, 0, 0], 1], [2, 2, 2, 2, 3, 3, 3, 1, 1]), ('regression: segment separator reset', [['L', 'WS', 'B', 'ON', 'WS', 'R', 'S', 'WS', 'WS', 'L', 'PDI', 'S'], [1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4], 0], [1, 0, 0, 2, 2, 2, 0, 2, 2, 4, 0, 0]), ('partial-repair probe', [['EN', 'R', 'B', 'WS', 'R', 'L', 'L', 'ON', 'LRI', 'ON', 'EN'], [2, 2, 4, 4, 4, 1, 1, 1, 4, 1, 3], 1], [2, 2, 1, 4, 4, 1, 1, 1, 4, 1, 3]), ('partial-repair probe', [['L', 'WS', 'B', 'WS', 'ON'], [0, 0, 0, 2, 2], 1], [0, 1, 1, 2, 2]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['ON', 'WS'], [2, 2], 1], [2, 1]), ('control layout', [['RLI', 'ON'], [2, 2], 1], [2, 2])], [('regression: segment separator reset', [['LRI', 'EN', 'WS', 'WS', 'R', 'RLI', 'S', 'WS', 'ON', 'L', 'EN', 'PDI'], [2, 2, 1, 2, 2, 2, 1, 1, 3, 3, 1, 3], 0], [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0]), ('regression: segment separator reset', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('partial-repair probe', [['WS', 'R', 'LRI'], [0, 0, 1], 1], [0, 0, 1]), ('partial-repair probe', [['L', 'B', 'WS', 'PDI', 'L', 'B', 'L', 'L', 'RLI'], [2, 2, 2, 2, 3, 3, 3, 2, 2], 1], [2, 1, 2, 2, 3, 1, 3, 2, 1]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['L', 'FSI'], [1, 4], 0], [1, 0]), ('control layout', [['WS', 'L', 'EN', 'R', 'R'], [1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1])], [('regression: segment separator reset', [['S', 'RLI', 'B', 'L', 'WS', 'L', 'WS'], [1, 1, 1, 2, 2, 2, 0], 0], [0, 0, 0, 2, 2, 2, 0]), ('regression: segment separator reset', [['EN', 'LRI', 'LRI', 'S', 'B', 'FSI', 'R', 'ON', 'PDI', 'B'], [2, 2, 2, 2, 2, 2, 2, 2, 2, 3], 1], [2, 1, 1, 1, 1, 2, 2, 2, 1, 1]), ('partial-repair probe', [['WS', 'PDI', 'L', 'L'], [1, 1, 1, 1], 0], [1, 1, 1, 1]), ('partial-repair probe', [['R', 'ON', 'LRI', 'L', 'WS', 'WS', 'PDI', 'ON'], [1, 3, 3, 3, 2, 4, 4, 4], 0], [1, 3, 3, 3, 2, 4, 4, 4]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['EN', 'R', 'ON', 'R', 'WS'], [1, 1, 1, 1, 3], 0], [1, 1, 1, 1, 0]), ('control layout', [['FSI', 'RLI', 'B', 'R', 'ON', 'RLI', 'LRI', 'ON', 'WS'], [2, 2, 2, 2, 2, 1, 2, 0, 0], 1], [1, 1, 1, 2, 2, 1, 2, 0, 1])]]
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 |
|---|---|---|---|
| space before tab | [1, 0, 0, 1] | [1, 0, 0, 1] | Passed |
| regression: segment separator reset | [1, 0, 1, 0, 1] | [1, 0, 0, 0, 1] | Failed |
| partial-repair probe | [0, 3] | [3, 3] | Failed |
| partial-repair probe | [3, 0, 0, 1, 1, 0] | [3, 1, 1, 1, 1, 0] | Failed |
| all whitespace line | [0, 0] | [0, 0] | Passed |
| trailing isolate and space | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| control layout | [1, 2, 2, 2] | [1, 2, 2, 2] | Passed |
| control layout | [1, 3, 3] | [1, 3, 3] | Passed |
SHA-256 / 909bd41d26217909735a4b4d1890dddfa02ee33c3e0db4459f4aea2782d1cd4b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
classes, levels, para = x
out = list(levels)
n = len(classes)
RESETTABLE = ('WS', 'FSI', 'LRI', 'RLI', 'PDI')
j = n - 1
while j >= 0 and classes[j] in RESETTABLE:
out[j] = para
j -= 1
for i, c in enumerate(classes):
if c in ('S', 'B'):
out[i] = para
k = i - 1
while k >= 0 and classes[k] in RESETTABLE:
out[k] = para
k -= 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('regression: segment separator reset', [['S', 'R', 'WS', 'ON', 'S'], [0, 0, 0, 0, 3], 1], [1, 0, 0, 0, 1]), ('partial-repair probe', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('partial-repair probe', [['L', 'PDI', 'WS', 'ON', 'ON', 'PDI'], [3, 1, 1, 1, 1, 1], 0], [3, 1, 1, 1, 1, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['ON', 'LRI', 'EN', 'ON'], [1, 2, 2, 2], 0], [1, 2, 2, 2]), ('control layout', [['R', 'FSI', 'L'], [1, 3, 3], 0], [1, 3, 3])], [('regression: segment separator reset', [['R', 'LRI', 'L', 'S', 'R', 'ON', 'R', 'L'], [1, 3, 3, 3, 0, 2, 2, 2], 0], [1, 3, 3, 0, 0, 2, 2, 2]), ('regression: segment separator reset', [['S', 'S', 'PDI', 'WS', 'R', 'ON', 'LRI', 'WS', 'ON', 'R', 'WS', 'ON'], [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2], 1], [1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]), ('partial-repair probe', [['FSI', 'L', 'L', 'LRI', 'WS', 'ON', 'WS', 'RLI', 'WS', 'B', 'PDI', 'L'], [2, 2, 2, 2, 1, 0, 0, 1, 1, 1, 1, 1], 0], [2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 1, 1]), ('regression: segment separator reset', [['EN', 'S', 'RLI', 'EN', 'R', 'WS', 'R', 'FSI', 'ON', 'WS', 'WS', 'FSI'], [4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 1], 0], [4, 0, 4, 4, 4, 4, 4, 3, 3, 0, 0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R', 'L', 'R', 'WS'], [1, 1, 1, 1], 0], [1, 1, 1, 0]), ('control layout', [['L', 'RLI', 'ON', 'RLI'], [4, 4, 4, 4], 0], [4, 4, 4, 0])], [('regression: segment separator reset', [['WS', 'EN', 'RLI', 'WS', 'PDI', 'R', 'EN', 'WS', 'S'], [2, 2, 2, 2, 3, 3, 3, 0, 0], 1], [2, 2, 2, 2, 3, 3, 3, 1, 1]), ('regression: segment separator reset', [['L', 'WS', 'B', 'ON', 'WS', 'R', 'S', 'WS', 'WS', 'L', 'PDI', 'S'], [1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4], 0], [1, 0, 0, 2, 2, 2, 0, 2, 2, 4, 0, 0]), ('partial-repair probe', [['EN', 'R', 'B', 'WS', 'R', 'L', 'L', 'ON', 'LRI', 'ON', 'EN'], [2, 2, 4, 4, 4, 1, 1, 1, 4, 1, 3], 1], [2, 2, 1, 4, 4, 1, 1, 1, 4, 1, 3]), ('partial-repair probe', [['L', 'WS', 'B', 'WS', 'ON'], [0, 0, 0, 2, 2], 1], [0, 1, 1, 2, 2]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['ON', 'WS'], [2, 2], 1], [2, 1]), ('control layout', [['RLI', 'ON'], [2, 2], 1], [2, 2])], [('regression: segment separator reset', [['LRI', 'EN', 'WS', 'WS', 'R', 'RLI', 'S', 'WS', 'ON', 'L', 'EN', 'PDI'], [2, 2, 1, 2, 2, 2, 1, 1, 3, 3, 1, 3], 0], [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0]), ('regression: segment separator reset', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('partial-repair probe', [['WS', 'R', 'LRI'], [0, 0, 1], 1], [0, 0, 1]), ('partial-repair probe', [['L', 'B', 'WS', 'PDI', 'L', 'B', 'L', 'L', 'RLI'], [2, 2, 2, 2, 3, 3, 3, 2, 2], 1], [2, 1, 2, 2, 3, 1, 3, 2, 1]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('control layout', [['L', 'FSI'], [1, 4], 0], [1, 0]), ('control layout', [['WS', 'L', 'EN', 'R', 'R'], [1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1])], [('regression: segment separator reset', [['S', 'RLI', 'B', 'L', 'WS', 'L', 'WS'], [1, 1, 1, 2, 2, 2, 0], 0], [0, 0, 0, 2, 2, 2, 0]), ('regression: segment separator reset', [['EN', 'LRI', 'LRI', 'S', 'B', 'FSI', 'R', 'ON', 'PDI', 'B'], [2, 2, 2, 2, 2, 2, 2, 2, 2, 3], 1], [2, 1, 1, 1, 1, 2, 2, 2, 1, 1]), ('partial-repair probe', [['WS', 'PDI', 'L', 'L'], [1, 1, 1, 1], 0], [1, 1, 1, 1]), ('partial-repair probe', [['R', 'ON', 'LRI', 'L', 'WS', 'WS', 'PDI', 'ON'], [1, 3, 3, 3, 2, 4, 4, 4], 0], [1, 3, 3, 3, 2, 4, 4, 4]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['EN', 'R', 'ON', 'R', 'WS'], [1, 1, 1, 1, 3], 0], [1, 1, 1, 1, 0]), ('control layout', [['FSI', 'RLI', 'B', 'R', 'ON', 'RLI', 'LRI', 'ON', 'WS'], [2, 2, 2, 2, 2, 1, 2, 0, 0], 1], [1, 1, 1, 2, 2, 1, 2, 0, 1])]]
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 |
|---|---|---|---|
| space before tab | [1, 0, 0, 1] | [1, 0, 0, 1] | Passed |
| regression: segment separator reset | [1, 0, 0, 0, 1] | [1, 0, 0, 0, 1] | Passed |
| partial-repair probe | [3, 3] | [3, 3] | Passed |
| partial-repair probe | [3, 1, 1, 1, 1, 0] | [3, 1, 1, 1, 1, 0] | Passed |
| all whitespace line | [0, 0] | [0, 0] | Passed |
| trailing isolate and space | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| control layout | [1, 2, 2, 2] | [1, 2, 2, 2] | Passed |
| control layout | [1, 3, 3] | [1, 3, 3] | Passed |
SHA-256 / 0edaca853bd4b5d46033039b51132bb8680896284bcaf5b9c2ed4630ab2a0b29
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:54.420516+00:00.
Case digest / e942718dc9ac63f6648ce91eef26ce2293b85f44663b4109e92139036e125c36