FAILURE MAP
← Case archive

FA-8351 / Viewport layout / Open access

Anchored overlay placement: Overlay width is omitted from right-edge collision handling · case 01

Overlay width is omitted from right-edge collision handling.

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

ROOT CAUSE

The horizontal clamp operation uses `max(0, min(x, vw))` where the contract requires `max(0, min(x, vw - width))`.

VERIFIED REPAIR

Implement the horizontal clamp operation as `max(0, min(x, vw - width))`.

Unsuccessful approach: Dropping the lower clamp permits negative coordinates.

Case contract

Place below with a gap when fully fitting; otherwise above; align left edges and clamp both axes so oversized overlays start at zero.

Why this case matters

A deterministic model of anchored overlay placement; this isolates one interface invariant without requiring a browser.

1 / The failure

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

N = 1
observations = []
def solve(anchor, size, viewport, gap):
    left, top, right, bottom = anchor
    width, height = size
    vw, vh = viewport
    x = left
    below = bottom + gap
    y = below if below + height <= vh else top - gap - height
    x = max(0, min(x, vw))
    y = max(0, min(y, vh - height))
    return (x, y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('below', solve((10,20,30,40), (25,10), (100,100), 3), (10, 43))
check('flip', solve((10,80,30,90), (25,15), (100,100), 3), (10, 62))
check('shape', solve((10,70,30,80), (5,30), (100,100), 3), (10, 37))
check('right clamp', solve((90,20,95,30), (25,10), (100,100), 3), (75, 33))
check('left clamp', solve((-5,20,10,30), (25,10), (100,100), 3), (0, 33))
check('oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
check('parameterized geometry', solve((2*N,3*N,4*N,5*N), (2*N,N), (20*N,20*N), N), (2*N,6*N))
for repetition in range(N):
    check('repeat oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
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
below[10, 43][10, 43]Passed
flip[10, 62][10, 62]Passed
shape[10, 37][10, 37]Passed
right clamp[90, 33][75, 33]Failed
left clamp[0, 33][0, 33]Passed
oversize[10, 0][0, 0]Failed
parameterized geometry[2, 6][2, 6]Passed
repeat oversize[10, 0][0, 0]Failed

SHA-256 / 78f91d40def46fb80754b585d5a9a5967d47512618061bad36f47c5f32188081

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(anchor, size, viewport, gap):
    left, top, right, bottom = anchor
    width, height = size
    vw, vh = viewport
    x = left
    below = bottom + gap
    y = below if below + height <= vh else top - gap - height
    x = min(x, vw - width)
    y = max(0, min(y, vh - height))
    return (x, y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('below', solve((10,20,30,40), (25,10), (100,100), 3), (10, 43))
check('flip', solve((10,80,30,90), (25,15), (100,100), 3), (10, 62))
check('shape', solve((10,70,30,80), (5,30), (100,100), 3), (10, 37))
check('right clamp', solve((90,20,95,30), (25,10), (100,100), 3), (75, 33))
check('left clamp', solve((-5,20,10,30), (25,10), (100,100), 3), (0, 33))
check('oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
check('parameterized geometry', solve((2*N,3*N,4*N,5*N), (2*N,N), (20*N,20*N), N), (2*N,6*N))
for repetition in range(N):
    check('repeat oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
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
below[10, 43][10, 43]Passed
flip[10, 62][10, 62]Passed
shape[10, 37][10, 37]Passed
right clamp[75, 33][75, 33]Passed
left clamp[-5, 33][0, 33]Failed
oversize[-50, 0][0, 0]Failed
parameterized geometry[2, 6][2, 6]Passed
repeat oversize[-50, 0][0, 0]Failed

SHA-256 / 99afa830b58dec4f6f2834e36342a4bfc857d93ff47d7567701b486f3f5c1fb3

3 / The verified repair

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

N = 1
observations = []
def solve(anchor, size, viewport, gap):
    left, top, right, bottom = anchor
    width, height = size
    vw, vh = viewport
    x = left
    below = bottom + gap
    y = below if below + height <= vh else top - gap - height
    x = max(0, min(x, vw - width))
    y = max(0, min(y, vh - height))
    return (x, y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('below', solve((10,20,30,40), (25,10), (100,100), 3), (10, 43))
check('flip', solve((10,80,30,90), (25,15), (100,100), 3), (10, 62))
check('shape', solve((10,70,30,80), (5,30), (100,100), 3), (10, 37))
check('right clamp', solve((90,20,95,30), (25,10), (100,100), 3), (75, 33))
check('left clamp', solve((-5,20,10,30), (25,10), (100,100), 3), (0, 33))
check('oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
check('parameterized geometry', solve((2*N,3*N,4*N,5*N), (2*N,N), (20*N,20*N), N), (2*N,6*N))
for repetition in range(N):
    check('repeat oversize', solve((10,10,20,20), (150,150), (100,100), 3), (0, 0))
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
below[10, 43][10, 43]Passed
flip[10, 62][10, 62]Passed
shape[10, 37][10, 37]Passed
right clamp[75, 33][75, 33]Passed
left clamp[0, 33][0, 33]Passed
oversize[0, 0][0, 0]Passed
parameterized geometry[2, 6][2, 6]Passed
repeat oversize[0, 0][0, 0]Passed

SHA-256 / 288d4f8f633e276f215cf70d913a72ca4dc5433399134f4174321ba1924cfd62

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

Case digest / 690b433607e754ac3cf2f91500a053359c2b1a9f0d02bb2957e1c5635230d5c1