FAILURE MAP
← Case archive

FA-70761 / GIS polygon topology / Open access

Snapping ring vertices to a reference layer: nearest candidate · case 01

Vertices snap to the first reference vertex in range rather than the closest one.

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

ROOT CAUSE

The first reference vertex within tolerance wins regardless of distance.

VERIFIED REPAIR

At the nearest candidate step restore `and (bd is None or d < bd):`, leaving the rest of the model unchanged.

Unsuccessful approach: Using <= picks the nearest vertex but lets a later reference vertex win exact ties.

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:
                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 #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 #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 #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 #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 #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 #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 #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 #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 #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]]), ('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]]), ('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, 5], [8, 2], [9, 9], [5, 5]][[5, 6], [8, 2], [9, 9], [5, 6]]Failed
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 #6[[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

SHA-256 / 06a5540630f82c27d5cbb6699f25abef67db57a39fe21aedcda36cb9a1bbdaf6

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] != 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 #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 #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 #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 #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 #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 #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 #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 #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 #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]]), ('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]]), ('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, 6], [8, 2], [9, 9], [5, 6]][[5, 5], [8, 2], [9, 9], [5, 5]]Failed
boundary #5[[0, 0], [8, 2], [9, 9], [0, 0]][[0, 0], [8, 2], [9, 9], [0, 0]]Passed
regression #6[[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

SHA-256 / 591ecf9c97b58ef25f1870530d26a039729cc3281fa253cd048bca77c2b74a25

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 #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 #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 #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 #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 #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 #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 #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 #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 #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]]), ('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]]), ('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 #6[[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

SHA-256 / 4f69007fcf6e945a5146dc002dfbd69fad1c14f0eef1d293eb81f804656f41d8

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

Case digest / 93e1115590e1dd6814222bbddae39c82f0d72cfbc486f3de960507c476690ebe