FAILURE MAP
← Case archive

FA-70571 / GIS polygon topology / Open access

Grid snapping with ring collapse handling: snapped duplicate merge · case 01

Snapped rings contain zero-length edges and collapsed rings survive.

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

ROOT CAUSE

Positions that snap onto the same grid node are all kept.

VERIFIED REPAIR

At the snapped duplicate merge step restore `if not pts or pts[-1] != q: pts.append(q)`, leaving the rest of the model unchanged.

Unsuccessful approach: Looking back two positions also swallows legitimate back-and-forth vertices and the closing position of short rings.

Case contract

Input [rings, g]: polygon rings (exterior first), closed, numeric coordinates; grid size g > 0 anchored at 0. Each coordinate snaps to floor(v/g + 0.5)*g (halves round toward +infinity). Consecutive identical snapped positions are merged. A ring left with fewer than 4 positions has collapsed: if it is the exterior return None, otherwise drop that hole. Return the snapped rings.

Why this case matters

Precision reduction for storage, tiling and topology cleaning snaps vertices to a grid; collapse rules decide whether tiny holes vanish or the polygon is discarded.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    rings, g = x
    def snap(v):
        return math.floor(v / g + 0.5) * g
    out = []
    for k, ring in enumerate(rings):
        pts = []
        for p in ring:
            q = [snap(p[0]), snap(p[1])]
            pts.append(q)
        if len(pts) < 4:
            if k == 0:
                return None
            continue
        out.append(pts)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0.2, 0.1], [9.7, 0.4], [9.6, 9.8], [0.3, 9.9], [0.2, 0.1]]], 1], [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #1', [[[[0.5, 0.5], [10.5, 0.5], [10.5, 10.5], [0.5, 10.5], [0.5, 0.5]]], 1], [[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]), ('regression #2', [[[[-2.5, -2.5], [7.5, -2.5], [7.5, 3.5], [-2.5, 3.5], [-2.5, -2.5]]], 1], [[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]), ('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #16', [[[[15, 25], [45, 25], [45, 55], [15, 55], [15, 25]]], 10], [[[20, 30], [50, 30], [50, 60], [20, 60], [20, 30]]]), ('boundary #17', [[[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]], 5], None), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]), ('boundary #19', [[[[0, 0], [2.2, 0], [2, 0.4], [0, 0]]], 1], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
control #0[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]][[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]Passed
regression #1[[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]][[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]Passed
regression #2[[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]][[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]Passed
regression #3[[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]][[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]Passed
boundary #4[[[0, 0], [0, 0], [0, 0], [0, 0]]]NoneFailed
boundary #5[[[0, 0], [2, 0], [2, 2], [0, 0]]][[[0, 0], [2, 0], [2, 2], [0, 0]]]Passed
regression #6[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 5], [5, 5], [5, 5]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]Failed
regression #18[[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]][[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]Passed

SHA-256 / 1587c086dfb1b47a29832178c3df9fccf0fcf33064ae47830d456c2463998e02

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    rings, g = x
    def snap(v):
        return math.floor(v / g + 0.5) * g
    out = []
    for k, ring in enumerate(rings):
        pts = []
        for p in ring:
            q = [snap(p[0]), snap(p[1])]
            if q not in pts[-2:]:
                pts.append(q)
        if len(pts) < 4:
            if k == 0:
                return None
            continue
        out.append(pts)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0.2, 0.1], [9.7, 0.4], [9.6, 9.8], [0.3, 9.9], [0.2, 0.1]]], 1], [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #1', [[[[0.5, 0.5], [10.5, 0.5], [10.5, 10.5], [0.5, 10.5], [0.5, 0.5]]], 1], [[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]), ('regression #2', [[[[-2.5, -2.5], [7.5, -2.5], [7.5, 3.5], [-2.5, 3.5], [-2.5, -2.5]]], 1], [[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]), ('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #16', [[[[15, 25], [45, 25], [45, 55], [15, 55], [15, 25]]], 10], [[[20, 30], [50, 30], [50, 60], [20, 60], [20, 30]]]), ('boundary #17', [[[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]], 5], None), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]), ('boundary #19', [[[[0, 0], [2.2, 0], [2, 0.4], [0, 0]]], 1], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
control #0[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]][[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]Passed
regression #1[[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]][[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]Passed
regression #2[[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]][[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]Passed
regression #3[[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]][[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]Passed
boundary #4NoneNonePassed
boundary #5[[[0, 0], [2, 0], [2, 2], [0, 0]]][[[0, 0], [2, 0], [2, 2], [0, 0]]]Passed
regression #6[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]Passed
regression #18[[[0, 0], [5, 0], [5, 5], [8, 0], [8, 8], [0, 8], [0, 0]]][[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]Failed

SHA-256 / 3cec90c8043644926e2c8289e19cd929b28c022c31e5059bfae4ff2a7573f6b0

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    rings, g = x
    def snap(v):
        return math.floor(v / g + 0.5) * g
    out = []
    for k, ring in enumerate(rings):
        pts = []
        for p in ring:
            q = [snap(p[0]), snap(p[1])]
            if not pts or pts[-1] != q:
                pts.append(q)
        if len(pts) < 4:
            if k == 0:
                return None
            continue
        out.append(pts)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0.2, 0.1], [9.7, 0.4], [9.6, 9.8], [0.3, 9.9], [0.2, 0.1]]], 1], [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #1', [[[[0.5, 0.5], [10.5, 0.5], [10.5, 10.5], [0.5, 10.5], [0.5, 0.5]]], 1], [[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]), ('regression #2', [[[[-2.5, -2.5], [7.5, -2.5], [7.5, 3.5], [-2.5, 3.5], [-2.5, -2.5]]], 1], [[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]), ('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #3', [[[[-1.4, -1.4], [6.2, -1.4], [6.2, 6.2], [-1.4, 6.2], [-1.4, -1.4]]], 2], [[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]), ('boundary #4', [[[[0, 0], [0.4, 0.2], [0.3, 0.4], [0, 0]]], 1], None), ('boundary #5', [[[[0, 0], [2.2, 0], [2, 1.6], [0, 0]]], 1], [[[0, 0], [2, 0], [2, 2], [0, 0]]]), ('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #6', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]), ('regression #7', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5.1, 5.1], [5.2, 5.3], [5.4, 5.1], [5.1, 5.1]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]], 1], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]), ('control #8', [[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[4, 4], [4, 8], [8, 8], [8, 4], [4, 4]]], 5], [[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5], [5, 10], [10, 10], [10, 5], [5, 5]]]), ('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #9', [[[[0, 0], [10.4, 0.3], [10.6, 0.2], [10.2, 10.2], [0, 10], [0, 0]]], 1], [[[0, 0], [10, 0], [11, 0], [10, 10], [0, 10], [0, 0]]]), ('regression #10', [[[[0, 0], [3, 0], [3.2, 0.2], [3, 3], [0, 3], [0, 0]]], 1], [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]), ('control #11', [[[[1.26, 2.74], [8.33, 2.51], [7.9, 9.49], [1.26, 2.74]]], 0.5], [[[1.5, 2.5], [8.5, 2.5], [8.0, 9.5], [1.5, 2.5]]]), ('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]])], [('regression #12', [[[[1.25, 2.75], [8.25, 2.25], [7.75, 9.75], [1.25, 2.75]]], 0.5], [[[1.5, 3.0], [8.5, 2.5], [8.0, 10.0], [1.5, 3.0]]]), ('regression #13', [[[[-0.5, 0], [4, 0], [4, 4], [-0.5, 0]]], 1], [[[0, 0], [4, 0], [4, 4], [0, 0]]]), ('boundary #14', [[[[0, 0], [4.4, 0], [4.6, 0.4], [0, 0]]], 1], [[[0, 0], [4, 0], [5, 0], [0, 0]]]), ('control #15', [[[[12, 13], [48, 11], [51, 47], [9, 52], [12, 13]]], 10], [[[10, 10], [50, 10], [50, 50], [10, 50], [10, 10]]]), ('regression #16', [[[[15, 25], [45, 25], [45, 55], [15, 55], [15, 25]]], 10], [[[20, 30], [50, 30], [50, 60], [20, 60], [20, 30]]]), ('boundary #17', [[[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]], 5], None), ('regression #18', [[[[0, 0], [5, 0], [5, 5], [5.2, 0.1], [8, 0], [8, 8], [0, 8], [0, 0]]], 1], [[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]), ('boundary #19', [[[[0, 0], [2.2, 0], [2, 0.4], [0, 0]]], 1], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
control #0[[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]][[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]]Passed
regression #1[[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]][[[1, 1], [11, 1], [11, 11], [1, 11], [1, 1]]]Passed
regression #2[[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]][[[-2, -2], [8, -2], [8, 4], [-2, 4], [-2, -2]]]Passed
regression #3[[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]][[[-2, -2], [6, -2], [6, 6], [-2, 6], [-2, -2]]]Passed
boundary #4NoneNonePassed
boundary #5[[[0, 0], [2, 0], [2, 2], [0, 0]]][[[0, 0], [2, 0], [2, 2], [0, 0]]]Passed
regression #6[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]Passed
regression #18[[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]][[[0, 0], [5, 0], [5, 5], [5, 0], [8, 0], [8, 8], [0, 8], [0, 0]]]Passed

SHA-256 / 15333d8dd249802e35a10c06e6a582ff758bcaa496a8faf130541c242c665598

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:21.915801+00:00.

Case digest / c991ef7f6eb59f7a534c72d19cfb6622f614b76e0e0eb17cc20bbea0502ed658