{"abstract":"Tap-to-focus on portrait photos selects a point mirrored across the diagonal.","category":"Image orientation metadata","checks":8,"contract":"A viewer letterboxes the displayed image (contain fit, centred) inside a view [vw, vh]. Map a tap [tx, ty] in view coordinates to the stored pixel [x, y] of an image of stored size [w, h] with orientation tag 1..8 (invalid -> 1); tags 5..8 swap displayed axes. Taps in the letterbox bars or on the far edge return None; the displayed pixel is floor of the exact position, then mapped back through the inverse of the orientation.","evaluation_group":"w2-image-orientation-metadata-tap-to-stored-pixel","failed_approach":"Using the width as the mirror extent is the tag-8 inverse, not tag 6.","family":"w2-image-orientation-metadata-tap-to-stored-pixel-inverse-tag6","id":"FA-79261","implementations":{"attempt":{"sha256":"8a7e66f3294a5694096a294d84e6a1cbe28bf72f3b2ad362d5b1e5c70328d7ab","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(view, size, tag, tap):\n    vw, vh = view\n    w, h = size\n    tx, ty = tap\n    if tag not in range(1, 9):\n        tag = 1\n    dw, dh = (h, w) if tag >= 5 else (w, h)\n    s = min(Fraction(vw, dw), Fraction(vh, dh))\n    ox = (vw - dw * s) / 2\n    oy = (vh - dh * s) / 2\n    dx = (tx - ox) / s\n    dy = (ty - oy) / s\n    if dx < 0 or dy < 0 or dx >= dw or dy >= dh:\n        return None\n    px, py = math.floor(dx), math.floor(dy)\n    if tag == 1:\n        return [px, py]\n    if tag == 2:\n        return [w - 1 - px, py]\n    if tag == 3:\n        return [w - 1 - px, h - 1 - py]\n    if tag == 4:\n        return [px, h - 1 - py]\n    if tag == 5:\n        return [py, px]\n    if tag == 6:\n        return [py, w - 1 - px]\n    if tag == 7:\n        return [w - 1 - py, h - 1 - px]\n    return [w - 1 - py, px]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([13, 35], [3, 2], 6, [12, 19]), [1, 0]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 27], [6, 9], 6, [18, 15]), [3, 1]]], [[([38, 27], [8, 8], 6, [10, 21]), [6, 6]], [([22, 10], [5, 9], 6, [17, 5]), [2, 1]], [([22, 28], [8, 7], 6, [5, 13]), [3, 5]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([23, 36], [6, 4], 6, [14, 11]), [1, 1]]], [[([8, 30], [2, 5], 6, [7, 15]), [1, 0]], [([9, 19], [5, 6], 6, [1, 9]), [2, 5]], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]]], [[([36, 34], [5, 7], 6, [14, 25]), [4, 4]], [([36, 37], [6, 8], 6, [29, 28]), [5, 1]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([29, 39], [9, 2], 8, [0, 36]), None], [([35, 10], [4, 8], 6, [17, 8]), [3, 4]]], [[([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([15, 17], [5, 7], 6, [8, 9]), [2, 3]], [([29, 39], [7, 6], 6, [23, 25]), [4, 1]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]]]]\nlabels = [\"regression: inverse mapping for tag 6\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), 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":"7e74c106633bf5e1ba68de73e4f51a9225fc6df7f4fc45009773137a59d56bbd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(view, size, tag, tap):\n    vw, vh = view\n    w, h = size\n    tx, ty = tap\n    if tag not in range(1, 9):\n        tag = 1\n    dw, dh = (h, w) if tag >= 5 else (w, h)\n    s = min(Fraction(vw, dw), Fraction(vh, dh))\n    ox = (vw - dw * s) / 2\n    oy = (vh - dh * s) / 2\n    dx = (tx - ox) / s\n    dy = (ty - oy) / s\n    if dx < 0 or dy < 0 or dx >= dw or dy >= dh:\n        return None\n    px, py = math.floor(dx), math.floor(dy)\n    if tag == 1:\n        return [px, py]\n    if tag == 2:\n        return [w - 1 - px, py]\n    if tag == 3:\n        return [w - 1 - px, h - 1 - py]\n    if tag == 4:\n        return [px, h - 1 - py]\n    if tag == 5:\n        return [py, px]\n    if tag == 6:\n        return [h - 1 - py, px]\n    if tag == 7:\n        return [w - 1 - py, h - 1 - px]\n    return [w - 1 - py, px]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([13, 35], [3, 2], 6, [12, 19]), [1, 0]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 27], [6, 9], 6, [18, 15]), [3, 1]]], [[([38, 27], [8, 8], 6, [10, 21]), [6, 6]], [([22, 10], [5, 9], 6, [17, 5]), [2, 1]], [([22, 28], [8, 7], 6, [5, 13]), [3, 5]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([23, 36], [6, 4], 6, [14, 11]), [1, 1]]], [[([8, 30], [2, 5], 6, [7, 15]), [1, 0]], [([9, 19], [5, 6], 6, [1, 9]), [2, 5]], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]]], [[([36, 34], [5, 7], 6, [14, 25]), [4, 4]], [([36, 37], [6, 8], 6, [29, 28]), [5, 1]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([29, 39], [9, 2], 8, [0, 36]), None], [([35, 10], [4, 8], 6, [17, 8]), [3, 4]]], [[([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([15, 17], [5, 7], 6, [8, 9]), [2, 3]], [([29, 39], [7, 6], 6, [23, 25]), [4, 1]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]]]]\nlabels = [\"regression: inverse mapping for tag 6\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), 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":"77deb3127e7778c28a757901abb898c0764ef52728786287260acb2b36173574","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(view, size, tag, tap):\n    vw, vh = view\n    w, h = size\n    tx, ty = tap\n    if tag not in range(1, 9):\n        tag = 1\n    dw, dh = (h, w) if tag >= 5 else (w, h)\n    s = min(Fraction(vw, dw), Fraction(vh, dh))\n    ox = (vw - dw * s) / 2\n    oy = (vh - dh * s) / 2\n    dx = (tx - ox) / s\n    dy = (ty - oy) / s\n    if dx < 0 or dy < 0 or dx >= dw or dy >= dh:\n        return None\n    px, py = math.floor(dx), math.floor(dy)\n    if tag == 1:\n        return [px, py]\n    if tag == 2:\n        return [w - 1 - px, py]\n    if tag == 3:\n        return [w - 1 - px, h - 1 - py]\n    if tag == 4:\n        return [px, h - 1 - py]\n    if tag == 5:\n        return [py, px]\n    if tag == 6:\n        return [py, h - 1 - px]\n    if tag == 7:\n        return [w - 1 - py, h - 1 - px]\n    return [w - 1 - py, px]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([13, 35], [3, 2], 6, [12, 19]), [1, 0]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 27], [6, 9], 6, [18, 15]), [3, 1]]], [[([38, 27], [8, 8], 6, [10, 21]), [6, 6]], [([22, 10], [5, 9], 6, [17, 5]), [2, 1]], [([22, 28], [8, 7], 6, [5, 13]), [3, 5]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([23, 36], [6, 4], 6, [14, 11]), [1, 1]]], [[([8, 30], [2, 5], 6, [7, 15]), [1, 0]], [([9, 19], [5, 6], 6, [1, 9]), [2, 5]], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]]], [[([36, 34], [5, 7], 6, [14, 25]), [4, 4]], [([36, 37], [6, 8], 6, [29, 28]), [5, 1]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([29, 39], [9, 2], 8, [0, 36]), None], [([35, 10], [4, 8], 6, [17, 8]), [3, 4]]], [[([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([15, 17], [5, 7], 6, [8, 9]), [2, 3]], [([29, 39], [7, 6], 6, [23, 25]), [4, 1]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]]]]\nlabels = [\"regression: inverse mapping for tag 6\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), 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 bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. 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-image-orientation-metadata-tap-to-stored-pixel-inverse-tag6","generated_at":"2026-09-29T14:49:43.046152+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Camera, phone and scanner images carry an orientation hint separately from the stored pixels; galleries, thumbnailers, editors and upload pipelines must interpret it consistently or photos appear sideways, mirrored or doubly rotated.","repair":"Invert the clockwise rotation: x = display y, y = h - 1 - display x.","root_cause":"The display-to-stored conversion reuses the stored-to-display formula for tag 6.","sha256":"9a41543783b40dfa7694ee034fe810af5ab7fad0aef9f437a8526f699af0d821","title":"Tap mapping applies the forward tag-6 rotation instead of its inverse · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.168,"exit_code":1,"observations":[{"actual":[0,2],"check":"regression: inverse mapping for tag 6 0","expected":[0,5],"passed":false},{"actual":[1,1],"check":"repair trap 1","expected":[1,0],"passed":false},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 5","expected":[0,5],"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":[3,-2],"check":"control 7","expected":[3,1],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: inverse mapping for tag 6 0\", \"actual\": [0, 2], \"expected\": [0, 5], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [1, 1], \"expected\": [1, 0], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [3, -2], \"expected\": [3, 1], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.819,"exit_code":1,"observations":[{"actual":[7,2],"check":"regression: inverse mapping for tag 6 0","expected":[0,5],"passed":false},{"actual":[0,1],"check":"repair trap 1","expected":[1,0],"passed":false},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 5","expected":[0,5],"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":[5,7],"check":"control 7","expected":[3,1],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: inverse mapping for tag 6 0\", \"actual\": [7, 2], \"expected\": [0, 5], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [0, 1], \"expected\": [1, 0], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [5, 7], \"expected\": [3, 1], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.435,"exit_code":0,"observations":[{"actual":[0,5],"check":"regression: inverse mapping for tag 6 0","expected":[0,5],"passed":true},{"actual":[1,0],"check":"repair trap 1","expected":[1,0],"passed":true},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 5","expected":[0,5],"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":[3,1],"check":"control 7","expected":[3,1],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: inverse mapping for tag 6 0\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [1, 0], \"expected\": [1, 0], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [3, 1], \"expected\": [3, 1], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}