FAILURE MAP
← Case archive

FA-8346 / Viewport layout / Open access

Anchored overlay placement: Flipped overlays overlap the anchor instead of ending above it · case 01

Flipped overlays overlap the anchor instead of ending above it.

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

ROOT CAUSE

The flip coordinate operation uses `top - gap` where the contract requires `top - gap - height`.

VERIFIED REPAIR

Implement the flip coordinate operation as `top - gap - height`.

Unsuccessful approach: Using the lower anchor edge still overlaps its body.

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
    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, 77][10, 62]Failed
shape[10, 67][10, 37]Failed
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 / 5d0410009020a7912ff58d862bc11deb185a1fcb6330b79404e5e995dc5d5bdf

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 bottom - 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, 72][10, 62]Failed
shape[10, 47][10, 37]Failed
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 / 938f66ad755a0470a4c7b3815236b1035a640c163d7a182acc1b9b12a4b47390

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

Case digest / 43aebacd37ddddf70a98f7df7f879113c371706352c41e71aeaa7287cf347c99