FA-80506 / Bidirectional text layout / Open access
Line-end whitespace level reset: trailing run start · case 01
The final space on the line keeps its embedded level.
ROOT CAUSE
The trailing scan starts at the second-to-last character.
VERIFIED REPAIR
Start the trailing scan at the last character.
Unsuccessful approach: Stopping before index 0 misses all-whitespace lines.
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 - 2
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 = [[('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('regression: trailing run start', [['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]), ('partial-repair probe', [['RLI', 'WS', 'FSI', 'WS', 'WS'], [0, 0, 0, 0, 1], 1], [1, 1, 1, 1, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'WS', 'L', 'PDI', 'ON', 'R', 'L'], [1, 1, 1, 4, 4, 3, 3], 0], [1, 1, 1, 4, 4, 3, 3]), ('control layout', [['WS', 'FSI', 'WS', 'RLI', 'R', 'L', 'R', 'WS', 'S', 'L'], [2, 2, 2, 1, 1, 1, 1, 1, 2, 2], 0], [2, 2, 2, 1, 1, 1, 1, 0, 0, 2]), ('control layout', [['LRI', 'R', 'ON', 'ON', 'PDI', 'PDI'], [1, 1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1, 1])], [('regression: trailing run start', [['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: trailing run start', [['R', 'PDI', 'LRI', 'WS', 'R', 'WS', 'RLI'], [1, 0, 0, 0, 0, 0, 0], 1], [1, 0, 0, 0, 0, 1, 1]), ('regression: trailing run start', [['PDI', 'WS', 'WS', 'LRI', 'RLI', 'WS'], [1, 1, 1, 2, 2, 2], 0], [0, 0, 0, 0, 0, 0]), ('regression: trailing run start', [['LRI'], [2], 0], [0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'R', 'LRI', 'L', 'R'], [2, 2, 2, 1, 1], 1], [2, 2, 2, 1, 1]), ('control layout', [['EN', 'LRI', 'FSI', 'R', 'WS', 'WS', 'FSI', 'R', 'R', 'S'], [2, 2, 2, 2, 1, 1, 1, 2, 2, 2], 0], [2, 2, 2, 2, 1, 1, 1, 2, 2, 0])], [('regression: trailing run start', [['S', 'R', 'L', 'L', 'S', 'WS'], [0, 3, 3, 3, 3, 3], 1], [1, 3, 3, 3, 1, 1]), ('regression: trailing run start', [['LRI', 'R', 'EN', 'S', 'L', 'L', 'LRI', 'FSI', 'WS'], [3, 3, 3, 3, 3, 3, 3, 3, 4], 1], [3, 3, 3, 1, 3, 3, 1, 1, 1]), ('regression: trailing run start', [['RLI'], [0], 1], [1]), ('regression: trailing run start', [['LRI'], [3], 0], [0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R'], [3], 1], [3]), ('control layout', [['LRI', 'R', 'EN', 'WS', 'B', 'L', 'L', 'PDI', 'LRI', 'ON'], [3, 3, 3, 3, 0, 0, 1, 1, 1, 1], 1], [3, 3, 3, 1, 1, 0, 1, 1, 1, 1])], [('regression: trailing run start', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('regression: trailing run start', [['L', 'S', 'ON', 'WS', 'LRI', 'L', 'R', 'L', 'ON', 'PDI'], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1], 0], [1, 0, 1, 1, 1, 1, 1, 1, 0, 0]), ('regression: trailing run start', [['LRI', 'WS'], [2, 2], 0], [0, 0]), ('regression: trailing run start', [['WS'], [1], 0], [0]), ('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', 'R', 'L', 'R', 'S'], [0, 0, 0, 0, 1], 0], [0, 0, 0, 0, 0]), ('control layout', [['R'], [3], 1], [3])], [('regression: trailing run start', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('regression: trailing run start', [['FSI', 'R', 'EN', 'L', 'R', 'L', 'EN', 'L', 'LRI'], [1, 1, 1, 4, 4, 4, 4, 1, 3], 1], [1, 1, 1, 4, 4, 4, 4, 1, 1]), ('regression: trailing run start', [['FSI'], [2], 1], [1]), ('regression: trailing run start', [['WS', 'PDI'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['S'], [3], 0], [0]), ('control layout', [['R', 'L', 'R', 'L', 'ON', 'R', 'ON', 'L'], [1, 1, 1, 1, 1, 1, 2, 2], 0], [1, 1, 1, 1, 1, 1, 2, 2])]]
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 |
|---|---|---|---|
| trailing isolate and space | [1, 1, 0, 1] | [1, 1, 0, 0] | Failed |
| regression: trailing run start | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 3] | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0] | Failed |
| partial-repair probe | [1, 1, 1, 1, 1] | [1, 1, 1, 1, 1] | Passed |
| all whitespace line | [0, 1] | [0, 0] | Failed |
| space before tab | [1, 0, 0, 1] | [1, 0, 0, 1] | Passed |
| control layout | [1, 1, 1, 4, 4, 3, 3] | [1, 1, 1, 4, 4, 3, 3] | Passed |
| control layout | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | Passed |
| control layout | [1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1] | Passed |
SHA-256 / 0649ab8cf1c14d14e6648dcb9da7efe77fd7f0fdb7649ef39f7e6288e827ce53
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'):
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 = [[('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('regression: trailing run start', [['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]), ('partial-repair probe', [['RLI', 'WS', 'FSI', 'WS', 'WS'], [0, 0, 0, 0, 1], 1], [1, 1, 1, 1, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'WS', 'L', 'PDI', 'ON', 'R', 'L'], [1, 1, 1, 4, 4, 3, 3], 0], [1, 1, 1, 4, 4, 3, 3]), ('control layout', [['WS', 'FSI', 'WS', 'RLI', 'R', 'L', 'R', 'WS', 'S', 'L'], [2, 2, 2, 1, 1, 1, 1, 1, 2, 2], 0], [2, 2, 2, 1, 1, 1, 1, 0, 0, 2]), ('control layout', [['LRI', 'R', 'ON', 'ON', 'PDI', 'PDI'], [1, 1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1, 1])], [('regression: trailing run start', [['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: trailing run start', [['R', 'PDI', 'LRI', 'WS', 'R', 'WS', 'RLI'], [1, 0, 0, 0, 0, 0, 0], 1], [1, 0, 0, 0, 0, 1, 1]), ('regression: trailing run start', [['PDI', 'WS', 'WS', 'LRI', 'RLI', 'WS'], [1, 1, 1, 2, 2, 2], 0], [0, 0, 0, 0, 0, 0]), ('regression: trailing run start', [['LRI'], [2], 0], [0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'R', 'LRI', 'L', 'R'], [2, 2, 2, 1, 1], 1], [2, 2, 2, 1, 1]), ('control layout', [['EN', 'LRI', 'FSI', 'R', 'WS', 'WS', 'FSI', 'R', 'R', 'S'], [2, 2, 2, 2, 1, 1, 1, 2, 2, 2], 0], [2, 2, 2, 2, 1, 1, 1, 2, 2, 0])], [('regression: trailing run start', [['S', 'R', 'L', 'L', 'S', 'WS'], [0, 3, 3, 3, 3, 3], 1], [1, 3, 3, 3, 1, 1]), ('regression: trailing run start', [['LRI', 'R', 'EN', 'S', 'L', 'L', 'LRI', 'FSI', 'WS'], [3, 3, 3, 3, 3, 3, 3, 3, 4], 1], [3, 3, 3, 1, 3, 3, 1, 1, 1]), ('regression: trailing run start', [['RLI'], [0], 1], [1]), ('regression: trailing run start', [['LRI'], [3], 0], [0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R'], [3], 1], [3]), ('control layout', [['LRI', 'R', 'EN', 'WS', 'B', 'L', 'L', 'PDI', 'LRI', 'ON'], [3, 3, 3, 3, 0, 0, 1, 1, 1, 1], 1], [3, 3, 3, 1, 1, 0, 1, 1, 1, 1])], [('regression: trailing run start', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('regression: trailing run start', [['L', 'S', 'ON', 'WS', 'LRI', 'L', 'R', 'L', 'ON', 'PDI'], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1], 0], [1, 0, 1, 1, 1, 1, 1, 1, 0, 0]), ('regression: trailing run start', [['LRI', 'WS'], [2, 2], 0], [0, 0]), ('regression: trailing run start', [['WS'], [1], 0], [0]), ('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', 'R', 'L', 'R', 'S'], [0, 0, 0, 0, 1], 0], [0, 0, 0, 0, 0]), ('control layout', [['R'], [3], 1], [3])], [('regression: trailing run start', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('regression: trailing run start', [['FSI', 'R', 'EN', 'L', 'R', 'L', 'EN', 'L', 'LRI'], [1, 1, 1, 4, 4, 4, 4, 1, 3], 1], [1, 1, 1, 4, 4, 4, 4, 1, 1]), ('regression: trailing run start', [['FSI'], [2], 1], [1]), ('regression: trailing run start', [['WS', 'PDI'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['S'], [3], 0], [0]), ('control layout', [['R', 'L', 'R', 'L', 'ON', 'R', 'ON', 'L'], [1, 1, 1, 1, 1, 1, 2, 2], 0], [1, 1, 1, 1, 1, 1, 2, 2])]]
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 |
|---|---|---|---|
| trailing isolate and space | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| regression: trailing run start | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0] | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0] | Passed |
| partial-repair probe | [0, 1, 1, 1, 1] | [1, 1, 1, 1, 1] | Failed |
| all whitespace line | [1, 0] | [0, 0] | Failed |
| space before tab | [1, 0, 0, 1] | [1, 0, 0, 1] | Passed |
| control layout | [1, 1, 1, 4, 4, 3, 3] | [1, 1, 1, 4, 4, 3, 3] | Passed |
| control layout | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | Passed |
| control layout | [1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1] | Passed |
SHA-256 / 16266a1ad21b68ca11d6c9db7b9172c66fb7f416155b86ca2b890bcfd0727968
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 = [[('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('regression: trailing run start', [['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]), ('partial-repair probe', [['RLI', 'WS', 'FSI', 'WS', 'WS'], [0, 0, 0, 0, 1], 1], [1, 1, 1, 1, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'WS', 'L', 'PDI', 'ON', 'R', 'L'], [1, 1, 1, 4, 4, 3, 3], 0], [1, 1, 1, 4, 4, 3, 3]), ('control layout', [['WS', 'FSI', 'WS', 'RLI', 'R', 'L', 'R', 'WS', 'S', 'L'], [2, 2, 2, 1, 1, 1, 1, 1, 2, 2], 0], [2, 2, 2, 1, 1, 1, 1, 0, 0, 2]), ('control layout', [['LRI', 'R', 'ON', 'ON', 'PDI', 'PDI'], [1, 1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1, 1])], [('regression: trailing run start', [['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: trailing run start', [['R', 'PDI', 'LRI', 'WS', 'R', 'WS', 'RLI'], [1, 0, 0, 0, 0, 0, 0], 1], [1, 0, 0, 0, 0, 1, 1]), ('regression: trailing run start', [['PDI', 'WS', 'WS', 'LRI', 'RLI', 'WS'], [1, 1, 1, 2, 2, 2], 0], [0, 0, 0, 0, 0, 0]), ('regression: trailing run start', [['LRI'], [2], 0], [0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'R', 'LRI', 'L', 'R'], [2, 2, 2, 1, 1], 1], [2, 2, 2, 1, 1]), ('control layout', [['EN', 'LRI', 'FSI', 'R', 'WS', 'WS', 'FSI', 'R', 'R', 'S'], [2, 2, 2, 2, 1, 1, 1, 2, 2, 2], 0], [2, 2, 2, 2, 1, 1, 1, 2, 2, 0])], [('regression: trailing run start', [['S', 'R', 'L', 'L', 'S', 'WS'], [0, 3, 3, 3, 3, 3], 1], [1, 3, 3, 3, 1, 1]), ('regression: trailing run start', [['LRI', 'R', 'EN', 'S', 'L', 'L', 'LRI', 'FSI', 'WS'], [3, 3, 3, 3, 3, 3, 3, 3, 4], 1], [3, 3, 3, 1, 3, 3, 1, 1, 1]), ('regression: trailing run start', [['RLI'], [0], 1], [1]), ('regression: trailing run start', [['LRI'], [3], 0], [0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['R'], [3], 1], [3]), ('control layout', [['LRI', 'R', 'EN', 'WS', 'B', 'L', 'L', 'PDI', 'LRI', 'ON'], [3, 3, 3, 3, 0, 0, 1, 1, 1, 1], 1], [3, 3, 3, 1, 1, 0, 1, 1, 1, 1])], [('regression: trailing run start', [['PDI', 'S', 'R', 'ON', 'LRI'], [1, 4, 4, 4, 4], 1], [1, 1, 4, 4, 1]), ('regression: trailing run start', [['L', 'S', 'ON', 'WS', 'LRI', 'L', 'R', 'L', 'ON', 'PDI'], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1], 0], [1, 0, 1, 1, 1, 1, 1, 1, 0, 0]), ('regression: trailing run start', [['LRI', 'WS'], [2, 2], 0], [0, 0]), ('regression: trailing run start', [['WS'], [1], 0], [0]), ('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', 'R', 'L', 'R', 'S'], [0, 0, 0, 0, 1], 0], [0, 0, 0, 0, 0]), ('control layout', [['R'], [3], 1], [3])], [('regression: trailing run start', [['WS', 'ON'], [3, 3], 0], [3, 3]), ('regression: trailing run start', [['FSI', 'R', 'EN', 'L', 'R', 'L', 'EN', 'L', 'LRI'], [1, 1, 1, 4, 4, 4, 4, 1, 3], 1], [1, 1, 1, 4, 4, 4, 4, 1, 1]), ('regression: trailing run start', [['FSI'], [2], 1], [1]), ('regression: trailing run start', [['WS', 'PDI'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['S'], [3], 0], [0]), ('control layout', [['R', 'L', 'R', 'L', 'ON', 'R', 'ON', 'L'], [1, 1, 1, 1, 1, 1, 2, 2], 0], [1, 1, 1, 1, 1, 1, 2, 2])]]
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 |
|---|---|---|---|
| trailing isolate and space | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| regression: trailing run start | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0] | [2, 2, 1, 2, 2, 0, 0, 1, 3, 3, 1, 0] | Passed |
| partial-repair probe | [1, 1, 1, 1, 1] | [1, 1, 1, 1, 1] | Passed |
| all whitespace line | [0, 0] | [0, 0] | Passed |
| space before tab | [1, 0, 0, 1] | [1, 0, 0, 1] | Passed |
| control layout | [1, 1, 1, 4, 4, 3, 3] | [1, 1, 1, 4, 4, 3, 3] | Passed |
| control layout | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | [2, 2, 2, 1, 1, 1, 1, 0, 0, 2] | Passed |
| control layout | [1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1] | Passed |
SHA-256 / 92a017732c8fce0d571ca5327c408756a1bd5d0bb896915bf1b3edaf1e8dd16d
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.420373+00:00.
Case digest / 83b19ded40e795e2a6e50c05a1bf7346285ea42c13dcfcdd136aee02affde9f9