{"abstract":"Trailing whitespace is reset to the lowest level on the line.","category":"Bidirectional text layout","checks":8,"contract":"Input [original classes, resolved levels, paragraph level]. Reset to the paragraph level: every S and B; any run of WS and isolate formatting characters (FSI LRI RLI PDI) immediately before an S or B; and such a run at the end of the line. Return levels.","contract_signature":"x","evaluation_group":"w2-bidirectional-text-layout-whitespace-reset","failed_approach":"Using the first character level is equally unrelated to the paragraph level.","family":"w2-bidirectional-text-layout-whitespace-reset-reset-target-level","id":"FA-80516","implementations":{"attempt":{"sha256":"65e2247a258adc017c704f384b281f404a449df31de89946192bb0e529044123","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    classes, levels, para = x\n    out = list(levels)\n    n = len(classes)\n    RESETTABLE = ('WS', 'FSI', 'LRI', 'RLI', 'PDI')\n    j = n - 1\n    while j >= 0 and classes[j] in RESETTABLE:\n        out[j] = levels[0]\n        j -= 1\n    for i, c in enumerate(classes):\n        if c in ('S', 'B'):\n            out[i] = para\n            k = i - 1\n            while k >= 0 and classes[k] in RESETTABLE:\n                out[k] = para\n                k -= 1\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('regression: reset target level', [['ON', 'WS'], [2, 2], 1], [2, 1]), ('partial-repair probe', [['R', 'R', 'PDI', 'R', 'PDI'], [2, 1, 1, 1, 1], 1], [2, 1, 1, 1, 1]), ('regression: reset target level', [['L', 'R', 'WS'], [2, 2, 2], 1], [2, 2, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['RLI', 'ON'], [2, 2], 1], [2, 2]), ('control layout', [['PDI', 'S', 'WS', 'R'], [4, 4, 4, 4], 1], [1, 1, 4, 4])], [('regression: reset target level', [['R', 'L', 'RLI', 'L', 'LRI', 'B', 'L', 'ON', 'PDI'], [1, 2, 2, 2, 2, 0, 0, 0, 1], 1], [1, 2, 2, 2, 1, 1, 0, 0, 1]), ('regression: reset target level', [['WS', 'R', 'L', 'WS', 'R', 'EN', 'FSI'], [3, 3, 2, 2, 2, 2, 3], 1], [3, 3, 2, 2, 2, 2, 1]), ('regression: reset target level', [['LRI'], [2], 0], [0]), ('regression: reset target level', [['WS', 'L', 'FSI', 'R', 'ON', 'R', 'WS'], [3, 3, 0, 0, 1, 3, 3], 1], [3, 3, 0, 0, 1, 3, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'ON', 'L', 'WS', 'WS', 'ON', 'L', 'LRI', 'WS', 'EN', 'WS', 'L'], [4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], 1], [4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3]), ('control layout', [['ON', 'WS', 'S', 'L', 'R', 'ON'], [1, 1, 1, 0, 1, 1], 1], [1, 1, 1, 0, 1, 1])], [('regression: reset target level', [['WS', 'L', 'R', 'WS', 'WS', 'L', 'WS', 'RLI'], [3, 3, 3, 3, 2, 2, 2, 0], 1], [3, 3, 3, 3, 2, 2, 1, 1]), ('regression: reset target level', [['WS'], [0], 1], [1]), ('regression: reset target level', [['ON', 'PDI', 'FSI', 'L', 'B', 'PDI', 'S', 'L', 'WS', 'L', 'RLI', 'WS'], [3, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0], 1], [3, 3, 3, 3, 1, 1, 1, 2, 0, 0, 1, 1]), ('partial-repair probe', [['FSI', 'R', 'WS', 'ON', 'B', 'LRI'], [2, 2, 2, 0, 0, 3], 0], [2, 2, 2, 0, 0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['WS', 'R', 'WS', 'B', 'FSI', 'WS'], [1, 1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1, 1]), ('control layout', [['R', 'PDI', 'L', 'LRI', 'ON'], [2, 2, 2, 2, 2], 0], [2, 2, 2, 2, 2])], [('regression: reset target level', [['RLI', 'WS', 'WS'], [2, 2, 3], 1], [1, 1, 1]), ('regression: reset target level', [['L', 'B', 'WS', 'PDI', 'L', 'B', 'L', 'L', 'RLI'], [2, 2, 2, 2, 3, 3, 3, 2, 2], 1], [2, 1, 2, 2, 3, 1, 3, 2, 1]), ('regression: reset target level', [['B', 'L', 'R', 'L', 'PDI', 'ON', 'L', 'S', 'WS', 'ON', 'WS'], [4, 4, 4, 2, 2, 2, 2, 4, 4, 4, 3], 0], [0, 4, 4, 2, 2, 2, 2, 0, 4, 4, 0]), ('regression: reset target level', [['R', 'EN', 'PDI', 'S', 'WS'], [0, 0, 0, 0, 2], 1], [0, 0, 1, 1, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['RLI', 'L', 'ON', 'WS', 'WS', 'FSI', 'ON', 'WS', 'L'], [2, 3, 3, 3, 3, 0, 0, 2, 2], 1], [2, 3, 3, 3, 3, 0, 0, 2, 2]), ('control layout', [['WS', 'FSI', 'S', 'B', 'R', 'L'], [1, 1, 1, 1, 4, 1], 1], [1, 1, 1, 1, 4, 1])], [('regression: reset target level', [['R', 'EN', 'PDI', 'S', 'WS'], [0, 0, 0, 0, 2], 1], [0, 0, 1, 1, 1]), ('regression: reset target level', [['L', 'L', 'WS', 'PDI'], [2, 2, 2, 2], 0], [2, 2, 0, 0]), ('partial-repair probe', [['RLI', 'PDI', 'WS', 'S', 'L', 'R', 'R', 'R', 'WS', 'LRI'], [2, 2, 2, 2, 2, 2, 2, 1, 1, 1], 1], [1, 1, 1, 1, 2, 2, 2, 1, 1, 1]), ('regression: reset target level', [['S', 'R', 'ON', 'LRI', 'WS', 'R', 'WS', 'LRI', 'WS', 'R', 'WS'], [0, 0, 0, 0, 3, 3, 0, 3, 3, 3, 3], 1], [1, 0, 0, 0, 3, 3, 0, 3, 3, 3, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['RLI', 'PDI', 'FSI', 'PDI', 'EN', 'L', 'WS', 'WS', 'ON'], [2, 2, 2, 2, 2, 2, 2, 1, 4], 1], [2, 2, 2, 2, 2, 2, 2, 1, 4]), ('control layout', [['R', 'WS', 'R', 'EN', 'R'], [4, 4, 2, 2, 2], 0], [4, 4, 2, 2, 2])]]\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":"292ae7dbe6688c404347d5b09db1cfe9c8e8a1315febc615f9428f7f778f9fc5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    classes, levels, para = x\n    out = list(levels)\n    n = len(classes)\n    RESETTABLE = ('WS', 'FSI', 'LRI', 'RLI', 'PDI')\n    j = n - 1\n    while j >= 0 and classes[j] in RESETTABLE:\n        out[j] = min(levels)\n        j -= 1\n    for i, c in enumerate(classes):\n        if c in ('S', 'B'):\n            out[i] = para\n            k = i - 1\n            while k >= 0 and classes[k] in RESETTABLE:\n                out[k] = para\n                k -= 1\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('regression: reset target level', [['ON', 'WS'], [2, 2], 1], [2, 1]), ('partial-repair probe', [['R', 'R', 'PDI', 'R', 'PDI'], [2, 1, 1, 1, 1], 1], [2, 1, 1, 1, 1]), ('regression: reset target level', [['L', 'R', 'WS'], [2, 2, 2], 1], [2, 2, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['RLI', 'ON'], [2, 2], 1], [2, 2]), ('control layout', [['PDI', 'S', 'WS', 'R'], [4, 4, 4, 4], 1], [1, 1, 4, 4])], [('regression: reset target level', [['R', 'L', 'RLI', 'L', 'LRI', 'B', 'L', 'ON', 'PDI'], [1, 2, 2, 2, 2, 0, 0, 0, 1], 1], [1, 2, 2, 2, 1, 1, 0, 0, 1]), ('regression: reset target level', [['WS', 'R', 'L', 'WS', 'R', 'EN', 'FSI'], [3, 3, 2, 2, 2, 2, 3], 1], [3, 3, 2, 2, 2, 2, 1]), ('regression: reset target level', [['LRI'], [2], 0], [0]), ('regression: reset target level', [['WS', 'L', 'FSI', 'R', 'ON', 'R', 'WS'], [3, 3, 0, 0, 1, 3, 3], 1], [3, 3, 0, 0, 1, 3, 1]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['WS', 'ON', 'L', 'WS', 'WS', 'ON', 'L', 'LRI', 'WS', 'EN', 'WS', 'L'], [4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], 1], [4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3]), ('control layout', [['ON', 'WS', 'S', 'L', 'R', 'ON'], [1, 1, 1, 0, 1, 1], 1], [1, 1, 1, 0, 1, 1])], [('regression: reset target level', [['WS', 'L', 'R', 'WS', 'WS', 'L', 'WS', 'RLI'], [3, 3, 3, 3, 2, 2, 2, 0], 1], [3, 3, 3, 3, 2, 2, 1, 1]), ('regression: reset target level', [['WS'], [0], 1], [1]), ('regression: reset target level', [['ON', 'PDI', 'FSI', 'L', 'B', 'PDI', 'S', 'L', 'WS', 'L', 'RLI', 'WS'], [3, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0], 1], [3, 3, 3, 3, 1, 1, 1, 2, 0, 0, 1, 1]), ('partial-repair probe', [['FSI', 'R', 'WS', 'ON', 'B', 'LRI'], [2, 2, 2, 0, 0, 3], 0], [2, 2, 2, 0, 0, 0]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['WS', 'R', 'WS', 'B', 'FSI', 'WS'], [1, 1, 1, 1, 1, 1], 1], [1, 1, 1, 1, 1, 1]), ('control layout', [['R', 'PDI', 'L', 'LRI', 'ON'], [2, 2, 2, 2, 2], 0], [2, 2, 2, 2, 2])], [('regression: reset target level', [['RLI', 'WS', 'WS'], [2, 2, 3], 1], [1, 1, 1]), ('regression: reset target level', [['L', 'B', 'WS', 'PDI', 'L', 'B', 'L', 'L', 'RLI'], [2, 2, 2, 2, 3, 3, 3, 2, 2], 1], [2, 1, 2, 2, 3, 1, 3, 2, 1]), ('regression: reset target level', [['B', 'L', 'R', 'L', 'PDI', 'ON', 'L', 'S', 'WS', 'ON', 'WS'], [4, 4, 4, 2, 2, 2, 2, 4, 4, 4, 3], 0], [0, 4, 4, 2, 2, 2, 2, 0, 4, 4, 0]), ('regression: reset target level', [['R', 'EN', 'PDI', 'S', 'WS'], [0, 0, 0, 0, 2], 1], [0, 0, 1, 1, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('all whitespace line', [['WS', 'WS'], [1, 1], 0], [0, 0]), ('control layout', [['RLI', 'L', 'ON', 'WS', 'WS', 'FSI', 'ON', 'WS', 'L'], [2, 3, 3, 3, 3, 0, 0, 2, 2], 1], [2, 3, 3, 3, 3, 0, 0, 2, 2]), ('control layout', [['WS', 'FSI', 'S', 'B', 'R', 'L'], [1, 1, 1, 1, 4, 1], 1], [1, 1, 1, 1, 4, 1])], [('regression: reset target level', [['R', 'EN', 'PDI', 'S', 'WS'], [0, 0, 0, 0, 2], 1], [0, 0, 1, 1, 1]), ('regression: reset target level', [['L', 'L', 'WS', 'PDI'], [2, 2, 2, 2], 0], [2, 2, 0, 0]), ('partial-repair probe', [['RLI', 'PDI', 'WS', 'S', 'L', 'R', 'R', 'R', 'WS', 'LRI'], [2, 2, 2, 2, 2, 2, 2, 1, 1, 1], 1], [1, 1, 1, 1, 2, 2, 2, 1, 1, 1]), ('regression: reset target level', [['S', 'R', 'ON', 'LRI', 'WS', 'R', 'WS', 'LRI', 'WS', 'R', 'WS'], [0, 0, 0, 0, 3, 3, 0, 3, 3, 3, 3], 1], [1, 0, 0, 0, 3, 3, 0, 3, 3, 3, 1]), ('trailing isolate and space', [['R', 'R', 'PDI', 'WS'], [1, 1, 1, 1], 0], [1, 1, 0, 0]), ('space before tab', [['R', 'WS', 'S', 'R'], [1, 1, 1, 1], 0], [1, 0, 0, 1]), ('control layout', [['RLI', 'PDI', 'FSI', 'PDI', 'EN', 'L', 'WS', 'WS', 'ON'], [2, 2, 2, 2, 2, 2, 2, 1, 4], 1], [2, 2, 2, 2, 2, 2, 2, 1, 4]), ('control layout', [['R', 'WS', 'R', 'EN', 'R'], [4, 4, 2, 2, 2], 0], [4, 4, 2, 2, 2])]]\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-whitespace-reset-reset-target-level","generated_at":"2026-09-29T14:49:54.765626+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":"The trailing reset uses the minimum resolved level instead of the paragraph level.","sha256":"bad4a542cce538763d6c9224fa3850a39d32d2ac3e69c60d2b4f893323ac0135","title":"Line-end whitespace level reset: reset target level · 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":40.419,"exit_code":1,"observations":[{"actual":[1,1,1,1],"check":"trailing isolate and space","expected":[1,1,0,0],"passed":false},{"actual":[2,2],"check":"regression: reset target level","expected":[2,1],"passed":false},{"actual":[2,1,1,1,2],"check":"partial-repair probe","expected":[2,1,1,1,1],"passed":false},{"actual":[2,2,2],"check":"regression: reset target level","expected":[2,2,1],"passed":false},{"actual":[1,1],"check":"all whitespace line","expected":[0,0],"passed":false},{"actual":[1,0,0,1],"check":"space before tab","expected":[1,0,0,1],"passed":true},{"actual":[2,2],"check":"control layout","expected":[2,2],"passed":true},{"actual":[1,1,4,4],"check":"control layout","expected":[1,1,4,4],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"trailing isolate and space\", \"actual\": [1, 1, 1, 1], \"expected\": [1, 1, 0, 0], \"passed\": false}, {\"check\": \"regression: reset target level\", \"actual\": [2, 2], \"expected\": [2, 1], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [2, 1, 1, 1, 2], \"expected\": [2, 1, 1, 1, 1], \"passed\": false}, {\"check\": \"regression: reset target level\", \"actual\": [2, 2, 2], \"expected\": [2, 2, 1], \"passed\": false}, {\"check\": \"all whitespace line\", \"actual\": [1, 1], \"expected\": [0, 0], \"passed\": false}, {\"check\": \"space before tab\", \"actual\": [1, 0, 0, 1], \"expected\": [1, 0, 0, 1], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [2, 2], \"expected\": [2, 2], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [1, 1, 4, 4], \"expected\": [1, 1, 4, 4], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.499,"exit_code":1,"observations":[{"actual":[1,1,1,1],"check":"trailing isolate and space","expected":[1,1,0,0],"passed":false},{"actual":[2,2],"check":"regression: reset target level","expected":[2,1],"passed":false},{"actual":[2,1,1,1,1],"check":"partial-repair probe","expected":[2,1,1,1,1],"passed":true},{"actual":[2,2,2],"check":"regression: reset target level","expected":[2,2,1],"passed":false},{"actual":[1,1],"check":"all whitespace line","expected":[0,0],"passed":false},{"actual":[1,0,0,1],"check":"space before tab","expected":[1,0,0,1],"passed":true},{"actual":[2,2],"check":"control layout","expected":[2,2],"passed":true},{"actual":[1,1,4,4],"check":"control layout","expected":[1,1,4,4],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"trailing isolate and space\", \"actual\": [1, 1, 1, 1], \"expected\": [1, 1, 0, 0], \"passed\": false}, {\"check\": \"regression: reset target level\", \"actual\": [2, 2], \"expected\": [2, 1], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [2, 1, 1, 1, 1], \"expected\": [2, 1, 1, 1, 1], \"passed\": true}, {\"check\": \"regression: reset target level\", \"actual\": [2, 2, 2], \"expected\": [2, 2, 1], \"passed\": false}, {\"check\": \"all whitespace line\", \"actual\": [1, 1], \"expected\": [0, 0], \"passed\": false}, {\"check\": \"space before tab\", \"actual\": [1, 0, 0, 1], \"expected\": [1, 0, 0, 1], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [2, 2], \"expected\": [2, 2], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [1, 1, 4, 4], \"expected\": [1, 1, 4, 4], \"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."}}