{"abstract":"Visual orders for later lines refer to the first line.","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":"Offsetting by the line length instead of the line start is still wrong.","family":"w2-bidirectional-text-layout-per-line-reordering-line-local-indices","id":"FA-80726","implementations":{"attempt":{"sha256":"8ad294efb4c308109bcfc72b82459432b2419fe1293eb62177085eb2a05e4907","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':\n            lv[j] = para\n            j -= 1\n        local = reorder(lv)\n        out.append([v + ln 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: 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]])]]\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":"c4e3f03e903d45a7656890d7e47e1d920f4a9d7b2113c7b1108926ecebe6d7e3","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':\n            lv[j] = para\n            j -= 1\n        local = reorder(lv)\n        out.append(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: 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]])]]\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-line-local-indices","generated_at":"2026-09-29T14:49:56.673593+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":"Line-local visual positions are returned without mapping back to paragraph indices.","sha256":"d8723aa1ce7d5589a839bea5e86f5cf27b94b8d0abf1f457b7a6916a9911e69f","title":"Per-line visual reordering: line-local indices · 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":42.155,"exit_code":1,"observations":[{"actual":[[4,3,5],[5,4,3]],"check":"RTL run split across lines","expected":[[1,0,2],[5,4,3]],"passed":false},{"actual":[[5,3,4],[3,2],[9,8,7,5,6],[3,2],[1],[1]],"check":"regression: line-local indices","expected":[[2,0,1],[4,3],[9,8,7,5,6],[11,10],[12],[13]],"passed":false},{"actual":[[2,3]],"check":"partial-repair probe","expected":[[0,1]],"passed":false},{"actual":[[4,5,3],[5,4,3],[2,3],[1],[1]],"check":"regression: line-local indices","expected":[[1,2,0],[5,4,3],[6,7],[8],[9]],"passed":false},{"actual":[[1],[1]],"check":"regression: line-local indices","expected":[[0],[1]],"passed":false},{"actual":[[7,4,5,6],[1],[9,8,7,6,5],[1]],"check":"regression: line-local indices","expected":[[3,0,1,2],[4],[9,8,7,6,5],[10]],"passed":false},{"actual":[[5,6,7,8,9],[1],[3,2]],"check":"regression: line-local indices","expected":[[0,1,2,3,4],[5],[7,6]],"passed":false},{"actual":[[3,2],[1]],"check":"regression: line-local indices","expected":[[1,0],[2]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"RTL run split across lines\", \"actual\": [[4, 3, 5], [5, 4, 3]], \"expected\": [[1, 0, 2], [5, 4, 3]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[5, 3, 4], [3, 2], [9, 8, 7, 5, 6], [3, 2], [1], [1]], \"expected\": [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [[2, 3]], \"expected\": [[0, 1]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[4, 5, 3], [5, 4, 3], [2, 3], [1], [1]], \"expected\": [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[1], [1]], \"expected\": [[0], [1]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[7, 4, 5, 6], [1], [9, 8, 7, 6, 5], [1]], \"expected\": [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[5, 6, 7, 8, 9], [1], [3, 2]], \"expected\": [[0, 1, 2, 3, 4], [5], [7, 6]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[3, 2], [1]], \"expected\": [[1, 0], [2]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.487,"exit_code":1,"observations":[{"actual":[[1,0,2],[2,1,0]],"check":"RTL run split across lines","expected":[[1,0,2],[5,4,3]],"passed":false},{"actual":[[2,0,1],[1,0],[4,3,2,0,1],[1,0],[0],[0]],"check":"regression: line-local indices","expected":[[2,0,1],[4,3],[9,8,7,5,6],[11,10],[12],[13]],"passed":false},{"actual":[[0,1]],"check":"partial-repair probe","expected":[[0,1]],"passed":true},{"actual":[[1,2,0],[2,1,0],[0,1],[0],[0]],"check":"regression: line-local indices","expected":[[1,2,0],[5,4,3],[6,7],[8],[9]],"passed":false},{"actual":[[0],[0]],"check":"regression: line-local indices","expected":[[0],[1]],"passed":false},{"actual":[[3,0,1,2],[0],[4,3,2,1,0],[0]],"check":"regression: line-local indices","expected":[[3,0,1,2],[4],[9,8,7,6,5],[10]],"passed":false},{"actual":[[0,1,2,3,4],[0],[1,0]],"check":"regression: line-local indices","expected":[[0,1,2,3,4],[5],[7,6]],"passed":false},{"actual":[[1,0],[0]],"check":"regression: line-local indices","expected":[[1,0],[2]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"RTL run split across lines\", \"actual\": [[1, 0, 2], [2, 1, 0]], \"expected\": [[1, 0, 2], [5, 4, 3]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[2, 0, 1], [1, 0], [4, 3, 2, 0, 1], [1, 0], [0], [0]], \"expected\": [[2, 0, 1], [4, 3], [9, 8, 7, 5, 6], [11, 10], [12], [13]], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [[0, 1]], \"expected\": [[0, 1]], \"passed\": true}, {\"check\": \"regression: line-local indices\", \"actual\": [[1, 2, 0], [2, 1, 0], [0, 1], [0], [0]], \"expected\": [[1, 2, 0], [5, 4, 3], [6, 7], [8], [9]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[0], [0]], \"expected\": [[0], [1]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[3, 0, 1, 2], [0], [4, 3, 2, 1, 0], [0]], \"expected\": [[3, 0, 1, 2], [4], [9, 8, 7, 6, 5], [10]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[0, 1, 2, 3, 4], [0], [1, 0]], \"expected\": [[0, 1, 2, 3, 4], [5], [7, 6]], \"passed\": false}, {\"check\": \"regression: line-local indices\", \"actual\": [[1, 0], [0]], \"expected\": [[1, 0], [2]], \"passed\": false}], \"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."}}