{"abstract":"Combining marks take the sequence start type instead of their base.","category":"Bidirectional text layout","checks":8,"contract":"Input [classes of one isolating run sequence, sos]. W1 NSM takes the previous type (sos at start; ON after LRI/RLI/FSI/PDI). W2 EN after the last strong AL becomes AN. W3 AL->R. W4 a single ES between EN and EN -> EN; a single CS between two numbers of the same type takes that type. W5 a run of ET adjacent to EN -> EN. W6 remaining ES/ET/CS -> ON. W7 EN whose last strong (sos at start) is L -> L. Return resolved classes.","evaluation_group":"w2-bidirectional-text-layout-weak-types","failed_approach":"Using the original class of the previous character copies NSM for mark chains.","family":"w2-bidirectional-text-layout-weak-types-nonspacing-mark-inheritance","id":"FA-80371","implementations":{"attempt":{"sha256":"710f1af6737c1f24f9274af2173e12c11cf84ba13214310ac9ce4b833ec7f02a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos = x\n    t = list(types)\n    n = len(t)\n    prev = sos\n    for i in range(n):\n        if t[i] == 'NSM':\n            t[i] = types[i - 1] if i else sos\n        prev = t[i]\n    last_strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R', 'AL'):\n            last_strong = t[i]\n        elif t[i] == 'EN' and last_strong == 'AL':\n            t[i] = 'AN'\n    t = ['R' if c == 'AL' else c for c in t]\n    for i in range(1, n - 1):\n        if t[i] == 'ES' and t[i - 1] == 'EN' and t[i + 1] == 'EN':\n            t[i] = 'EN'\n        elif t[i] == 'CS' and t[i - 1] == t[i + 1] and t[i - 1] in ('EN', 'AN'):\n            t[i] = t[i - 1]\n    i = 0\n    while i < n:\n        if t[i] == 'ET':\n            j = i\n            while j < n and t[j] == 'ET':\n                j += 1\n            if (i > 0 and t[i - 1] == 'EN') or (j < n and t[j] == 'EN'):\n                for k in range(i, j):\n                    t[k] = 'EN'\n            i = j\n        else:\n            i += 1\n    t = ['ON' if c in ('ES', 'ET', 'CS') else c for c in t]\n    strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R'):\n            strong = t[i]\n        elif t[i] == 'EN' and strong == 'L':\n            t[i] = 'L'\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('NSM chain after R', [['R', 'NSM', 'NSM', 'EN'], 'L'], ['R', 'R', 'R', 'EN']), ('regression: nonspacing mark inheritance', [['NSM', 'EN', 'LRI', 'ET', 'NSM', 'AN', 'ES', 'ET'], 'L'], ['L', 'L', 'LRI', 'ON', 'ON', 'AN', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['LRI', 'NSM', 'AN'], 'L'], ['LRI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'R', 'AL', 'AN', 'CS'], 'R'], ['R', 'R', 'R', 'R', 'AN', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['AN', 'EN'], 'R'], ['AN', 'EN']), ('control layout', [['WS', 'L'], 'L'], ['WS', 'L'])], [('regression: nonspacing mark inheritance', [['L', 'LRI', 'CS', 'WS', 'CS', 'AN', 'NSM', 'CS', 'ON', 'AN', 'CS'], 'L'], ['L', 'LRI', 'ON', 'WS', 'ON', 'AN', 'AN', 'ON', 'ON', 'AN', 'ON']), ('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('partial-repair probe', [['EN', 'EN', 'NSM', 'NSM', 'EN', 'AN'], 'L'], ['L', 'L', 'L', 'L', 'L', 'AN']), ('partial-repair probe', [['R', 'L', 'NSM', 'NSM', 'AN', 'ES', 'WS', 'EN', 'EN', 'CS'], 'L'], ['R', 'L', 'L', 'L', 'AN', 'ON', 'WS', 'L', 'L', 'ON']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['WS', 'L', 'ET', 'EN', 'AN', 'R'], 'L'], ['WS', 'L', 'L', 'L', 'AN', 'R']), ('control layout', [['LRI', 'WS', 'ET'], 'R'], ['LRI', 'WS', 'ON'])], [('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('regression: nonspacing mark inheritance', [['PDI', 'ET', 'NSM', 'NSM', 'ET'], 'R'], ['PDI', 'ON', 'ON', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'EN', 'CS', 'EN', 'ON', 'WS', 'LRI', 'CS'], 'L'], ['L', 'L', 'L', 'L', 'L', 'ON', 'WS', 'LRI', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['AL', 'R', 'ON'], 'R'], ['R', 'R', 'ON']), ('control layout', [['ET', 'EN', 'AN', 'L'], 'L'], ['L', 'L', 'AN', 'L'])], [('regression: nonspacing mark inheritance', [['AN', 'NSM', 'AN', 'EN', 'CS', 'CS', 'EN', 'EN', 'AL'], 'L'], ['AN', 'AN', 'AN', 'L', 'ON', 'ON', 'L', 'L', 'R']), ('regression: nonspacing mark inheritance', [['EN', 'CS', 'NSM', 'LRI'], 'R'], ['EN', 'ON', 'ON', 'LRI']), ('regression: nonspacing mark inheritance', [['ET', 'PDI', 'NSM', 'ON', 'ON', 'NSM', 'NSM', 'EN'], 'L'], ['ON', 'PDI', 'ON', 'ON', 'ON', 'ON', 'ON', 'L']), ('regression: nonspacing mark inheritance', [['ES', 'R', 'L', 'LRI', 'NSM'], 'R'], ['ON', 'R', 'L', 'LRI', 'ON']), ('Arabic number context', [['AL', 'EN', 'CS', 'EN'], 'L'], ['R', 'AN', 'AN', 'AN']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['EN', 'CS', 'R', 'AL', 'ET', 'ES', 'AN', 'R', 'AL', 'AL', 'L'], 'L'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'R', 'R', 'R', 'L']), ('control layout', [['L', 'ES', 'AL', 'LRI'], 'R'], ['L', 'ON', 'R', 'LRI'])], [('regression: nonspacing mark inheritance', [['L', 'L', 'CS', 'ET', 'CS', 'NSM', 'AL', 'LRI', 'PDI', 'L', 'ES'], 'R'], ['L', 'L', 'ON', 'ON', 'ON', 'ON', 'R', 'LRI', 'PDI', 'L', 'ON']), ('regression: nonspacing mark inheritance', [['L', 'CS', 'AL', 'NSM', 'ET', 'CS', 'AN', 'ES', 'EN'], 'R'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'ON', 'AN']), ('partial-repair probe', [['ET', 'PDI', 'EN', 'NSM', 'NSM', 'R', 'L', 'AL'], 'L'], ['ON', 'PDI', 'L', 'L', 'L', 'R', 'L', 'R']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['NSM', 'LRI', 'EN', 'L', 'WS'], 'L'], ['L', 'LRI', 'L', 'L', 'WS']), ('control layout', [['AN', 'ES', 'ET', 'ON', 'AL'], 'L'], ['AN', 'ON', 'ON', 'ON', '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":"df0b8e7590874a57ab0f5925f9ef8d58a27b1791c7b3d68cb5997ea154c0da7e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos = x\n    t = list(types)\n    n = len(t)\n    prev = sos\n    for i in range(n):\n        if t[i] == 'NSM':\n            t[i] = sos\n        prev = t[i]\n    last_strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R', 'AL'):\n            last_strong = t[i]\n        elif t[i] == 'EN' and last_strong == 'AL':\n            t[i] = 'AN'\n    t = ['R' if c == 'AL' else c for c in t]\n    for i in range(1, n - 1):\n        if t[i] == 'ES' and t[i - 1] == 'EN' and t[i + 1] == 'EN':\n            t[i] = 'EN'\n        elif t[i] == 'CS' and t[i - 1] == t[i + 1] and t[i - 1] in ('EN', 'AN'):\n            t[i] = t[i - 1]\n    i = 0\n    while i < n:\n        if t[i] == 'ET':\n            j = i\n            while j < n and t[j] == 'ET':\n                j += 1\n            if (i > 0 and t[i - 1] == 'EN') or (j < n and t[j] == 'EN'):\n                for k in range(i, j):\n                    t[k] = 'EN'\n            i = j\n        else:\n            i += 1\n    t = ['ON' if c in ('ES', 'ET', 'CS') else c for c in t]\n    strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R'):\n            strong = t[i]\n        elif t[i] == 'EN' and strong == 'L':\n            t[i] = 'L'\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('NSM chain after R', [['R', 'NSM', 'NSM', 'EN'], 'L'], ['R', 'R', 'R', 'EN']), ('regression: nonspacing mark inheritance', [['NSM', 'EN', 'LRI', 'ET', 'NSM', 'AN', 'ES', 'ET'], 'L'], ['L', 'L', 'LRI', 'ON', 'ON', 'AN', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['LRI', 'NSM', 'AN'], 'L'], ['LRI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'R', 'AL', 'AN', 'CS'], 'R'], ['R', 'R', 'R', 'R', 'AN', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['AN', 'EN'], 'R'], ['AN', 'EN']), ('control layout', [['WS', 'L'], 'L'], ['WS', 'L'])], [('regression: nonspacing mark inheritance', [['L', 'LRI', 'CS', 'WS', 'CS', 'AN', 'NSM', 'CS', 'ON', 'AN', 'CS'], 'L'], ['L', 'LRI', 'ON', 'WS', 'ON', 'AN', 'AN', 'ON', 'ON', 'AN', 'ON']), ('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('partial-repair probe', [['EN', 'EN', 'NSM', 'NSM', 'EN', 'AN'], 'L'], ['L', 'L', 'L', 'L', 'L', 'AN']), ('partial-repair probe', [['R', 'L', 'NSM', 'NSM', 'AN', 'ES', 'WS', 'EN', 'EN', 'CS'], 'L'], ['R', 'L', 'L', 'L', 'AN', 'ON', 'WS', 'L', 'L', 'ON']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['WS', 'L', 'ET', 'EN', 'AN', 'R'], 'L'], ['WS', 'L', 'L', 'L', 'AN', 'R']), ('control layout', [['LRI', 'WS', 'ET'], 'R'], ['LRI', 'WS', 'ON'])], [('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('regression: nonspacing mark inheritance', [['PDI', 'ET', 'NSM', 'NSM', 'ET'], 'R'], ['PDI', 'ON', 'ON', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'EN', 'CS', 'EN', 'ON', 'WS', 'LRI', 'CS'], 'L'], ['L', 'L', 'L', 'L', 'L', 'ON', 'WS', 'LRI', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['AL', 'R', 'ON'], 'R'], ['R', 'R', 'ON']), ('control layout', [['ET', 'EN', 'AN', 'L'], 'L'], ['L', 'L', 'AN', 'L'])], [('regression: nonspacing mark inheritance', [['AN', 'NSM', 'AN', 'EN', 'CS', 'CS', 'EN', 'EN', 'AL'], 'L'], ['AN', 'AN', 'AN', 'L', 'ON', 'ON', 'L', 'L', 'R']), ('regression: nonspacing mark inheritance', [['EN', 'CS', 'NSM', 'LRI'], 'R'], ['EN', 'ON', 'ON', 'LRI']), ('regression: nonspacing mark inheritance', [['ET', 'PDI', 'NSM', 'ON', 'ON', 'NSM', 'NSM', 'EN'], 'L'], ['ON', 'PDI', 'ON', 'ON', 'ON', 'ON', 'ON', 'L']), ('regression: nonspacing mark inheritance', [['ES', 'R', 'L', 'LRI', 'NSM'], 'R'], ['ON', 'R', 'L', 'LRI', 'ON']), ('Arabic number context', [['AL', 'EN', 'CS', 'EN'], 'L'], ['R', 'AN', 'AN', 'AN']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['EN', 'CS', 'R', 'AL', 'ET', 'ES', 'AN', 'R', 'AL', 'AL', 'L'], 'L'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'R', 'R', 'R', 'L']), ('control layout', [['L', 'ES', 'AL', 'LRI'], 'R'], ['L', 'ON', 'R', 'LRI'])], [('regression: nonspacing mark inheritance', [['L', 'L', 'CS', 'ET', 'CS', 'NSM', 'AL', 'LRI', 'PDI', 'L', 'ES'], 'R'], ['L', 'L', 'ON', 'ON', 'ON', 'ON', 'R', 'LRI', 'PDI', 'L', 'ON']), ('regression: nonspacing mark inheritance', [['L', 'CS', 'AL', 'NSM', 'ET', 'CS', 'AN', 'ES', 'EN'], 'R'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'ON', 'AN']), ('partial-repair probe', [['ET', 'PDI', 'EN', 'NSM', 'NSM', 'R', 'L', 'AL'], 'L'], ['ON', 'PDI', 'L', 'L', 'L', 'R', 'L', 'R']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['NSM', 'LRI', 'EN', 'L', 'WS'], 'L'], ['L', 'LRI', 'L', 'L', 'WS']), ('control layout', [['AN', 'ES', 'ET', 'ON', 'AL'], 'L'], ['AN', 'ON', 'ON', 'ON', '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":"b6a5f36627d5df08f7cd6eb42388b3f6d7ead2596e773f30ed900bc24533437a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    types, sos = x\n    t = list(types)\n    n = len(t)\n    prev = sos\n    for i in range(n):\n        if t[i] == 'NSM':\n            t[i] = 'ON' if prev in ('LRI', 'RLI', 'FSI', 'PDI') else prev\n        prev = t[i]\n    last_strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R', 'AL'):\n            last_strong = t[i]\n        elif t[i] == 'EN' and last_strong == 'AL':\n            t[i] = 'AN'\n    t = ['R' if c == 'AL' else c for c in t]\n    for i in range(1, n - 1):\n        if t[i] == 'ES' and t[i - 1] == 'EN' and t[i + 1] == 'EN':\n            t[i] = 'EN'\n        elif t[i] == 'CS' and t[i - 1] == t[i + 1] and t[i - 1] in ('EN', 'AN'):\n            t[i] = t[i - 1]\n    i = 0\n    while i < n:\n        if t[i] == 'ET':\n            j = i\n            while j < n and t[j] == 'ET':\n                j += 1\n            if (i > 0 and t[i - 1] == 'EN') or (j < n and t[j] == 'EN'):\n                for k in range(i, j):\n                    t[k] = 'EN'\n            i = j\n        else:\n            i += 1\n    t = ['ON' if c in ('ES', 'ET', 'CS') else c for c in t]\n    strong = sos\n    for i in range(n):\n        if t[i] in ('L', 'R'):\n            strong = t[i]\n        elif t[i] == 'EN' and strong == 'L':\n            t[i] = 'L'\n    return t\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('NSM chain after R', [['R', 'NSM', 'NSM', 'EN'], 'L'], ['R', 'R', 'R', 'EN']), ('regression: nonspacing mark inheritance', [['NSM', 'EN', 'LRI', 'ET', 'NSM', 'AN', 'ES', 'ET'], 'L'], ['L', 'L', 'LRI', 'ON', 'ON', 'AN', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['LRI', 'NSM', 'AN'], 'L'], ['LRI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'R', 'AL', 'AN', 'CS'], 'R'], ['R', 'R', 'R', 'R', 'AN', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['AN', 'EN'], 'R'], ['AN', 'EN']), ('control layout', [['WS', 'L'], 'L'], ['WS', 'L'])], [('regression: nonspacing mark inheritance', [['L', 'LRI', 'CS', 'WS', 'CS', 'AN', 'NSM', 'CS', 'ON', 'AN', 'CS'], 'L'], ['L', 'LRI', 'ON', 'WS', 'ON', 'AN', 'AN', 'ON', 'ON', 'AN', 'ON']), ('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('partial-repair probe', [['EN', 'EN', 'NSM', 'NSM', 'EN', 'AN'], 'L'], ['L', 'L', 'L', 'L', 'L', 'AN']), ('partial-repair probe', [['R', 'L', 'NSM', 'NSM', 'AN', 'ES', 'WS', 'EN', 'EN', 'CS'], 'L'], ['R', 'L', 'L', 'L', 'AN', 'ON', 'WS', 'L', 'L', 'ON']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('percent after number', [['EN', 'ET', 'ET', 'L'], 'R'], ['EN', 'EN', 'EN', 'L']), ('control layout', [['WS', 'L', 'ET', 'EN', 'AN', 'R'], 'L'], ['WS', 'L', 'L', 'L', 'AN', 'R']), ('control layout', [['LRI', 'WS', 'ET'], 'R'], ['LRI', 'WS', 'ON'])], [('regression: nonspacing mark inheritance', [['EN', 'AL', 'L', 'ES', 'NSM', 'ES', 'AL', 'ES', 'EN', 'AL'], 'R'], ['EN', 'R', 'L', 'ON', 'ON', 'ON', 'R', 'ON', 'AN', 'R']), ('regression: nonspacing mark inheritance', [['PDI', 'ET', 'NSM', 'NSM', 'ET'], 'R'], ['PDI', 'ON', 'ON', 'ON', 'ON']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('partial-repair probe', [['NSM', 'NSM', 'EN', 'CS', 'EN', 'ON', 'WS', 'LRI', 'CS'], 'L'], ['L', 'L', 'L', 'L', 'L', 'ON', 'WS', 'LRI', 'ON']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['AL', 'R', 'ON'], 'R'], ['R', 'R', 'ON']), ('control layout', [['ET', 'EN', 'AN', 'L'], 'L'], ['L', 'L', 'AN', 'L'])], [('regression: nonspacing mark inheritance', [['AN', 'NSM', 'AN', 'EN', 'CS', 'CS', 'EN', 'EN', 'AL'], 'L'], ['AN', 'AN', 'AN', 'L', 'ON', 'ON', 'L', 'L', 'R']), ('regression: nonspacing mark inheritance', [['EN', 'CS', 'NSM', 'LRI'], 'R'], ['EN', 'ON', 'ON', 'LRI']), ('regression: nonspacing mark inheritance', [['ET', 'PDI', 'NSM', 'ON', 'ON', 'NSM', 'NSM', 'EN'], 'L'], ['ON', 'PDI', 'ON', 'ON', 'ON', 'ON', 'ON', 'L']), ('regression: nonspacing mark inheritance', [['ES', 'R', 'L', 'LRI', 'NSM'], 'R'], ['ON', 'R', 'L', 'LRI', 'ON']), ('Arabic number context', [['AL', 'EN', 'CS', 'EN'], 'L'], ['R', 'AN', 'AN', 'AN']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['EN', 'CS', 'R', 'AL', 'ET', 'ES', 'AN', 'R', 'AL', 'AL', 'L'], 'L'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'R', 'R', 'R', 'L']), ('control layout', [['L', 'ES', 'AL', 'LRI'], 'R'], ['L', 'ON', 'R', 'LRI'])], [('regression: nonspacing mark inheritance', [['L', 'L', 'CS', 'ET', 'CS', 'NSM', 'AL', 'LRI', 'PDI', 'L', 'ES'], 'R'], ['L', 'L', 'ON', 'ON', 'ON', 'ON', 'R', 'LRI', 'PDI', 'L', 'ON']), ('regression: nonspacing mark inheritance', [['L', 'CS', 'AL', 'NSM', 'ET', 'CS', 'AN', 'ES', 'EN'], 'R'], ['L', 'ON', 'R', 'R', 'ON', 'ON', 'AN', 'ON', 'AN']), ('partial-repair probe', [['ET', 'PDI', 'EN', 'NSM', 'NSM', 'R', 'L', 'AL'], 'L'], ['ON', 'PDI', 'L', 'L', 'L', 'R', 'L', 'R']), ('regression: nonspacing mark inheritance', [['NSM', 'AN', 'AL', 'NSM', 'AL', 'NSM', 'PDI', 'NSM', 'EN'], 'L'], ['L', 'AN', 'R', 'R', 'R', 'R', 'PDI', 'ON', 'AN']), ('NSM after isolate initiator', [['LRI', 'NSM', 'L', 'PDI'], 'R'], ['LRI', 'ON', 'L', 'PDI']), ('plus between numbers', [['EN', 'ES', 'EN', 'R'], 'R'], ['EN', 'EN', 'EN', 'R']), ('control layout', [['NSM', 'LRI', 'EN', 'L', 'WS'], 'L'], ['L', 'LRI', 'L', 'L', 'WS']), ('control layout', [['AN', 'ES', 'ET', 'ON', 'AL'], 'L'], ['AN', 'ON', 'ON', 'ON', '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-weak-types-nonspacing-mark-inheritance","generated_at":"2026-09-29T14:49:53.241081+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":"Give each NSM the type of the preceding character.","root_cause":"W1 assigns sos to every NSM instead of the preceding type.","sha256":"ed9a21b9a115d5c30b175be7c64342ef80135d8d692ff0a9b3b6cc0595b239aa","title":"Weak type resolution: nonspacing mark inheritance · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.831,"exit_code":1,"observations":[{"actual":["R","R","NSM","EN"],"check":"NSM chain after R","expected":["R","R","R","EN"],"passed":false},{"actual":["L","L","LRI","ON","ON","AN","ON","ON"],"check":"regression: nonspacing mark inheritance","expected":["L","L","LRI","ON","ON","AN","ON","ON"],"passed":true},{"actual":["LRI","LRI","AN"],"check":"regression: nonspacing mark inheritance","expected":["LRI","ON","AN"],"passed":false},{"actual":["R","NSM","R","R","AN","ON"],"check":"partial-repair probe","expected":["R","R","R","R","AN","ON"],"passed":false},{"actual":["LRI","LRI","L","PDI"],"check":"NSM after isolate initiator","expected":["LRI","ON","L","PDI"],"passed":false},{"actual":["EN","EN","EN","L"],"check":"percent after number","expected":["EN","EN","EN","L"],"passed":true},{"actual":["AN","EN"],"check":"control layout","expected":["AN","EN"],"passed":true},{"actual":["WS","L"],"check":"control layout","expected":["WS","L"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"NSM chain after R\", \"actual\": [\"R\", \"R\", \"NSM\", \"EN\"], \"expected\": [\"R\", \"R\", \"R\", \"EN\"], \"passed\": false}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"L\", \"L\", \"LRI\", \"ON\", \"ON\", \"AN\", \"ON\", \"ON\"], \"expected\": [\"L\", \"L\", \"LRI\", \"ON\", \"ON\", \"AN\", \"ON\", \"ON\"], \"passed\": true}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"LRI\", \"LRI\", \"AN\"], \"expected\": [\"LRI\", \"ON\", \"AN\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"R\", \"NSM\", \"R\", \"R\", \"AN\", \"ON\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"AN\", \"ON\"], \"passed\": false}, {\"check\": \"NSM after isolate initiator\", \"actual\": [\"LRI\", \"LRI\", \"L\", \"PDI\"], \"expected\": [\"LRI\", \"ON\", \"L\", \"PDI\"], \"passed\": false}, {\"check\": \"percent after number\", \"actual\": [\"EN\", \"EN\", \"EN\", \"L\"], \"expected\": [\"EN\", \"EN\", \"EN\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"EN\"], \"expected\": [\"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"WS\", \"L\"], \"expected\": [\"WS\", \"L\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.141,"exit_code":1,"observations":[{"actual":["R","L","L","L"],"check":"NSM chain after R","expected":["R","R","R","EN"],"passed":false},{"actual":["L","L","LRI","ON","L","AN","ON","ON"],"check":"regression: nonspacing mark inheritance","expected":["L","L","LRI","ON","ON","AN","ON","ON"],"passed":false},{"actual":["LRI","L","AN"],"check":"regression: nonspacing mark inheritance","expected":["LRI","ON","AN"],"passed":false},{"actual":["R","R","R","R","AN","ON"],"check":"partial-repair probe","expected":["R","R","R","R","AN","ON"],"passed":true},{"actual":["LRI","R","L","PDI"],"check":"NSM after isolate initiator","expected":["LRI","ON","L","PDI"],"passed":false},{"actual":["EN","EN","EN","L"],"check":"percent after number","expected":["EN","EN","EN","L"],"passed":true},{"actual":["AN","EN"],"check":"control layout","expected":["AN","EN"],"passed":true},{"actual":["WS","L"],"check":"control layout","expected":["WS","L"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"NSM chain after R\", \"actual\": [\"R\", \"L\", \"L\", \"L\"], \"expected\": [\"R\", \"R\", \"R\", \"EN\"], \"passed\": false}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"L\", \"L\", \"LRI\", \"ON\", \"L\", \"AN\", \"ON\", \"ON\"], \"expected\": [\"L\", \"L\", \"LRI\", \"ON\", \"ON\", \"AN\", \"ON\", \"ON\"], \"passed\": false}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"LRI\", \"L\", \"AN\"], \"expected\": [\"LRI\", \"ON\", \"AN\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"AN\", \"ON\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"AN\", \"ON\"], \"passed\": true}, {\"check\": \"NSM after isolate initiator\", \"actual\": [\"LRI\", \"R\", \"L\", \"PDI\"], \"expected\": [\"LRI\", \"ON\", \"L\", \"PDI\"], \"passed\": false}, {\"check\": \"percent after number\", \"actual\": [\"EN\", \"EN\", \"EN\", \"L\"], \"expected\": [\"EN\", \"EN\", \"EN\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"EN\"], \"expected\": [\"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"WS\", \"L\"], \"expected\": [\"WS\", \"L\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.106,"exit_code":0,"observations":[{"actual":["R","R","R","EN"],"check":"NSM chain after R","expected":["R","R","R","EN"],"passed":true},{"actual":["L","L","LRI","ON","ON","AN","ON","ON"],"check":"regression: nonspacing mark inheritance","expected":["L","L","LRI","ON","ON","AN","ON","ON"],"passed":true},{"actual":["LRI","ON","AN"],"check":"regression: nonspacing mark inheritance","expected":["LRI","ON","AN"],"passed":true},{"actual":["R","R","R","R","AN","ON"],"check":"partial-repair probe","expected":["R","R","R","R","AN","ON"],"passed":true},{"actual":["LRI","ON","L","PDI"],"check":"NSM after isolate initiator","expected":["LRI","ON","L","PDI"],"passed":true},{"actual":["EN","EN","EN","L"],"check":"percent after number","expected":["EN","EN","EN","L"],"passed":true},{"actual":["AN","EN"],"check":"control layout","expected":["AN","EN"],"passed":true},{"actual":["WS","L"],"check":"control layout","expected":["WS","L"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"NSM chain after R\", \"actual\": [\"R\", \"R\", \"R\", \"EN\"], \"expected\": [\"R\", \"R\", \"R\", \"EN\"], \"passed\": true}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"L\", \"L\", \"LRI\", \"ON\", \"ON\", \"AN\", \"ON\", \"ON\"], \"expected\": [\"L\", \"L\", \"LRI\", \"ON\", \"ON\", \"AN\", \"ON\", \"ON\"], \"passed\": true}, {\"check\": \"regression: nonspacing mark inheritance\", \"actual\": [\"LRI\", \"ON\", \"AN\"], \"expected\": [\"LRI\", \"ON\", \"AN\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"R\", \"R\", \"R\", \"R\", \"AN\", \"ON\"], \"expected\": [\"R\", \"R\", \"R\", \"R\", \"AN\", \"ON\"], \"passed\": true}, {\"check\": \"NSM after isolate initiator\", \"actual\": [\"LRI\", \"ON\", \"L\", \"PDI\"], \"expected\": [\"LRI\", \"ON\", \"L\", \"PDI\"], \"passed\": true}, {\"check\": \"percent after number\", \"actual\": [\"EN\", \"EN\", \"EN\", \"L\"], \"expected\": [\"EN\", \"EN\", \"EN\", \"L\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"AN\", \"EN\"], \"expected\": [\"AN\", \"EN\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"WS\", \"L\"], \"expected\": [\"WS\", \"L\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}