FAILURE MAP
← Case archive

FA-95581 / Shipping rate zone lookup / Open access

Injection zone: band limit exclusive · case 01

A destination exactly at a band limit is rated one zone higher.

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

ROOT CAUSE

Band membership uses a strict comparison with the band limit.

THE FAILURE

Band membership uses a strict comparison with the band limit.

Unsuccessful approach: Scanning bands from the top returns the widest band that contains the distance.

Case contract

dest [x, y] and points [[name, x, y, linehaul_cents]] on a mile grid. Distance = straight line rounded up to a whole mile. Zone bands (miles, inclusive upper): 50, 150, 300, 600, 1000, 1400, 1800 -> zones 1-7, beyond -> 8. Choose the point with the lowest zone, then linehaul, then name. Return [name, zone, miles] or None.

Why this case matters

Zone skipping injects parcels at the hub that minimizes delivery zone and linehaul.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(dest, points):
    BANDS = [50, 150, 300, 600, 1000, 1400, 1800]
    def zone_for(m):
        for i, lim in enumerate(BANDS):
            if m < lim:
                return i + 1
        return 8
    best = None
    for name, x, y, lh in points:
        sq = (x - dest[0]) ** 2 + (y - dest[1]) ** 2
        s = math.isqrt(sq)
        miles = s + (1 if s * s < sq else 0)
        z = zone_for(miles)
        key = (z, lh, name)
        if best is None or key < best[0]:
            best = (key, [name, z, miles])
    return best[1] if best else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['no points', [[0, 0], []], None], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 8', [[5, 0], [['GA', 300, 40, 300]]], ['GA', 3, 298]]], [['generated mix 45', [[5, 3], [['IL', 2000, 150, 100], ['PA', 590, 400, 100], ['TX', 30, 150, 300]]], ['TX', 2, 150]], ['generated mix 2', [[-10, 3], [['IL', 2000, 41, 100], ['TX', 590, 150, 300]]], ['TX', 5, 618]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['generated mix 10', [[5, 0], [['GA', 2000, 400, 900], ['IL', 1500, 41, 300]]], ['IL', 7, 1496]], ['generated mix 18', [[5, 3], [['IL', 30, 41, 300], ['IL', 120, 400, 300]]], ['IL', 1, 46]]], [['generated mix 12', [[-10, 0], [['GA', 40, 0, 100]]], ['GA', 1, 50]], ['generated mix 7', [[5, 3], [['NJ', 0, 41, 300], ['NJ', 100, 400, 300], ['NJ', 0, 0, 100]]], ['NJ', 1, 6]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 22', [[-10, 0], [['IL', 40, 40, 100], ['GA', 1000, 40, 300], ['GA', 590, 40, 300]]], ['IL', 2, 65]], ['generated mix 30', [[-10, 3], [['OH', 0, 41, 300], ['PA', 300, 1, 300], ['NJ', 290, 40, 300]]], ['OH', 1, 40]]], [['generated mix 5', [[0, 0], [['GA', 1500, 40, 100], ['NJ', 30, 40, 100], ['OH', 1000, 400, 300]]], ['NJ', 1, 50]], ['generated mix 13', [[5, 0], [['GA', 301, 1, 300], ['PA', 1000, 400, 900], ['NJ', 300, 0, 100]]], ['NJ', 3, 295]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 33', [[0, 3], [['GA', 1500, 150, 900], ['OH', 30, 1, 300]]], ['OH', 1, 31]], ['generated mix 41', [[0, 3], [['OH', 30, 0, 300], ['PA', 1500, 0, 300]]], ['OH', 1, 31]]], [['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['generated mix 18', [[5, 3], [['IL', 30, 41, 300], ['IL', 120, 400, 300]]], ['IL', 1, 46]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 43', [[5, 3], [['IL', 2000, 40, 900], ['GA', 301, 400, 100], ['TX', 301, 0, 900]]], ['TX', 3, 297]], ['generated mix 51', [[-10, 0], [['NJ', 100, 40, 300], ['IL', 120, 400, 300]]], ['NJ', 2, 118]], ['generated mix 59', [[-10, 0], [['PA', 100, 1, 100], ['OH', 1500, 400, 100]]], ['PA', 2, 111]]]]
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
exact 50 miles['A', 2, 50]['A', 1, 50]Failed
just over['A', 2, 51]['A', 2, 51]Passed
linehaul tiebreak['B', 2, 120]['B', 2, 120]Passed
name tiebreak['M', 1, 10]['M', 1, 10]Passed
no pointsNoneNonePassed
zone beats linehaul['A', 1, 40]['A', 1, 40]Passed
far['A', 8, 2000]['A', 8, 2000]Passed
generated mix 8['GA', 3, 298]['GA', 3, 298]Passed

SHA-256 / d91ee9cc7f31b21fe0b8266737f90d53a277241a82ae60c952b75d570cd6853c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(dest, points):
    BANDS = [50, 150, 300, 600, 1000, 1400, 1800]
    def zone_for(m):
        for i, lim in reversed(list(enumerate(BANDS))):
            if m <= lim:
                return i + 1
        return 8
    best = None
    for name, x, y, lh in points:
        sq = (x - dest[0]) ** 2 + (y - dest[1]) ** 2
        s = math.isqrt(sq)
        miles = s + (1 if s * s < sq else 0)
        z = zone_for(miles)
        key = (z, lh, name)
        if best is None or key < best[0]:
            best = (key, [name, z, miles])
    return best[1] if best else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['no points', [[0, 0], []], None], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 8', [[5, 0], [['GA', 300, 40, 300]]], ['GA', 3, 298]]], [['generated mix 45', [[5, 3], [['IL', 2000, 150, 100], ['PA', 590, 400, 100], ['TX', 30, 150, 300]]], ['TX', 2, 150]], ['generated mix 2', [[-10, 3], [['IL', 2000, 41, 100], ['TX', 590, 150, 300]]], ['TX', 5, 618]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['generated mix 10', [[5, 0], [['GA', 2000, 400, 900], ['IL', 1500, 41, 300]]], ['IL', 7, 1496]], ['generated mix 18', [[5, 3], [['IL', 30, 41, 300], ['IL', 120, 400, 300]]], ['IL', 1, 46]]], [['generated mix 12', [[-10, 0], [['GA', 40, 0, 100]]], ['GA', 1, 50]], ['generated mix 7', [[5, 3], [['NJ', 0, 41, 300], ['NJ', 100, 400, 300], ['NJ', 0, 0, 100]]], ['NJ', 1, 6]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 22', [[-10, 0], [['IL', 40, 40, 100], ['GA', 1000, 40, 300], ['GA', 590, 40, 300]]], ['IL', 2, 65]], ['generated mix 30', [[-10, 3], [['OH', 0, 41, 300], ['PA', 300, 1, 300], ['NJ', 290, 40, 300]]], ['OH', 1, 40]]], [['generated mix 5', [[0, 0], [['GA', 1500, 40, 100], ['NJ', 30, 40, 100], ['OH', 1000, 400, 300]]], ['NJ', 1, 50]], ['generated mix 13', [[5, 0], [['GA', 301, 1, 300], ['PA', 1000, 400, 900], ['NJ', 300, 0, 100]]], ['NJ', 3, 295]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 33', [[0, 3], [['GA', 1500, 150, 900], ['OH', 30, 1, 300]]], ['OH', 1, 31]], ['generated mix 41', [[0, 3], [['OH', 30, 0, 300], ['PA', 1500, 0, 300]]], ['OH', 1, 31]]], [['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['generated mix 18', [[5, 3], [['IL', 30, 41, 300], ['IL', 120, 400, 300]]], ['IL', 1, 46]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 43', [[5, 3], [['IL', 2000, 40, 900], ['GA', 301, 400, 100], ['TX', 301, 0, 900]]], ['TX', 3, 297]], ['generated mix 51', [[-10, 0], [['NJ', 100, 40, 300], ['IL', 120, 400, 300]]], ['NJ', 2, 118]], ['generated mix 59', [[-10, 0], [['PA', 100, 1, 100], ['OH', 1500, 400, 100]]], ['PA', 2, 111]]]]
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
exact 50 miles['A', 7, 50]['A', 1, 50]Failed
just over['A', 7, 51]['A', 2, 51]Failed
linehaul tiebreak['B', 7, 120]['B', 2, 120]Failed
name tiebreak['M', 7, 10]['M', 1, 10]Failed
no pointsNoneNonePassed
zone beats linehaul['B', 7, 120]['A', 1, 40]Failed
far['A', 8, 2000]['A', 8, 2000]Passed
generated mix 8['GA', 7, 298]['GA', 3, 298]Failed

SHA-256 / 6741c44d635dfc5c8189e4c8f7b21d64524b87a12d62b264a100a986d762bb52

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Grid distance stand-in; not geodesic distances. 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:52:14.994539+00:00.

Case digest / eb16de3fd57aa104bcbd8e91d8c9f055daeb1f052c957a496a0808b845786a0c