{"abstract":"TMS tiles report bounds one tile further south than their neighbours report.","category":"Map projection transforms","checks":8,"contract":"Input [z, col, row, scheme] where scheme is \"xyz\" (row 0 at north) or \"tms\" (row 0 at south). Return [west, south, east, north] in degrees rounded to 6 decimals, using lon = col/n*360-180 and lat = degrees(atan(sinh(pi*(1-2*r/n)))) for an xyz row edge r, n = 2**z. A tms row t is the xyz row n-1-t.","contract_signature":"x","evaluation_group":"w2-map-projection-transforms-xyz-tile-bounds","failed_approach":"The special-case for row 0 keeps the southernmost TMS row unflipped, so it reports the north edge tile.","family":"w2-map-projection-transforms-xyz-tile-bounds-tms-row-flip","id":"FA-69916","implementations":{"attempt":{"sha256":"7fe3635633b094225fb727c016742e74fd5c45b00d6c8c6ccf8dc819cb67f161","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    z, col, row, scheme = x\n    n = 2 ** z\n    if scheme == 'tms':\n        row = n - 1 - row if row > 0 else row\n    def edge_lat(r):\n        return math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * r / n))))\n    west = col / n * 360.0 - 180.0\n    east = (col + 1) / n * 360.0 - 180.0\n    north = edge_lat(row)\n    south = edge_lat(row + 1)\n    return [round(west, 6), round(south, 6), round(east, 6), round(north, 6)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321])], [('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361])], [('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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":"879c83ec14c392ec0bfabc4ce465b9b7dbc52662903623221aa6d3f462237bbf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    z, col, row, scheme = x\n    n = 2 ** z\n    if scheme == 'tms':\n        row = n - row\n    def edge_lat(r):\n        return math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * r / n))))\n    west = col / n * 360.0 - 180.0\n    east = (col + 1) / n * 360.0 - 180.0\n    north = edge_lat(row)\n    south = edge_lat(row + 1)\n    return [round(west, 6), round(south, 6), round(east, 6), round(north, 6)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321])], [('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361])], [('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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":"Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. 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-map-projection-transforms-xyz-tile-bounds-tms-row-flip","generated_at":"2026-09-29T14:48:15.821667+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Tile footprints drive cache invalidation, label placement and raster reprojection; wrong edges misalign tiles.","root_cause":"Converting a TMS row to an xyz row uses n - row, an off-by-one that shifts every TMS tile by one row.","sha256":"c15ed0fe28de8abc6cac336e3a35987444fca4143872061767a799612ef15736","title":"Geographic bounds of a map tile: tms row flip · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.751,"exit_code":1,"observations":[{"actual":[-180.0,-85.051129,180.0,85.051129],"check":"control #0","expected":[-180.0,-85.051129,180.0,85.051129],"passed":true},{"actual":[0.0,0.0,180.0,85.051129],"check":"control #1","expected":[0.0,0.0,180.0,85.051129],"passed":true},{"actual":[90.0,66.51326,180.0,85.051129],"check":"control #2","expected":[90.0,66.51326,180.0,85.051129],"passed":true},{"actual":[45.0,40.979898,90.0,66.51326],"check":"control #3","expected":[45.0,40.979898,90.0,66.51326],"passed":true},{"actual":[-22.5,21.943046,0.0,40.979898],"check":"control #4","expected":[-22.5,21.943046,0.0,40.979898],"passed":true},{"actual":[0.0,48.922499,11.25,55.776573],"check":"control #5","expected":[0.0,48.922499,11.25,55.776573],"passed":true},{"actual":[5.625,-52.48278,11.25,-48.922499],"check":"control #6","expected":[5.625,-52.48278,11.25,-48.922499],"passed":true},{"actual":[178.59375,84.928321,180.0,85.051129],"check":"control #9","expected":[178.59375,-85.051129,180.0,-84.928321],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control #0\", \"actual\": [-180.0, -85.051129, 180.0, 85.051129], \"expected\": [-180.0, -85.051129, 180.0, 85.051129], \"passed\": true}, {\"check\": \"control #1\", \"actual\": [0.0, 0.0, 180.0, 85.051129], \"expected\": [0.0, 0.0, 180.0, 85.051129], \"passed\": true}, {\"check\": \"control #2\", \"actual\": [90.0, 66.51326, 180.0, 85.051129], \"expected\": [90.0, 66.51326, 180.0, 85.051129], \"passed\": true}, {\"check\": \"control #3\", \"actual\": [45.0, 40.979898, 90.0, 66.51326], \"expected\": [45.0, 40.979898, 90.0, 66.51326], \"passed\": true}, {\"check\": \"control #4\", \"actual\": [-22.5, 21.943046, 0.0, 40.979898], \"expected\": [-22.5, 21.943046, 0.0, 40.979898], \"passed\": true}, {\"check\": \"control #5\", \"actual\": [0.0, 48.922499, 11.25, 55.776573], \"expected\": [0.0, 48.922499, 11.25, 55.776573], \"passed\": true}, {\"check\": \"control #6\", \"actual\": [5.625, -52.48278, 11.25, -48.922499], \"expected\": [5.625, -52.48278, 11.25, -48.922499], \"passed\": true}, {\"check\": \"control #9\", \"actual\": [178.59375, 84.928321, 180.0, 85.051129], \"expected\": [178.59375, -85.051129, 180.0, -84.928321], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.079,"exit_code":1,"observations":[{"actual":[-180.0,-85.051129,180.0,85.051129],"check":"control #0","expected":[-180.0,-85.051129,180.0,85.051129],"passed":true},{"actual":[0.0,0.0,180.0,85.051129],"check":"control #1","expected":[0.0,0.0,180.0,85.051129],"passed":true},{"actual":[90.0,0.0,180.0,66.51326],"check":"control #2","expected":[90.0,66.51326,180.0,85.051129],"passed":false},{"actual":[45.0,40.979898,90.0,66.51326],"check":"control #3","expected":[45.0,40.979898,90.0,66.51326],"passed":true},{"actual":[-22.5,0.0,0.0,21.943046],"check":"control #4","expected":[-22.5,21.943046,0.0,40.979898],"passed":false},{"actual":[0.0,48.922499,11.25,55.776573],"check":"control #5","expected":[0.0,48.922499,11.25,55.776573],"passed":true},{"actual":[5.625,-55.776573,11.25,-52.48278],"check":"control #6","expected":[5.625,-52.48278,11.25,-48.922499],"passed":false},{"actual":[178.59375,-85.17097,180.0,-85.051129],"check":"control #9","expected":[178.59375,-85.051129,180.0,-84.928321],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control #0\", \"actual\": [-180.0, -85.051129, 180.0, 85.051129], \"expected\": [-180.0, -85.051129, 180.0, 85.051129], \"passed\": true}, {\"check\": \"control #1\", \"actual\": [0.0, 0.0, 180.0, 85.051129], \"expected\": [0.0, 0.0, 180.0, 85.051129], \"passed\": true}, {\"check\": \"control #2\", \"actual\": [90.0, 0.0, 180.0, 66.51326], \"expected\": [90.0, 66.51326, 180.0, 85.051129], \"passed\": false}, {\"check\": \"control #3\", \"actual\": [45.0, 40.979898, 90.0, 66.51326], \"expected\": [45.0, 40.979898, 90.0, 66.51326], \"passed\": true}, {\"check\": \"control #4\", \"actual\": [-22.5, 0.0, 0.0, 21.943046], \"expected\": [-22.5, 21.943046, 0.0, 40.979898], \"passed\": false}, {\"check\": \"control #5\", \"actual\": [0.0, 48.922499, 11.25, 55.776573], \"expected\": [0.0, 48.922499, 11.25, 55.776573], \"passed\": true}, {\"check\": \"control #6\", \"actual\": [5.625, -55.776573, 11.25, -52.48278], \"expected\": [5.625, -52.48278, 11.25, -48.922499], \"passed\": false}, {\"check\": \"control #9\", \"actual\": [178.59375, -85.17097, 180.0, -85.051129], \"expected\": [178.59375, -85.051129, 180.0, -84.928321], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}