{"abstract":"Paragraphs that start with a number become left-to-right.","category":"Bidirectional text layout","checks":8,"contract":"Input [bidi classes, default level]. Scan for the first L (level 0) or R/AL (level 1), skipping characters between an isolate initiator (LRI, RLI, FSI) and its matching PDI (nesting counted; an unmatched PDI is ignored). Embedding codes are not skipped. Return [level, index of deciding character] or [default, None].","contract_signature":"x","evaluation_group":"w2-bidirectional-text-layout-paragraph-direction","failed_approach":"Counting numbers only when the default is LTR still lets digits decide.","family":"w2-bidirectional-text-layout-paragraph-direction-numbers-as-strong","id":"FA-80356","implementations":{"attempt":{"sha256":"0a60d3b37c31323b10ee3cf646740964650953839c124c4217232105f91a21a8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    classes, default = x\n    depth = 0\n    for i, c in enumerate(classes):\n        if c in ('LRI', 'RLI', 'FSI'):\n            depth += 1\n        elif c == 'PDI':\n            if depth > 0:\n                depth -= 1\n        elif depth == 0:\n            if c == 'L' or c == 'EN' and default == 0:\n                return [0, i]\n            if c in ('R', 'AL'):\n                return [1, i]\n    return [default, None]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('numbers are not strong', [['EN', 'ON', 'R'], 0], [1, 2]), ('regression: numbers as strong', [['NSM', 'WS', 'EN', 'EN', 'L', 'FSI', 'ON'], 0], [0, 4]), ('regression: numbers as strong', [['LRE', 'EN', 'L'], 0], [0, 2]), ('regression: numbers as strong', [['LRE', 'EN', 'EN', 'WS', 'RLI', 'R'], 0], [0, None]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('control layout', [['L', 'RLI', 'L'], 1], [0, 0]), ('control layout', [['FSI', 'WS', 'NSM', 'AN', 'RLI', 'RLI', 'LRE', 'ON'], 1], [1, None])], [('regression: numbers as strong', [['LRE', 'AN', 'EN'], 1], [1, None]), ('regression: numbers as strong', [['ON', 'EN', 'RLI'], 0], [0, None]), ('regression: numbers as strong', [['EN', 'AN', 'WS', 'L', 'NSM', 'ON', 'LRI', 'PDI', 'EN', 'ON'], 0], [0, 3]), ('regression: numbers as strong', [['EN', 'LRE', 'R'], 0], [1, 2]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('control layout', [['AN'], 1], [1, None]), ('control layout', [['FSI'], 0], [0, None])], [('regression: numbers as strong', [['ON', 'AN', 'ON', 'EN'], 0], [0, None]), ('regression: numbers as strong', [['AN', 'NSM', 'ON', 'EN', 'AN', 'NSM', 'L', 'WS', 'ON', 'ES'], 1], [0, 6]), ('regression: numbers as strong', [['EN', 'L', 'FSI', 'LRI', 'ON', 'R', 'EN', 'ON', 'ON', 'AL'], 0], [0, 1]), ('regression: numbers as strong', [['EN', 'PDI', 'RLI', 'FSI', 'RLI', 'WS', 'PDI', 'ON', 'EN', 'LRI'], 0], [0, None]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('numbers are not strong', [['EN', 'ON', 'R'], 0], [1, 2]), ('control layout', [['WS', 'WS', 'R', 'NSM'], 0], [1, 2]), ('control layout', [['WS', 'LRI', 'FSI', 'PDI', 'R', 'LRE'], 1], [1, None])], [('regression: numbers as strong', [['EN', 'EN', 'R', 'ON', 'PDI', 'L', 'FSI', 'ON', 'L'], 1], [1, 2]), ('regression: numbers as strong', [['EN', 'ON', 'R', 'AN', 'L', 'FSI'], 0], [1, 2]), ('regression: numbers as strong', [['EN', 'PDI', 'R', 'AL', 'LRE', 'WS', 'PDI', 'LRE', 'PDI'], 0], [1, 2]), ('regression: numbers as strong', [['EN', 'EN', 'WS', 'EN'], 0], [0, None]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('control layout', [['PDI', 'PDI', 'LRI', 'WS', 'LRI', 'PDI', 'LRI', 'R', 'EN', 'L'], 1], [1, None]), ('control layout', [['AL', 'EN', 'L', 'WS', 'LRE', 'PDI'], 0], [1, 0])], [('regression: numbers as strong', [['PDI', 'EN', 'ON', 'EN', 'ON', 'RLI', 'LRI', 'L', 'WS'], 1], [1, None]), ('regression: numbers as strong', [['EN', 'AN', 'ES', 'RLI', 'AL', 'AL', 'ON', 'FSI'], 1], [1, None]), ('regression: numbers as strong', [['EN', 'PDI', 'FSI', 'EN', 'ES', 'AN', 'WS', 'PDI', 'ES'], 0], [0, None]), ('regression: numbers as strong', [['LRE', 'LRE', 'PDI', 'EN', 'PDI', 'L', 'ON', 'EN'], 0], [0, 5]), ('FSI content skipped', [['FSI', 'R', 'PDI', 'L'], 1], [0, 3]), ('Arabic letter decides', [['ON', 'AL', 'L'], 0], [1, 1]), ('control layout', [['LRI'], 0], [0, None]), ('control layout', [['AN', 'R'], 1], [1, 1])]]\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":"3de908dce8e55435b600d4f15fde2827e356c890a472542c8c3eb3d5c314ddf0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    classes, default = x\n    depth = 0\n    for i, c in enumerate(classes):\n        if c in ('LRI', 'RLI', 'FSI'):\n            depth += 1\n        elif c == 'PDI':\n            if depth > 0:\n                depth -= 1\n        elif depth == 0:\n            if c in ('L', 'EN'):\n                return [0, i]\n            if c in ('R', 'AL'):\n                return [1, i]\n    return [default, None]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('numbers are not strong', [['EN', 'ON', 'R'], 0], [1, 2]), ('regression: numbers as strong', [['NSM', 'WS', 'EN', 'EN', 'L', 'FSI', 'ON'], 0], [0, 4]), ('regression: numbers as strong', [['LRE', 'EN', 'L'], 0], [0, 2]), ('regression: numbers as strong', [['LRE', 'EN', 'EN', 'WS', 'RLI', 'R'], 0], [0, None]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('control layout', [['L', 'RLI', 'L'], 1], [0, 0]), ('control layout', [['FSI', 'WS', 'NSM', 'AN', 'RLI', 'RLI', 'LRE', 'ON'], 1], [1, None])], [('regression: numbers as strong', [['LRE', 'AN', 'EN'], 1], [1, None]), ('regression: numbers as strong', [['ON', 'EN', 'RLI'], 0], [0, None]), ('regression: numbers as strong', [['EN', 'AN', 'WS', 'L', 'NSM', 'ON', 'LRI', 'PDI', 'EN', 'ON'], 0], [0, 3]), ('regression: numbers as strong', [['EN', 'LRE', 'R'], 0], [1, 2]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('control layout', [['AN'], 1], [1, None]), ('control layout', [['FSI'], 0], [0, None])], [('regression: numbers as strong', [['ON', 'AN', 'ON', 'EN'], 0], [0, None]), ('regression: numbers as strong', [['AN', 'NSM', 'ON', 'EN', 'AN', 'NSM', 'L', 'WS', 'ON', 'ES'], 1], [0, 6]), ('regression: numbers as strong', [['EN', 'L', 'FSI', 'LRI', 'ON', 'R', 'EN', 'ON', 'ON', 'AL'], 0], [0, 1]), ('regression: numbers as strong', [['EN', 'PDI', 'RLI', 'FSI', 'RLI', 'WS', 'PDI', 'ON', 'EN', 'LRI'], 0], [0, None]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('numbers are not strong', [['EN', 'ON', 'R'], 0], [1, 2]), ('control layout', [['WS', 'WS', 'R', 'NSM'], 0], [1, 2]), ('control layout', [['WS', 'LRI', 'FSI', 'PDI', 'R', 'LRE'], 1], [1, None])], [('regression: numbers as strong', [['EN', 'EN', 'R', 'ON', 'PDI', 'L', 'FSI', 'ON', 'L'], 1], [1, 2]), ('regression: numbers as strong', [['EN', 'ON', 'R', 'AN', 'L', 'FSI'], 0], [1, 2]), ('regression: numbers as strong', [['EN', 'PDI', 'R', 'AL', 'LRE', 'WS', 'PDI', 'LRE', 'PDI'], 0], [1, 2]), ('regression: numbers as strong', [['EN', 'EN', 'WS', 'EN'], 0], [0, None]), ('nested isolates', [['LRI', 'RLI', 'R', 'PDI', 'L', 'PDI', 'R'], 0], [1, 6]), ('stray PDI before isolate', [['PDI', 'RLI', 'L', 'PDI', 'R'], 0], [1, 4]), ('control layout', [['PDI', 'PDI', 'LRI', 'WS', 'LRI', 'PDI', 'LRI', 'R', 'EN', 'L'], 1], [1, None]), ('control layout', [['AL', 'EN', 'L', 'WS', 'LRE', 'PDI'], 0], [1, 0])], [('regression: numbers as strong', [['PDI', 'EN', 'ON', 'EN', 'ON', 'RLI', 'LRI', 'L', 'WS'], 1], [1, None]), ('regression: numbers as strong', [['EN', 'AN', 'ES', 'RLI', 'AL', 'AL', 'ON', 'FSI'], 1], [1, None]), ('regression: numbers as strong', [['EN', 'PDI', 'FSI', 'EN', 'ES', 'AN', 'WS', 'PDI', 'ES'], 0], [0, None]), ('regression: numbers as strong', [['LRE', 'LRE', 'PDI', 'EN', 'PDI', 'L', 'ON', 'EN'], 0], [0, 5]), ('FSI content skipped', [['FSI', 'R', 'PDI', 'L'], 1], [0, 3]), ('Arabic letter decides', [['ON', 'AL', 'L'], 0], [1, 1]), ('control layout', [['LRI'], 0], [0, None]), ('control layout', [['AN', 'R'], 1], [1, 1])]]\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-paragraph-direction-numbers-as-strong","generated_at":"2026-09-29T14:49:52.936432+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Mixed right-to-left and left-to-right text must resolve levels and visual order exactly, or words, numbers and carets land in the wrong place.","root_cause":"European numbers are counted as strong left-to-right characters.","sha256":"d7980317361ee08ee42de5301a7972aace389691355e87d136e7df424a1cfaf8","title":"First-strong paragraph direction: numbers as strong · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.921,"exit_code":1,"observations":[{"actual":[0,0],"check":"numbers are not strong","expected":[1,2],"passed":false},{"actual":[0,2],"check":"regression: numbers as strong","expected":[0,4],"passed":false},{"actual":[0,1],"check":"regression: numbers as strong","expected":[0,2],"passed":false},{"actual":[0,1],"check":"regression: numbers as strong","expected":[0,null],"passed":false},{"actual":[1,4],"check":"stray PDI before isolate","expected":[1,4],"passed":true},{"actual":[1,6],"check":"nested isolates","expected":[1,6],"passed":true},{"actual":[0,0],"check":"control layout","expected":[0,0],"passed":true},{"actual":[1,null],"check":"control layout","expected":[1,null],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"numbers are not strong\", \"actual\": [0, 0], \"expected\": [1, 2], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 2], \"expected\": [0, 4], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 1], \"expected\": [0, 2], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 1], \"expected\": [0, null], \"passed\": false}, {\"check\": \"stray PDI before isolate\", \"actual\": [1, 4], \"expected\": [1, 4], \"passed\": true}, {\"check\": \"nested isolates\", \"actual\": [1, 6], \"expected\": [1, 6], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [1, null], \"expected\": [1, null], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.032,"exit_code":1,"observations":[{"actual":[0,0],"check":"numbers are not strong","expected":[1,2],"passed":false},{"actual":[0,2],"check":"regression: numbers as strong","expected":[0,4],"passed":false},{"actual":[0,1],"check":"regression: numbers as strong","expected":[0,2],"passed":false},{"actual":[0,1],"check":"regression: numbers as strong","expected":[0,null],"passed":false},{"actual":[1,4],"check":"stray PDI before isolate","expected":[1,4],"passed":true},{"actual":[1,6],"check":"nested isolates","expected":[1,6],"passed":true},{"actual":[0,0],"check":"control layout","expected":[0,0],"passed":true},{"actual":[1,null],"check":"control layout","expected":[1,null],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"numbers are not strong\", \"actual\": [0, 0], \"expected\": [1, 2], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 2], \"expected\": [0, 4], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 1], \"expected\": [0, 2], \"passed\": false}, {\"check\": \"regression: numbers as strong\", \"actual\": [0, 1], \"expected\": [0, null], \"passed\": false}, {\"check\": \"stray PDI before isolate\", \"actual\": [1, 4], \"expected\": [1, 4], \"passed\": true}, {\"check\": \"nested isolates\", \"actual\": [1, 6], \"expected\": [1, 6], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [1, null], \"expected\": [1, null], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}