{"abstract":"Closing brackets in RTL text render unflipped.","category":"Bidirectional text layout","checks":8,"contract":"Input [text, resolved levels]. Characters at odd levels with a mirror pair ( ) [ ] { } < > « » are replaced by their mirror, decided per logical character; then runs are reversed from the highest level to the lowest odd level. Return the visual string.","contract_signature":"x","evaluation_group":"w2-bidirectional-text-layout-mirrored-rendering","failed_approach":"A symmetric ASCII-only table still misses guillemets.","family":"w2-bidirectional-text-layout-mirrored-rendering-mirror-table-symmetry","id":"FA-80561","implementations":{"attempt":{"sha256":"3b25dc12519b6af88ff22f9832ce0c2d9d69452c7eb0609f605fbb76f7956683","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport itertools\nN = 1\nobservations = []\ndef solve(x):\n    text, levels = x\n    M = {'(': ')', ')': '(', '[': ']', ']': '[', '{': '}', '}': '{', '<': '>', '>': '<'}\n    n = len(text)\n    glyphs = [M.get(ch, ch) if levels[i] % 2 == 1 else ch for i, ch in enumerate(text)]\n    order = list(range(n))\n    odd = [l for l in levels if l % 2]\n    if odd:\n        for lev in range(max(levels), min(odd) - 1, -1):\n            runs = []\n            for key, grp in itertools.groupby(order, key=lambda i: levels[i] >= lev):\n                g = list(grp)\n                runs.extend(g[::-1] if key else g)\n            order = runs\n    return ''.join(glyphs[i] for i in order)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('regression: mirror table symmetry', ['b(][)]{«({b]', [3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2]], '({b]»}[(][)b'), ('regression: mirror table symmetry', ['>»yyb)', [3, 3, 3, 3, 3, 1]], '(byy«<'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['<<«a', [2, 2, 2, 2]], '<<«a'), ('control layout', ['xy(>(xb', [2, 2, 2, 2, 2, 2, 2]], 'xy(>(xb'), ('control layout', ['y(x«[', [1, 0, 0, 0, 0]], 'y(x«[')], [('regression: mirror table symmetry', [')', [1]], '('), ('regression: mirror table symmetry', ['<[}y{([y', [1, 1, 1, 1, 1, 3, 3, 0]], '])}y{]>y'), ('regression: mirror table symmetry', ['{<[b«}x>«x', [0, 0, 0, 0, 0, 0, 0, 3, 3, 3]], '{<[b«}xx»<'), ('regression: mirror table symmetry', ['}«<)<yya<[y(', [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1]], ')y]>yay>(>»{'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['a[', [1, 1]], ']a'), ('control layout', ['»a[', [0, 0, 0]], '»a[')], [('regression: mirror table symmetry', ['«])ay}xb', [2, 2, 2, 2, 2, 3, 3, 4]], '«])aybx{'), ('regression: mirror table symmetry', ['xy(»«y{(', [2, 2, 4, 3, 3, 3, 3, 1]], ')xy}y»«('), ('regression: mirror table symmetry', ['<»b«{', [1, 1, 1, 4, 3]], '}«b«>'), ('regression: mirror table symmetry', ['y]«', [3, 3, 3]], '»[y'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('control layout', ['»»}<y[«}ay{x', [2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 4, 4]], '{xya«}]»»}<y'), ('control layout', ['ay]»y[', [2, 2, 2, 2, 1, 2]], '[yay]»')], [('regression: mirror table symmetry', ['x}b>y]({}>({', [0, 0, 1, 3, 0, 0, 0, 0, 1, 2, 2, 0]], 'x}<by]({>({{'), ('regression: mirror table symmetry', ['«]x)<', [1, 1, 1, 0, 1]], 'x[»)>'), ('regression: mirror table symmetry', ['}«<)<yya<[y(', [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1]], ')y]>yay>(>»{'), ('regression: mirror table symmetry', ['xy(»«y{(', [2, 2, 4, 3, 3, 3, 3, 1]], ')xy}y»«('), ('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('control layout', ['a', [2]], 'a'), ('control layout', ['b({()', [1, 1, 1, 0, 0]], '})b()')], [('regression: mirror table symmetry', ['<<(b]b)]]»', [3, 3, 3, 1, 1, 1, 0, 0, 0, 2]], 'b[b)>>)]]»'), ('regression: mirror table symmetry', ['()»<x»)yy', [3, 3, 0, 0, 0, 0, 0, 0, 0]], '()»<x»)yy'), ('partial-repair probe', ['yy(«x', [1, 1, 1, 1, 2]], 'x»)yy'), ('partial-repair probe', ['y[([ay[«', [1, 1, 1, 1, 1, 2, 2, 1]], '»y[a])]y'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['ba', [3, 3]], 'ab'), ('control layout', ['y', [3]], 'y')]]\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":"dfbf1a71dc1b314190f25ceef2415cb19b6a5811e60615913024ed6da60dd2bb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport itertools\nN = 1\nobservations = []\ndef solve(x):\n    text, levels = x\n    M = {'(': ')', '[': ']', '{': '}', '<': '>', '«': '»'}\n    n = len(text)\n    glyphs = [M.get(ch, ch) if levels[i] % 2 == 1 else ch for i, ch in enumerate(text)]\n    order = list(range(n))\n    odd = [l for l in levels if l % 2]\n    if odd:\n        for lev in range(max(levels), min(odd) - 1, -1):\n            runs = []\n            for key, grp in itertools.groupby(order, key=lambda i: levels[i] >= lev):\n                g = list(grp)\n                runs.extend(g[::-1] if key else g)\n            order = runs\n    return ''.join(glyphs[i] for i in order)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('regression: mirror table symmetry', ['b(][)]{«({b]', [3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2]], '({b]»}[(][)b'), ('regression: mirror table symmetry', ['>»yyb)', [3, 3, 3, 3, 3, 1]], '(byy«<'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['<<«a', [2, 2, 2, 2]], '<<«a'), ('control layout', ['xy(>(xb', [2, 2, 2, 2, 2, 2, 2]], 'xy(>(xb'), ('control layout', ['y(x«[', [1, 0, 0, 0, 0]], 'y(x«[')], [('regression: mirror table symmetry', [')', [1]], '('), ('regression: mirror table symmetry', ['<[}y{([y', [1, 1, 1, 1, 1, 3, 3, 0]], '])}y{]>y'), ('regression: mirror table symmetry', ['{<[b«}x>«x', [0, 0, 0, 0, 0, 0, 0, 3, 3, 3]], '{<[b«}xx»<'), ('regression: mirror table symmetry', ['}«<)<yya<[y(', [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1]], ')y]>yay>(>»{'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['a[', [1, 1]], ']a'), ('control layout', ['»a[', [0, 0, 0]], '»a[')], [('regression: mirror table symmetry', ['«])ay}xb', [2, 2, 2, 2, 2, 3, 3, 4]], '«])aybx{'), ('regression: mirror table symmetry', ['xy(»«y{(', [2, 2, 4, 3, 3, 3, 3, 1]], ')xy}y»«('), ('regression: mirror table symmetry', ['<»b«{', [1, 1, 1, 4, 3]], '}«b«>'), ('regression: mirror table symmetry', ['y]«', [3, 3, 3]], '»[y'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('control layout', ['»»}<y[«}ay{x', [2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 4, 4]], '{xya«}]»»}<y'), ('control layout', ['ay]»y[', [2, 2, 2, 2, 1, 2]], '[yay]»')], [('regression: mirror table symmetry', ['x}b>y]({}>({', [0, 0, 1, 3, 0, 0, 0, 0, 1, 2, 2, 0]], 'x}<by]({>({{'), ('regression: mirror table symmetry', ['«]x)<', [1, 1, 1, 0, 1]], 'x[»)>'), ('regression: mirror table symmetry', ['}«<)<yya<[y(', [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1]], ')y]>yay>(>»{'), ('regression: mirror table symmetry', ['xy(»«y{(', [2, 2, 4, 3, 3, 3, 3, 1]], ')xy}y»«('), ('bracket in RTL run', ['a(b)', [1, 1, 1, 1]], '(b)a'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('control layout', ['a', [2]], 'a'), ('control layout', ['b({()', [1, 1, 1, 0, 0]], '})b()')], [('regression: mirror table symmetry', ['<<(b]b)]]»', [3, 3, 3, 1, 1, 1, 0, 0, 0, 2]], 'b[b)>>)]]»'), ('regression: mirror table symmetry', ['()»<x»)yy', [3, 3, 0, 0, 0, 0, 0, 0, 0]], '()»<x»)yy'), ('partial-repair probe', ['yy(«x', [1, 1, 1, 1, 2]], 'x»)yy'), ('partial-repair probe', ['y[([ay[«', [1, 1, 1, 1, 1, 2, 2, 1]], '»y[a])]y'), ('guillemets RTL', ['«ab»', [1, 1, 1, 1]], '«ba»'), ('bracket at level two', ['(x)', [2, 2, 2]], '(x)'), ('control layout', ['ba', [3, 3]], 'ab'), ('control layout', ['y', [3]], 'y')]]\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-mirrored-rendering-mirror-table-symmetry","generated_at":"2026-09-29T14:49:54.892686+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 mirror table maps only opening characters to closing ones.","sha256":"486ec10508918017d65a49044ab6b018190b491b770087a1f50597c95c8b9ed4","title":"Mirrored glyph rendering: mirror table symmetry · 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.334,"exit_code":1,"observations":[{"actual":"(b)a","check":"bracket in RTL run","expected":"(b)a","passed":true},{"actual":"({b]«}[(][)b","check":"regression: mirror table symmetry","expected":"({b]»}[(][)b","passed":false},{"actual":"(byy»<","check":"regression: mirror table symmetry","expected":"(byy«<","passed":false},{"actual":"»ba«","check":"guillemets RTL","expected":"«ba»","passed":false},{"actual":"(x)","check":"bracket at level two","expected":"(x)","passed":true},{"actual":"<<«a","check":"control layout","expected":"<<«a","passed":true},{"actual":"xy(>(xb","check":"control layout","expected":"xy(>(xb","passed":true},{"actual":"y(x«[","check":"control layout","expected":"y(x«[","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bracket in RTL run\", \"actual\": \"(b)a\", \"expected\": \"(b)a\", \"passed\": true}, {\"check\": \"regression: mirror table symmetry\", \"actual\": \"({b]«}[(][)b\", \"expected\": \"({b]»}[(][)b\", \"passed\": false}, {\"check\": \"regression: mirror table symmetry\", \"actual\": \"(byy»<\", \"expected\": \"(byy«<\", \"passed\": false}, {\"check\": \"guillemets RTL\", \"actual\": \"»ba«\", \"expected\": \"«ba»\", \"passed\": false}, {\"check\": \"bracket at level two\", \"actual\": \"(x)\", \"expected\": \"(x)\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"<<«a\", \"expected\": \"<<«a\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"xy(>(xb\", \"expected\": \"xy(>(xb\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"y(x«[\", \"expected\": \"y(x«[\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.048,"exit_code":1,"observations":[{"actual":")b)a","check":"bracket in RTL run","expected":"(b)a","passed":false},{"actual":"({b]»}])]])b","check":"regression: mirror table symmetry","expected":"({b]»}[(][)b","passed":false},{"actual":")byy»>","check":"regression: mirror table symmetry","expected":"(byy«<","passed":false},{"actual":"»ba»","check":"guillemets RTL","expected":"«ba»","passed":false},{"actual":"(x)","check":"bracket at level two","expected":"(x)","passed":true},{"actual":"<<«a","check":"control layout","expected":"<<«a","passed":true},{"actual":"xy(>(xb","check":"control layout","expected":"xy(>(xb","passed":true},{"actual":"y(x«[","check":"control layout","expected":"y(x«[","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bracket in RTL run\", \"actual\": \")b)a\", \"expected\": \"(b)a\", \"passed\": false}, {\"check\": \"regression: mirror table symmetry\", \"actual\": \"({b]»}])]])b\", \"expected\": \"({b]»}[(][)b\", \"passed\": false}, {\"check\": \"regression: mirror table symmetry\", \"actual\": \")byy»>\", \"expected\": \"(byy«<\", \"passed\": false}, {\"check\": \"guillemets RTL\", \"actual\": \"»ba»\", \"expected\": \"«ba»\", \"passed\": false}, {\"check\": \"bracket at level two\", \"actual\": \"(x)\", \"expected\": \"(x)\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"<<«a\", \"expected\": \"<<«a\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"xy(>(xb\", \"expected\": \"xy(>(xb\", \"passed\": true}, {\"check\": \"control layout\", \"actual\": \"y(x«[\", \"expected\": \"y(x«[\", \"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."}}