{"abstract":"Spaces at the end of wrapped lines jump to the far side.","category":"Bidirectional text layout","checks":8,"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.","contract_signature":"x","evaluation_group":"w2-bidirectional-text-layout-per-line-reordering","failed_approach":"Also resetting trailing neutrals changes punctuation placement.","family":"w2-bidirectional-text-layout-per-line-reordering-trailing-whitespace-per-line","id":"FA-80716","implementations":{"attempt":{"sha256":"c631682a1649296bb4fced42c1128d3434b4aa905f35d2f96af558d671797d40","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def reorder(lv):\n        vis = list(range(len(lv)))\n        odd = [l for l in lv if l % 2 == 1]\n        if not odd:\n            return vis\n        for lev in range(max(lv), min(odd) - 1, -1):\n            i = 0\n            while i < len(vis):\n                if lv[vis[i]] >= lev:\n                    j = i\n                    while j < len(vis) and lv[vis[j]] >= lev:\n                        j += 1\n                    vis[i:j] = vis[i:j][::-1]\n                    i = j\n                else:\n                    i += 1\n        return vis\n    \n    levels, classes, para, line_lengths = x\n    out = []\n    start = 0\n    for ln in line_lengths:\n        idx = list(range(start, start + ln))\n        lv = [levels[i] for i in idx]\n        j = ln - 1\n        while j >= 0 and classes[idx[j]] in ('WS', 'ON'):\n            lv[j] = para\n            j -= 1\n        local = reorder(lv)\n        out.append([idx[v] for v in local])\n        start += ln\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('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: trailing whitespace per line', [[2, 1, 2, 2, 2, 2], ['ON', 'WS', 'ON', 'WS', 'WS', 'R'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: trailing whitespace per line', [[4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 1, 3], ['WS', 'R', 'L', 'ON', 'WS', 'WS', 'WS', 'L', 'ON', 'R', 'WS', 'L', 'R'], 1, [2, 5, 3, 1, 1, 1]], [[0, 1], [6, 5, 4, 2, 3], [7, 8, 9], [10], [11], [12]]), ('regression: trailing whitespace per line', [[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]]), ('control layout', [[1, 0, 0, 0, 0, 0, 0, 0, 0], ['R', 'R', 'WS', 'WS', 'WS', 'ON', 'R', 'WS', 'WS'], 0, [4, 1, 4]], [[0, 1, 2, 3], [4], [5, 6, 7, 8]]), ('control layout', [[3, 0], ['ON', 'WS'], 1, [1, 1]], [[0], [1]]), ('control layout', [[0, 3, 3], ['L', 'L', 'WS'], 0, [1, 2]], [[0], [1, 2]]), ('control layout', [[4, 4, 4, 4, 2, 2, 2], ['L', 'R', 'L', 'WS', 'R', 'R', 'R'], 1, [2, 5]], [[0, 1], [2, 3, 4, 5, 6]])], [('regression: trailing whitespace per line', [[2, 3, 0, 0, 3, 2, 2, 2, 1, 1, 1], ['L', 'WS', 'WS', 'WS', 'WS', 'ON', 'R', 'L', 'L', 'R', 'R'], 1, [4, 5, 1, 1]], [[3, 2, 1, 0], [8, 4, 5, 6, 7], [9], [10]]), ('regression: trailing whitespace per line', [[3, 2, 2, 2, 2, 1, 1, 1, 4, 4], ['R', 'WS', 'R', 'R', 'WS', 'WS', 'L', 'R', 'ON', 'L'], 1, [2, 3, 2, 2, 1]], [[1, 0], [4, 2, 3], [6, 5], [8, 7], [9]]), ('partial-repair probe', [[0, 0, 0, 0, 1, 1, 3, 2, 2, 2, 2, 0, 0], ['WS', 'WS', 'R', 'R', 'R', 'R', 'L', 'WS', 'ON', 'L', 'R', 'WS', 'R'], 0, [5, 4, 4]], [[0, 1, 2, 3, 4], [6, 7, 8, 5], [9, 10, 11, 12]]), ('partial-repair probe', [[2, 2, 1, 1, 1, 1, 2, 2], ['WS', 'L', 'R', 'WS', 'ON', 'L', 'WS', 'L'], 0, [5, 1, 2]], [[4, 3, 2, 0, 1], [5], [6, 7]]), ('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]]), ('control layout', [[2, 2, 2, 1, 2, 3, 3, 3, 2], ['L', 'ON', 'R', 'R', 'L', 'L', 'R', 'L', 'L'], 0, [5, 3, 1]], [[4, 3, 0, 1, 2], [7, 6, 5], [8]]), ('control layout', [[4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'R', 'R', 'R', 'R', 'L', 'L', 'R', 'WS', 'WS', 'WS', 'WS', 'ON'], 1, [4, 2, 3, 1, 1, 1, 1]], [[3, 0, 1, 2], [5, 4], [8, 7, 6], [9], [10], [11], [12]]), ('control layout', [[1, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 1], ['L', 'L', 'ON', 'L', 'WS', 'L', 'WS', 'L', 'R', 'WS', 'WS', 'R'], 0, [4, 1, 5, 2]], [[1, 2, 3, 0], [4], [5, 6, 7, 8, 9], [11, 10]])], [('regression: trailing whitespace per line', [[4, 4, 4, 4, 3, 2, 2, 1], ['L', 'WS', 'R', 'L', 'WS', 'WS', 'WS', 'R'], 1, [3, 4, 1]], [[0, 1, 2], [6, 5, 4, 3], [7]]), ('regression: trailing whitespace per line', [[2, 2, 2, 2, 4, 4, 4, 3, 2, 2], ['WS', 'WS', 'WS', 'WS', 'L', 'WS', 'L', 'R', 'R', 'WS'], 1, [2, 2, 3, 2, 1]], [[1, 0], [3, 2], [4, 5, 6], [7, 8], [9]]), ('partial-repair probe', [[1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1], ['L', 'WS', 'ON', 'ON', 'WS', 'R', 'L', 'R', 'WS', 'L', 'WS'], 0, [3, 4, 1, 2, 1]], [[2, 1, 0], [6, 5, 4, 3], [7], [9, 8], [10]]), ('partial-repair probe', [[2, 2, 2, 2], ['L', 'R', 'ON', 'ON'], 1, [4]], [[0, 1, 2, 3]]), ('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]]), ('control layout', [[1, 1, 1, 1, 2], ['R', 'L', 'R', 'L', 'ON'], 1, [2, 1, 2]], [[1, 0], [2], [4, 3]]), ('control layout', [[4, 4, 4, 4, 2, 2, 2, 2, 2], ['L', 'WS', 'R', 'R', 'L', 'ON', 'R', 'R', 'R'], 1, [4, 4, 1]], [[0, 1, 2, 3], [4, 5, 6, 7], [8]]), ('control layout', [[4, 4, 4, 4, 4, 1, 1], ['L', 'ON', 'WS', 'L', 'WS', 'WS', 'WS'], 0, [5, 2]], [[0, 1, 2, 3, 4], [5, 6]])], [('regression: trailing whitespace per line', [[2, 2, 2, 2, 2, 2, 2, 2, 2], ['R', 'R', 'L', 'L', 'L', 'WS', 'WS', 'R', 'L'], 1, [3, 3, 1, 1, 1]], [[0, 1, 2], [5, 3, 4], [6], [7], [8]]), ('regression: trailing whitespace per line', [[4, 4, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1], ['R', 'WS', 'L', 'WS', 'WS', 'WS', 'L', 'WS', 'R', 'R', 'L', 'R'], 0, [4, 5, 2, 1]], [[2, 0, 1, 3], [8, 7, 6, 4, 5], [10, 9], [11]]), ('regression: trailing whitespace per line', [[1, 1, 1, 1, 3, 3, 3, 3], ['L', 'WS', 'ON', 'WS', 'WS', 'L', 'ON', 'R'], 0, [5, 3]], [[2, 1, 0, 3, 4], [7, 6, 5]]), ('partial-repair probe', [[3, 3, 1, 1, 1, 1, 4, 3, 1, 1, 4, 4, 4], ['WS', 'R', 'WS', 'WS', 'R', 'R', 'WS', 'L', 'WS', 'R', 'L', 'ON', 'WS'], 0, [5, 3, 5]], [[4, 3, 2, 1, 0], [7, 6, 5], [10, 11, 9, 8, 12]]), ('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]]), ('control layout', [[3, 3, 3, 3], ['L', 'ON', 'R', 'R'], 1, [3, 1]], [[2, 1, 0], [3]]), ('control layout', [[4, 1, 1, 3, 3, 2, 4, 2, 4, 4], ['R', 'R', 'WS', 'WS', 'L', 'WS', 'ON', 'L', 'L', 'L'], 1, [5, 3, 2]], [[4, 3, 2, 1, 0], [5, 6, 7], [8, 9]]), ('control layout', [[0, 0, 1, 1, 1, 2, 0], ['R', 'ON', 'R', 'R', 'R', 'WS', 'R'], 1, [3, 2, 1, 1]], [[0, 1, 2], [4, 3], [5], [6]])], [('regression: trailing whitespace per line', [[1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0], ['L', 'R', 'L', 'L', 'WS', 'L', 'R', 'ON', 'R', 'L', 'R', 'WS', 'L'], 1, [4, 4, 4, 1]], [[3, 2, 1, 0], [4, 5, 6, 7], [11, 10, 9, 8], [12]]), ('regression: trailing whitespace per line', [[1, 1, 4], ['R', 'WS', 'L'], 0, [2, 1]], [[0, 1], [2]]), ('regression: trailing whitespace per line', [[1, 1, 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 2, 2], ['WS', 'ON', 'WS', 'L', 'L', 'R', 'L', 'R', 'R', 'WS', 'L', 'ON', 'R', 'WS'], 0, [3, 3, 1, 4, 3]], [[1, 0, 2], [3, 4, 5], [6], [7, 8, 9, 10], [11, 12, 13]]), ('partial-repair probe', [[1, 1, 1, 1, 4, 2, 2, 1, 2, 4, 4, 4], ['WS', 'L', 'R', 'WS', 'R', 'R', 'R', 'R', 'WS', 'WS', 'L', 'ON'], 1, [3, 5, 1, 3]], [[2, 1, 0], [7, 4, 5, 6, 3], [8], [9, 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]]), ('control layout', [[0, 0], ['R', 'L'], 1, [1, 1]], [[0], [1]]), ('control layout', [[1, 1], ['L', 'WS'], 0, [2]], [[0, 1]]), ('control layout', [[2, 2, 2, 2], ['R', 'L', 'WS', 'R'], 0, [2, 2]], [[0, 1], [2, 3]])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"9701b8d1c2dfc6681b0a45cb34713efbd5cfae8b6ac5d26ed2fe9fbdd90b4653","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def reorder(lv):\n        vis = list(range(len(lv)))\n        odd = [l for l in lv if l % 2 == 1]\n        if not odd:\n            return vis\n        for lev in range(max(lv), min(odd) - 1, -1):\n            i = 0\n            while i < len(vis):\n                if lv[vis[i]] >= lev:\n                    j = i\n                    while j < len(vis) and lv[vis[j]] >= lev:\n                        j += 1\n                    vis[i:j] = vis[i:j][::-1]\n                    i = j\n                else:\n                    i += 1\n        return vis\n    \n    levels, classes, para, line_lengths = x\n    out = []\n    start = 0\n    for ln in line_lengths:\n        idx = list(range(start, start + ln))\n        lv = [levels[i] for i in idx]\n        j = ln - 1\n        while j >= 0 and classes[idx[j]] == 'WS' and start + ln == len(levels):\n            lv[j] = para\n            j -= 1\n        local = reorder(lv)\n        out.append([idx[v] for v in local])\n        start += ln\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('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: trailing whitespace per line', [[2, 1, 2, 2, 2, 2], ['ON', 'WS', 'ON', 'WS', 'WS', 'R'], 0, [2, 2, 1, 1]], [[0, 1], [2, 3], [4], [5]]), ('regression: trailing whitespace per line', [[4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 1, 3], ['WS', 'R', 'L', 'ON', 'WS', 'WS', 'WS', 'L', 'ON', 'R', 'WS', 'L', 'R'], 1, [2, 5, 3, 1, 1, 1]], [[0, 1], [6, 5, 4, 2, 3], [7, 8, 9], [10], [11], [12]]), ('regression: trailing whitespace per line', [[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]]), ('control layout', [[1, 0, 0, 0, 0, 0, 0, 0, 0], ['R', 'R', 'WS', 'WS', 'WS', 'ON', 'R', 'WS', 'WS'], 0, [4, 1, 4]], [[0, 1, 2, 3], [4], [5, 6, 7, 8]]), ('control layout', [[3, 0], ['ON', 'WS'], 1, [1, 1]], [[0], [1]]), ('control layout', [[0, 3, 3], ['L', 'L', 'WS'], 0, [1, 2]], [[0], [1, 2]]), ('control layout', [[4, 4, 4, 4, 2, 2, 2], ['L', 'R', 'L', 'WS', 'R', 'R', 'R'], 1, [2, 5]], [[0, 1], [2, 3, 4, 5, 6]])], [('regression: trailing whitespace per line', [[2, 3, 0, 0, 3, 2, 2, 2, 1, 1, 1], ['L', 'WS', 'WS', 'WS', 'WS', 'ON', 'R', 'L', 'L', 'R', 'R'], 1, [4, 5, 1, 1]], [[3, 2, 1, 0], [8, 4, 5, 6, 7], [9], [10]]), ('regression: trailing whitespace per line', [[3, 2, 2, 2, 2, 1, 1, 1, 4, 4], ['R', 'WS', 'R', 'R', 'WS', 'WS', 'L', 'R', 'ON', 'L'], 1, [2, 3, 2, 2, 1]], [[1, 0], [4, 2, 3], [6, 5], [8, 7], [9]]), ('partial-repair probe', [[0, 0, 0, 0, 1, 1, 3, 2, 2, 2, 2, 0, 0], ['WS', 'WS', 'R', 'R', 'R', 'R', 'L', 'WS', 'ON', 'L', 'R', 'WS', 'R'], 0, [5, 4, 4]], [[0, 1, 2, 3, 4], [6, 7, 8, 5], [9, 10, 11, 12]]), ('partial-repair probe', [[2, 2, 1, 1, 1, 1, 2, 2], ['WS', 'L', 'R', 'WS', 'ON', 'L', 'WS', 'L'], 0, [5, 1, 2]], [[4, 3, 2, 0, 1], [5], [6, 7]]), ('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]]), ('control layout', [[2, 2, 2, 1, 2, 3, 3, 3, 2], ['L', 'ON', 'R', 'R', 'L', 'L', 'R', 'L', 'L'], 0, [5, 3, 1]], [[4, 3, 0, 1, 2], [7, 6, 5], [8]]), ('control layout', [[4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], ['WS', 'R', 'R', 'R', 'R', 'L', 'L', 'R', 'WS', 'WS', 'WS', 'WS', 'ON'], 1, [4, 2, 3, 1, 1, 1, 1]], [[3, 0, 1, 2], [5, 4], [8, 7, 6], [9], [10], [11], [12]]), ('control layout', [[1, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 1], ['L', 'L', 'ON', 'L', 'WS', 'L', 'WS', 'L', 'R', 'WS', 'WS', 'R'], 0, [4, 1, 5, 2]], [[1, 2, 3, 0], [4], [5, 6, 7, 8, 9], [11, 10]])], [('regression: trailing whitespace per line', [[4, 4, 4, 4, 3, 2, 2, 1], ['L', 'WS', 'R', 'L', 'WS', 'WS', 'WS', 'R'], 1, [3, 4, 1]], [[0, 1, 2], [6, 5, 4, 3], [7]]), ('regression: trailing whitespace per line', [[2, 2, 2, 2, 4, 4, 4, 3, 2, 2], ['WS', 'WS', 'WS', 'WS', 'L', 'WS', 'L', 'R', 'R', 'WS'], 1, [2, 2, 3, 2, 1]], [[1, 0], [3, 2], [4, 5, 6], [7, 8], [9]]), ('partial-repair probe', [[1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1], ['L', 'WS', 'ON', 'ON', 'WS', 'R', 'L', 'R', 'WS', 'L', 'WS'], 0, [3, 4, 1, 2, 1]], [[2, 1, 0], [6, 5, 4, 3], [7], [9, 8], [10]]), ('partial-repair probe', [[2, 2, 2, 2], ['L', 'R', 'ON', 'ON'], 1, [4]], [[0, 1, 2, 3]]), ('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]]), ('control layout', [[1, 1, 1, 1, 2], ['R', 'L', 'R', 'L', 'ON'], 1, [2, 1, 2]], [[1, 0], [2], [4, 3]]), ('control layout', [[4, 4, 4, 4, 2, 2, 2, 2, 2], ['L', 'WS', 'R', 'R', 'L', 'ON', 'R', 'R', 'R'], 1, [4, 4, 1]], [[0, 1, 2, 3], [4, 5, 6, 7], [8]]), ('control layout', [[4, 4, 4, 4, 4, 1, 1], ['L', 'ON', 'WS', 'L', 'WS', 'WS', 'WS'], 0, [5, 2]], [[0, 1, 2, 3, 4], [5, 6]])], [('regression: trailing whitespace per line', [[2, 2, 2, 2, 2, 2, 2, 2, 2], ['R', 'R', 'L', 'L', 'L', 'WS', 'WS', 'R', 'L'], 1, [3, 3, 1, 1, 1]], [[0, 1, 2], [5, 3, 4], [6], [7], [8]]), ('regression: trailing whitespace per line', [[4, 4, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1], ['R', 'WS', 'L', 'WS', 'WS', 'WS', 'L', 'WS', 'R', 'R', 'L', 'R'], 0, [4, 5, 2, 1]], [[2, 0, 1, 3], [8, 7, 6, 4, 5], [10, 9], [11]]), ('regression: trailing whitespace per line', [[1, 1, 1, 1, 3, 3, 3, 3], ['L', 'WS', 'ON', 'WS', 'WS', 'L', 'ON', 'R'], 0, [5, 3]], [[2, 1, 0, 3, 4], [7, 6, 5]]), ('partial-repair probe', [[3, 3, 1, 1, 1, 1, 4, 3, 1, 1, 4, 4, 4], ['WS', 'R', 'WS', 'WS', 'R', 'R', 'WS', 'L', 'WS', 'R', 'L', 'ON', 'WS'], 0, [5, 3, 5]], [[4, 3, 2, 1, 0], [7, 6, 5], [10, 11, 9, 8, 12]]), ('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]]), ('control layout', [[3, 3, 3, 3], ['L', 'ON', 'R', 'R'], 1, [3, 1]], [[2, 1, 0], [3]]), ('control layout', [[4, 1, 1, 3, 3, 2, 4, 2, 4, 4], ['R', 'R', 'WS', 'WS', 'L', 'WS', 'ON', 'L', 'L', 'L'], 1, [5, 3, 2]], [[4, 3, 2, 1, 0], [5, 6, 7], [8, 9]]), ('control layout', [[0, 0, 1, 1, 1, 2, 0], ['R', 'ON', 'R', 'R', 'R', 'WS', 'R'], 1, [3, 2, 1, 1]], [[0, 1, 2], [4, 3], [5], [6]])], [('regression: trailing whitespace per line', [[1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0], ['L', 'R', 'L', 'L', 'WS', 'L', 'R', 'ON', 'R', 'L', 'R', 'WS', 'L'], 1, [4, 4, 4, 1]], [[3, 2, 1, 0], [4, 5, 6, 7], [11, 10, 9, 8], [12]]), ('regression: trailing whitespace per line', [[1, 1, 4], ['R', 'WS', 'L'], 0, [2, 1]], [[0, 1], [2]]), ('regression: trailing whitespace per line', [[1, 1, 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 2, 2], ['WS', 'ON', 'WS', 'L', 'L', 'R', 'L', 'R', 'R', 'WS', 'L', 'ON', 'R', 'WS'], 0, [3, 3, 1, 4, 3]], [[1, 0, 2], [3, 4, 5], [6], [7, 8, 9, 10], [11, 12, 13]]), ('partial-repair probe', [[1, 1, 1, 1, 4, 2, 2, 1, 2, 4, 4, 4], ['WS', 'L', 'R', 'WS', 'R', 'R', 'R', 'R', 'WS', 'WS', 'L', 'ON'], 1, [3, 5, 1, 3]], [[2, 1, 0], [7, 4, 5, 6, 3], [8], [9, 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]]), ('control layout', [[0, 0], ['R', 'L'], 1, [1, 1]], [[0], [1]]), ('control layout', [[1, 1], ['L', 'WS'], 0, [2]], [[0, 1]]), ('control layout', [[2, 2, 2, 2], ['R', 'L', 'WS', 'R'], 0, [2, 2]], [[0, 1], [2, 3]])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-bidirectional-text-layout-per-line-reordering-trailing-whitespace-per-line","generated_at":"2026-09-29T14:49:56.357564+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","root_cause":"Trailing whitespace is reset only on the final line of the paragraph.","sha256":"8ba7c2f5bf05e72e02c184e83d9c37a6afe602cad6b68b75303b31765f03a847","title":"Per-line visual reordering: trailing whitespace per line · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.379,"exit_code":1,"observations":[{"actual":[[1,0,2],[5,4,3]],"check":"RTL run split across lines","expected":[[1,0,2],[5,4,3]],"passed":true},{"actual":[[0,1],[2,3],[4],[5]],"check":"regression: trailing whitespace per line","expected":[[0,1],[2,3],[4],[5]],"passed":true},{"actual":[[0,1],[6,5,4,3,2],[7,8,9],[10],[11],[12]],"check":"regression: trailing whitespace per line","expected":[[0,1],[6,5,4,2,3],[7,8,9],[10],[11],[12]],"passed":false},{"actual":[[3,2,1,0],[5,4],[6]],"check":"regression: trailing whitespace per line","expected":[[3,2,1,0],[4,5],[6]],"passed":false},{"actual":[[0,1,2,3],[4],[5,6,7,8]],"check":"control layout","expected":[[0,1,2,3],[4],[5,6,7,8]],"passed":true},{"actual":[[0],[1]],"check":"control layout","expected":[[0],[1]],"passed":true},{"actual":[[0],[1,2]],"check":"control layout","expected":[[0],[1,2]],"passed":true},{"actual":[[0,1],[2,3,4,5,6]],"check":"control layout","expected":[[0,1],[2,3,4,5,6]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"RTL run split across lines\", \"actual\": [[1, 0, 2], [5, 4, 3]], \"expected\": [[1, 0, 2], [5, 4, 3]], \"passed\": true}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[0, 1], [2, 3], [4], [5]], \"expected\": [[0, 1], [2, 3], [4], [5]], \"passed\": true}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[0, 1], [6, 5, 4, 3, 2], [7, 8, 9], [10], [11], [12]], \"expected\": [[0, 1], [6, 5, 4, 2, 3], [7, 8, 9], [10], [11], [12]], \"passed\": false}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[3, 2, 1, 0], [5, 4], [6]], \"expected\": [[3, 2, 1, 0], [4, 5], [6]], \"passed\": false}, {\"check\": \"control layout\", \"actual\": [[0, 1, 2, 3], [4], [5, 6, 7, 8]], \"expected\": [[0, 1, 2, 3], [4], [5, 6, 7, 8]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0], [1]], \"expected\": [[0], [1]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0], [1, 2]], \"expected\": [[0], [1, 2]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0, 1], [2, 3, 4, 5, 6]], \"expected\": [[0, 1], [2, 3, 4, 5, 6]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.554,"exit_code":1,"observations":[{"actual":[[2,1,0],[5,4,3]],"check":"RTL run split across lines","expected":[[1,0,2],[5,4,3]],"passed":false},{"actual":[[1,0],[2,3],[4],[5]],"check":"regression: trailing whitespace per line","expected":[[0,1],[2,3],[4],[5]],"passed":false},{"actual":[[0,1],[2,3,4,5,6],[7,8,9],[10],[11],[12]],"check":"regression: trailing whitespace per line","expected":[[0,1],[6,5,4,2,3],[7,8,9],[10],[11],[12]],"passed":false},{"actual":[[0,1,2,3],[4,5],[6]],"check":"regression: trailing whitespace per line","expected":[[3,2,1,0],[4,5],[6]],"passed":false},{"actual":[[0,1,2,3],[4],[5,6,7,8]],"check":"control layout","expected":[[0,1,2,3],[4],[5,6,7,8]],"passed":true},{"actual":[[0],[1]],"check":"control layout","expected":[[0],[1]],"passed":true},{"actual":[[0],[1,2]],"check":"control layout","expected":[[0],[1,2]],"passed":true},{"actual":[[0,1],[2,3,4,5,6]],"check":"control layout","expected":[[0,1],[2,3,4,5,6]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"RTL run split across lines\", \"actual\": [[2, 1, 0], [5, 4, 3]], \"expected\": [[1, 0, 2], [5, 4, 3]], \"passed\": false}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[1, 0], [2, 3], [4], [5]], \"expected\": [[0, 1], [2, 3], [4], [5]], \"passed\": false}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[0, 1], [2, 3, 4, 5, 6], [7, 8, 9], [10], [11], [12]], \"expected\": [[0, 1], [6, 5, 4, 2, 3], [7, 8, 9], [10], [11], [12]], \"passed\": false}, {\"check\": \"regression: trailing whitespace per line\", \"actual\": [[0, 1, 2, 3], [4, 5], [6]], \"expected\": [[3, 2, 1, 0], [4, 5], [6]], \"passed\": false}, {\"check\": \"control layout\", \"actual\": [[0, 1, 2, 3], [4], [5, 6, 7, 8]], \"expected\": [[0, 1, 2, 3], [4], [5, 6, 7, 8]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0], [1]], \"expected\": [[0], [1]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0], [1, 2]], \"expected\": [[0], [1, 2]], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [[0, 1], [2, 3, 4, 5, 6]], \"expected\": [[0, 1], [2, 3, 4, 5, 6]], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}