FAILURE MAP
← Case archive

FA-11356 / Spreadsheet calculation semantics / Open access

Approximate lookup selects a nearest value instead of the lower bracket · case 01

A key between breakpoints gets a future band.

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

ROOT CAUSE

Nearest distance substitutes for floor-band lookup.

VERIFIED REPAIR

Select the last sorted key less than or equal to the query.

Unsuccessful approach: Requiring an exact match discards legitimate interior band queries.

Case contract

Unique sorted integer [key,value] rows define bands. Return value at greatest key <= query or #N/A below all keys or for empty rows.

Why this case matters

This isolated spreadsheet model makes cell semantics explicit; it does not claim compatibility with every workbook engine.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, query):
    return min(rows, key=lambda r: abs(r[0]-query))[1] if rows else '#N/A'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[0, 'low'], [10*N, 'high']]
check('interior near upper endpoint', solve(rows, 10*N-1), 'low')
check('below minimum', solve(rows, -N), '#N/A')
check('minimum inclusive', solve(rows, 0), 'low')
check('upper inclusive', solve(rows, 10*N), 'high')
check('above maximum', solve(rows, 20*N), 'high')
check('empty table', solve([], N), '#N/A')
check('single band interior', solve([[N, 'only']], N+1), 'only')
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
interior near upper endpointhighlowFailed
below minimumlow#N/AFailed
minimum inclusivelowlowPassed
upper inclusivehighhighPassed
above maximumhighhighPassed
empty table#N/A#N/APassed
single band interioronlyonlyPassed

SHA-256 / 7f72fdc17aaa3e8dae11b848b1c4ed0fca5801a72fb1c6b703a4d8ac953e79d1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, query):
    return next((v for k,v in rows if k == query), '#N/A')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[0, 'low'], [10*N, 'high']]
check('interior near upper endpoint', solve(rows, 10*N-1), 'low')
check('below minimum', solve(rows, -N), '#N/A')
check('minimum inclusive', solve(rows, 0), 'low')
check('upper inclusive', solve(rows, 10*N), 'high')
check('above maximum', solve(rows, 20*N), 'high')
check('empty table', solve([], N), '#N/A')
check('single band interior', solve([[N, 'only']], N+1), 'only')
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
interior near upper endpoint#N/AlowFailed
below minimum#N/A#N/APassed
minimum inclusivelowlowPassed
upper inclusivehighhighPassed
above maximum#N/AhighFailed
empty table#N/A#N/APassed
single band interior#N/AonlyFailed

SHA-256 / 31aca71f25503b44a0fd4fc4c7fc58cc69e97011f3ba160d592c53173711e791

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, query):
    return next((v for k,v in reversed(rows) if k <= query), '#N/A')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[0, 'low'], [10*N, 'high']]
check('interior near upper endpoint', solve(rows, 10*N-1), 'low')
check('below minimum', solve(rows, -N), '#N/A')
check('minimum inclusive', solve(rows, 0), 'low')
check('upper inclusive', solve(rows, 10*N), 'high')
check('above maximum', solve(rows, 20*N), 'high')
check('empty table', solve([], N), '#N/A')
check('single band interior', solve([[N, 'only']], N+1), 'only')
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
interior near upper endpointlowlowPassed
below minimum#N/A#N/APassed
minimum inclusivelowlowPassed
upper inclusivehighhighPassed
above maximumhighhighPassed
empty table#N/A#N/APassed
single band interioronlyonlyPassed

SHA-256 / baff8f6441fc70a5ea3e8805df7a13fa6dac503cd2ffe92ab487e346bce89dae

Verification & scope

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

Case digest / 429e151bdd921f12bf8350c807448b8417fbd37c0063f687cbcb9b9fcc6e7b0a