broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = [t for t in x['tabs'] if t in x['members']]
    r1 = [t for t in x['tabs'] if t not in x['members']]
    r2 = x['boundary']-sum(t in x['members'] for t in x['tabs'][:x['boundary']])
    r3 = all(t in x['members'] for t in x['tabs'][min(x['tabs'].index(t) for t in x['members']):x['boundary']]) and min(x['tabs'].index(t) for t in x['members'])<=x['boundary']<=max(x['tabs'].index(t) for t in x['members'])+1
    r4 = x['active']
    r5 = 1
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 1, True, 'c', 2])], 2: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 1, True, 'c', 2])], 3: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 1, True, 'c', 2])], 4: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1', 'background2'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 1, True, 'c', 2])], 5: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 1, True, 'c', 2])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = [t for t in x['tabs'] if t in x['members']]
    r1 = [t for t in x['tabs'] if t not in x['members']]
    r2 = x['boundary']-sum(t in x['members'] for t in x['tabs'][:x['boundary']])
    r3 = all(t in x['members'] for t in x['tabs'][min(x['tabs'].index(t) for t in x['members']):x['boundary']]) and min(x['tabs'].index(t) for t in x['members'])<=x['boundary']<=max(x['tabs'].index(t) for t in x['members'])+1
    r4 = x['active']
    r5 = len(x['tabs'])
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e'], 1, True, 'c', 2])], 2: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0'], 1, True, 'c', 2])], 3: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1'], 1, True, 'c', 2])], 4: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1', 'background2'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2'], 1, True, 'c', 2])], 5: [({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 0, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 0, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 3, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 1, True, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['c', 'd'], 'boundary': 5, 'active': 'c'}, [['c', 'd'], ['a', 'b', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'c', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 5, 'active': 'a'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 3, False, 'a', 2]), ({'tabs': ['a', 'b', 'c', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 'members': ['b', 'c'], 'boundary': 1, 'active': 'c'}, [['b', 'c'], ['a', 'd', 'e', 'background0', 'background1', 'background2', 'background3'], 1, True, 'c', 2])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect block size.

Move a contiguous tab group as one block: retain member order, remove all originals, rebase target boundary by members preceding it and preserve selected identity.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
The tab workspace reports an incorrect group detachment.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect pin list append.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect pinned slot.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect remaining group count.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect empty header dissolution.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect pin keeps active.

Pinning a tab removes it from its group, moves it behind existing pins, shrinks group count and dissolves empty group headers while keeping selection.

split: open-access


prompt:
The tab workspace reports an incorrect remaining pin prefix.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect restored normal rank.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect absolute restoration slot.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect normal partition insertion.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect saved group existence.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect new pin count.

Unpin restores a tab after the remaining pin prefix at its saved unpinned rank, clamps rank to the current normal partition and restores surviving group membership.

split: open-access


prompt:
The tab workspace reports an incorrect right neighbor range.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


prompt:
The tab workspace reports an incorrect right pin protection.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


prompt:
The tab workspace reports an incorrect right dirty prompts.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


prompt:
The tab workspace reports an incorrect right clean closures.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


prompt:
The tab workspace reports an incorrect target remains open.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


prompt:
The tab workspace reports an incorrect left prefix preservation.

Close To Right uses visual strip order after the invoked tab, excludes pins and crossing into another pane, and reports dirty prompts without closing them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']+x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect local coordinate.

A tab has half-open body, close-button and resize-grip regions in local coordinates. Clip hit targets to its visible strip intersection and prioritize close over body.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<=x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = 0<=x['pointer']<x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect body hit.

A tab has half-open body, close-button and resize-grip regions in local coordinates. Clip hit targets to its visible strip intersection and prioritize close over body.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['close_start']<=x['pointer']<x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['pointer']>=x['left']+x['close_start']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect close hit.

A tab has half-open body, close-button and resize-grip regions in local coordinates. Clip hit targets to its visible strip intersection and prioritize close over body.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = True
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<=x['clip_right']
    r4 = x['left']+x['width']-x['grip']<=x['pointer']<x['left']+x['width']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect clip hit.

