{"abstract":"Selfies are saved with unmirrored tags, so text on shirts reads correctly in the preview but the file shows it reversed.","category":"Image orientation metadata","checks":8,"contract":"Input [gx, gy, previous_rotation, camera] with gravity in milli-g in the portrait device frame (x right, y down). Device rotation: keep the previous bucket when the in-plane magnitude is below 300 mg or |gx| == |gy| (hysteresis); otherwise gy dominates -> 0 (gy > 0) or 180, gx dominates -> 90 (gx > 0) or 270. The back sensor is mounted at 90 degrees and needs (90 + r) mod 360 clockwise; the mirrored front sensor is mounted at 270 and needs (270 - r) mod 360 with the mirror bit. The tag comes from (quarter turns, mirror) via 1:(0,0) 2:(0,1) 3:(2,0) 4:(2,1) 5:(3,1) 6:(1,0) 7:(1,1) 8:(3,0). Return [tag, r].","evaluation_group":"w2-image-orientation-metadata-capture-accelerometer","failed_approach":"Adding a half turn does not emulate a mirror.","family":"w2-image-orientation-metadata-capture-accelerometer-front-mirror-bit","id":"FA-79106","implementations":{"attempt":{"sha256":"6bdb9d4f621215397cedb84e0635bdfda9d406bb6cc4834e7ce39bc4f94770f3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    gx, gy, prev_r, camera = x\n    if gx * gx + gy * gy < 300 * 300 or abs(gx) == abs(gy):\n        r = prev_r\n    elif abs(gy) > abs(gx):\n        r = 0 if gy > 0 else 180\n    else:\n        r = 90 if gx > 0 else 270\n    from_km = {(0, 0): 1, (0, 1): 2, (2, 0): 3, (2, 1): 4, (3, 1): 5, (1, 0): 6, (1, 1): 7, (3, 0): 8}\n    if camera == 'front':\n        total = (270 - r) % 360\n        return [from_km[((total // 90 + 2) % 4, 0)], r]\n    total = (90 + r) % 360\n    return [from_km[(total // 90, 0)], r]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[298, 553, 180, 'front'], [5, 0]], [[686, -373, 90, 'front'], [4, 90]], [[-382, -382, 180, 'back'], [8, 180]], [[50, -890, 180, 'back'], [8, 180]], [[53, -848, 270, 'back'], [8, 180]], [[247, -67, 270, 'back'], [1, 270]], [[201, -186, 180, 'back'], [8, 180]], [[-285, -766, 90, 'front'], [7, 180]]], [[[-835, 686, 0, 'front'], [2, 270]], [[-714, 28, 0, 'front'], [2, 270]], [[-926, 466, 0, 'back'], [1, 270]], [[110, -610, 0, 'back'], [8, 180]], [[-900, 900, 270, 'back'], [1, 270]], [[-869, 635, 270, 'back'], [1, 270]], [[-239, -597, 180, 'back'], [8, 180]], [[-993, 66, 0, 'front'], [2, 270]]], [[[-176, 109, 270, 'front'], [2, 270]], [[834, 834, 180, 'front'], [7, 180]], [[486, 992, 270, 'back'], [6, 0]], [[54, 63, 0, 'back'], [6, 0]], [[-86, -105, 270, 'back'], [1, 270]], [[-134, -182, 180, 'back'], [8, 180]], [[734, 301, 180, 'back'], [3, 90]], [[60, 809, 0, 'front'], [5, 0]]], [[[213, 206, 270, 'front'], [2, 270]], [[392, -1000, 270, 'front'], [7, 180]], [[137, 86, 180, 'back'], [8, 180]], [[116, 53, 90, 'back'], [3, 90]], [[-183, 181, 180, 'back'], [8, 180]], [[-651, 121, 180, 'back'], [1, 270]], [[49, 14, 180, 'back'], [8, 180]], [[-211, 211, 90, 'front'], [4, 90]]], [[[-869, -869, 0, 'front'], [5, 0]], [[-38, 38, 270, 'front'], [2, 270]], [[816, 260, 0, 'back'], [3, 90]], [[-188, 149, 180, 'back'], [8, 180]], [[-532, 686, 180, 'back'], [6, 0]], [[-67, 67, 270, 'back'], [1, 270]], [[-119, 365, 180, 'back'], [6, 0]], [[994, 659, 180, 'front'], [4, 90]]]]\nlabels = [\"regression: front camera mirror bit\", \"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":"c89cb08fa657996cf6f5e87980db71d54d20089a94e5ddef6a002e2e460f41c4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    gx, gy, prev_r, camera = x\n    if gx * gx + gy * gy < 300 * 300 or abs(gx) == abs(gy):\n        r = prev_r\n    elif abs(gy) > abs(gx):\n        r = 0 if gy > 0 else 180\n    else:\n        r = 90 if gx > 0 else 270\n    from_km = {(0, 0): 1, (0, 1): 2, (2, 0): 3, (2, 1): 4, (3, 1): 5, (1, 0): 6, (1, 1): 7, (3, 0): 8}\n    if camera == 'front':\n        total = (270 - r) % 360\n        return [from_km[(total // 90, 0)], r]\n    total = (90 + r) % 360\n    return [from_km[(total // 90, 0)], r]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[298, 553, 180, 'front'], [5, 0]], [[686, -373, 90, 'front'], [4, 90]], [[-382, -382, 180, 'back'], [8, 180]], [[50, -890, 180, 'back'], [8, 180]], [[53, -848, 270, 'back'], [8, 180]], [[247, -67, 270, 'back'], [1, 270]], [[201, -186, 180, 'back'], [8, 180]], [[-285, -766, 90, 'front'], [7, 180]]], [[[-835, 686, 0, 'front'], [2, 270]], [[-714, 28, 0, 'front'], [2, 270]], [[-926, 466, 0, 'back'], [1, 270]], [[110, -610, 0, 'back'], [8, 180]], [[-900, 900, 270, 'back'], [1, 270]], [[-869, 635, 270, 'back'], [1, 270]], [[-239, -597, 180, 'back'], [8, 180]], [[-993, 66, 0, 'front'], [2, 270]]], [[[-176, 109, 270, 'front'], [2, 270]], [[834, 834, 180, 'front'], [7, 180]], [[486, 992, 270, 'back'], [6, 0]], [[54, 63, 0, 'back'], [6, 0]], [[-86, -105, 270, 'back'], [1, 270]], [[-134, -182, 180, 'back'], [8, 180]], [[734, 301, 180, 'back'], [3, 90]], [[60, 809, 0, 'front'], [5, 0]]], [[[213, 206, 270, 'front'], [2, 270]], [[392, -1000, 270, 'front'], [7, 180]], [[137, 86, 180, 'back'], [8, 180]], [[116, 53, 90, 'back'], [3, 90]], [[-183, 181, 180, 'back'], [8, 180]], [[-651, 121, 180, 'back'], [1, 270]], [[49, 14, 180, 'back'], [8, 180]], [[-211, 211, 90, 'front'], [4, 90]]], [[[-869, -869, 0, 'front'], [5, 0]], [[-38, 38, 270, 'front'], [2, 270]], [[816, 260, 0, 'back'], [3, 90]], [[-188, 149, 180, 'back'], [8, 180]], [[-532, 686, 180, 'back'], [6, 0]], [[-67, 67, 270, 'back'], [1, 270]], [[-119, 365, 180, 'back'], [6, 0]], [[994, 659, 180, 'front'], [4, 90]]]]\nlabels = [\"regression: front camera mirror bit\", \"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":"fb034d1eb1185987dddea9b597194f7ea2c0c03e81fec9b637cf2ef160b40581","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    gx, gy, prev_r, camera = x\n    if gx * gx + gy * gy < 300 * 300 or abs(gx) == abs(gy):\n        r = prev_r\n    elif abs(gy) > abs(gx):\n        r = 0 if gy > 0 else 180\n    else:\n        r = 90 if gx > 0 else 270\n    from_km = {(0, 0): 1, (0, 1): 2, (2, 0): 3, (2, 1): 4, (3, 1): 5, (1, 0): 6, (1, 1): 7, (3, 0): 8}\n    if camera == 'front':\n        total = (270 - r) % 360\n        return [from_km[(total // 90, 1)], r]\n    total = (90 + r) % 360\n    return [from_km[(total // 90, 0)], r]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[298, 553, 180, 'front'], [5, 0]], [[686, -373, 90, 'front'], [4, 90]], [[-382, -382, 180, 'back'], [8, 180]], [[50, -890, 180, 'back'], [8, 180]], [[53, -848, 270, 'back'], [8, 180]], [[247, -67, 270, 'back'], [1, 270]], [[201, -186, 180, 'back'], [8, 180]], [[-285, -766, 90, 'front'], [7, 180]]], [[[-835, 686, 0, 'front'], [2, 270]], [[-714, 28, 0, 'front'], [2, 270]], [[-926, 466, 0, 'back'], [1, 270]], [[110, -610, 0, 'back'], [8, 180]], [[-900, 900, 270, 'back'], [1, 270]], [[-869, 635, 270, 'back'], [1, 270]], [[-239, -597, 180, 'back'], [8, 180]], [[-993, 66, 0, 'front'], [2, 270]]], [[[-176, 109, 270, 'front'], [2, 270]], [[834, 834, 180, 'front'], [7, 180]], [[486, 992, 270, 'back'], [6, 0]], [[54, 63, 0, 'back'], [6, 0]], [[-86, -105, 270, 'back'], [1, 270]], [[-134, -182, 180, 'back'], [8, 180]], [[734, 301, 180, 'back'], [3, 90]], [[60, 809, 0, 'front'], [5, 0]]], [[[213, 206, 270, 'front'], [2, 270]], [[392, -1000, 270, 'front'], [7, 180]], [[137, 86, 180, 'back'], [8, 180]], [[116, 53, 90, 'back'], [3, 90]], [[-183, 181, 180, 'back'], [8, 180]], [[-651, 121, 180, 'back'], [1, 270]], [[49, 14, 180, 'back'], [8, 180]], [[-211, 211, 90, 'front'], [4, 90]]], [[[-869, -869, 0, 'front'], [5, 0]], [[-38, 38, 270, 'front'], [2, 270]], [[816, 260, 0, 'back'], [3, 90]], [[-188, 149, 180, 'back'], [8, 180]], [[-532, 686, 180, 'back'], [6, 0]], [[-67, 67, 270, 'back'], [1, 270]], [[-119, 365, 180, 'back'], [6, 0]], [[994, 659, 180, 'front'], [4, 90]]]]\nlabels = [\"regression: front camera mirror bit\", \"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-capture-accelerometer-front-mirror-bit","generated_at":"2026-09-29T14:49:41.509977+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 mirrored tag family (2, 4, 5, 7) for the front sensor.","root_cause":"The front-camera tag is looked up without the mirror bit.","sha256":"4e4174fb4d9333e71c912ed9cc7adbb45d582b5aa72624dcb25292011aefc318","title":"Front camera tags omit the mirror · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.131,"exit_code":1,"observations":[{"actual":[6,0],"check":"regression: front camera mirror bit 0","expected":[5,0],"passed":false},{"actual":[1,90],"check":"repair trap 1","expected":[4,90],"passed":false},{"actual":[8,180],"check":"combined fault 2","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 3","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 4","expected":[8,180],"passed":true},{"actual":[1,270],"check":"boundary 5","expected":[1,270],"passed":true},{"actual":[8,180],"check":"boundary 6","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 7","expected":[7,180],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: front camera mirror bit 0\", \"actual\": [6, 0], \"expected\": [5, 0], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [1, 90], \"expected\": [4, 90], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [1, 270], \"expected\": [1, 270], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [8, 180], \"expected\": [7, 180], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.25,"exit_code":1,"observations":[{"actual":[8,0],"check":"regression: front camera mirror bit 0","expected":[5,0],"passed":false},{"actual":[3,90],"check":"repair trap 1","expected":[4,90],"passed":false},{"actual":[8,180],"check":"combined fault 2","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 3","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 4","expected":[8,180],"passed":true},{"actual":[1,270],"check":"boundary 5","expected":[1,270],"passed":true},{"actual":[8,180],"check":"boundary 6","expected":[8,180],"passed":true},{"actual":[6,180],"check":"control 7","expected":[7,180],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: front camera mirror bit 0\", \"actual\": [8, 0], \"expected\": [5, 0], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [3, 90], \"expected\": [4, 90], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [1, 270], \"expected\": [1, 270], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [6, 180], \"expected\": [7, 180], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.262,"exit_code":0,"observations":[{"actual":[5,0],"check":"regression: front camera mirror bit 0","expected":[5,0],"passed":true},{"actual":[4,90],"check":"repair trap 1","expected":[4,90],"passed":true},{"actual":[8,180],"check":"combined fault 2","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 3","expected":[8,180],"passed":true},{"actual":[8,180],"check":"control 4","expected":[8,180],"passed":true},{"actual":[1,270],"check":"boundary 5","expected":[1,270],"passed":true},{"actual":[8,180],"check":"boundary 6","expected":[8,180],"passed":true},{"actual":[7,180],"check":"control 7","expected":[7,180],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: front camera mirror bit 0\", \"actual\": [5, 0], \"expected\": [5, 0], \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [4, 90], \"expected\": [4, 90], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [1, 270], \"expected\": [1, 270], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [8, 180], \"expected\": [8, 180], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [7, 180], \"expected\": [7, 180], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}