{"abstract":"Tag 5 and 7 JPEGs are reported with stored width and height after a lossless bake.","category":"Image orientation metadata","checks":8,"contract":"Input [w, h, tag, sampling]. A lossless JPEG transform that bakes the orientation can only move whole MCUs (444: 8x8, 422: 16 wide x 8 high, 420: 16x16, 440: 8 wide x 16 high), so any partial MCU column or row that would move to the leading edge is trimmed. The tag decomposes into stored-space flips (fx, fy) followed by an optional transpose; fx trims the width and fy trims the height to a multiple of the MCU size. Invalid tags are treated as 1. Return the displayed [width, height], \"refuse\" when a trimmed side becomes 0, or \"unknown-sampling\".","evaluation_group":"w2-image-orientation-metadata-lossless-mcu-trim","failed_approach":"Requiring a horizontal flip as well misses tags 5 and 6.","family":"w2-image-orientation-metadata-lossless-mcu-trim-transpose-swap","id":"FA-79076","implementations":{"attempt":{"sha256":"a858bd1f750a4e856e0b7e0e6508524be65d2517eedba9d3246d6d8ba0299de9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (16, 8), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if fx and tr:\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[24, 16, 5, '422'], [16, 24]], [[24, 20, 5, '420'], [20, 24]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[40, 2600, 0, '440'], [40, 2600]], [[24, 20, 0, '444'], [24, 20]], [[16, 24, 0, '420'], [16, 24]], [[12, 16, 5, '444'], [16, 12]]], [[[2388, 13, 5, '420'], [13, 2388]], [[16, 20, 5, '440'], [20, 16]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[8, 2948, 7, '422'], 'refuse'], [[24, 24, 2, '440'], [24, 24]], [[2550, 16, 5, '444'], [16, 2550]]], [[[8, 12, 5, '422'], [12, 8]], [[8, 20, 6, '420'], [16, 8]], [[40, 24, 5, '422'], [24, 40]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[40, 24, 0, '422'], [40, 24]], [[40, 8, 7, '444'], [8, 40]]], [[[40, 81, 5, '444'], [81, 40]], [[24, 16, 6, '440'], [16, 24]], [[12, 32, 5, '420'], [32, 12]], [[40, 12, 2, '444'], [40, 12]], [[24, 24, 4, '420'], [24, 16]], [[24, 4, 3, '422'], 'refuse'], [[8, 8, 0, '411'], 'unknown-sampling'], [[2236, 16, 7, '422'], [16, 2224]]], [[[8, 24, 5, '422'], [24, 8]], [[1545, 12, 6, '422'], [8, 1545]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[40, 8, 1, '440'], [40, 8]], [[16, 8, 8, '422'], [8, 16]], [[1533, 16, 3, '411'], 'unknown-sampling'], [[8, 67, 7, '444'], [64, 8]]]]\nlabels = [\"regression: output dimension swap\", \"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":"3c28c24ad2d79e3122521c07bcc30a87426237ae5a6aeaff6aaf947b17f71127","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (16, 8), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if tag in (6, 8):\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[24, 16, 5, '422'], [16, 24]], [[24, 20, 5, '420'], [20, 24]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[40, 2600, 0, '440'], [40, 2600]], [[24, 20, 0, '444'], [24, 20]], [[16, 24, 0, '420'], [16, 24]], [[12, 16, 5, '444'], [16, 12]]], [[[2388, 13, 5, '420'], [13, 2388]], [[16, 20, 5, '440'], [20, 16]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[8, 2948, 7, '422'], 'refuse'], [[24, 24, 2, '440'], [24, 24]], [[2550, 16, 5, '444'], [16, 2550]]], [[[8, 12, 5, '422'], [12, 8]], [[8, 20, 6, '420'], [16, 8]], [[40, 24, 5, '422'], [24, 40]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[40, 24, 0, '422'], [40, 24]], [[40, 8, 7, '444'], [8, 40]]], [[[40, 81, 5, '444'], [81, 40]], [[24, 16, 6, '440'], [16, 24]], [[12, 32, 5, '420'], [32, 12]], [[40, 12, 2, '444'], [40, 12]], [[24, 24, 4, '420'], [24, 16]], [[24, 4, 3, '422'], 'refuse'], [[8, 8, 0, '411'], 'unknown-sampling'], [[2236, 16, 7, '422'], [16, 2224]]], [[[8, 24, 5, '422'], [24, 8]], [[1545, 12, 6, '422'], [8, 1545]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[40, 8, 1, '440'], [40, 8]], [[16, 8, 8, '422'], [8, 16]], [[1533, 16, 3, '411'], 'unknown-sampling'], [[8, 67, 7, '444'], [64, 8]]]]\nlabels = [\"regression: output dimension swap\", \"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":"e25da64c32f4dce8319625cee07c3a3f9f0958f728b6bdb951588ce5e50c1a6b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (16, 8), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if tr:\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[24, 16, 5, '422'], [16, 24]], [[24, 20, 5, '420'], [20, 24]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[40, 2600, 0, '440'], [40, 2600]], [[24, 20, 0, '444'], [24, 20]], [[16, 24, 0, '420'], [16, 24]], [[12, 16, 5, '444'], [16, 12]]], [[[2388, 13, 5, '420'], [13, 2388]], [[16, 20, 5, '440'], [20, 16]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[8, 2948, 7, '422'], 'refuse'], [[24, 24, 2, '440'], [24, 24]], [[2550, 16, 5, '444'], [16, 2550]]], [[[8, 12, 5, '422'], [12, 8]], [[8, 20, 6, '420'], [16, 8]], [[40, 24, 5, '422'], [24, 40]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[40, 24, 0, '422'], [40, 24]], [[40, 8, 7, '444'], [8, 40]]], [[[40, 81, 5, '444'], [81, 40]], [[24, 16, 6, '440'], [16, 24]], [[12, 32, 5, '420'], [32, 12]], [[40, 12, 2, '444'], [40, 12]], [[24, 24, 4, '420'], [24, 16]], [[24, 4, 3, '422'], 'refuse'], [[8, 8, 0, '411'], 'unknown-sampling'], [[2236, 16, 7, '422'], [16, 2224]]], [[[8, 24, 5, '422'], [24, 8]], [[1545, 12, 6, '422'], [8, 1545]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[40, 8, 1, '440'], [40, 8]], [[16, 8, 8, '422'], [8, 16]], [[1533, 16, 3, '411'], 'unknown-sampling'], [[8, 67, 7, '444'], [64, 8]]]]\nlabels = [\"regression: output dimension swap\", \"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-lossless-mcu-trim-transpose-swap","generated_at":"2026-09-29T14:49:41.159349+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":"Swap the trimmed dimensions whenever the decomposition includes a transpose.","root_cause":"Only the pure rotations swap the reported size.","sha256":"0f66c5547159019d257da574dbefa3b3b831e89b010e6b16fa5257419cf54a5b","title":"Lossless transpose keeps stored dimensions · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.418,"exit_code":1,"observations":[{"actual":[24,16],"check":"regression: output dimension swap 0","expected":[16,24],"passed":false},{"actual":[24,20],"check":"repair trap 1","expected":[20,24],"passed":false},{"actual":[24,12],"check":"combined fault 2","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 3","expected":[2969,96],"passed":true},{"actual":[40,2600],"check":"control 4","expected":[40,2600],"passed":true},{"actual":[24,20],"check":"boundary 5","expected":[24,20],"passed":true},{"actual":[16,24],"check":"boundary 6","expected":[16,24],"passed":true},{"actual":[12,16],"check":"control 7","expected":[16,12],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: output dimension swap 0\", \"actual\": [24, 16], \"expected\": [16, 24], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [24, 20], \"expected\": [20, 24], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [24, 20], \"expected\": [24, 20], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [12, 16], \"expected\": [16, 12], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.352,"exit_code":1,"observations":[{"actual":[24,16],"check":"regression: output dimension swap 0","expected":[16,24],"passed":false},{"actual":[24,20],"check":"repair trap 1","expected":[20,24],"passed":false},{"actual":[24,12],"check":"combined fault 2","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 3","expected":[2969,96],"passed":true},{"actual":[40,2600],"check":"control 4","expected":[40,2600],"passed":true},{"actual":[24,20],"check":"boundary 5","expected":[24,20],"passed":true},{"actual":[16,24],"check":"boundary 6","expected":[16,24],"passed":true},{"actual":[12,16],"check":"control 7","expected":[16,12],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: output dimension swap 0\", \"actual\": [24, 16], \"expected\": [16, 24], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [24, 20], \"expected\": [20, 24], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [24, 20], \"expected\": [24, 20], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [12, 16], \"expected\": [16, 12], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.273,"exit_code":0,"observations":[{"actual":[16,24],"check":"regression: output dimension swap 0","expected":[16,24],"passed":true},{"actual":[20,24],"check":"repair trap 1","expected":[20,24],"passed":true},{"actual":[24,12],"check":"combined fault 2","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 3","expected":[2969,96],"passed":true},{"actual":[40,2600],"check":"control 4","expected":[40,2600],"passed":true},{"actual":[24,20],"check":"boundary 5","expected":[24,20],"passed":true},{"actual":[16,24],"check":"boundary 6","expected":[16,24],"passed":true},{"actual":[16,12],"check":"control 7","expected":[16,12],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: output dimension swap 0\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [20, 24], \"expected\": [20, 24], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [24, 20], \"expected\": [24, 20], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [16, 12], \"expected\": [16, 12], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}