FAILURE MAP
← Case archive

FA-70581 / GIS polygon topology / Open access

Grid snapping with ring collapse handling: hole collapse policy · case 01

A polygon disappears because one tiny hole collapsed.

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

ROOT CAUSE

Any collapsed ring, including a hole, discards the whole polygon.

VERIFIED REPAIR

At the hole collapse policy step restore `if k == 0: return None continue`, leaving the rest of the model unchanged.

Unsuccessful approach: Collapsed holes are kept in the output instead of dropped.

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])]
            if not pts or pts[-1] != q:
                pts.append(q)
        if len(pts) < 4:
            return None
        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 #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]]])], [('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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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 #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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('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 #6None[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]Failed
regression #7None[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]Failed

SHA-256 / 7d391c1f52d60f13c7ed1e463d616b3ae5cb833bf960728e5d281b59155c9f06

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 not pts or pts[-1] != q:
                pts.append(q)
        if len(pts) < 4:
            if k == 0:
                return None
            out.append(pts)
            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 #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]]])], [('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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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 #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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('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]], [[5, 5]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]]]Failed
regression #7[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[5, 5]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]Failed

SHA-256 / 1b3ab6a53e9209b5b2739d07a708f620d6da1044ff9dcfa45e3a7e8af839ba14

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 #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]]])], [('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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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 #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]]]), ('boundary #20', [[[[0, 0], [9, 0], [9, 9], [0, 9], [0, 0]], [[3, 3], [5.2, 3], [5, 3.4], [3, 3]]], 1], [[[0, 0], [9, 0], [9, 9], [0, 9], [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]]]), ('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 #7[[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]][[[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]], [[10, 10], [10, 14], [14, 14], [14, 10], [10, 10]]]Passed

SHA-256 / a3eaf22e0e1a7ffa5d664e5ef8d79cd17f5e754a4e10e7b6c5b4d65af27d7eb1

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.971703+00:00.

Case digest / 03bc8aa24b467d643438a237b84244159c6f3c6de6909572bb90bc387e1ddd2c