{"abstract":"Neutral runs resolve piecemeal with inconsistent directions.","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":"Grouping only identical neutral classes still splits mixed runs.","family":"w2-bidirectional-text-layout-neutral-resolution-neutral-run-grouping","id":"FA-80436","implementations":{"attempt":{"sha256":"7d0f5b709dfb53513e9994deed873071da0237afaab2e9039868f9a089caeac3","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 and t[j] == t[i]:\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 = [[('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'WS', 'ON', 'ON'], 'L', 'L', 3], ['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'L', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'ON', 'WS', 'S', 'WS', 'EN', 'R'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: neutral run grouping', [['B', 'R', 'R', 'EN', 'WS', 'B', 'AN', 'AN'], 'L', 'L', 0], ['L', 'R', 'R', 'EN', 'R', 'R', 'AN', 'AN']), ('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', [['WS', 'L', 'L', 'S', 'ON', 'R', 'R', 'L', 'L'], 'R', 'L', 3], ['R', 'L', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['R', 'R', 'L', 'AN', 'ON', 'L', 'L', 'AN'], 'L', 'R', 3], ['R', 'R', 'L', 'AN', 'R', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'B', 'L', 'ON', 'WS', 'WS'], 'R', 'R', 3], ['R', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'WS', 'ON', 'AN', 'WS', 'L', 'AN', 'B', 'ON', 'B', 'B'], 'R', 'R', 0], ['R', 'R', 'R', 'AN', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: neutral run grouping', [['S', 'L', 'AN', 'WS', 'B', 'B', 'ON', 'ON', 'B', 'R', 'WS'], 'R', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R']), ('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', [['EN', 'EN', 'WS', 'ON', 'R', 'L', 'ON', 'R', 'R', 'L', 'ON'], 'R', 'R', 1], ['EN', 'EN', 'R', 'R', 'R', 'L', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['L', 'WS', 'B', 'B', 'B', 'L', 'L'], 'R', 'R', 0], ['L', 'L', 'L', 'L', 'L', 'L', 'L'])], [('regression: neutral run grouping', [['B', 'L', 'L', 'EN', 'WS', 'ON', 'R', 'R', 'R'], 'L', 'R', 2], ['L', 'L', 'L', 'EN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'L', 'AN', 'B', 'R', 'ON', 'ON', 'WS'], 'L', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'EN', 'B', 'WS', 'WS', 'S'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['ON', 'R', 'R', 'R', 'L', 'R', 'AN', 'WS', 'ON', 'B', 'AN'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'L', 'R', 'AN', 'R', 'R', 'R', 'AN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('control layout', [['AN', 'L', 'AN', 'L', 'ON', 'R', 'AN', 'AN', 'B', 'L'], 'L', 'L', 3], ['AN', 'L', 'AN', 'L', 'R', 'R', 'AN', 'AN', 'R', 'L']), ('control layout', [['L', 'S', 'EN', 'AN', 'L', 'ON'], 'L', 'L', 2], ['L', 'L', 'EN', 'AN', 'L', 'L'])], [('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', 'L']), ('regression: neutral run grouping', [['S', 'B', 'B'], 'R', 'R', 2], ['R', 'R', 'R']), ('regression: neutral run grouping', [['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: neutral run grouping', [['B', 'WS', 'R', 'S', 'R'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('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', [['R', 'ON', 'ON', 'R', 'EN'], 'L', 'R', 3], ['R', 'R', 'R', 'R', 'EN']), ('control layout', [['L', 'WS', 'WS', 'AN'], 'R', 'L', 2], ['L', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'L', 'R', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'R', 'R', 'ON', 'B', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R', 'AN', 'AN', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'L', 'WS', 'AN', 'WS', 'S', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', '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', 'L', 'R', 'B', 'WS', 'R', 'L', 'WS'], 'R', 'L', 1], ['R', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['ON', 'EN', 'ON', 'R', 'B', 'ON'], 'R', 'L', 1], ['R', 'EN', 'R', 'R', 'R', 'R'])]]\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":"cae6c74bf45ff853e11b03b6f89b2230671f2aa0134d0e5bfc7e5c550cb58aed","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            j = i + 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 = [[('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'WS', 'ON', 'ON'], 'L', 'L', 3], ['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'L', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'ON', 'WS', 'S', 'WS', 'EN', 'R'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: neutral run grouping', [['B', 'R', 'R', 'EN', 'WS', 'B', 'AN', 'AN'], 'L', 'L', 0], ['L', 'R', 'R', 'EN', 'R', 'R', 'AN', 'AN']), ('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', [['WS', 'L', 'L', 'S', 'ON', 'R', 'R', 'L', 'L'], 'R', 'L', 3], ['R', 'L', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['R', 'R', 'L', 'AN', 'ON', 'L', 'L', 'AN'], 'L', 'R', 3], ['R', 'R', 'L', 'AN', 'R', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'B', 'L', 'ON', 'WS', 'WS'], 'R', 'R', 3], ['R', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'WS', 'ON', 'AN', 'WS', 'L', 'AN', 'B', 'ON', 'B', 'B'], 'R', 'R', 0], ['R', 'R', 'R', 'AN', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: neutral run grouping', [['S', 'L', 'AN', 'WS', 'B', 'B', 'ON', 'ON', 'B', 'R', 'WS'], 'R', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R']), ('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', [['EN', 'EN', 'WS', 'ON', 'R', 'L', 'ON', 'R', 'R', 'L', 'ON'], 'R', 'R', 1], ['EN', 'EN', 'R', 'R', 'R', 'L', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['L', 'WS', 'B', 'B', 'B', 'L', 'L'], 'R', 'R', 0], ['L', 'L', 'L', 'L', 'L', 'L', 'L'])], [('regression: neutral run grouping', [['B', 'L', 'L', 'EN', 'WS', 'ON', 'R', 'R', 'R'], 'L', 'R', 2], ['L', 'L', 'L', 'EN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'L', 'AN', 'B', 'R', 'ON', 'ON', 'WS'], 'L', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'EN', 'B', 'WS', 'WS', 'S'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['ON', 'R', 'R', 'R', 'L', 'R', 'AN', 'WS', 'ON', 'B', 'AN'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'L', 'R', 'AN', 'R', 'R', 'R', 'AN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('control layout', [['AN', 'L', 'AN', 'L', 'ON', 'R', 'AN', 'AN', 'B', 'L'], 'L', 'L', 3], ['AN', 'L', 'AN', 'L', 'R', 'R', 'AN', 'AN', 'R', 'L']), ('control layout', [['L', 'S', 'EN', 'AN', 'L', 'ON'], 'L', 'L', 2], ['L', 'L', 'EN', 'AN', 'L', 'L'])], [('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', 'L']), ('regression: neutral run grouping', [['S', 'B', 'B'], 'R', 'R', 2], ['R', 'R', 'R']), ('regression: neutral run grouping', [['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: neutral run grouping', [['B', 'WS', 'R', 'S', 'R'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('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', [['R', 'ON', 'ON', 'R', 'EN'], 'L', 'R', 3], ['R', 'R', 'R', 'R', 'EN']), ('control layout', [['L', 'WS', 'WS', 'AN'], 'R', 'L', 2], ['L', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'L', 'R', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'R', 'R', 'ON', 'B', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R', 'AN', 'AN', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'L', 'WS', 'AN', 'WS', 'S', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', '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', 'L', 'R', 'B', 'WS', 'R', 'L', 'WS'], 'R', 'L', 1], ['R', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['ON', 'EN', 'ON', 'R', 'B', 'ON'], 'R', 'L', 1], ['R', 'EN', 'R', 'R', 'R', 'R'])]]\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":"7960100df8b586f0248cdbe2160b6fad6bcaf3521fd1f2474f3e6f52a00cb388","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 = [[('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'WS', 'ON', 'ON'], 'L', 'L', 3], ['EN', 'AN', 'L', 'EN', 'AN', 'AN', 'L', 'L', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'ON', 'WS', 'S', 'WS', 'EN', 'R'], 'R', 'R', 2], ['R', 'R', 'R', 'R', 'R', 'EN', 'R']), ('regression: neutral run grouping', [['B', 'R', 'R', 'EN', 'WS', 'B', 'AN', 'AN'], 'L', 'L', 0], ['L', 'R', 'R', 'EN', 'R', 'R', 'AN', 'AN']), ('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', [['WS', 'L', 'L', 'S', 'ON', 'R', 'R', 'L', 'L'], 'R', 'L', 3], ['R', 'L', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['R', 'R', 'L', 'AN', 'ON', 'L', 'L', 'AN'], 'L', 'R', 3], ['R', 'R', 'L', 'AN', 'R', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'B', 'L', 'ON', 'WS', 'WS'], 'R', 'R', 3], ['R', 'L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'WS', 'ON', 'AN', 'WS', 'L', 'AN', 'B', 'ON', 'B', 'B'], 'R', 'R', 0], ['R', 'R', 'R', 'AN', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'ON', 'AN', 'ON', 'S', 'AN', 'WS', 'L', 'AN'], 'R', 'L', 2], ['R', 'R', 'AN', 'R', 'R', 'AN', 'L', 'L', 'AN']), ('regression: neutral run grouping', [['S', 'L', 'AN', 'WS', 'B', 'B', 'ON', 'ON', 'B', 'R', 'WS'], 'R', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R']), ('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', [['EN', 'EN', 'WS', 'ON', 'R', 'L', 'ON', 'R', 'R', 'L', 'ON'], 'R', 'R', 1], ['EN', 'EN', 'R', 'R', 'R', 'L', 'R', 'R', 'R', 'L', 'R']), ('control layout', [['L', 'WS', 'B', 'B', 'B', 'L', 'L'], 'R', 'R', 0], ['L', 'L', 'L', 'L', 'L', 'L', 'L'])], [('regression: neutral run grouping', [['B', 'L', 'L', 'EN', 'WS', 'ON', 'R', 'R', 'R'], 'L', 'R', 2], ['L', 'L', 'L', 'EN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['WS', 'L', 'AN', 'B', 'R', 'ON', 'ON', 'WS'], 'L', 'R', 2], ['L', 'L', 'AN', 'R', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'EN', 'B', 'WS', 'WS', 'S'], 'R', 'R', 2], ['R', 'EN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['ON', 'R', 'R', 'R', 'L', 'R', 'AN', 'WS', 'ON', 'B', 'AN'], 'L', 'R', 2], ['L', 'R', 'R', 'R', 'L', 'R', 'AN', 'R', 'R', 'R', 'AN']), ('mixed neutral run', [['R', 'WS', 'ON', 'S', 'R'], 'L', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('neutral between numbers and R', [['R', 'ON', 'EN'], 'L', 'L', 0], ['R', 'R', 'EN']), ('control layout', [['AN', 'L', 'AN', 'L', 'ON', 'R', 'AN', 'AN', 'B', 'L'], 'L', 'L', 3], ['AN', 'L', 'AN', 'L', 'R', 'R', 'AN', 'AN', 'R', 'L']), ('control layout', [['L', 'S', 'EN', 'AN', 'L', 'ON'], 'L', 'L', 2], ['L', 'L', 'EN', 'AN', 'L', 'L'])], [('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', 'L']), ('regression: neutral run grouping', [['S', 'B', 'B'], 'R', 'R', 2], ['R', 'R', 'R']), ('regression: neutral run grouping', [['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: neutral run grouping', [['B', 'WS', 'R', 'S', 'R'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R']), ('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', [['R', 'ON', 'ON', 'R', 'EN'], 'L', 'R', 3], ['R', 'R', 'R', 'R', 'EN']), ('control layout', [['L', 'WS', 'WS', 'AN'], 'R', 'L', 2], ['L', 'L', 'L', 'AN'])], [('regression: neutral run grouping', [['WS', 'L', 'ON', 'L', 'R', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'L', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'R', 'R', 'ON', 'B', 'AN', 'AN', 'ON', 'L'], 'R', 'L', 0], ['R', 'R', 'R', 'R', 'R', 'AN', 'AN', 'L', 'L']), ('regression: neutral run grouping', [['WS', 'L', 'WS', 'AN', 'WS', 'S', 'S', 'S'], 'L', 'R', 0], ['L', 'L', 'L', 'AN', 'R', 'R', 'R', 'R']), ('regression: neutral run grouping', [['R', 'AN', 'B', 'ON', 'WS', 'WS', 'AN', 'WS'], 'L', 'L', 2], ['R', 'AN', 'R', 'R', 'R', 'R', 'AN', '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', 'L', 'R', 'B', 'WS', 'R', 'L', 'WS'], 'R', 'L', 1], ['R', 'L', 'R', 'R', 'R', 'R', 'L', 'L']), ('control layout', [['ON', 'EN', 'ON', 'R', 'B', 'ON'], 'R', 'L', 1], ['R', 'EN', 'R', 'R', 'R', 'R'])]]\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-neutral-run-grouping","generated_at":"2026-09-29T14:49:53.783417+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":"Resolve a maximal run of neutrals together.","root_cause":"Each neutral is resolved on its own using possibly-resolved neighbours.","sha256":"05cf31f5cf9b01a23b694cad4d72d55b61f2da31646e337743cbdac46e88f772","title":"Neutral run resolution: neutral run grouping · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.877,"exit_code":1,"observations":[{"actual":["R","L","L","L","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":false},{"actual":["EN","AN","L","EN","AN","AN","L","R","R","R"],"check":"regression: neutral run grouping","expected":["EN","AN","L","EN","AN","AN","L","L","L","L"],"passed":false},{"actual":["L","L","L","L","L","EN","R"],"check":"regression: neutral run grouping","expected":["R","R","R","R","R","EN","R"],"passed":false},{"actual":["L","R","R","EN","L","L","AN","AN"],"check":"regression: neutral run grouping","expected":["L","R","R","EN","R","R","AN","AN"],"passed":false},{"actual":["R","R","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":true},{"actual":["R","R"],"check":"leading neutral uses sos","expected":["R","R"],"passed":true},{"actual":["R","L","L","R","R","R","R","L","L"],"check":"control layout","expected":["R","L","L","R","R","R","R","L","L"],"passed":true},{"actual":["R","R","L","AN","R","L","L","AN"],"check":"control layout","expected":["R","R","L","AN","R","L","L","AN"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"L\", \"L\", \"L\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"R\", \"R\", \"R\"], \"expected\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"L\", \"L\", \"L\", \"L\", \"L\", \"EN\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\", \"EN\", \"R\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"L\", \"R\", \"R\", \"EN\", \"L\", \"L\", \"AN\", \"AN\"], \"expected\": [\"L\", \"R\", \"R\", \"EN\", \"R\", \"R\", \"AN\", \"AN\"], \"passed\": false}, {\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"R\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": true}, {\"check\": \"leading neutral uses sos\", \"actual\": [\"R\", \"R\"], \"expected\": [\"R\", \"R\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"expected\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.404,"exit_code":1,"observations":[{"actual":["R","L","L","L","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":false},{"actual":["EN","AN","L","EN","AN","AN","L","R","R","R"],"check":"regression: neutral run grouping","expected":["EN","AN","L","EN","AN","AN","L","L","L","L"],"passed":false},{"actual":["L","L","L","L","L","EN","R"],"check":"regression: neutral run grouping","expected":["R","R","R","R","R","EN","R"],"passed":false},{"actual":["L","R","R","EN","L","L","AN","AN"],"check":"regression: neutral run grouping","expected":["L","R","R","EN","R","R","AN","AN"],"passed":false},{"actual":["R","R","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":true},{"actual":["R","R"],"check":"leading neutral uses sos","expected":["R","R"],"passed":true},{"actual":["R","L","L","R","R","R","R","L","L"],"check":"control layout","expected":["R","L","L","R","R","R","R","L","L"],"passed":true},{"actual":["R","R","L","AN","R","L","L","AN"],"check":"control layout","expected":["R","R","L","AN","R","L","L","AN"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"L\", \"L\", \"L\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"R\", \"R\", \"R\"], \"expected\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"L\", \"L\", \"L\", \"L\", \"L\", \"EN\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\", \"EN\", \"R\"], \"passed\": false}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"L\", \"R\", \"R\", \"EN\", \"L\", \"L\", \"AN\", \"AN\"], \"expected\": [\"L\", \"R\", \"R\", \"EN\", \"R\", \"R\", \"AN\", \"AN\"], \"passed\": false}, {\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"R\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": true}, {\"check\": \"leading neutral uses sos\", \"actual\": [\"R\", \"R\"], \"expected\": [\"R\", \"R\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"expected\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.957,"exit_code":0,"observations":[{"actual":["R","R","R","R","R"],"check":"mixed neutral run","expected":["R","R","R","R","R"],"passed":true},{"actual":["EN","AN","L","EN","AN","AN","L","L","L","L"],"check":"regression: neutral run grouping","expected":["EN","AN","L","EN","AN","AN","L","L","L","L"],"passed":true},{"actual":["R","R","R","R","R","EN","R"],"check":"regression: neutral run grouping","expected":["R","R","R","R","R","EN","R"],"passed":true},{"actual":["L","R","R","EN","R","R","AN","AN"],"check":"regression: neutral run grouping","expected":["L","R","R","EN","R","R","AN","AN"],"passed":true},{"actual":["R","R","EN"],"check":"neutral between numbers and R","expected":["R","R","EN"],"passed":true},{"actual":["R","R"],"check":"leading neutral uses sos","expected":["R","R"],"passed":true},{"actual":["R","L","L","R","R","R","R","L","L"],"check":"control layout","expected":["R","L","L","R","R","R","R","L","L"],"passed":true},{"actual":["R","R","L","AN","R","L","L","AN"],"check":"control layout","expected":["R","R","L","AN","R","L","L","AN"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"mixed neutral run\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\"], \"passed\": true}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"expected\": [\"EN\", \"AN\", \"L\", \"EN\", \"AN\", \"AN\", \"L\", \"L\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"R\", \"EN\", \"R\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"R\", \"EN\", \"R\"], \"passed\": true}, {\"check\": \"regression: neutral run grouping\", \"actual\": [\"L\", \"R\", \"R\", \"EN\", \"R\", \"R\", \"AN\", \"AN\"], \"expected\": [\"L\", \"R\", \"R\", \"EN\", \"R\", \"R\", \"AN\", \"AN\"], \"passed\": true}, {\"check\": \"neutral between numbers and R\", \"actual\": [\"R\", \"R\", \"EN\"], \"expected\": [\"R\", \"R\", \"EN\"], \"passed\": true}, {\"check\": \"leading neutral uses sos\", \"actual\": [\"R\", \"R\"], \"expected\": [\"R\", \"R\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"expected\": [\"R\", \"L\", \"L\", \"R\", \"R\", \"R\", \"R\", \"L\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"expected\": [\"R\", \"R\", \"L\", \"AN\", \"R\", \"L\", \"L\", \"AN\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}