{"abstract":"Neutrals between Hebrew text and a number fall back to the embedding direction.","category":"Bidirectional text layout","checks":8,"contract":"Input [resolved weak classes, sos, eos, embedding level]. A maximal run of neutrals (ON, WS, B, S) takes the direction of its surrounding strong types when both sides agree (EN and AN count as R; sos/eos at the edges); otherwise the embedding direction (L for even level, R for odd). Return classes.","evaluation_group":"w2-bidirectional-text-layout-neutral-resolution","failed_approach":"Mapping EN to L is the opposite error.","family":"w2-bidirectional-text-layout-neutral-resolution-numbers-as-right-to-left-context","id":"FA-80416","implementations":{"attempt":{"sha256":"fb592f8b79508dc139a5cdf551f8f03816fad817d863509916be61ed0280fa1f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos, eos, level = x\n    t = list(types)\n    n = len(t)\n    NI = ('ON', 'WS', 'B', 'S')\n    e = 'L' if level % 2 == 0 else 'R'\n    def strong(c):\n        return 'L' if c == 'EN' else ('R' if c in ('R', 'AN') else c)\n    i = 0\n    while i < n:\n        if t[i] in NI:\n            j = i\n            while j < n and t[j] in NI:\n                j += 1\n            before = sos if i == 0 else strong(t[i - 1])\n            after = eos if j == n else strong(t[j])\n            fill = before if before == after else e\n            for k in range(i, j):\n                t[k] = fill\n            i = j\n        else:\n            i += 1\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('partial-repair probe', [['AN', 'EN', 'WS', 'L', 'R', 'WS', 'ON', 'AN', 'WS'], 'L', 'L', 1], ['AN', 'EN', 'R', 'L', 'R', 'R', 'R', 'AN', 'R']), ('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'WS', 'EN', 'AN', 'AN', 'EN'], 'L', 'L', 2], ['L', 'L', 'L', 'EN', 'AN', 'AN', 'EN']), ('control layout', [['AN', 'ON', 'B', 'WS', 'WS', 'L', 'R', 'EN', 'L'], 'R', 'R', 0], ['AN', 'L', 'L', 'L', 'L', 'L', 'R', 'EN', 'L'])], [('regression: numbers as right-to-left context', [['R', 'R', 'AN', 'WS', 'EN', 'R', 'EN', 'WS'], 'L', 'L', 0], ['R', 'R', 'AN', 'R', 'EN', 'R', 'EN', 'L']), ('regression: numbers as right-to-left context', [['AN', 'WS', 'ON', 'R', 'ON', 'EN', 'ON', 'L', 'S', 'R', 'AN'], 'L', 'L', 0], ['AN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'ON', 'WS', 'WS', 'WS', 'R', 'ON', 'EN', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'EN', 'R', 'R']), ('regression: numbers as right-to-left context', [['R', 'AN', 'ON', 'EN', 'L', 'ON', 'EN'], 'R', 'R', 0], ['R', 'AN', 'R', 'EN', 'L', 'L', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'R', 'S', 'WS', 'ON', 'L', 'R'], 'R', 'L', 1], ['R', 'R', 'R', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['S', 'L', 'ON', 'ON'], 'L', 'R', 0], ['L', 'L', 'L', 'L'])], [('regression: numbers as right-to-left context', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'R', 'R', 'ON', 'EN', 'ON', 'WS', 'WS', 'WS', 'EN', 'ON'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'EN', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('partial-repair probe', [['L', 'ON', 'ON', 'EN', 'EN', 'L', 'R', 'S', 'WS', 'WS', 'EN'], 'R', 'L', 3], ['L', 'R', 'R', 'EN', 'EN', 'L', 'R', 'R', 'R', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'ON', 'R', 'ON', 'AN', 'S', 'R'], 'L', 'L', 1], ['AN', 'R', 'R', 'R', 'AN', 'R', 'R']), ('control layout', [['WS', 'ON', 'L', 'WS', 'L', 'WS', 'S', 'ON', 'R', 'WS', 'S'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'L', 'L'])], [('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['R', 'EN', 'WS', 'R', 'AN', 'WS', 'WS', 'ON', 'R', 'AN'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'AN', 'R', 'R', 'R', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'R', 'WS', 'EN', 'AN', 'AN', 'ON', 'B', 'WS', 'R'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'AN', 'AN', 'R', 'R', 'R', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('control layout', [['WS', 'S', 'L', 'S', 'EN', 'R', 'S', 'AN', 'AN'], 'R', 'R', 2], ['L', 'L', 'L', 'L', 'EN', 'R', 'R', 'AN', 'AN']), ('control layout', [['WS', 'R', 'ON', 'S', 'L', 'WS', 'ON', 'WS', 'R'], 'R', 'L', 0], ['R', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'R'])], [('regression: numbers as right-to-left context', [['L', 'EN', 'WS', 'R', 'ON', 'R', 'EN', 'L', 'B', 'B'], 'L', 'L', 2], ['L', 'EN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'WS', 'R', 'ON', 'EN', 'R', 'WS', 'S'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'R', 'L', 'L']), ('partial-repair probe', [['EN', 'EN', 'ON', 'L', 'ON', 'L', 'WS', 'L'], 'L', 'L', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'R', 'ON', 'L'], 'R', 'R', 1], ['R', 'R', 'R', 'L']), ('control layout', [['WS', 'L', 'L', 'R', 'EN', 'EN', 'WS', 'ON', 'L'], 'R', 'L', 0], ['L', 'L', 'L', 'R', 'EN', 'EN', 'L', 'L', 'L'])]]\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":"e4b86900096ad83dce76f4070561c76d709ed8b97f57f06393fae077b2bb04a5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos, eos, level = x\n    t = list(types)\n    n = len(t)\n    NI = ('ON', 'WS', 'B', 'S')\n    e = 'L' if level % 2 == 0 else 'R'\n    def strong(c):\n        return 'R' if c in ('R', 'AN') else c\n    i = 0\n    while i < n:\n        if t[i] in NI:\n            j = i\n            while j < n and t[j] in NI:\n                j += 1\n            before = sos if i == 0 else strong(t[i - 1])\n            after = eos if j == n else strong(t[j])\n            fill = before if before == after else e\n            for k in range(i, j):\n                t[k] = fill\n            i = j\n        else:\n            i += 1\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('partial-repair probe', [['AN', 'EN', 'WS', 'L', 'R', 'WS', 'ON', 'AN', 'WS'], 'L', 'L', 1], ['AN', 'EN', 'R', 'L', 'R', 'R', 'R', 'AN', 'R']), ('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'WS', 'EN', 'AN', 'AN', 'EN'], 'L', 'L', 2], ['L', 'L', 'L', 'EN', 'AN', 'AN', 'EN']), ('control layout', [['AN', 'ON', 'B', 'WS', 'WS', 'L', 'R', 'EN', 'L'], 'R', 'R', 0], ['AN', 'L', 'L', 'L', 'L', 'L', 'R', 'EN', 'L'])], [('regression: numbers as right-to-left context', [['R', 'R', 'AN', 'WS', 'EN', 'R', 'EN', 'WS'], 'L', 'L', 0], ['R', 'R', 'AN', 'R', 'EN', 'R', 'EN', 'L']), ('regression: numbers as right-to-left context', [['AN', 'WS', 'ON', 'R', 'ON', 'EN', 'ON', 'L', 'S', 'R', 'AN'], 'L', 'L', 0], ['AN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'ON', 'WS', 'WS', 'WS', 'R', 'ON', 'EN', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'EN', 'R', 'R']), ('regression: numbers as right-to-left context', [['R', 'AN', 'ON', 'EN', 'L', 'ON', 'EN'], 'R', 'R', 0], ['R', 'AN', 'R', 'EN', 'L', 'L', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'R', 'S', 'WS', 'ON', 'L', 'R'], 'R', 'L', 1], ['R', 'R', 'R', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['S', 'L', 'ON', 'ON'], 'L', 'R', 0], ['L', 'L', 'L', 'L'])], [('regression: numbers as right-to-left context', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'R', 'R', 'ON', 'EN', 'ON', 'WS', 'WS', 'WS', 'EN', 'ON'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'EN', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('partial-repair probe', [['L', 'ON', 'ON', 'EN', 'EN', 'L', 'R', 'S', 'WS', 'WS', 'EN'], 'R', 'L', 3], ['L', 'R', 'R', 'EN', 'EN', 'L', 'R', 'R', 'R', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'ON', 'R', 'ON', 'AN', 'S', 'R'], 'L', 'L', 1], ['AN', 'R', 'R', 'R', 'AN', 'R', 'R']), ('control layout', [['WS', 'ON', 'L', 'WS', 'L', 'WS', 'S', 'ON', 'R', 'WS', 'S'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'L', 'L'])], [('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['R', 'EN', 'WS', 'R', 'AN', 'WS', 'WS', 'ON', 'R', 'AN'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'AN', 'R', 'R', 'R', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'R', 'WS', 'EN', 'AN', 'AN', 'ON', 'B', 'WS', 'R'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'AN', 'AN', 'R', 'R', 'R', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('control layout', [['WS', 'S', 'L', 'S', 'EN', 'R', 'S', 'AN', 'AN'], 'R', 'R', 2], ['L', 'L', 'L', 'L', 'EN', 'R', 'R', 'AN', 'AN']), ('control layout', [['WS', 'R', 'ON', 'S', 'L', 'WS', 'ON', 'WS', 'R'], 'R', 'L', 0], ['R', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'R'])], [('regression: numbers as right-to-left context', [['L', 'EN', 'WS', 'R', 'ON', 'R', 'EN', 'L', 'B', 'B'], 'L', 'L', 2], ['L', 'EN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'WS', 'R', 'ON', 'EN', 'R', 'WS', 'S'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'R', 'L', 'L']), ('partial-repair probe', [['EN', 'EN', 'ON', 'L', 'ON', 'L', 'WS', 'L'], 'L', 'L', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'R', 'ON', 'L'], 'R', 'R', 1], ['R', 'R', 'R', 'L']), ('control layout', [['WS', 'L', 'L', 'R', 'EN', 'EN', 'WS', 'ON', 'L'], 'R', 'L', 0], ['L', 'L', 'L', 'R', 'EN', 'EN', 'L', 'L', 'L'])]]\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"},"fixed":{"sha256":"0a7c6a279dd7cb7d70690967bb9e408f9418d1c3ed6caacf39bbab1d245a7d1e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos, eos, level = x\n    t = list(types)\n    n = len(t)\n    NI = ('ON', 'WS', 'B', 'S')\n    e = 'L' if level % 2 == 0 else 'R'\n    def strong(c):\n        return 'R' if c in ('R', 'EN', 'AN') else c\n    i = 0\n    while i < n:\n        if t[i] in NI:\n            j = i\n            while j < n and t[j] in NI:\n                j += 1\n            before = sos if i == 0 else strong(t[i - 1])\n            after = eos if j == n else strong(t[j])\n            fill = before if before == after else e\n            for k in range(i, j):\n                t[k] = fill\n            i = j\n        else:\n            i += 1\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('partial-repair probe', [['AN', 'EN', 'WS', 'L', 'R', 'WS', 'ON', 'AN', 'WS'], 'L', 'L', 1], ['AN', 'EN', 'R', 'L', 'R', 'R', 'R', 'AN', 'R']), ('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'WS', 'EN', 'AN', 'AN', 'EN'], 'L', 'L', 2], ['L', 'L', 'L', 'EN', 'AN', 'AN', 'EN']), ('control layout', [['AN', 'ON', 'B', 'WS', 'WS', 'L', 'R', 'EN', 'L'], 'R', 'R', 0], ['AN', 'L', 'L', 'L', 'L', 'L', 'R', 'EN', 'L'])], [('regression: numbers as right-to-left context', [['R', 'R', 'AN', 'WS', 'EN', 'R', 'EN', 'WS'], 'L', 'L', 0], ['R', 'R', 'AN', 'R', 'EN', 'R', 'EN', 'L']), ('regression: numbers as right-to-left context', [['AN', 'WS', 'ON', 'R', 'ON', 'EN', 'ON', 'L', 'S', 'R', 'AN'], 'L', 'L', 0], ['AN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'ON', 'WS', 'WS', 'WS', 'R', 'ON', 'EN', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'EN', 'R', 'R']), ('regression: numbers as right-to-left context', [['R', 'AN', 'ON', 'EN', 'L', 'ON', 'EN'], 'R', 'R', 0], ['R', 'AN', 'R', 'EN', 'L', 'L', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['S', 'WS', 'R', 'S', 'WS', 'ON', 'L', 'R'], 'R', 'L', 1], ['R', 'R', 'R', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['S', 'L', 'ON', 'ON'], 'L', 'R', 0], ['L', 'L', 'L', 'L'])], [('regression: numbers as right-to-left context', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'R', 'R', 'ON', 'EN', 'ON', 'WS', 'WS', 'WS', 'EN', 'ON'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'EN', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('partial-repair probe', [['L', 'ON', 'ON', 'EN', 'EN', 'L', 'R', 'S', 'WS', 'WS', 'EN'], 'R', 'L', 3], ['L', 'R', 'R', 'EN', 'EN', 'L', 'R', 'R', 'R', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'ON', 'R', 'ON', 'AN', 'S', 'R'], 'L', 'L', 1], ['AN', 'R', 'R', 'R', 'AN', 'R', 'R']), ('control layout', [['WS', 'ON', 'L', 'WS', 'L', 'WS', 'S', 'ON', 'R', 'WS', 'S'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'L', 'L'])], [('regression: numbers as right-to-left context', [['R', 'WS', 'EN', 'EN', 'L', 'WS', 'ON'], 'R', 'R', 2], ['R', 'R', 'EN', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['R', 'EN', 'WS', 'R', 'AN', 'WS', 'WS', 'ON', 'R', 'AN'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'AN', 'R', 'R', 'R', 'R', 'AN']), ('regression: numbers as right-to-left context', [['R', 'ON', 'R', 'WS', 'EN', 'AN', 'AN', 'ON', 'B', 'WS', 'R'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'AN', 'AN', 'R', 'R', 'R', 'R']), ('regression: numbers as right-to-left context', [['AN', 'B', 'EN', 'R', 'EN', 'EN', 'ON', 'AN', 'EN'], 'L', 'L', 2], ['AN', 'R', 'EN', 'R', 'EN', 'EN', 'R', 'AN', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('control layout', [['WS', 'S', 'L', 'S', 'EN', 'R', 'S', 'AN', 'AN'], 'R', 'R', 2], ['L', 'L', 'L', 'L', 'EN', 'R', 'R', 'AN', 'AN']), ('control layout', [['WS', 'R', 'ON', 'S', 'L', 'WS', 'ON', 'WS', 'R'], 'R', 'L', 0], ['R', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'R'])], [('regression: numbers as right-to-left context', [['L', 'EN', 'WS', 'R', 'ON', 'R', 'EN', 'L', 'B', 'B'], 'L', 'L', 2], ['L', 'EN', 'R', 'R', 'R', 'R', 'EN', 'L', 'L', 'L']), ('regression: numbers as right-to-left context', [['AN', 'ON', 'EN', 'R', 'L', 'S', 'AN', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['AN', 'R', 'EN', 'R', 'L', 'L', 'AN', 'AN', 'AN', 'L', 'L']), ('regression: numbers as right-to-left context', [['ON', 'WS', 'R', 'ON', 'EN', 'R', 'WS', 'S'], 'R', 'L', 2], ['R', 'R', 'R', 'R', 'EN', 'R', 'L', 'L']), ('partial-repair probe', [['EN', 'EN', 'ON', 'L', 'ON', 'L', 'WS', 'L'], 'L', 'L', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'R', 'ON', 'L'], 'R', 'R', 1], ['R', 'R', 'R', 'L']), ('control layout', [['WS', 'L', 'L', 'R', 'EN', 'EN', 'WS', 'ON', 'L'], 'R', 'L', 0], ['L', 'L', 'L', 'R', 'EN', 'EN', 'L', 'L', 'L'])]]\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-neutral-resolution-numbers-as-right-to-left-context","generated_at":"2026-09-29T14:49:53.567088+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.","repair":"Treat EN and AN as R for neutral resolution.","root_cause":"European numbers are not mapped to R when used as neutral context.","sha256":"79e2be9c8795f2842de7aa18213ac236eade66448ddf620959c3ad8707aa8d77","title":"Neutral run resolution: numbers as right-to-left context · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.574,"exit_code":1,"observations":[{"actual":["R","L","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":false},{"actual":["AN","L","EN","R","L","L","AN","AN","AN","L","L"],"check":"regression: numbers as right-to-left context","expected":["AN","R","EN","R","L","L","AN","AN","AN","L","L"],"passed":false},{"actual":["AN","EN","L","L","R","R","R","AN","R"],"check":"partial-repair probe","expected":["AN","EN","R","L","R","R","R","AN","R"],"passed":false},{"actual":["R","L","EN","EN","L","L","L"],"check":"regression: numbers as right-to-left context","expected":["R","R","EN","EN","L","L","L"],"passed":false},{"actual":["R","R","R","R","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":true},{"actual":["L","L"],"check":"trailing neutral uses eos","expected":["L","L"],"passed":true},{"actual":["L","L","L","EN","AN","AN","EN"],"check":"control layout","expected":["L","L","L","EN","AN","AN","EN"],"passed":true},{"actual":["AN","L","L","L","L","L","R","EN","L"],"check":"control layout","expected":["AN","L","L","L","L","L","R","EN","L"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"L\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": false}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"AN\", \"L\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"expected\": [\"AN\", \"R\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"AN\", \"EN\", \"L\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"expected\": [\"AN\", \"EN\", \"R\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"passed\": false}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"R\", \"L\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"R\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": true}, {\"check\": \"trailing neutral uses eos\", \"actual\": [\"L\", \"L\"], \"expected\": [\"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"expected\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"expected\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.207,"exit_code":1,"observations":[{"actual":["R","L","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":false},{"actual":["AN","L","EN","R","L","L","AN","AN","AN","L","L"],"check":"regression: numbers as right-to-left context","expected":["AN","R","EN","R","L","L","AN","AN","AN","L","L"],"passed":false},{"actual":["AN","EN","R","L","R","R","R","AN","R"],"check":"partial-repair probe","expected":["AN","EN","R","L","R","R","R","AN","R"],"passed":true},{"actual":["R","L","EN","EN","L","L","L"],"check":"regression: numbers as right-to-left context","expected":["R","R","EN","EN","L","L","L"],"passed":false},{"actual":["R","R","R","R","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":true},{"actual":["L","L"],"check":"trailing neutral uses eos","expected":["L","L"],"passed":true},{"actual":["L","L","L","EN","AN","AN","EN"],"check":"control layout","expected":["L","L","L","EN","AN","AN","EN"],"passed":true},{"actual":["AN","L","L","L","L","L","R","EN","L"],"check":"control layout","expected":["AN","L","L","L","L","L","R","EN","L"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"L\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": false}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"AN\", \"L\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"expected\": [\"AN\", \"R\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"AN\", \"EN\", \"R\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"expected\": [\"AN\", \"EN\", \"R\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"passed\": true}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"R\", \"L\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"R\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": true}, {\"check\": \"trailing neutral uses eos\", \"actual\": [\"L\", \"L\"], \"expected\": [\"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"expected\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"expected\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.143,"exit_code":0,"observations":[{"actual":["R","R","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":true},{"actual":["AN","R","EN","R","L","L","AN","AN","AN","L","L"],"check":"regression: numbers as right-to-left context","expected":["AN","R","EN","R","L","L","AN","AN","AN","L","L"],"passed":true},{"actual":["AN","EN","R","L","R","R","R","AN","R"],"check":"partial-repair probe","expected":["AN","EN","R","L","R","R","R","AN","R"],"passed":true},{"actual":["R","R","EN","EN","L","L","L"],"check":"regression: numbers as right-to-left context","expected":["R","R","EN","EN","L","L","L"],"passed":true},{"actual":["R","R","R","R","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":true},{"actual":["L","L"],"check":"trailing neutral uses eos","expected":["L","L"],"passed":true},{"actual":["L","L","L","EN","AN","AN","EN"],"check":"control layout","expected":["L","L","L","EN","AN","AN","EN"],"passed":true},{"actual":["AN","L","L","L","L","L","R","EN","L"],"check":"control layout","expected":["AN","L","L","L","L","L","R","EN","L"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"R\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": true}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"AN\", \"R\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"expected\": [\"AN\", \"R\", \"EN\", \"R\", \"L\", \"L\", \"AN\", \"AN\", \"AN\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"AN\", \"EN\", \"R\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"expected\": [\"AN\", \"EN\", \"R\", \"L\", \"R\", \"R\", \"R\", \"AN\", \"R\"], \"passed\": true}, {\"check\": \"regression: numbers as right-to-left context\", \"actual\": [\"R\", \"R\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"R\", \"EN\", \"EN\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": true}, {\"check\": \"trailing neutral uses eos\", \"actual\": [\"L\", \"L\"], \"expected\": [\"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"expected\": [\"L\", \"L\", \"L\", \"EN\", \"AN\", \"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"expected\": [\"AN\", \"L\", \"L\", \"L\", \"L\", \"L\", \"R\", \"EN\", \"L\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}