FAILURE MAP
← Case archive

FA-79276 / Image orientation metadata / Open access

Tap exactly on the image far edge maps outside the image · case 01

Tapping the right or bottom boundary returns a stored coordinate one past the last pixel.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The bounds test includes the far edge, whose floor equals the extent.

VERIFIED REPAIR

Treat the displayed extent as half-open [0, dw).

Unsuccessful approach: Excluding the last whole pixel rejects valid taps.

Case 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.

Why this case matters

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.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(view, size, tag, tap):
    vw, vh = view
    w, h = size
    tx, ty = tap
    if tag not in range(1, 9):
        tag = 1
    dw, dh = (h, w) if tag >= 5 else (w, h)
    s = min(Fraction(vw, dw), Fraction(vh, dh))
    ox = (vw - dw * s) / 2
    oy = (vh - dh * s) / 2
    dx = (tx - ox) / s
    dy = (ty - oy) / s
    if dx < 0 or dy < 0 or dx > dw or dy > dh:
        return None
    px, py = math.floor(dx), math.floor(dy)
    if tag == 1:
        return [px, py]
    if tag == 2:
        return [w - 1 - px, py]
    if tag == 3:
        return [w - 1 - px, h - 1 - py]
    if tag == 4:
        return [px, h - 1 - py]
    if tag == 5:
        return [py, px]
    if tag == 6:
        return [py, h - 1 - px]
    if tag == 7:
        return [w - 1 - py, h - 1 - px]
    return [w - 1 - py, px]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([21, 25], [7, 5], 8, [12, 25]), None], [([24, 38], [5, 9], 2, [10, 35]), [2, 8]], [([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], [([15, 21], [9, 9], 5, [8, 18]), None]], [[([39, 10], [9, 4], 3, [22, 10]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([39, 14], [5, 3], 6, [26, 10]), None], [([14, 27], [5, 9], 4, [14, 4]), None]], [[([22, 22], [3, 2], 5, [6, 22]), None], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([11, 19], [8, 2], 8, [8, 11]), None], [([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], [([24, 31], [7, 5], 6, [20, 31]), None]], [[([21, 22], [8, 6], 5, [9, 22]), None], [([33, 11], [3, 9], 5, [1, 9]), [2, 0]], [([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], [([10, 18], [2, 5], 3, [4, 18]), None]], [[([35, 14], [8, 3], 2, [35, 5]), None], [([34, 23], [5, 8], 5, [26, 21]), [4, 6]], [([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]], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([33, 24], [4, 6], 6, [33, 2]), None]]]
labels = ["regression: far edge exclusion", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: far edge exclusion 0[-1, 2]NoneFailed
repair trap 1[2, 8][2, 8]Passed
combined fault 2NoneNonePassed
control 3NoneNonePassed
control 4NoneNonePassed
boundary 5[0, 5][0, 5]Passed
boundary 6NoneNonePassed
control 7[9, 4]NoneFailed

SHA-256 / eaaa6afa9dacf8a42f7d5be3302c4e96ceae470596457268aab767a6e306ba2e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(view, size, tag, tap):
    vw, vh = view
    w, h = size
    tx, ty = tap
    if tag not in range(1, 9):
        tag = 1
    dw, dh = (h, w) if tag >= 5 else (w, h)
    s = min(Fraction(vw, dw), Fraction(vh, dh))
    ox = (vw - dw * s) / 2
    oy = (vh - dh * s) / 2
    dx = (tx - ox) / s
    dy = (ty - oy) / s
    if dx < 0 or dy < 0 or dx >= dw - 1 or dy >= dh - 1:
        return None
    px, py = math.floor(dx), math.floor(dy)
    if tag == 1:
        return [px, py]
    if tag == 2:
        return [w - 1 - px, py]
    if tag == 3:
        return [w - 1 - px, h - 1 - py]
    if tag == 4:
        return [px, h - 1 - py]
    if tag == 5:
        return [py, px]
    if tag == 6:
        return [py, h - 1 - px]
    if tag == 7:
        return [w - 1 - py, h - 1 - px]
    return [w - 1 - py, px]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([21, 25], [7, 5], 8, [12, 25]), None], [([24, 38], [5, 9], 2, [10, 35]), [2, 8]], [([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], [([15, 21], [9, 9], 5, [8, 18]), None]], [[([39, 10], [9, 4], 3, [22, 10]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([39, 14], [5, 3], 6, [26, 10]), None], [([14, 27], [5, 9], 4, [14, 4]), None]], [[([22, 22], [3, 2], 5, [6, 22]), None], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([11, 19], [8, 2], 8, [8, 11]), None], [([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], [([24, 31], [7, 5], 6, [20, 31]), None]], [[([21, 22], [8, 6], 5, [9, 22]), None], [([33, 11], [3, 9], 5, [1, 9]), [2, 0]], [([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], [([10, 18], [2, 5], 3, [4, 18]), None]], [[([35, 14], [8, 3], 2, [35, 5]), None], [([34, 23], [5, 8], 5, [26, 21]), [4, 6]], [([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]], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([33, 24], [4, 6], 6, [33, 2]), None]]]
labels = ["regression: far edge exclusion", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: far edge exclusion 0NoneNonePassed
repair trap 1None[2, 8]Failed
combined fault 2NoneNonePassed
control 3NoneNonePassed
control 4NoneNonePassed
boundary 5[0, 5][0, 5]Passed
boundary 6NoneNonePassed
control 7NoneNonePassed

SHA-256 / 475b6df948a80bbc73011f9f70f33eb738ed0021a79bd1b69643087f4aa3484a

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(view, size, tag, tap):
    vw, vh = view
    w, h = size
    tx, ty = tap
    if tag not in range(1, 9):
        tag = 1
    dw, dh = (h, w) if tag >= 5 else (w, h)
    s = min(Fraction(vw, dw), Fraction(vh, dh))
    ox = (vw - dw * s) / 2
    oy = (vh - dh * s) / 2
    dx = (tx - ox) / s
    dy = (ty - oy) / s
    if dx < 0 or dy < 0 or dx >= dw or dy >= dh:
        return None
    px, py = math.floor(dx), math.floor(dy)
    if tag == 1:
        return [px, py]
    if tag == 2:
        return [w - 1 - px, py]
    if tag == 3:
        return [w - 1 - px, h - 1 - py]
    if tag == 4:
        return [px, h - 1 - py]
    if tag == 5:
        return [py, px]
    if tag == 6:
        return [py, h - 1 - px]
    if tag == 7:
        return [w - 1 - py, h - 1 - px]
    return [w - 1 - py, px]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([21, 25], [7, 5], 8, [12, 25]), None], [([24, 38], [5, 9], 2, [10, 35]), [2, 8]], [([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], [([15, 21], [9, 9], 5, [8, 18]), None]], [[([39, 10], [9, 4], 3, [22, 10]), None], [([29, 40], [2, 5], 3, [22, 11]), [0, 3]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([39, 14], [5, 3], 6, [26, 10]), None], [([14, 27], [5, 9], 4, [14, 4]), None]], [[([22, 22], [3, 2], 5, [6, 22]), None], [([35, 28], [3, 2], 6, [23, 18]), [1, 0]], [([11, 19], [8, 2], 8, [8, 11]), None], [([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], [([24, 31], [7, 5], 6, [20, 31]), None]], [[([21, 22], [8, 6], 5, [9, 22]), None], [([33, 11], [3, 9], 5, [1, 9]), [2, 0]], [([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], [([10, 18], [2, 5], 3, [4, 18]), None]], [[([35, 14], [8, 3], 2, [35, 5]), None], [([34, 23], [5, 8], 5, [26, 21]), [4, 6]], [([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]], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([33, 24], [4, 6], 6, [33, 2]), None]]]
labels = ["regression: far edge exclusion", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: far edge exclusion 0NoneNonePassed
repair trap 1[2, 8][2, 8]Passed
combined fault 2NoneNonePassed
control 3NoneNonePassed
control 4NoneNonePassed
boundary 5[0, 5][0, 5]Passed
boundary 6NoneNonePassed
control 7NoneNonePassed

SHA-256 / e70ede26b194b5a6544711e0e970e3fe79f412920e14b6bf83fc0595160cbb03

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:43.100839+00:00.

Case digest / d3d200212762d3877cb91c3af505ed87afe1d3182075e6a07d9cf29f88d6efb8