FA-78861 / Image orientation metadata / Open access
Pixel bake mirrors tag 2 across the wrong axis · case 01
Horizontally mirrored scans come out vertically flipped.
ROOT CAUSE
The tag-2 branch reverses rows (vertical flip) rather than columns.
VERIFIED REPAIR
Reverse the column index: grid[r][w-1-c].
Unsuccessful approach: Negative indexing with -c leaves column 0 in place and shifts the rest by one.
Case contract
Bake an EXIF-style orientation tag (1..8) into a row-major pixel grid so the result displays upright. Tags 2/4 mirror horizontally/vertically, 3 rotates 180, 6 rotates 90 clockwise, 8 rotates 90 counter-clockwise, 5 transposes and 7 transverses; tags outside 1..8 are treated as 1. Tags 5..8 swap the output width and height.
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
N = 1
observations = []
def solve(grid, tag):
h = len(grid)
w = len(grid[0]) if h else 0
if tag not in range(1, 9):
tag = 1
if tag in (5, 6, 7, 8):
out_h, out_w = w, h
else:
out_h, out_w = h, w
out = []
for r in range(out_h):
row = []
for c in range(out_w):
if tag == 1:
v = grid[r][c]
elif tag == 2:
v = grid[h - 1 - r][c]
elif tag == 3:
v = grid[h - 1 - r][w - 1 - c]
elif tag == 4:
v = grid[h - 1 - r][c]
elif tag == 5:
v = grid[c][r]
elif tag == 6:
v = grid[h - 1 - c][r]
elif tag == 7:
v = grid[h - 1 - c][w - 1 - r]
else:
v = grid[c][w - 1 - r]
row.append(v)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([[1, 2, 3, 4]], 2), [[4, 3, 2, 1]]], [([[1, 2, 3, 4], [11, 12, 13, 14]], 2), [[4, 3, 2, 1], [14, 13, 12, 11]]], [([[1, 2, 3, 4], [11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34]], 6), [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[1], [11], [21], [31]], 8), [[1, 11, 21, 31]]], [([[1, 2, 3], [11, 12, 13], [21, 22, 23]], 6), [[21, 11, 1], [22, 12, 2], [23, 13, 3]]], [([[1, 2, 3, 4]], 5), [[1], [2], [3], [4]]], [([[1, 2, 3]], 4), [[1, 2, 3]]], [([[1, 2], [11, 12], [21, 22], [31, 32]], 2), [[2, 1], [12, 11], [22, 21], [32, 31]]]], [[([[2, 3, 4, 5], [12, 13, 14, 15], [22, 23, 24, 25]], 2), [[5, 4, 3, 2], [15, 14, 13, 12], [25, 24, 23, 22]]], [([[2, 3], [12, 13], [22, 23], [32, 33]], 2), [[3, 2], [13, 12], [23, 22], [33, 32]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 9), [[2, 3, 4, 5], [12, 13, 14, 15]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24]], 0), [[2, 3, 4], [12, 13, 14], [22, 23, 24]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24], [32, 33, 34]], 6), [[32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[2]], 1), [[2]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 6), [[12, 2], [13, 3], [14, 4], [15, 5]]], [([[2, 3, 4, 5]], 2), [[5, 4, 3, 2]]]], [[([[3, 4, 5], [13, 14, 15]], 2), [[5, 4, 3], [15, 14, 13]]], [([[3, 4, 5, 6]], 2), [[6, 5, 4, 3]]], [([[3, 4, 5, 6]], 8), [[6], [5], [4], [3]]], [([[3, 4], [13, 14], [23, 24], [33, 34]], 8), [[4, 14, 24, 34], [3, 13, 23, 33]]], [([[3]], 8), [[3]]], [([[3, 4], [13, 14], [23, 24]], 6), [[23, 13, 3], [24, 14, 4]]], [([[3, 4, 5, 6], [13, 14, 15, 16], [23, 24, 25, 26]], 8), [[6, 16, 26], [5, 15, 25], [4, 14, 24], [3, 13, 23]]], [([[3, 4], [13, 14]], 2), [[4, 3], [14, 13]]]], [[([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 2), [[7, 6, 5, 4], [17, 16, 15, 14], [27, 26, 25, 24], [37, 36, 35, 34]]], [([[4, 5, 6], [14, 15, 16]], 2), [[6, 5, 4], [16, 15, 14]]], [([[4, 5], [14, 15]], 2), [[5, 4], [15, 14]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]]], [([[4, 5, 6], [14, 15, 16]], 3), [[16, 15, 14], [6, 5, 4]]], [([[4, 5], [14, 15]], 5), [[4, 14], [5, 15]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]]], [([[4, 5, 6]], 2), [[6, 5, 4]]]], [[([[5], [15]], 2), [[5], [15]]], [([[5, 6, 7], [15, 16, 17], [25, 26, 27]], 2), [[7, 6, 5], [17, 16, 15], [27, 26, 25]]], [([[5, 6, 7]], 2), [[7, 6, 5]]], [([[5], [15]], 4), [[15], [5]]], [([[5, 6]], 9), [[5, 6]]], [([[5]], 6), [[5]]], [([[5, 6, 7, 8], [15, 16, 17, 18], [25, 26, 27, 28]], 3), [[28, 27, 26, 25], [18, 17, 16, 15], [8, 7, 6, 5]]], [([[5], [15], [25], [35]], 2), [[5], [15], [25], [35]]]]]
labels = ["regression: tag 2 mirror axis", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tag 2 mirror axis 0 | [[1, 2, 3, 4]] | [[4, 3, 2, 1]] | Failed |
| repair trap 1 | [[11, 12, 13, 14], [1, 2, 3, 4]] | [[4, 3, 2, 1], [14, 13, 12, 11]] | Failed |
| combined fault 2 | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | Passed |
| control 3 | [[1, 11, 21, 31]] | [[1, 11, 21, 31]] | Passed |
| control 4 | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | Passed |
| boundary 5 | [[1], [2], [3], [4]] | [[1], [2], [3], [4]] | Passed |
| boundary 6 | [[1, 2, 3]] | [[1, 2, 3]] | Passed |
| control 7 | [[31, 32], [21, 22], [11, 12], [1, 2]] | [[2, 1], [12, 11], [22, 21], [32, 31]] | Failed |
SHA-256 / 99cd169eab676b905360013b7779851ba7bc5b49b185938f0c8c2d07505dc564
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, tag):
h = len(grid)
w = len(grid[0]) if h else 0
if tag not in range(1, 9):
tag = 1
if tag in (5, 6, 7, 8):
out_h, out_w = w, h
else:
out_h, out_w = h, w
out = []
for r in range(out_h):
row = []
for c in range(out_w):
if tag == 1:
v = grid[r][c]
elif tag == 2:
v = grid[r][-c]
elif tag == 3:
v = grid[h - 1 - r][w - 1 - c]
elif tag == 4:
v = grid[h - 1 - r][c]
elif tag == 5:
v = grid[c][r]
elif tag == 6:
v = grid[h - 1 - c][r]
elif tag == 7:
v = grid[h - 1 - c][w - 1 - r]
else:
v = grid[c][w - 1 - r]
row.append(v)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([[1, 2, 3, 4]], 2), [[4, 3, 2, 1]]], [([[1, 2, 3, 4], [11, 12, 13, 14]], 2), [[4, 3, 2, 1], [14, 13, 12, 11]]], [([[1, 2, 3, 4], [11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34]], 6), [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[1], [11], [21], [31]], 8), [[1, 11, 21, 31]]], [([[1, 2, 3], [11, 12, 13], [21, 22, 23]], 6), [[21, 11, 1], [22, 12, 2], [23, 13, 3]]], [([[1, 2, 3, 4]], 5), [[1], [2], [3], [4]]], [([[1, 2, 3]], 4), [[1, 2, 3]]], [([[1, 2], [11, 12], [21, 22], [31, 32]], 2), [[2, 1], [12, 11], [22, 21], [32, 31]]]], [[([[2, 3, 4, 5], [12, 13, 14, 15], [22, 23, 24, 25]], 2), [[5, 4, 3, 2], [15, 14, 13, 12], [25, 24, 23, 22]]], [([[2, 3], [12, 13], [22, 23], [32, 33]], 2), [[3, 2], [13, 12], [23, 22], [33, 32]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 9), [[2, 3, 4, 5], [12, 13, 14, 15]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24]], 0), [[2, 3, 4], [12, 13, 14], [22, 23, 24]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24], [32, 33, 34]], 6), [[32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[2]], 1), [[2]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 6), [[12, 2], [13, 3], [14, 4], [15, 5]]], [([[2, 3, 4, 5]], 2), [[5, 4, 3, 2]]]], [[([[3, 4, 5], [13, 14, 15]], 2), [[5, 4, 3], [15, 14, 13]]], [([[3, 4, 5, 6]], 2), [[6, 5, 4, 3]]], [([[3, 4, 5, 6]], 8), [[6], [5], [4], [3]]], [([[3, 4], [13, 14], [23, 24], [33, 34]], 8), [[4, 14, 24, 34], [3, 13, 23, 33]]], [([[3]], 8), [[3]]], [([[3, 4], [13, 14], [23, 24]], 6), [[23, 13, 3], [24, 14, 4]]], [([[3, 4, 5, 6], [13, 14, 15, 16], [23, 24, 25, 26]], 8), [[6, 16, 26], [5, 15, 25], [4, 14, 24], [3, 13, 23]]], [([[3, 4], [13, 14]], 2), [[4, 3], [14, 13]]]], [[([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 2), [[7, 6, 5, 4], [17, 16, 15, 14], [27, 26, 25, 24], [37, 36, 35, 34]]], [([[4, 5, 6], [14, 15, 16]], 2), [[6, 5, 4], [16, 15, 14]]], [([[4, 5], [14, 15]], 2), [[5, 4], [15, 14]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]]], [([[4, 5, 6], [14, 15, 16]], 3), [[16, 15, 14], [6, 5, 4]]], [([[4, 5], [14, 15]], 5), [[4, 14], [5, 15]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]]], [([[4, 5, 6]], 2), [[6, 5, 4]]]], [[([[5], [15]], 2), [[5], [15]]], [([[5, 6, 7], [15, 16, 17], [25, 26, 27]], 2), [[7, 6, 5], [17, 16, 15], [27, 26, 25]]], [([[5, 6, 7]], 2), [[7, 6, 5]]], [([[5], [15]], 4), [[15], [5]]], [([[5, 6]], 9), [[5, 6]]], [([[5]], 6), [[5]]], [([[5, 6, 7, 8], [15, 16, 17, 18], [25, 26, 27, 28]], 3), [[28, 27, 26, 25], [18, 17, 16, 15], [8, 7, 6, 5]]], [([[5], [15], [25], [35]], 2), [[5], [15], [25], [35]]]]]
labels = ["regression: tag 2 mirror axis", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tag 2 mirror axis 0 | [[1, 4, 3, 2]] | [[4, 3, 2, 1]] | Failed |
| repair trap 1 | [[1, 4, 3, 2], [11, 14, 13, 12]] | [[4, 3, 2, 1], [14, 13, 12, 11]] | Failed |
| combined fault 2 | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | Passed |
| control 3 | [[1, 11, 21, 31]] | [[1, 11, 21, 31]] | Passed |
| control 4 | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | Passed |
| boundary 5 | [[1], [2], [3], [4]] | [[1], [2], [3], [4]] | Passed |
| boundary 6 | [[1, 2, 3]] | [[1, 2, 3]] | Passed |
| control 7 | [[1, 2], [11, 12], [21, 22], [31, 32]] | [[2, 1], [12, 11], [22, 21], [32, 31]] | Failed |
SHA-256 / e9ca208d7bf241d14280e3cfa8fdca2389b0c1ec9584233032a691f13a2c143d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, tag):
h = len(grid)
w = len(grid[0]) if h else 0
if tag not in range(1, 9):
tag = 1
if tag in (5, 6, 7, 8):
out_h, out_w = w, h
else:
out_h, out_w = h, w
out = []
for r in range(out_h):
row = []
for c in range(out_w):
if tag == 1:
v = grid[r][c]
elif tag == 2:
v = grid[r][w - 1 - c]
elif tag == 3:
v = grid[h - 1 - r][w - 1 - c]
elif tag == 4:
v = grid[h - 1 - r][c]
elif tag == 5:
v = grid[c][r]
elif tag == 6:
v = grid[h - 1 - c][r]
elif tag == 7:
v = grid[h - 1 - c][w - 1 - r]
else:
v = grid[c][w - 1 - r]
row.append(v)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([[1, 2, 3, 4]], 2), [[4, 3, 2, 1]]], [([[1, 2, 3, 4], [11, 12, 13, 14]], 2), [[4, 3, 2, 1], [14, 13, 12, 11]]], [([[1, 2, 3, 4], [11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34]], 6), [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[1], [11], [21], [31]], 8), [[1, 11, 21, 31]]], [([[1, 2, 3], [11, 12, 13], [21, 22, 23]], 6), [[21, 11, 1], [22, 12, 2], [23, 13, 3]]], [([[1, 2, 3, 4]], 5), [[1], [2], [3], [4]]], [([[1, 2, 3]], 4), [[1, 2, 3]]], [([[1, 2], [11, 12], [21, 22], [31, 32]], 2), [[2, 1], [12, 11], [22, 21], [32, 31]]]], [[([[2, 3, 4, 5], [12, 13, 14, 15], [22, 23, 24, 25]], 2), [[5, 4, 3, 2], [15, 14, 13, 12], [25, 24, 23, 22]]], [([[2, 3], [12, 13], [22, 23], [32, 33]], 2), [[3, 2], [13, 12], [23, 22], [33, 32]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 9), [[2, 3, 4, 5], [12, 13, 14, 15]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24]], 0), [[2, 3, 4], [12, 13, 14], [22, 23, 24]]], [([[2, 3, 4], [12, 13, 14], [22, 23, 24], [32, 33, 34]], 6), [[32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]]], [([[2]], 1), [[2]]], [([[2, 3, 4, 5], [12, 13, 14, 15]], 6), [[12, 2], [13, 3], [14, 4], [15, 5]]], [([[2, 3, 4, 5]], 2), [[5, 4, 3, 2]]]], [[([[3, 4, 5], [13, 14, 15]], 2), [[5, 4, 3], [15, 14, 13]]], [([[3, 4, 5, 6]], 2), [[6, 5, 4, 3]]], [([[3, 4, 5, 6]], 8), [[6], [5], [4], [3]]], [([[3, 4], [13, 14], [23, 24], [33, 34]], 8), [[4, 14, 24, 34], [3, 13, 23, 33]]], [([[3]], 8), [[3]]], [([[3, 4], [13, 14], [23, 24]], 6), [[23, 13, 3], [24, 14, 4]]], [([[3, 4, 5, 6], [13, 14, 15, 16], [23, 24, 25, 26]], 8), [[6, 16, 26], [5, 15, 25], [4, 14, 24], [3, 13, 23]]], [([[3, 4], [13, 14]], 2), [[4, 3], [14, 13]]]], [[([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 2), [[7, 6, 5, 4], [17, 16, 15, 14], [27, 26, 25, 24], [37, 36, 35, 34]]], [([[4, 5, 6], [14, 15, 16]], 2), [[6, 5, 4], [16, 15, 14]]], [([[4, 5], [14, 15]], 2), [[5, 4], [15, 14]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27]]], [([[4, 5, 6], [14, 15, 16]], 3), [[16, 15, 14], [6, 5, 4]]], [([[4, 5], [14, 15]], 5), [[4, 14], [5, 15]]], [([[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]], 9), [[4, 5, 6, 7], [14, 15, 16, 17], [24, 25, 26, 27], [34, 35, 36, 37]]], [([[4, 5, 6]], 2), [[6, 5, 4]]]], [[([[5], [15]], 2), [[5], [15]]], [([[5, 6, 7], [15, 16, 17], [25, 26, 27]], 2), [[7, 6, 5], [17, 16, 15], [27, 26, 25]]], [([[5, 6, 7]], 2), [[7, 6, 5]]], [([[5], [15]], 4), [[15], [5]]], [([[5, 6]], 9), [[5, 6]]], [([[5]], 6), [[5]]], [([[5, 6, 7, 8], [15, 16, 17, 18], [25, 26, 27, 28]], 3), [[28, 27, 26, 25], [18, 17, 16, 15], [8, 7, 6, 5]]], [([[5], [15], [25], [35]], 2), [[5], [15], [25], [35]]]]]
labels = ["regression: tag 2 mirror axis", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tag 2 mirror axis 0 | [[4, 3, 2, 1]] | [[4, 3, 2, 1]] | Passed |
| repair trap 1 | [[4, 3, 2, 1], [14, 13, 12, 11]] | [[4, 3, 2, 1], [14, 13, 12, 11]] | Passed |
| combined fault 2 | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | [[31, 21, 11, 1], [32, 22, 12, 2], [33, 23, 13, 3], [34, 24, 14, 4]] | Passed |
| control 3 | [[1, 11, 21, 31]] | [[1, 11, 21, 31]] | Passed |
| control 4 | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | [[21, 11, 1], [22, 12, 2], [23, 13, 3]] | Passed |
| boundary 5 | [[1], [2], [3], [4]] | [[1], [2], [3], [4]] | Passed |
| boundary 6 | [[1, 2, 3]] | [[1, 2, 3]] | Passed |
| control 7 | [[2, 1], [12, 11], [22, 21], [32, 31]] | [[2, 1], [12, 11], [22, 21], [32, 31]] | Passed |
SHA-256 / 807683b7dbf27fa954b753ecbcf853ddf81fae6c5bb21ee363596a7a746e30f1
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:39.243936+00:00.
Case digest / b66edbec2304bfe0f96959fbc2a07a38494567a20ede23171a4fc39536e283c6