FAILURE MAP
← Case archive

FA-70771 / GIS polygon topology / Open access

Snapping ring vertices to a reference layer: post-snap merge · case 01

Snapped rings contain repeated consecutive vertices.

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

ROOT CAUSE

Vertices that snap onto the same reference vertex are all kept.

VERIFIED REPAIR

At the post-snap merge step restore `if not out or out[-1] != np:`, leaving the rest of the model unchanged.

Unsuccessful approach: The merge compares the new snapped vertex with the raw input vertex, so real duplicates survive.

Case contract

Input [ring, ref, tol]: a closed ring, reference vertices and a tolerance. Each ring vertex moves to the NEAREST reference vertex within Euclidean distance tol (inclusive; ties go to the lowest reference index), otherwise stays. Consecutive identical snapped vertices merge. If the result has fewer than 4 positions or is not closed return None, else return it.

Why this case matters

Integrating new survey data with an authoritative layer snaps nearby vertices so shared boundaries become identical; snapping to the wrong vertex creates slivers.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ring, ref, tol = x
    out = []
    for p in ring:
        best, bd = None, None
        for q in ref:
            d = (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2
            if d <= tol * tol and (bd is None or d < bd):
                best, bd = q, d
        np = list(best) if best is not None else list(p)
        if True:
            out.append(np)
    if len(out) < 4 or out[0] != out[-1]:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None)], [('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]])], [('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]]), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]]), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])]]
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
control #1[[1, 1], [8, 1], [8, 8], [1, 1]][[1, 1], [8, 1], [8, 8], [1, 1]]Passed
regression #2[[5, 6], [8, 2], [9, 9], [5, 6]][[5, 6], [8, 2], [9, 9], [5, 6]]Passed
regression #3[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
regression #4[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
boundary #5[[0, 0], [8, 2], [9, 9], [0, 0]][[0, 0], [8, 2], [9, 9], [0, 0]]Passed
regression #7[[0, 0], [0, 0], [10, 0], [10, 10], [0, 0]][[0, 0], [10, 0], [10, 10], [0, 0]]Failed
regression #8[[0, 0], [10, 0], [0, 0], [0, 0]]NoneFailed

SHA-256 / ffc4a7f2c21f6d9bb88eca88fa402dc8786ee21c6628e4854bc38dc02d088693

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ring, ref, tol = x
    out = []
    for p in ring:
        best, bd = None, None
        for q in ref:
            d = (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2
            if d <= tol * tol and (bd is None or d < bd):
                best, bd = q, d
        np = list(best) if best is not None else list(p)
        if not out or out[-1] != list(p):
            out.append(np)
    if len(out) < 4 or out[0] != out[-1]:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None)], [('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]])], [('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]]), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]]), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])]]
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
control #1[[1, 1], [8, 1], [8, 8], [1, 1]][[1, 1], [8, 1], [8, 8], [1, 1]]Passed
regression #2[[5, 6], [8, 2], [9, 9], [5, 6]][[5, 6], [8, 2], [9, 9], [5, 6]]Passed
regression #3[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
regression #4[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
boundary #5[[0, 0], [8, 2], [9, 9], [0, 0]][[0, 0], [8, 2], [9, 9], [0, 0]]Passed
regression #7[[0, 0], [0, 0], [10, 0], [10, 10], [0, 0]][[0, 0], [10, 0], [10, 10], [0, 0]]Failed
regression #8[[0, 0], [10, 0], [0, 0], [0, 0]]NoneFailed

SHA-256 / acb3d0150997d60787803b3e2d9b5fcc895fb0f1c731c7e794427c0d9b587c75

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ring, ref, tol = x
    out = []
    for p in ring:
        best, bd = None, None
        for q in ref:
            d = (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2
            if d <= tol * tol and (bd is None or d < bd):
                best, bd = q, d
        np = list(best) if best is not None else list(p)
        if not out or out[-1] != np:
            out.append(np)
    if len(out) < 4 or out[0] != out[-1]:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None)], [('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('boundary #5', [[[0, 1], [8, 2], [9, 9], [0, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]])], [('regression #6', [[[0, 0.8], [8, 2], [9, 9], [0, 0.8]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [8, 2], [9, 9], [0, 0]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #10', [[[2, 2], [3, 2], [3, 3], [2, 2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 0.5], [[2, 2], [3, 2], [3, 3], [2, 2]]), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('boundary #9', [[[0.2, 0.2], [9.6, 0.2], [9.8, 0.4], [0.2, 0.2]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('regression #11', [[[3, 4], [8, 2], [9, 9], [3, 4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 3], [[5, 5], [10, 0], [10, 10], [5, 5]]), ('regression #12', [[[1, 1.5], [9, 1.2], [9, 9], [1, 1.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 2], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #13', [[[1.2, 0], [8, 3], [8.5, 8.5], [1.2, 0]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[0, 0], [8, 3], [8.5, 8.5], [0, 0]]), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])], [('control #0', [[[0.4, 0.3], [9.8, 0.1], [10.2, 9.9], [0.1, 10.3], [0.4, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]), ('control #1', [[[1, 1], [8, 1], [8, 8], [1, 1]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[1, 1], [8, 1], [8, 8], [1, 1]]), ('regression #2', [[[5, 5.6], [8, 2], [9, 9], [5, 5.6]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 6], [8, 2], [9, 9], [5, 6]]), ('regression #3', [[[5, 5.4], [8, 2], [9, 9], [5, 5.4]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #4', [[[5, 5.5], [8, 2], [9, 9], [5, 5.5]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[5, 5], [8, 2], [9, 9], [5, 5]]), ('regression #7', [[[0.3, 0.3], [0.1, 0.2], [10, 0.4], [9.7, 9.6], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], [[0, 0], [10, 0], [10, 10], [0, 0]]), ('regression #8', [[[0.3, 0.3], [9.8, 0.2], [0.2, 0.1], [0.3, 0.3]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1], None), ('control #14', [[[19, 19], [30, 19], [30, 30], [19, 19]], [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [5, 6], [20, 20]], 1.5], [[20, 20], [30, 19], [30, 30], [20, 20]])]]
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
control #1[[1, 1], [8, 1], [8, 8], [1, 1]][[1, 1], [8, 1], [8, 8], [1, 1]]Passed
regression #2[[5, 6], [8, 2], [9, 9], [5, 6]][[5, 6], [8, 2], [9, 9], [5, 6]]Passed
regression #3[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
regression #4[[5, 5], [8, 2], [9, 9], [5, 5]][[5, 5], [8, 2], [9, 9], [5, 5]]Passed
boundary #5[[0, 0], [8, 2], [9, 9], [0, 0]][[0, 0], [8, 2], [9, 9], [0, 0]]Passed
regression #7[[0, 0], [10, 0], [10, 10], [0, 0]][[0, 0], [10, 0], [10, 10], [0, 0]]Passed
regression #8NoneNonePassed

SHA-256 / 9a02242881c994eb08b0c413680108d2945489d525b9a700b1bbcb922fea7787

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

Case digest / a69affd987c0d02fe0fa18af8bbfb7e309ca972776c60d3c291ac1c9cc0fe5c3