{"abstract":"Unresolvable neutrals take the opposite of 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":"Treating only level 0 as LTR breaks level 2 embeddings.","family":"w2-bidirectional-text-layout-neutral-resolution-embedding-direction-parity","id":"FA-80421","implementations":{"attempt":{"sha256":"1acb4e04951f4e20b451379785cbe15ef7eb37a6e614899c946fb66766d009fc","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 == 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 = [[('regression: embedding direction parity', [['R', 'ON', 'L', 'WS', 'WS', 'R', 'L', 'L', 'WS'], 'R', 'L', 0], ['R', 'L', 'L', 'L', 'L', 'R', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'L', 'AN', 'ON', 'L', 'L', 'ON'], 'R', 'R', 0], ['EN', 'L', 'AN', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['R', 'L'], 'R', 'R', 3], ['R', 'L']), ('control layout', [['EN', 'R', 'EN', 'R'], 'L', 'L', 3], ['EN', 'R', 'EN', 'R'])], [('regression: embedding direction parity', [['EN', 'EN', 'ON', 'L', 'S', 'L', 'WS', 'R', 'R', 'ON', 'L'], 'R', 'R', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'L']), ('regression: embedding direction parity', [['S', 'S', 'R', 'R', 'R', 'ON', 'AN', 'L', 'S'], 'L', 'L', 3], ['R', 'R', 'R', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['L', 'L'], 'L', 'R', 0], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN', 'L', 'R', 'L', 'R', 'ON', 'AN', 'L'], 'R', 'R', 3], ['R', 'R', 'EN', 'L', 'R', 'L', 'R', 'R', 'AN', 'L'])], [('regression: embedding direction parity', [['WS', 'EN', 'L', 'WS', 'ON', 'WS'], 'L', 'R', 3], ['R', 'EN', 'L', 'R', 'R', 'R']), ('regression: embedding direction parity', [['EN', 'AN', 'WS', 'L', 'ON', 'R'], 'L', 'L', 1], ['EN', 'AN', 'R', 'L', 'R', 'R']), ('regression: embedding direction parity', [['ON', 'AN', 'R', 'R'], 'L', 'L', 2], ['L', 'AN', 'R', 'R']), ('regression: embedding direction parity', [['WS', 'R'], 'L', 'L', 2], ['L', 'R']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'AN', 'ON', 'R'], 'L', 'L', 1], ['AN', 'AN', 'R', 'R']), ('control layout', [['ON', 'WS', 'B', 'ON', 'L', 'R', 'AN', 'L', 'EN', 'WS'], 'L', 'R', 1], ['L', 'L', 'L', 'L', 'L', 'R', 'AN', 'L', 'EN', 'R'])], [('regression: embedding direction parity', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: embedding direction parity', [['L', 'L', 'WS', 'WS', 'S', 'R', 'R', 'WS', 'AN', 'WS', 'L'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['AN', 'B', 'S'], 'R', 'L', 2], ['AN', 'L', 'L']), ('regression: embedding direction parity', [['WS', 'WS', 'B', 'R', 'R', 'EN', 'S', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'R', 'R', 'EN', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN'], 'R', 'R', 1], ['R', 'R', 'EN']), ('control layout', [['AN', 'L'], 'L', 'R', 1], ['AN', 'L'])], [('regression: embedding direction parity', [['B', 'R', 'ON', 'L', 'AN', 'AN', 'WS'], 'L', 'R', 1], ['R', 'R', 'R', 'L', 'AN', 'AN', 'R']), ('regression: embedding direction parity', [['WS', 'EN', 'R', 'WS', 'L', 'EN', 'R'], 'L', 'L', 2], ['L', 'EN', 'R', 'L', 'L', 'EN', 'R']), ('regression: embedding direction parity', [['B', 'L', 'ON', 'ON', 'AN', 'AN', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'L', 'AN', 'AN', 'EN']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['R', 'L', 'ON', 'WS', 'L', 'L', 'R', 'WS', 'WS'], 'L', 'R', 2], ['R', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('control layout', [['R', 'EN', 'ON', 'AN'], 'L', 'L', 3], ['R', 'EN', 'R', 'AN'])]]\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":"e7c23fac6280faf34d13d70ea16ab723705ec1b687e0770edeedf87db3b904b4","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 == 1 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 = [[('regression: embedding direction parity', [['R', 'ON', 'L', 'WS', 'WS', 'R', 'L', 'L', 'WS'], 'R', 'L', 0], ['R', 'L', 'L', 'L', 'L', 'R', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'L', 'AN', 'ON', 'L', 'L', 'ON'], 'R', 'R', 0], ['EN', 'L', 'AN', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['R', 'L'], 'R', 'R', 3], ['R', 'L']), ('control layout', [['EN', 'R', 'EN', 'R'], 'L', 'L', 3], ['EN', 'R', 'EN', 'R'])], [('regression: embedding direction parity', [['EN', 'EN', 'ON', 'L', 'S', 'L', 'WS', 'R', 'R', 'ON', 'L'], 'R', 'R', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'L']), ('regression: embedding direction parity', [['S', 'S', 'R', 'R', 'R', 'ON', 'AN', 'L', 'S'], 'L', 'L', 3], ['R', 'R', 'R', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['L', 'L'], 'L', 'R', 0], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN', 'L', 'R', 'L', 'R', 'ON', 'AN', 'L'], 'R', 'R', 3], ['R', 'R', 'EN', 'L', 'R', 'L', 'R', 'R', 'AN', 'L'])], [('regression: embedding direction parity', [['WS', 'EN', 'L', 'WS', 'ON', 'WS'], 'L', 'R', 3], ['R', 'EN', 'L', 'R', 'R', 'R']), ('regression: embedding direction parity', [['EN', 'AN', 'WS', 'L', 'ON', 'R'], 'L', 'L', 1], ['EN', 'AN', 'R', 'L', 'R', 'R']), ('regression: embedding direction parity', [['ON', 'AN', 'R', 'R'], 'L', 'L', 2], ['L', 'AN', 'R', 'R']), ('regression: embedding direction parity', [['WS', 'R'], 'L', 'L', 2], ['L', 'R']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'AN', 'ON', 'R'], 'L', 'L', 1], ['AN', 'AN', 'R', 'R']), ('control layout', [['ON', 'WS', 'B', 'ON', 'L', 'R', 'AN', 'L', 'EN', 'WS'], 'L', 'R', 1], ['L', 'L', 'L', 'L', 'L', 'R', 'AN', 'L', 'EN', 'R'])], [('regression: embedding direction parity', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: embedding direction parity', [['L', 'L', 'WS', 'WS', 'S', 'R', 'R', 'WS', 'AN', 'WS', 'L'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['AN', 'B', 'S'], 'R', 'L', 2], ['AN', 'L', 'L']), ('regression: embedding direction parity', [['WS', 'WS', 'B', 'R', 'R', 'EN', 'S', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'R', 'R', 'EN', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN'], 'R', 'R', 1], ['R', 'R', 'EN']), ('control layout', [['AN', 'L'], 'L', 'R', 1], ['AN', 'L'])], [('regression: embedding direction parity', [['B', 'R', 'ON', 'L', 'AN', 'AN', 'WS'], 'L', 'R', 1], ['R', 'R', 'R', 'L', 'AN', 'AN', 'R']), ('regression: embedding direction parity', [['WS', 'EN', 'R', 'WS', 'L', 'EN', 'R'], 'L', 'L', 2], ['L', 'EN', 'R', 'L', 'L', 'EN', 'R']), ('regression: embedding direction parity', [['B', 'L', 'ON', 'ON', 'AN', 'AN', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'L', 'AN', 'AN', 'EN']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['R', 'L', 'ON', 'WS', 'L', 'L', 'R', 'WS', 'WS'], 'L', 'R', 2], ['R', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('control layout', [['R', 'EN', 'ON', 'AN'], 'L', 'L', 3], ['R', 'EN', 'R', 'AN'])]]\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":"6f203b93dc1711a1aa2d934b4ac4f9dc3b838ec4b95b3f8a6f63477644fa2fa3","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 = [[('regression: embedding direction parity', [['R', 'ON', 'L', 'WS', 'WS', 'R', 'L', 'L', 'WS'], 'R', 'L', 0], ['R', 'L', 'L', 'L', 'L', 'R', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'L', 'AN', 'ON', 'L', 'L', 'ON'], 'R', 'R', 0], ['EN', 'L', 'AN', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['R', 'L'], 'R', 'R', 3], ['R', 'L']), ('control layout', [['EN', 'R', 'EN', 'R'], 'L', 'L', 3], ['EN', 'R', 'EN', 'R'])], [('regression: embedding direction parity', [['EN', 'EN', 'ON', 'L', 'S', 'L', 'WS', 'R', 'R', 'ON', 'L'], 'R', 'R', 3], ['EN', 'EN', 'R', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'L']), ('regression: embedding direction parity', [['S', 'S', 'R', 'R', 'R', 'ON', 'AN', 'L', 'S'], 'L', 'L', 3], ['R', 'R', 'R', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: embedding direction parity', [['ON', 'L', 'R', 'WS', 'AN', 'ON', 'WS', 'L', 'AN'], 'R', 'R', 2], ['L', 'L', 'R', 'R', 'AN', 'L', 'L', 'L', 'AN']), ('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', [['L', 'L'], 'L', 'R', 0], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN', 'L', 'R', 'L', 'R', 'ON', 'AN', 'L'], 'R', 'R', 3], ['R', 'R', 'EN', 'L', 'R', 'L', 'R', 'R', 'AN', 'L'])], [('regression: embedding direction parity', [['WS', 'EN', 'L', 'WS', 'ON', 'WS'], 'L', 'R', 3], ['R', 'EN', 'L', 'R', 'R', 'R']), ('regression: embedding direction parity', [['EN', 'AN', 'WS', 'L', 'ON', 'R'], 'L', 'L', 1], ['EN', 'AN', 'R', 'L', 'R', 'R']), ('regression: embedding direction parity', [['ON', 'AN', 'R', 'R'], 'L', 'L', 2], ['L', 'AN', 'R', 'R']), ('regression: embedding direction parity', [['WS', 'R'], 'L', 'L', 2], ['L', 'R']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['AN', 'AN', 'ON', 'R'], 'L', 'L', 1], ['AN', 'AN', 'R', 'R']), ('control layout', [['ON', 'WS', 'B', 'ON', 'L', 'R', 'AN', 'L', 'EN', 'WS'], 'L', 'R', 1], ['L', 'L', 'L', 'L', 'L', 'R', 'AN', 'L', 'EN', 'R'])], [('regression: embedding direction parity', [['AN', 'R', 'ON', 'B', 'EN', 'EN', 'EN', 'R', 'ON', 'L'], 'R', 'R', 0], ['AN', 'R', 'R', 'R', 'EN', 'EN', 'EN', 'R', 'L', 'L']), ('regression: embedding direction parity', [['L', 'L', 'WS', 'WS', 'S', 'R', 'R', 'WS', 'AN', 'WS', 'L'], 'R', 'L', 2], ['L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'AN', 'L', 'L']), ('regression: embedding direction parity', [['AN', 'B', 'S'], 'R', 'L', 2], ['AN', 'L', 'L']), ('regression: embedding direction parity', [['WS', 'WS', 'B', 'R', 'R', 'EN', 'S', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'R', 'R', 'EN', 'R', 'EN']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('trailing neutral uses eos', [['L', 'WS'], 'L', 'L', 1], ['L', 'L']), ('control layout', [['ON', 'WS', 'EN'], 'R', 'R', 1], ['R', 'R', 'EN']), ('control layout', [['AN', 'L'], 'L', 'R', 1], ['AN', 'L'])], [('regression: embedding direction parity', [['B', 'R', 'ON', 'L', 'AN', 'AN', 'WS'], 'L', 'R', 1], ['R', 'R', 'R', 'L', 'AN', 'AN', 'R']), ('regression: embedding direction parity', [['WS', 'EN', 'R', 'WS', 'L', 'EN', 'R'], 'L', 'L', 2], ['L', 'EN', 'R', 'L', 'L', 'EN', 'R']), ('regression: embedding direction parity', [['B', 'L', 'ON', 'ON', 'AN', 'AN', 'EN'], 'L', 'R', 2], ['L', 'L', 'L', 'L', 'AN', 'AN', 'EN']), ('regression: embedding direction parity', [['EN', 'R', 'ON', 'ON', 'WS', 'ON', 'WS', 'L', 'WS'], 'L', 'R', 2], ['EN', 'R', 'L', 'L', 'L', 'L', 'L', 'L', 'L']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('leading neutral uses sos', [['WS', 'R'], 'R', 'L', 0], ['R', 'R']), ('control layout', [['R', 'L', 'ON', 'WS', 'L', 'L', 'R', 'WS', 'WS'], 'L', 'R', 2], ['R', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('control layout', [['R', 'EN', 'ON', 'AN'], 'L', 'L', 3], ['R', 'EN', 'R', 'AN'])]]\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-embedding-direction-parity","generated_at":"2026-09-29T14:49:53.572409+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":"Even embedding levels are left-to-right.","root_cause":"Even levels are mapped to R.","sha256":"853260f1afc855c87544d0892bc3ebd79c8bf92ba80e3451c7c7317c06e455b7","title":"Neutral run resolution: embedding direction parity · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.381,"exit_code":1,"observations":[{"actual":["R","L","L","L","L","R","L","L","L"],"check":"regression: embedding direction parity","expected":["R","L","L","L","L","R","L","L","L"],"passed":true},{"actual":["EN","L","AN","L","L","L","L"],"check":"regression: embedding direction parity","expected":["EN","L","AN","L","L","L","L"],"passed":true},{"actual":["EN","R","R","R","R","R","R","L","R"],"check":"regression: embedding direction parity","expected":["EN","R","L","L","L","L","L","L","L"],"passed":false},{"actual":["R","L","R","R","AN","R","R","L","AN"],"check":"regression: embedding direction parity","expected":["L","L","R","R","AN","L","L","L","AN"],"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":["R","L"],"check":"control layout","expected":["R","L"],"passed":true},{"actual":["EN","R","EN","R"],"check":"control layout","expected":["EN","R","EN","R"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: embedding direction parity\", \"actual\": [\"R\", \"L\", \"L\", \"L\", \"L\", \"R\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"L\", \"L\", \"R\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"L\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"expected\": [\"EN\", \"L\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"R\", \"R\", \"R\", \"R\", \"R\", \"R\", \"L\", \"R\"], \"expected\": [\"EN\", \"R\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"R\", \"L\", \"R\", \"R\", \"AN\", \"R\", \"R\", \"L\", \"AN\"], \"expected\": [\"L\", \"L\", \"R\", \"R\", \"AN\", \"L\", \"L\", \"L\", \"AN\"], \"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\": [\"R\", \"L\"], \"expected\": [\"R\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"EN\", \"R\", \"EN\", \"R\"], \"expected\": [\"EN\", \"R\", \"EN\", \"R\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.872,"exit_code":1,"observations":[{"actual":["R","R","L","R","R","R","L","L","L"],"check":"regression: embedding direction parity","expected":["R","L","L","L","L","R","L","L","L"],"passed":false},{"actual":["EN","L","AN","R","L","L","R"],"check":"regression: embedding direction parity","expected":["EN","L","AN","L","L","L","L"],"passed":false},{"actual":["EN","R","R","R","R","R","R","L","R"],"check":"regression: embedding direction parity","expected":["EN","R","L","L","L","L","L","L","L"],"passed":false},{"actual":["R","L","R","R","AN","R","R","L","AN"],"check":"regression: embedding direction parity","expected":["L","L","R","R","AN","L","L","L","AN"],"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":["R","L"],"check":"control layout","expected":["R","L"],"passed":true},{"actual":["EN","R","EN","R"],"check":"control layout","expected":["EN","R","EN","R"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: embedding direction parity\", \"actual\": [\"R\", \"R\", \"L\", \"R\", \"R\", \"R\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"L\", \"L\", \"R\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"R\"], \"expected\": [\"EN\", \"L\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"R\", \"R\", \"R\", \"R\", \"R\", \"R\", \"L\", \"R\"], \"expected\": [\"EN\", \"R\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"R\", \"L\", \"R\", \"R\", \"AN\", \"R\", \"R\", \"L\", \"AN\"], \"expected\": [\"L\", \"L\", \"R\", \"R\", \"AN\", \"L\", \"L\", \"L\", \"AN\"], \"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\": [\"R\", \"L\"], \"expected\": [\"R\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"EN\", \"R\", \"EN\", \"R\"], \"expected\": [\"EN\", \"R\", \"EN\", \"R\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.399,"exit_code":0,"observations":[{"actual":["R","L","L","L","L","R","L","L","L"],"check":"regression: embedding direction parity","expected":["R","L","L","L","L","R","L","L","L"],"passed":true},{"actual":["EN","L","AN","L","L","L","L"],"check":"regression: embedding direction parity","expected":["EN","L","AN","L","L","L","L"],"passed":true},{"actual":["EN","R","L","L","L","L","L","L","L"],"check":"regression: embedding direction parity","expected":["EN","R","L","L","L","L","L","L","L"],"passed":true},{"actual":["L","L","R","R","AN","L","L","L","AN"],"check":"regression: embedding direction parity","expected":["L","L","R","R","AN","L","L","L","AN"],"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":["R","L"],"check":"control layout","expected":["R","L"],"passed":true},{"actual":["EN","R","EN","R"],"check":"control layout","expected":["EN","R","EN","R"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: embedding direction parity\", \"actual\": [\"R\", \"L\", \"L\", \"L\", \"L\", \"R\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"L\", \"L\", \"R\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"L\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"expected\": [\"EN\", \"L\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"EN\", \"R\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\"], \"expected\": [\"EN\", \"R\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: embedding direction parity\", \"actual\": [\"L\", \"L\", \"R\", \"R\", \"AN\", \"L\", \"L\", \"L\", \"AN\"], \"expected\": [\"L\", \"L\", \"R\", \"R\", \"AN\", \"L\", \"L\", \"L\", \"AN\"], \"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\": [\"R\", \"L\"], \"expected\": [\"R\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"EN\", \"R\", \"EN\", \"R\"], \"expected\": [\"EN\", \"R\", \"EN\", \"R\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}