A tab has half-open body, close-button and resize-grip regions in local coordinates. Clip hit targets to its visible strip intersection and prioritize close over body.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['pointer']>=x['width']-x['grip']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    r0 = x['pointer']-x['left']
    r1 = x['left']<=x['pointer']<x['left']+x['width']
    r2 = x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width']
    r3 = x['clip_left']<=x['pointer']<x['clip_right']
    r4 = x['pointer']>=x['left']+x['width']-x['grip']
    r5 = 'close' if x['left']+x['close_start']<=x['pointer']<x['left']+x['close_start']+x['close_width'] else 'body' if x['left']<=x['pointer']<x['left']+x['width'] else 'none'
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'pointer': 85, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [65, True, False, True, False, 'body']), ({'pointer': 100, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [80, True, True, True, False, 'close']), ({'pointer': 20, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [0, True, False, True, False, 'body']), ({'pointer': 120, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [100, False, False, True, False, 'none']), ({'pointer': 95, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 90, 'grip': 5}, [75, True, False, False, False, 'body']), ({'pointer': 117, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [97, True, True, True, True, 'close']), ({'pointer': 200, 'left': 20, 'width': 100, 'close_start': 80, 'close_width': 20, 'clip_left': 0, 'clip_right': 200, 'grip': 5}, [180, False, False, False, False, 'none'])], 2: [({'pointer': 170, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [130, True, False, True, False, 'body']), ({'pointer': 200, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [160, True, True, True, False, 'close']), ({'pointer': 40, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [0, True, False, True, False, 'body']), ({'pointer': 240, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [200, False, False, True, False, 'none']), ({'pointer': 190, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 180, 'grip': 10}, [150, True, False, False, False, 'body']), ({'pointer': 234, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [194, True, True, True, True, 'close']), ({'pointer': 400, 'left': 40, 'width': 200, 'close_start': 160, 'close_width': 40, 'clip_left': 0, 'clip_right': 400, 'grip': 10}, [360, False, False, False, False, 'none'])], 3: [({'pointer': 255, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [195, True, False, True, False, 'body']), ({'pointer': 300, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [240, True, True, True, False, 'close']), ({'pointer': 60, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [0, True, False, True, False, 'body']), ({'pointer': 360, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [300, False, False, True, False, 'none']), ({'pointer': 285, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 270, 'grip': 15}, [225, True, False, False, False, 'body']), ({'pointer': 351, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [291, True, True, True, True, 'close']), ({'pointer': 600, 'left': 60, 'width': 300, 'close_start': 240, 'close_width': 60, 'clip_left': 0, 'clip_right': 600, 'grip': 15}, [540, False, False, False, False, 'none'])], 4: [({'pointer': 340, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [260, True, False, True, False, 'body']), ({'pointer': 400, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [320, True, True, True, False, 'close']), ({'pointer': 80, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [0, True, False, True, False, 'body']), ({'pointer': 480, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [400, False, False, True, False, 'none']), ({'pointer': 380, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 360, 'grip': 20}, [300, True, False, False, False, 'body']), ({'pointer': 468, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [388, True, True, True, True, 'close']), ({'pointer': 800, 'left': 80, 'width': 400, 'close_start': 320, 'close_width': 80, 'clip_left': 0, 'clip_right': 800, 'grip': 20}, [720, False, False, False, False, 'none'])], 5: [({'pointer': 425, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [325, True, False, True, False, 'body']), ({'pointer': 500, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [400, True, True, True, False, 'close']), ({'pointer': 100, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [0, True, False, True, False, 'body']), ({'pointer': 600, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [500, False, False, True, False, 'none']), ({'pointer': 475, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 450, 'grip': 25}, [375, True, False, False, False, 'body']), ({'pointer': 585, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [485, True, True, True, True, 'close']), ({'pointer': 1000, 'left': 100, 'width': 500, 'close_start': 400, 'close_width': 100, 'clip_left': 0, 'clip_right': 1000, 'grip': 25}, [900, False, False, False, False, 'none'])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), 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)

prompt:
The tab workspace reports an incorrect grip hit.

A tab has half-open body, close-button and resize-grip regions in local coordinates. Clip hit targets to its visible strip intersection and prioritize close over body.

split: open-access