{"abstract":"Taps near the letterbox bars map to pixels that are not on screen.","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":"Fitting only to the view width overflows tall images.","family":"w2-image-orientation-metadata-tap-to-stored-pixel-fit-mode","id":"FA-79271","implementations":{"attempt":{"sha256":"4150b671c83b619e25fda804b0243e98929c5d8923df23eac35354b98411e1b4","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 = Fraction(vw, dw)\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 = [[[([40, 25], [5, 4], 8, [32, 13]), None], [([32, 19], [6, 3], 8, [7, 6]), None], [([36, 10], [2, 9], 1, [36, 0]), None], [([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([38, 22], [9, 5], 4, [20, 12]), [4, 2]], [([11, 9], [3, 2], 6, [11, 2]), None], [([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([35, 16], [9, 2], 5, [3, 11]), None]], [[([40, 21], [2, 9], 3, [13, 12]), None], [([22, 39], [2, 9], 4, [16, 1]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([14, 32], [7, 4], 7, [8, 32]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([8, 33], [6, 2], 8, [3, 15]), [3, 0]], [([25, 26], [2, 9], 6, [18, 0]), None]], [[([11, 19], [8, 2], 8, [8, 11]), None], [([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 38], [2, 7], 4, [5, 7]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([33, 14], [4, 7], 7, [20, 5]), [2, 2]], [([8, 17], [2, 4], 1, [0, 11]), [0, 2]], [([10, 14], [2, 8], 6, [3, 6]), [0, 5]]], [[([22, 29], [9, 2], 3, [8, 26]), None], [([33, 29], [4, 8], 2, [22, 8]), [0, 2]], [([23, 17], [8, 8], 4, [2, 11]), None], [([33, 38], [9, 9], 4, [12, 18]), [3, 4]], [([39, 38], [3, 2], 2, [30, 38]), None], [([21, 27], [7, 5], 7, [12, 2]), [6, 2]], [([12, 23], [5, 9], 1, [9, 2]), [3, 0]], [([35, 33], [4, 8], 3, [8, 22]), None]], [[([29, 29], [7, 9], 8, [12, 2]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]], [([15, 35], [8, 2], 5, [2, 15]), None], [([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([39, 35], [7, 7], 4, [15, 9]), [2, 5]], [([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([14, 27], [3, 9], 3, [3, 26]), [2, 0]]]]\nlabels = [\"regression: contain versus cover scale\", \"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":"d98798cc2f42040607222fb2ebaf8c2cf498347a53998eef5967f255d5159157","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 = max(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 = [[[([40, 25], [5, 4], 8, [32, 13]), None], [([32, 19], [6, 3], 8, [7, 6]), None], [([36, 10], [2, 9], 1, [36, 0]), None], [([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([38, 22], [9, 5], 4, [20, 12]), [4, 2]], [([11, 9], [3, 2], 6, [11, 2]), None], [([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([35, 16], [9, 2], 5, [3, 11]), None]], [[([40, 21], [2, 9], 3, [13, 12]), None], [([22, 39], [2, 9], 4, [16, 1]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([14, 32], [7, 4], 7, [8, 32]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([8, 33], [6, 2], 8, [3, 15]), [3, 0]], [([25, 26], [2, 9], 6, [18, 0]), None]], [[([11, 19], [8, 2], 8, [8, 11]), None], [([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 38], [2, 7], 4, [5, 7]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([33, 14], [4, 7], 7, [20, 5]), [2, 2]], [([8, 17], [2, 4], 1, [0, 11]), [0, 2]], [([10, 14], [2, 8], 6, [3, 6]), [0, 5]]], [[([22, 29], [9, 2], 3, [8, 26]), None], [([33, 29], [4, 8], 2, [22, 8]), [0, 2]], [([23, 17], [8, 8], 4, [2, 11]), None], [([33, 38], [9, 9], 4, [12, 18]), [3, 4]], [([39, 38], [3, 2], 2, [30, 38]), None], [([21, 27], [7, 5], 7, [12, 2]), [6, 2]], [([12, 23], [5, 9], 1, [9, 2]), [3, 0]], [([35, 33], [4, 8], 3, [8, 22]), None]], [[([29, 29], [7, 9], 8, [12, 2]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]], [([15, 35], [8, 2], 5, [2, 15]), None], [([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([39, 35], [7, 7], 4, [15, 9]), [2, 5]], [([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([14, 27], [3, 9], 3, [3, 26]), [2, 0]]]]\nlabels = [\"regression: contain versus cover scale\", \"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":"127dcd8fa500374a2aa72f7af0cd29ec70c394856a31c879a3c38da9faff2d61","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 = [[[([40, 25], [5, 4], 8, [32, 13]), None], [([32, 19], [6, 3], 8, [7, 6]), None], [([36, 10], [2, 9], 1, [36, 0]), None], [([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([38, 22], [9, 5], 4, [20, 12]), [4, 2]], [([11, 9], [3, 2], 6, [11, 2]), None], [([38, 23], [5, 8], 6, [12, 1]), [0, 5]], [([35, 16], [9, 2], 5, [3, 11]), None]], [[([40, 21], [2, 9], 3, [13, 12]), None], [([22, 39], [2, 9], 4, [16, 1]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([14, 32], [7, 4], 7, [8, 32]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([8, 33], [6, 2], 8, [3, 15]), [3, 0]], [([25, 26], [2, 9], 6, [18, 0]), None]], [[([11, 19], [8, 2], 8, [8, 11]), None], [([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 38], [2, 7], 4, [5, 7]), None], [([15, 28], [7, 3], 6, [4, 18]), [4, 2]], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([33, 14], [4, 7], 7, [20, 5]), [2, 2]], [([8, 17], [2, 4], 1, [0, 11]), [0, 2]], [([10, 14], [2, 8], 6, [3, 6]), [0, 5]]], [[([22, 29], [9, 2], 3, [8, 26]), None], [([33, 29], [4, 8], 2, [22, 8]), [0, 2]], [([23, 17], [8, 8], 4, [2, 11]), None], [([33, 38], [9, 9], 4, [12, 18]), [3, 4]], [([39, 38], [3, 2], 2, [30, 38]), None], [([21, 27], [7, 5], 7, [12, 2]), [6, 2]], [([12, 23], [5, 9], 1, [9, 2]), [3, 0]], [([35, 33], [4, 8], 3, [8, 22]), None]], [[([29, 29], [7, 9], 8, [12, 2]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]], [([15, 35], [8, 2], 5, [2, 15]), None], [([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([39, 35], [7, 7], 4, [15, 9]), [2, 5]], [([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([39, 29], [4, 8], 6, [11, 19]), [2, 5]], [([14, 27], [3, 9], 3, [3, 26]), [2, 0]]]]\nlabels = [\"regression: contain versus cover scale\", \"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-fit-mode","generated_at":"2026-09-29T14:49:43.096539+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":"Use the smaller ratio so the whole image fits.","root_cause":"The scale uses the larger ratio (cover), but the viewer uses contain.","sha256":"dbf4ac189ad8b20bae985d130c22522a052b10be5bef04600266fd595c52f7c9","title":"Tap mapping assumes cover fit · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.302,"exit_code":1,"observations":[{"actual":[2,3],"check":"regression: contain versus cover scale 0","expected":null,"passed":false},{"actual":[3,0],"check":"repair trap 1","expected":null,"passed":false},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":[7,4],"check":"control 3","expected":[7,4],"passed":true},{"actual":[4,2],"check":"control 4","expected":[4,2],"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 6","expected":[0,5],"passed":true},{"actual":[4,0],"check":"control 7","expected":null,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: contain versus cover scale 0\", \"actual\": [2, 3], \"expected\": null, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [3, 0], \"expected\": null, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": [7, 4], \"expected\": [7, 4], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [4, 2], \"expected\": [4, 2], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [4, 0], \"expected\": null, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.509,"exit_code":1,"observations":[{"actual":[2,3],"check":"regression: contain versus cover scale 0","expected":null,"passed":false},{"actual":[3,0],"check":"repair trap 1","expected":null,"passed":false},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":[7,4],"check":"control 3","expected":[7,4],"passed":true},{"actual":[4,2],"check":"control 4","expected":[4,2],"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 6","expected":[0,5],"passed":true},{"actual":[4,0],"check":"control 7","expected":null,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: contain versus cover scale 0\", \"actual\": [2, 3], \"expected\": null, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [3, 0], \"expected\": null, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": [7, 4], \"expected\": [7, 4], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [4, 2], \"expected\": [4, 2], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [4, 0], \"expected\": null, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.311,"exit_code":0,"observations":[{"actual":null,"check":"regression: contain versus cover scale 0","expected":null,"passed":true},{"actual":null,"check":"repair trap 1","expected":null,"passed":true},{"actual":null,"check":"combined fault 2","expected":null,"passed":true},{"actual":[7,4],"check":"control 3","expected":[7,4],"passed":true},{"actual":[4,2],"check":"control 4","expected":[4,2],"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":[0,5],"check":"boundary 6","expected":[0,5],"passed":true},{"actual":null,"check":"control 7","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: contain versus cover scale 0\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 3\", \"actual\": [7, 4], \"expected\": [7, 4], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [4, 2], \"expected\": [4, 2], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [0, 5], \"expected\": [0, 5], \"passed\": true}, {\"check\": \"control 7\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}