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

N = 1
observations = []
def solve(x):
    r0 = [t for t in x['ids'] if t in x['hidden']]
    r1 = [[label,t] for label,t in {x['labels'][t]:t for t in x['ids'] if t in x['hidden']}.items()]
    r2 = x['active'] in x['hidden']
    r3 = [t for t in x['ids'] if t in x['hidden'] and t in x['dirty']]
    r4 = [i for i,t in enumerate(x['ids']) if t in x['hidden']]
    r5 = [x['labels'][t] for t in x['ids'] if t in x['hidden']]
    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: [({'ids': ['a', 'b', 'c', 'd'], 'hidden': ['b', 'd'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [['b', 'd'], [['same', 'b'], ['same', 'd']], True, ['b'], [1, 3], ['same', 'same']]), ({'ids': ['a', 'b', 'c', 'd'], 'hidden': ['a', 'c'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [['a', 'c'], [['one', 'a'], ['three', 'c']], False, [], [0, 2], ['one', 'three']]), ({'ids': ['a', 'b', 'c', 'd'], 'hidden': ['b', 'd'], 'active': 'a', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [['b', 'd'], [['same', 'b'], ['same', 'd']], False, ['b'], [1, 3], ['same', 'same']]), ({'ids': ['a', 'b', 'c', 'd'], 'hidden': ['b', 'd'], 'active': 'd', 'dirty': ['d'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [['b', 'd'], [['same', 'b'], ['same', 'd']], True, ['d'], [1, 3], ['same', 'same']]), ({'ids': ['a', 'b', 'c', 'd'], 'hidden': [], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [[], [], False, [], [], []]), ({'ids': ['a', 'b', 'c', 'd'], 'hidden': ['d', 'b'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same'}}, [['b', 'd'], [['same', 'b'], ['same', 'd']], True, ['b'], [1, 3], ['same', 'same']])], 2: [({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['b', 'd', 'extra0'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['b', 'd', 'extra0'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0']], True, ['b'], [1, 3, 4], ['same', 'same', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['a', 'c', 'extra0'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['a', 'c', 'extra0'], [['one', 'a'], ['three', 'c'], ['additional', 'extra0']], False, [], [0, 2, 4], ['one', 'three', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['b', 'd', 'extra0'], 'active': 'a', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['b', 'd', 'extra0'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0']], False, ['b'], [1, 3, 4], ['same', 'same', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['b', 'd', 'extra0'], 'active': 'd', 'dirty': ['d'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['b', 'd', 'extra0'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0']], True, ['d'], [1, 3, 4], ['same', 'same', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['extra0'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['extra0'], [['additional', 'extra0']], False, [], [4], ['additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0'], 'hidden': ['d', 'b', 'extra0'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional'}}, [['b', 'd', 'extra0'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0']], True, ['b'], [1, 3, 4], ['same', 'same', 'additional']])], 3: [({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['b', 'd', 'extra0', 'extra1'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['b', 'd', 'extra0', 'extra1'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1']], True, ['b'], [1, 3, 4, 5], ['same', 'same', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['a', 'c', 'extra0', 'extra1'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['a', 'c', 'extra0', 'extra1'], [['one', 'a'], ['three', 'c'], ['additional', 'extra0'], ['additional', 'extra1']], False, [], [0, 2, 4, 5], ['one', 'three', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['b', 'd', 'extra0', 'extra1'], 'active': 'a', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['b', 'd', 'extra0', 'extra1'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1']], False, ['b'], [1, 3, 4, 5], ['same', 'same', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['b', 'd', 'extra0', 'extra1'], 'active': 'd', 'dirty': ['d'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['b', 'd', 'extra0', 'extra1'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1']], True, ['d'], [1, 3, 4, 5], ['same', 'same', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['extra0', 'extra1'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['extra0', 'extra1'], [['additional', 'extra0'], ['additional', 'extra1']], False, [], [4, 5], ['additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1'], 'hidden': ['d', 'b', 'extra0', 'extra1'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional'}}, [['b', 'd', 'extra0', 'extra1'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1']], True, ['b'], [1, 3, 4, 5], ['same', 'same', 'additional', 'additional']])], 4: [({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], True, ['b'], [1, 3, 4, 5, 6], ['same', 'same', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['a', 'c', 'extra0', 'extra1', 'extra2'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['a', 'c', 'extra0', 'extra1', 'extra2'], [['one', 'a'], ['three', 'c'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], False, [], [0, 2, 4, 5, 6], ['one', 'three', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2'], 'active': 'a', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], False, ['b'], [1, 3, 4, 5, 6], ['same', 'same', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2'], 'active': 'd', 'dirty': ['d'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], True, ['d'], [1, 3, 4, 5, 6], ['same', 'same', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['extra0', 'extra1', 'extra2'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['extra0', 'extra1', 'extra2'], [['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], False, [], [4, 5, 6], ['additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2'], 'hidden': ['d', 'b', 'extra0', 'extra1', 'extra2'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2']], True, ['b'], [1, 3, 4, 5, 6], ['same', 'same', 'additional', 'additional', 'additional']])], 5: [({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], True, ['b'], [1, 3, 4, 5, 6, 7], ['same', 'same', 'additional', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['a', 'c', 'extra0', 'extra1', 'extra2', 'extra3'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['a', 'c', 'extra0', 'extra1', 'extra2', 'extra3'], [['one', 'a'], ['three', 'c'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], False, [], [0, 2, 4, 5, 6, 7], ['one', 'three', 'additional', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'active': 'a', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], False, ['b'], [1, 3, 4, 5, 6, 7], ['same', 'same', 'additional', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'active': 'd', 'dirty': ['d'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], True, ['d'], [1, 3, 4, 5, 6, 7], ['same', 'same', 'additional', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['extra0', 'extra1', 'extra2', 'extra3'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['extra0', 'extra1', 'extra2', 'extra3'], [['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], False, [], [4, 5, 6, 7], ['additional', 'additional', 'additional', 'additional']]), ({'ids': ['a', 'b', 'c', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], 'hidden': ['d', 'b', 'extra0', 'extra1', 'extra2', 'extra3'], 'active': 'd', 'dirty': ['b'], 'labels': {'a': 'one', 'b': 'same', 'c': 'three', 'd': 'same', 'extra0': 'additional', 'extra1': 'additional', 'extra2': 'additional', 'extra3': 'additional'}}, [['b', 'd', 'extra0', 'extra1', 'extra2', 'extra3'], [['same', 'b'], ['same', 'd'], ['additional', 'extra0'], ['additional', 'extra1'], ['additional', 'extra2'], ['additional', 'extra3']], True, ['b'], [1, 3, 4, 5, 6, 7], ['same', 'same', 'additional', 'additional', 'additional', 'additional']])]}
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 menu row identity binding.

An overflow menu represents only fully hidden tabs in visual order, retains ID despite duplicate labels, exposes active/dirty badges, and locates original strip indices.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
The tab workspace reports an incorrect active overflow badge.

An overflow menu represents only fully hidden tabs in visual order, retains ID despite duplicate labels, exposes active/dirty badges, and locates original strip indices.

split: open-access


prompt:
The tab workspace reports an incorrect dirty overflow badges.

An overflow menu represents only fully hidden tabs in visual order, retains ID despite duplicate labels, exposes active/dirty badges, and locates original strip indices.

split: open-access


prompt:
The tab workspace reports an incorrect original strip indices.

An overflow menu represents only fully hidden tabs in visual order, retains ID despite duplicate labels, exposes active/dirty badges, and locates original strip indices.

split: open-access


prompt:
The tab workspace reports an incorrect duplicate label retention.

An overflow menu represents only fully hidden tabs in visual order, retains ID despite duplicate labels, exposes active/dirty badges, and locates original strip indices.

split: open-access


prompt:
The tab workspace reports an incorrect target protection.

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


prompt:
The tab workspace reports an incorrect pinned victim protection.

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


prompt:
The tab workspace reports an incorrect pane scope.

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


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

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


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

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


prompt:
The tab workspace reports an incorrect command selection.

Close Others is scoped to the invoked pane, protects its target and pins, asks about dirty victims in visual order and leaves other panes unchanged.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = False
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty'] and x['status']=='ok'
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 save required.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = x['dirty']
    r1 = True
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty']
    r1 = x['completion']<=x['request']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 completion correlation.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = x['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']!='error'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty']
    r1 = x['request']==x['completion']
    r2 = bool(x['status'])
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 save success.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = x['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']<=x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = True
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 revision cleanliness.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = x['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = x['status']=='ok'
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or x['status']=='ok'
    r5 = x['dirty'] and x['status']=='error' and x['request']==x['completion']
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 commit.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = x['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = x['status']!='ok'
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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['dirty']
    r1 = x['request']==x['completion']
    r2 = x['status']=='ok'
    r3 = x['saved_revision']==x['revision']
    r4 = not x['dirty'] or (x['status']=='ok' and x['request']==x['completion'] and x['saved_revision']==x['revision'])
    r5 = False
    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: [({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 2, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 7, 'saved_revision': 6, 'request': 3, 'completion': 3, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 7, 'saved_revision': 7, 'request': 3, 'completion': 3, 'status': 'ok'}, [False, True, True, True, True, False])], 2: [({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 4, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 14, 'saved_revision': 12, 'request': 6, 'completion': 6, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 14, 'saved_revision': 14, 'request': 6, 'completion': 6, 'status': 'ok'}, [False, True, True, True, True, False])], 3: [({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 6, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 21, 'saved_revision': 18, 'request': 9, 'completion': 9, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 21, 'saved_revision': 21, 'request': 9, 'completion': 9, 'status': 'ok'}, [False, True, True, True, True, False])], 4: [({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 8, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 28, 'saved_revision': 24, 'request': 12, 'completion': 12, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 28, 'saved_revision': 28, 'request': 12, 'completion': 12, 'status': 'ok'}, [False, True, True, True, True, False])], 5: [({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, True, True, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'error'}, [True, True, False, True, False, True]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'cancel'}, [True, True, False, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 10, 'status': 'ok'}, [True, False, True, True, False, False]), ({'dirty': True, 'revision': 35, 'saved_revision': 30, 'request': 15, 'completion': 15, 'status': 'ok'}, [True, True, True, False, False, False]), ({'dirty': False, 'revision': 35, 'saved_revision': 35, 'request': 15, 'completion': 15, 'status': 'ok'}, [False, True, True, True, True, False])]}
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 retry visible.

Closing a dirty tab waits for its save generation, accepts only matching successful completion, retains the tab on error/cancel and clears dirty only at the saved revision.

split: open-access


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

N = 1
observations = []
def solve(x):
    r0 = True
    r1 = x['doc']==x['peer_doc']
    r2 = x['token']!=x['last']
    r3 = x['scroll']*x['peer_range']//x['source_range']
    r4 = min(x['peer_range'],max(0,x['scroll']*x['peer_range']//x['source_range']))
    r5 = x['token']
    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: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, True, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [False, True, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, False, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 3, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, True, False, 100, 100, 3]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 0, 'source_range': 100, 'peer_range': 250}, [True, True, True, 0, 0, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 100, 'source_range': 100, 'peer_range': 250}, [True, True, True, 250, 250, 4])], 2: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, True, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [False, True, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, False, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 6, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, True, False, 200, 200, 6]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 0, 'source_range': 200, 'peer_range': 500}, [True, True, True, 0, 0, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 200, 'source_range': 200, 'peer_range': 500}, [True, True, True, 500, 500, 8])], 3: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, True, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [False, True, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, False, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 9, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, True, False, 300, 300, 9]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 0, 'source_range': 300, 'peer_range': 750}, [True, True, True, 0, 0, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 300, 'source_range': 300, 'peer_range': 750}, [True, True, True, 750, 750, 12])], 4: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [False, True, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, False, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, True, False, 400, 400, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 0, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 0, 0, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 400, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 1000, 1000, 16])], 5: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [False, True, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, False, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 15, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, True, False, 500, 500, 15]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 0, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 0, 0, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 500, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 1250, 1250, 20])]}
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['event_view']!=x['source']
    r1 = x['doc']==x['peer_doc']
    r2 = x['token']!=x['last']
    r3 = x['scroll']*x['peer_range']//x['source_range']
    r4 = min(x['peer_range'],max(0,x['scroll']*x['peer_range']//x['source_range']))
    r5 = x['token']
    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: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, True, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [False, True, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 4, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, False, True, 100, 100, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 3, 'last': 3, 'scroll': 40, 'source_range': 100, 'peer_range': 250}, [True, True, False, 100, 100, 3]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 0, 'source_range': 100, 'peer_range': 250}, [True, True, True, 0, 0, 4]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 4, 'last': 3, 'scroll': 100, 'source_range': 100, 'peer_range': 250}, [True, True, True, 250, 250, 4])], 2: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, True, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [False, True, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 8, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, False, True, 200, 200, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 6, 'last': 6, 'scroll': 80, 'source_range': 200, 'peer_range': 500}, [True, True, False, 200, 200, 6]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 0, 'source_range': 200, 'peer_range': 500}, [True, True, True, 0, 0, 8]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 8, 'last': 6, 'scroll': 200, 'source_range': 200, 'peer_range': 500}, [True, True, True, 500, 500, 8])], 3: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, True, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [False, True, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 12, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, False, True, 300, 300, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 9, 'last': 9, 'scroll': 120, 'source_range': 300, 'peer_range': 750}, [True, True, False, 300, 300, 9]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 0, 'source_range': 300, 'peer_range': 750}, [True, True, True, 0, 0, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 9, 'scroll': 300, 'source_range': 300, 'peer_range': 750}, [True, True, True, 750, 750, 12])], 4: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [False, True, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 16, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, False, True, 400, 400, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 12, 'last': 12, 'scroll': 160, 'source_range': 400, 'peer_range': 1000}, [True, True, False, 400, 400, 12]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 0, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 0, 0, 16]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 16, 'last': 12, 'scroll': 400, 'source_range': 400, 'peer_range': 1000}, [True, True, True, 1000, 1000, 16])], 5: [({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'b', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [False, True, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'e', 'token': 20, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, False, True, 500, 500, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 15, 'last': 15, 'scroll': 200, 'source_range': 500, 'peer_range': 1250}, [True, True, False, 500, 500, 15]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 0, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 0, 0, 20]), ({'source': 'a', 'event_view': 'a', 'doc': 'd', 'peer_doc': 'd', 'token': 20, 'last': 15, 'scroll': 500, 'source_range': 500, 'peer_range': 1250}, [True, True, True, 1250, 1250, 20])]}
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 source election.

Linked views of one document synchronize only scroll events from the elected source; map proportional content positions into the peer range and suppress echoed tokens.

split: open-access