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

N = 1
observations = []
def solve(operation, s):
    urgent, deferred, pending, active_generation, result_generation, suspended, previous, fallback = s
    if operation == 'urgent-value-echo':
        return urgent
    if operation == 'deferred-content-during-pending':
        return deferred if pending else urgent
    if operation == 'stale-transition-result':
        return result_generation==active_generation
    if operation == 'suspension-preserves-prior-screen':
        return previous if suspended and previous is not None else (fallback if suspended else urgent)
    if operation == 'pending-indicator-not-equality':
        return pending
    if operation == 'commit-clears-only-current-pending':
        return pending and result_generation!=active_generation
    if operation == 'deferred-value-commit':
        return urgent
    if operation == 'fallback-first-render':
        return suspended and previous is None
    if operation == 'transition-target-identity':
        return (active_generation,urgent)
    if operation == 'previous-empty-screen':
        return previous is not None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('urgent-value-echo scenario 1', solve('urgent-value-echo', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('urgent-value-echo scenario 2', solve('urgent-value-echo', ('','',False,1,1,False,'old','wait')), '')
check('urgent-value-echo scenario 3', solve('urgent-value-echo', ('new','old',True,2,2,True,'screen','spinner')), 'new')
check('urgent-value-echo scenario 4', solve('urgent-value-echo', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('urgent-value-echo scenario 5', solve('urgent-value-echo', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('urgent-value-echo scenario 6', solve('urgent-value-echo', ('','old',False,3,3,True,'','spinner')), '')
check('deferred-content-during-pending scenario 1', solve('deferred-content-during-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 2', solve('deferred-content-during-pending', ('','',False,1,1,False,'old','wait')), '')
check('deferred-content-during-pending scenario 3', solve('deferred-content-during-pending', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 4', solve('deferred-content-during-pending', ('new','old',True,2,2,False,None,'spinner')), 'old')
check('deferred-content-during-pending scenario 5', solve('deferred-content-during-pending', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-content-during-pending scenario 6', solve('deferred-content-during-pending', ('','old',False,3,3,True,'','spinner')), '')
check('stale-transition-result scenario 1', solve('stale-transition-result', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('stale-transition-result scenario 2', solve('stale-transition-result', ('','',False,1,1,False,'old','wait')), True)
check('stale-transition-result scenario 3', solve('stale-transition-result', ('new','old',True,2,2,True,'screen','spinner')), True)
check('stale-transition-result scenario 4', solve('stale-transition-result', ('new','old',True,2,2,False,None,'spinner')), True)
check('stale-transition-result scenario 5', solve('stale-transition-result', ('x','x',False,3,2,True,None,'spinner')), False)
check('stale-transition-result scenario 6', solve('stale-transition-result', ('','old',False,3,3,True,'','spinner')), True)
check('suspension-preserves-prior-screen scenario 1', solve('suspension-preserves-prior-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('suspension-preserves-prior-screen scenario 2', solve('suspension-preserves-prior-screen', ('','',False,1,1,False,'old','wait')), '')
check('suspension-preserves-prior-screen scenario 3', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,True,'screen','spinner')), 'screen')
check('suspension-preserves-prior-screen scenario 4', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('suspension-preserves-prior-screen scenario 5', solve('suspension-preserves-prior-screen', ('x','x',False,3,2,True,None,'spinner')), 'spinner')
check('suspension-preserves-prior-screen scenario 6', solve('suspension-preserves-prior-screen', ('','old',False,3,3,True,'','spinner')), '')
check('pending-indicator-not-equality scenario 1', solve('pending-indicator-not-equality', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 2', solve('pending-indicator-not-equality', ('','',False,1,1,False,'old','wait')), False)
check('pending-indicator-not-equality scenario 3', solve('pending-indicator-not-equality', ('new','old',True,2,2,True,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 4', solve('pending-indicator-not-equality', ('new','old',True,2,2,False,None,'spinner')), True)
check('pending-indicator-not-equality scenario 5', solve('pending-indicator-not-equality', ('x','x',False,3,2,True,None,'spinner')), False)
check('pending-indicator-not-equality scenario 6', solve('pending-indicator-not-equality', ('','old',False,3,3,True,'','spinner')), False)
check('commit-clears-only-current-pending scenario 1', solve('commit-clears-only-current-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('commit-clears-only-current-pending scenario 2', solve('commit-clears-only-current-pending', ('','',False,1,1,False,'old','wait')), False)
check('commit-clears-only-current-pending scenario 3', solve('commit-clears-only-current-pending', ('new','old',True,2,2,True,'screen','spinner')), False)
check('commit-clears-only-current-pending scenario 4', solve('commit-clears-only-current-pending', ('new','old',True,2,2,False,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 5', solve('commit-clears-only-current-pending', ('x','x',False,3,2,True,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 6', solve('commit-clears-only-current-pending', ('','old',False,3,3,True,'','spinner')), False)
check('deferred-value-commit scenario 1', solve('deferred-value-commit', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-value-commit scenario 2', solve('deferred-value-commit', ('','',False,1,1,False,'old','wait')), '')
check('deferred-value-commit scenario 3', solve('deferred-value-commit', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-value-commit scenario 4', solve('deferred-value-commit', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('deferred-value-commit scenario 5', solve('deferred-value-commit', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-value-commit scenario 6', solve('deferred-value-commit', ('','old',False,3,3,True,'','spinner')), 'old')
check('fallback-first-render scenario 1', solve('fallback-first-render', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('fallback-first-render scenario 2', solve('fallback-first-render', ('','',False,1,1,False,'old','wait')), False)
check('fallback-first-render scenario 3', solve('fallback-first-render', ('new','old',True,2,2,True,'screen','spinner')), False)
check('fallback-first-render scenario 4', solve('fallback-first-render', ('new','old',True,2,2,False,None,'spinner')), False)
check('fallback-first-render scenario 5', solve('fallback-first-render', ('x','x',False,3,2,True,None,'spinner')), True)
check('fallback-first-render scenario 6', solve('fallback-first-render', ('','old',False,3,3,True,'','spinner')), False)
check('transition-target-identity scenario 1', solve('transition-target-identity', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), (2,'q'+str(N)))
check('transition-target-identity scenario 2', solve('transition-target-identity', ('','',False,1,1,False,'old','wait')), (1,''))
check('transition-target-identity scenario 3', solve('transition-target-identity', ('new','old',True,2,2,True,'screen','spinner')), (2,'new'))
check('transition-target-identity scenario 4', solve('transition-target-identity', ('new','old',True,2,2,False,None,'spinner')), (2,'new'))
check('transition-target-identity scenario 5', solve('transition-target-identity', ('x','x',False,3,2,True,None,'spinner')), (3,'x'))
check('transition-target-identity scenario 6', solve('transition-target-identity', ('','old',False,3,3,True,'','spinner')), (3,''))
check('previous-empty-screen scenario 1', solve('previous-empty-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('previous-empty-screen scenario 2', solve('previous-empty-screen', ('','',False,1,1,False,'old','wait')), True)
check('previous-empty-screen scenario 3', solve('previous-empty-screen', ('new','old',True,2,2,True,'screen','spinner')), True)
check('previous-empty-screen scenario 4', solve('previous-empty-screen', ('new','old',True,2,2,False,None,'spinner')), False)
check('previous-empty-screen scenario 5', solve('previous-empty-screen', ('x','x',False,3,2,True,None,'spinner')), False)
check('previous-empty-screen scenario 6', solve('previous-empty-screen', ('','old',False,3,3,True,'','spinner')), True)
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(operation, s):
    urgent, deferred, pending, active_generation, result_generation, suspended, previous, fallback = s
    if operation == 'urgent-value-echo':
        return urgent
    if operation == 'deferred-content-during-pending':
        return deferred if pending else urgent
    if operation == 'stale-transition-result':
        return result_generation==active_generation
    if operation == 'suspension-preserves-prior-screen':
        return previous if suspended and previous is not None else (fallback if suspended else urgent)
    if operation == 'pending-indicator-not-equality':
        return pending
    if operation == 'commit-clears-only-current-pending':
        return pending and result_generation!=active_generation
    if operation == 'deferred-value-commit':
        return urgent if result_generation==active_generation else deferred
    if operation == 'fallback-first-render':
        return suspended and previous is None
    if operation == 'transition-target-identity':
        return (active_generation,urgent)
    if operation == 'previous-empty-screen':
        return previous is not None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('urgent-value-echo scenario 1', solve('urgent-value-echo', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('urgent-value-echo scenario 2', solve('urgent-value-echo', ('','',False,1,1,False,'old','wait')), '')
check('urgent-value-echo scenario 3', solve('urgent-value-echo', ('new','old',True,2,2,True,'screen','spinner')), 'new')
check('urgent-value-echo scenario 4', solve('urgent-value-echo', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('urgent-value-echo scenario 5', solve('urgent-value-echo', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('urgent-value-echo scenario 6', solve('urgent-value-echo', ('','old',False,3,3,True,'','spinner')), '')
check('deferred-content-during-pending scenario 1', solve('deferred-content-during-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 2', solve('deferred-content-during-pending', ('','',False,1,1,False,'old','wait')), '')
check('deferred-content-during-pending scenario 3', solve('deferred-content-during-pending', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 4', solve('deferred-content-during-pending', ('new','old',True,2,2,False,None,'spinner')), 'old')
check('deferred-content-during-pending scenario 5', solve('deferred-content-during-pending', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-content-during-pending scenario 6', solve('deferred-content-during-pending', ('','old',False,3,3,True,'','spinner')), '')
check('stale-transition-result scenario 1', solve('stale-transition-result', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('stale-transition-result scenario 2', solve('stale-transition-result', ('','',False,1,1,False,'old','wait')), True)
check('stale-transition-result scenario 3', solve('stale-transition-result', ('new','old',True,2,2,True,'screen','spinner')), True)
check('stale-transition-result scenario 4', solve('stale-transition-result', ('new','old',True,2,2,False,None,'spinner')), True)
check('stale-transition-result scenario 5', solve('stale-transition-result', ('x','x',False,3,2,True,None,'spinner')), False)
check('stale-transition-result scenario 6', solve('stale-transition-result', ('','old',False,3,3,True,'','spinner')), True)
check('suspension-preserves-prior-screen scenario 1', solve('suspension-preserves-prior-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('suspension-preserves-prior-screen scenario 2', solve('suspension-preserves-prior-screen', ('','',False,1,1,False,'old','wait')), '')
check('suspension-preserves-prior-screen scenario 3', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,True,'screen','spinner')), 'screen')
check('suspension-preserves-prior-screen scenario 4', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('suspension-preserves-prior-screen scenario 5', solve('suspension-preserves-prior-screen', ('x','x',False,3,2,True,None,'spinner')), 'spinner')
check('suspension-preserves-prior-screen scenario 6', solve('suspension-preserves-prior-screen', ('','old',False,3,3,True,'','spinner')), '')
check('pending-indicator-not-equality scenario 1', solve('pending-indicator-not-equality', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 2', solve('pending-indicator-not-equality', ('','',False,1,1,False,'old','wait')), False)
check('pending-indicator-not-equality scenario 3', solve('pending-indicator-not-equality', ('new','old',True,2,2,True,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 4', solve('pending-indicator-not-equality', ('new','old',True,2,2,False,None,'spinner')), True)
check('pending-indicator-not-equality scenario 5', solve('pending-indicator-not-equality', ('x','x',False,3,2,True,None,'spinner')), False)
check('pending-indicator-not-equality scenario 6', solve('pending-indicator-not-equality', ('','old',False,3,3,True,'','spinner')), False)
check('commit-clears-only-current-pending scenario 1', solve('commit-clears-only-current-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('commit-clears-only-current-pending scenario 2', solve('commit-clears-only-current-pending', ('','',False,1,1,False,'old','wait')), False)
check('commit-clears-only-current-pending scenario 3', solve('commit-clears-only-current-pending', ('new','old',True,2,2,True,'screen','spinner')), False)
check('commit-clears-only-current-pending scenario 4', solve('commit-clears-only-current-pending', ('new','old',True,2,2,False,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 5', solve('commit-clears-only-current-pending', ('x','x',False,3,2,True,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 6', solve('commit-clears-only-current-pending', ('','old',False,3,3,True,'','spinner')), False)
check('deferred-value-commit scenario 1', solve('deferred-value-commit', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-value-commit scenario 2', solve('deferred-value-commit', ('','',False,1,1,False,'old','wait')), '')
check('deferred-value-commit scenario 3', solve('deferred-value-commit', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-value-commit scenario 4', solve('deferred-value-commit', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('deferred-value-commit scenario 5', solve('deferred-value-commit', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-value-commit scenario 6', solve('deferred-value-commit', ('','old',False,3,3,True,'','spinner')), 'old')
check('fallback-first-render scenario 1', solve('fallback-first-render', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('fallback-first-render scenario 2', solve('fallback-first-render', ('','',False,1,1,False,'old','wait')), False)
check('fallback-first-render scenario 3', solve('fallback-first-render', ('new','old',True,2,2,True,'screen','spinner')), False)
check('fallback-first-render scenario 4', solve('fallback-first-render', ('new','old',True,2,2,False,None,'spinner')), False)
check('fallback-first-render scenario 5', solve('fallback-first-render', ('x','x',False,3,2,True,None,'spinner')), True)
check('fallback-first-render scenario 6', solve('fallback-first-render', ('','old',False,3,3,True,'','spinner')), False)
check('transition-target-identity scenario 1', solve('transition-target-identity', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), (2,'q'+str(N)))
check('transition-target-identity scenario 2', solve('transition-target-identity', ('','',False,1,1,False,'old','wait')), (1,''))
check('transition-target-identity scenario 3', solve('transition-target-identity', ('new','old',True,2,2,True,'screen','spinner')), (2,'new'))
check('transition-target-identity scenario 4', solve('transition-target-identity', ('new','old',True,2,2,False,None,'spinner')), (2,'new'))
check('transition-target-identity scenario 5', solve('transition-target-identity', ('x','x',False,3,2,True,None,'spinner')), (3,'x'))
check('transition-target-identity scenario 6', solve('transition-target-identity', ('','old',False,3,3,True,'','spinner')), (3,''))
check('previous-empty-screen scenario 1', solve('previous-empty-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('previous-empty-screen scenario 2', solve('previous-empty-screen', ('','',False,1,1,False,'old','wait')), True)
check('previous-empty-screen scenario 3', solve('previous-empty-screen', ('new','old',True,2,2,True,'screen','spinner')), True)
check('previous-empty-screen scenario 4', solve('previous-empty-screen', ('new','old',True,2,2,False,None,'spinner')), False)
check('previous-empty-screen scenario 5', solve('previous-empty-screen', ('x','x',False,3,2,True,None,'spinner')), False)
check('previous-empty-screen scenario 6', solve('previous-empty-screen', ('','old',False,3,3,True,'','spinner')), True)
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:
Deferred value commit.

Urgent input echoes immediately while deferred content may lag. Only the active transition can commit or clear pending work. A suspended update retains any prior screen, including empty text; first render uses fallback. Operation deferred-value-commit has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    urgent, deferred, pending, active_generation, result_generation, suspended, previous, fallback = s
    if operation == 'urgent-value-echo':
        return urgent
    if operation == 'deferred-content-during-pending':
        return deferred if pending else urgent
    if operation == 'stale-transition-result':
        return result_generation==active_generation
    if operation == 'suspension-preserves-prior-screen':
        return previous if suspended and previous is not None else (fallback if suspended else urgent)
    if operation == 'pending-indicator-not-equality':
        return pending
    if operation == 'commit-clears-only-current-pending':
        return pending and result_generation!=active_generation
    if operation == 'deferred-value-commit':
        return urgent if result_generation==active_generation and not suspended else deferred
    if operation == 'fallback-first-render':
        return suspended
    if operation == 'transition-target-identity':
        return (active_generation,urgent)
    if operation == 'previous-empty-screen':
        return previous is not None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('urgent-value-echo scenario 1', solve('urgent-value-echo', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('urgent-value-echo scenario 2', solve('urgent-value-echo', ('','',False,1,1,False,'old','wait')), '')
check('urgent-value-echo scenario 3', solve('urgent-value-echo', ('new','old',True,2,2,True,'screen','spinner')), 'new')
check('urgent-value-echo scenario 4', solve('urgent-value-echo', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('urgent-value-echo scenario 5', solve('urgent-value-echo', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('urgent-value-echo scenario 6', solve('urgent-value-echo', ('','old',False,3,3,True,'','spinner')), '')
check('deferred-content-during-pending scenario 1', solve('deferred-content-during-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 2', solve('deferred-content-during-pending', ('','',False,1,1,False,'old','wait')), '')
check('deferred-content-during-pending scenario 3', solve('deferred-content-during-pending', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 4', solve('deferred-content-during-pending', ('new','old',True,2,2,False,None,'spinner')), 'old')
check('deferred-content-during-pending scenario 5', solve('deferred-content-during-pending', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-content-during-pending scenario 6', solve('deferred-content-during-pending', ('','old',False,3,3,True,'','spinner')), '')
check('stale-transition-result scenario 1', solve('stale-transition-result', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('stale-transition-result scenario 2', solve('stale-transition-result', ('','',False,1,1,False,'old','wait')), True)
check('stale-transition-result scenario 3', solve('stale-transition-result', ('new','old',True,2,2,True,'screen','spinner')), True)
check('stale-transition-result scenario 4', solve('stale-transition-result', ('new','old',True,2,2,False,None,'spinner')), True)
check('stale-transition-result scenario 5', solve('stale-transition-result', ('x','x',False,3,2,True,None,'spinner')), False)
check('stale-transition-result scenario 6', solve('stale-transition-result', ('','old',False,3,3,True,'','spinner')), True)
check('suspension-preserves-prior-screen scenario 1', solve('suspension-preserves-prior-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('suspension-preserves-prior-screen scenario 2', solve('suspension-preserves-prior-screen', ('','',False,1,1,False,'old','wait')), '')
check('suspension-preserves-prior-screen scenario 3', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,True,'screen','spinner')), 'screen')
check('suspension-preserves-prior-screen scenario 4', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('suspension-preserves-prior-screen scenario 5', solve('suspension-preserves-prior-screen', ('x','x',False,3,2,True,None,'spinner')), 'spinner')
check('suspension-preserves-prior-screen scenario 6', solve('suspension-preserves-prior-screen', ('','old',False,3,3,True,'','spinner')), '')
check('pending-indicator-not-equality scenario 1', solve('pending-indicator-not-equality', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 2', solve('pending-indicator-not-equality', ('','',False,1,1,False,'old','wait')), False)
check('pending-indicator-not-equality scenario 3', solve('pending-indicator-not-equality', ('new','old',True,2,2,True,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 4', solve('pending-indicator-not-equality', ('new','old',True,2,2,False,None,'spinner')), True)
check('pending-indicator-not-equality scenario 5', solve('pending-indicator-not-equality', ('x','x',False,3,2,True,None,'spinner')), False)
check('pending-indicator-not-equality scenario 6', solve('pending-indicator-not-equality', ('','old',False,3,3,True,'','spinner')), False)
check('commit-clears-only-current-pending scenario 1', solve('commit-clears-only-current-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('commit-clears-only-current-pending scenario 2', solve('commit-clears-only-current-pending', ('','',False,1,1,False,'old','wait')), False)
check('commit-clears-only-current-pending scenario 3', solve('commit-clears-only-current-pending', ('new','old',True,2,2,True,'screen','spinner')), False)
check('commit-clears-only-current-pending scenario 4', solve('commit-clears-only-current-pending', ('new','old',True,2,2,False,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 5', solve('commit-clears-only-current-pending', ('x','x',False,3,2,True,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 6', solve('commit-clears-only-current-pending', ('','old',False,3,3,True,'','spinner')), False)
check('deferred-value-commit scenario 1', solve('deferred-value-commit', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-value-commit scenario 2', solve('deferred-value-commit', ('','',False,1,1,False,'old','wait')), '')
check('deferred-value-commit scenario 3', solve('deferred-value-commit', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-value-commit scenario 4', solve('deferred-value-commit', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('deferred-value-commit scenario 5', solve('deferred-value-commit', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-value-commit scenario 6', solve('deferred-value-commit', ('','old',False,3,3,True,'','spinner')), 'old')
check('fallback-first-render scenario 1', solve('fallback-first-render', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('fallback-first-render scenario 2', solve('fallback-first-render', ('','',False,1,1,False,'old','wait')), False)
check('fallback-first-render scenario 3', solve('fallback-first-render', ('new','old',True,2,2,True,'screen','spinner')), False)
check('fallback-first-render scenario 4', solve('fallback-first-render', ('new','old',True,2,2,False,None,'spinner')), False)
check('fallback-first-render scenario 5', solve('fallback-first-render', ('x','x',False,3,2,True,None,'spinner')), True)
check('fallback-first-render scenario 6', solve('fallback-first-render', ('','old',False,3,3,True,'','spinner')), False)
check('transition-target-identity scenario 1', solve('transition-target-identity', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), (2,'q'+str(N)))
check('transition-target-identity scenario 2', solve('transition-target-identity', ('','',False,1,1,False,'old','wait')), (1,''))
check('transition-target-identity scenario 3', solve('transition-target-identity', ('new','old',True,2,2,True,'screen','spinner')), (2,'new'))
check('transition-target-identity scenario 4', solve('transition-target-identity', ('new','old',True,2,2,False,None,'spinner')), (2,'new'))
check('transition-target-identity scenario 5', solve('transition-target-identity', ('x','x',False,3,2,True,None,'spinner')), (3,'x'))
check('transition-target-identity scenario 6', solve('transition-target-identity', ('','old',False,3,3,True,'','spinner')), (3,''))
check('previous-empty-screen scenario 1', solve('previous-empty-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('previous-empty-screen scenario 2', solve('previous-empty-screen', ('','',False,1,1,False,'old','wait')), True)
check('previous-empty-screen scenario 3', solve('previous-empty-screen', ('new','old',True,2,2,True,'screen','spinner')), True)
check('previous-empty-screen scenario 4', solve('previous-empty-screen', ('new','old',True,2,2,False,None,'spinner')), False)
check('previous-empty-screen scenario 5', solve('previous-empty-screen', ('x','x',False,3,2,True,None,'spinner')), False)
check('previous-empty-screen scenario 6', solve('previous-empty-screen', ('','old',False,3,3,True,'','spinner')), True)
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(operation, s):
    urgent, deferred, pending, active_generation, result_generation, suspended, previous, fallback = s
    if operation == 'urgent-value-echo':
        return urgent
    if operation == 'deferred-content-during-pending':
        return deferred if pending else urgent
    if operation == 'stale-transition-result':
        return result_generation==active_generation
    if operation == 'suspension-preserves-prior-screen':
        return previous if suspended and previous is not None else (fallback if suspended else urgent)
    if operation == 'pending-indicator-not-equality':
        return pending
    if operation == 'commit-clears-only-current-pending':
        return pending and result_generation!=active_generation
    if operation == 'deferred-value-commit':
        return urgent if result_generation==active_generation and not suspended else deferred
    if operation == 'fallback-first-render':
        return suspended and not previous
    if operation == 'transition-target-identity':
        return (active_generation,urgent)
    if operation == 'previous-empty-screen':
        return previous is not None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('urgent-value-echo scenario 1', solve('urgent-value-echo', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('urgent-value-echo scenario 2', solve('urgent-value-echo', ('','',False,1,1,False,'old','wait')), '')
check('urgent-value-echo scenario 3', solve('urgent-value-echo', ('new','old',True,2,2,True,'screen','spinner')), 'new')
check('urgent-value-echo scenario 4', solve('urgent-value-echo', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('urgent-value-echo scenario 5', solve('urgent-value-echo', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('urgent-value-echo scenario 6', solve('urgent-value-echo', ('','old',False,3,3,True,'','spinner')), '')
check('deferred-content-during-pending scenario 1', solve('deferred-content-during-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 2', solve('deferred-content-during-pending', ('','',False,1,1,False,'old','wait')), '')
check('deferred-content-during-pending scenario 3', solve('deferred-content-during-pending', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-content-during-pending scenario 4', solve('deferred-content-during-pending', ('new','old',True,2,2,False,None,'spinner')), 'old')
check('deferred-content-during-pending scenario 5', solve('deferred-content-during-pending', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-content-during-pending scenario 6', solve('deferred-content-during-pending', ('','old',False,3,3,True,'','spinner')), '')
check('stale-transition-result scenario 1', solve('stale-transition-result', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('stale-transition-result scenario 2', solve('stale-transition-result', ('','',False,1,1,False,'old','wait')), True)
check('stale-transition-result scenario 3', solve('stale-transition-result', ('new','old',True,2,2,True,'screen','spinner')), True)
check('stale-transition-result scenario 4', solve('stale-transition-result', ('new','old',True,2,2,False,None,'spinner')), True)
check('stale-transition-result scenario 5', solve('stale-transition-result', ('x','x',False,3,2,True,None,'spinner')), False)
check('stale-transition-result scenario 6', solve('stale-transition-result', ('','old',False,3,3,True,'','spinner')), True)
check('suspension-preserves-prior-screen scenario 1', solve('suspension-preserves-prior-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'q'+str(N))
check('suspension-preserves-prior-screen scenario 2', solve('suspension-preserves-prior-screen', ('','',False,1,1,False,'old','wait')), '')
check('suspension-preserves-prior-screen scenario 3', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,True,'screen','spinner')), 'screen')
check('suspension-preserves-prior-screen scenario 4', solve('suspension-preserves-prior-screen', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('suspension-preserves-prior-screen scenario 5', solve('suspension-preserves-prior-screen', ('x','x',False,3,2,True,None,'spinner')), 'spinner')
check('suspension-preserves-prior-screen scenario 6', solve('suspension-preserves-prior-screen', ('','old',False,3,3,True,'','spinner')), '')
check('pending-indicator-not-equality scenario 1', solve('pending-indicator-not-equality', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 2', solve('pending-indicator-not-equality', ('','',False,1,1,False,'old','wait')), False)
check('pending-indicator-not-equality scenario 3', solve('pending-indicator-not-equality', ('new','old',True,2,2,True,'screen','spinner')), True)
check('pending-indicator-not-equality scenario 4', solve('pending-indicator-not-equality', ('new','old',True,2,2,False,None,'spinner')), True)
check('pending-indicator-not-equality scenario 5', solve('pending-indicator-not-equality', ('x','x',False,3,2,True,None,'spinner')), False)
check('pending-indicator-not-equality scenario 6', solve('pending-indicator-not-equality', ('','old',False,3,3,True,'','spinner')), False)
check('commit-clears-only-current-pending scenario 1', solve('commit-clears-only-current-pending', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('commit-clears-only-current-pending scenario 2', solve('commit-clears-only-current-pending', ('','',False,1,1,False,'old','wait')), False)
check('commit-clears-only-current-pending scenario 3', solve('commit-clears-only-current-pending', ('new','old',True,2,2,True,'screen','spinner')), False)
check('commit-clears-only-current-pending scenario 4', solve('commit-clears-only-current-pending', ('new','old',True,2,2,False,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 5', solve('commit-clears-only-current-pending', ('x','x',False,3,2,True,None,'spinner')), False)
check('commit-clears-only-current-pending scenario 6', solve('commit-clears-only-current-pending', ('','old',False,3,3,True,'','spinner')), False)
check('deferred-value-commit scenario 1', solve('deferred-value-commit', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), 'old')
check('deferred-value-commit scenario 2', solve('deferred-value-commit', ('','',False,1,1,False,'old','wait')), '')
check('deferred-value-commit scenario 3', solve('deferred-value-commit', ('new','old',True,2,2,True,'screen','spinner')), 'old')
check('deferred-value-commit scenario 4', solve('deferred-value-commit', ('new','old',True,2,2,False,None,'spinner')), 'new')
check('deferred-value-commit scenario 5', solve('deferred-value-commit', ('x','x',False,3,2,True,None,'spinner')), 'x')
check('deferred-value-commit scenario 6', solve('deferred-value-commit', ('','old',False,3,3,True,'','spinner')), 'old')
check('fallback-first-render scenario 1', solve('fallback-first-render', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), False)
check('fallback-first-render scenario 2', solve('fallback-first-render', ('','',False,1,1,False,'old','wait')), False)
check('fallback-first-render scenario 3', solve('fallback-first-render', ('new','old',True,2,2,True,'screen','spinner')), False)
check('fallback-first-render scenario 4', solve('fallback-first-render', ('new','old',True,2,2,False,None,'spinner')), False)
check('fallback-first-render scenario 5', solve('fallback-first-render', ('x','x',False,3,2,True,None,'spinner')), True)
check('fallback-first-render scenario 6', solve('fallback-first-render', ('','old',False,3,3,True,'','spinner')), False)
check('transition-target-identity scenario 1', solve('transition-target-identity', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), (2,'q'+str(N)))
check('transition-target-identity scenario 2', solve('transition-target-identity', ('','',False,1,1,False,'old','wait')), (1,''))
check('transition-target-identity scenario 3', solve('transition-target-identity', ('new','old',True,2,2,True,'screen','spinner')), (2,'new'))
check('transition-target-identity scenario 4', solve('transition-target-identity', ('new','old',True,2,2,False,None,'spinner')), (2,'new'))
check('transition-target-identity scenario 5', solve('transition-target-identity', ('x','x',False,3,2,True,None,'spinner')), (3,'x'))
check('transition-target-identity scenario 6', solve('transition-target-identity', ('','old',False,3,3,True,'','spinner')), (3,''))
check('previous-empty-screen scenario 1', solve('previous-empty-screen', ('q'+str(N),'old',True,2,1,False,'screen','spinner')), True)
check('previous-empty-screen scenario 2', solve('previous-empty-screen', ('','',False,1,1,False,'old','wait')), True)
check('previous-empty-screen scenario 3', solve('previous-empty-screen', ('new','old',True,2,2,True,'screen','spinner')), True)
check('previous-empty-screen scenario 4', solve('previous-empty-screen', ('new','old',True,2,2,False,None,'spinner')), False)
check('previous-empty-screen scenario 5', solve('previous-empty-screen', ('x','x',False,3,2,True,None,'spinner')), False)
check('previous-empty-screen scenario 6', solve('previous-empty-screen', ('','old',False,3,3,True,'','spinner')), True)
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:
Fallback first render.

Urgent input echoes immediately while deferred content may lag. Only the active transition can commit or clear pending work. A suspended update retains any prior screen, including empty text; first render uses fallback. Operation fallback-first-render has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return bool(cache.get(key))
    if operation == 'stale-data-remains-visible':
        return cache.get(key)
    if operation == 'initial-vs-background-loading':
        return fetching and key not in cache
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return cache.get(key) is not None
    if operation == 'stale-data-remains-visible':
        return cache.get(key)
    if operation == 'initial-vs-background-loading':
        return fetching and key not in cache
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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:
Cache presence not truthiness.

Client cache presence is independent of payload truthiness. Stale data remains visible during background refresh; first-load status requires absent data. Observers retain resources, and invalidation is idempotent per key. Operation cache-presence-not-truthiness has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return key in cache
    if operation == 'stale-data-remains-visible':
        return None if key in stale else cache.get(key)
    if operation == 'initial-vs-background-loading':
        return fetching and key not in cache
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return key in cache
    if operation == 'stale-data-remains-visible':
        return cache.get(key) or None
    if operation == 'initial-vs-background-loading':
        return fetching and key not in cache
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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:
Stale data remains visible.

Client cache presence is independent of payload truthiness. Stale data remains visible during background refresh; first-load status requires absent data. Observers retain resources, and invalidation is idempotent per key. Operation stale-data-remains-visible has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return key in cache
    if operation == 'stale-data-remains-visible':
        return cache.get(key)
    if operation == 'initial-vs-background-loading':
        return fetching
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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(operation, s):
    cache, key, stale, observers, fetching, error = s
    if operation == 'cache-presence-not-truthiness':
        return key in cache
    if operation == 'stale-data-remains-visible':
        return cache.get(key)
    if operation == 'initial-vs-background-loading':
        return fetching and not cache.get(key)
    if operation == 'observed-stale-refetch':
        return key in stale and bool(observers)
    if operation == 'unobserved-garbage-collect':
        return not observers and not fetching
    if operation == 'resource-error-presence':
        return error is not None
    if operation == 'invalidate-one-resource':
        return list(dict.fromkeys(stale+[key]))
    if operation == 'evict-resource-key':
        return {k:v for k,v in cache.items() if k!=key}
    if operation == 'subscription-fanout-count':
        return len(observers)
    if operation == 'fetch-state-independent-of-data':
        return 'fetching' if fetching else 'idle'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cache-presence-not-truthiness scenario 1', solve('cache-presence-not-truthiness', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('cache-presence-not-truthiness scenario 2', solve('cache-presence-not-truthiness', ({'a':None},'a',[],[],False,'bad')), True)
check('cache-presence-not-truthiness scenario 3', solve('cache-presence-not-truthiness', ({},'a',[],['screen'],True,None)), False)
check('cache-presence-not-truthiness scenario 4', solve('cache-presence-not-truthiness', ({'a':0},'a',['a'],[],False,'')), True)
check('cache-presence-not-truthiness scenario 5', solve('cache-presence-not-truthiness', ({'b':N},'b',[],['one','two'],False,None)), True)
check('cache-presence-not-truthiness scenario 6', solve('cache-presence-not-truthiness', ({'a':[]},'a',['b'],[],True,None)), True)
check('stale-data-remains-visible scenario 1', solve('stale-data-remains-visible', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), N)
check('stale-data-remains-visible scenario 2', solve('stale-data-remains-visible', ({'a':None},'a',[],[],False,'bad')), None)
check('stale-data-remains-visible scenario 3', solve('stale-data-remains-visible', ({},'a',[],['screen'],True,None)), None)
check('stale-data-remains-visible scenario 4', solve('stale-data-remains-visible', ({'a':0},'a',['a'],[],False,'')), 0)
check('stale-data-remains-visible scenario 5', solve('stale-data-remains-visible', ({'b':N},'b',[],['one','two'],False,None)), N)
check('stale-data-remains-visible scenario 6', solve('stale-data-remains-visible', ({'a':[]},'a',['b'],[],True,None)), [])
check('initial-vs-background-loading scenario 1', solve('initial-vs-background-loading', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('initial-vs-background-loading scenario 2', solve('initial-vs-background-loading', ({'a':None},'a',[],[],False,'bad')), False)
check('initial-vs-background-loading scenario 3', solve('initial-vs-background-loading', ({},'a',[],['screen'],True,None)), True)
check('initial-vs-background-loading scenario 4', solve('initial-vs-background-loading', ({'a':0},'a',['a'],[],False,'')), False)
check('initial-vs-background-loading scenario 5', solve('initial-vs-background-loading', ({'b':N},'b',[],['one','two'],False,None)), False)
check('initial-vs-background-loading scenario 6', solve('initial-vs-background-loading', ({'a':[]},'a',['b'],[],True,None)), False)
check('observed-stale-refetch scenario 1', solve('observed-stale-refetch', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), True)
check('observed-stale-refetch scenario 2', solve('observed-stale-refetch', ({'a':None},'a',[],[],False,'bad')), False)
check('observed-stale-refetch scenario 3', solve('observed-stale-refetch', ({},'a',[],['screen'],True,None)), False)
check('observed-stale-refetch scenario 4', solve('observed-stale-refetch', ({'a':0},'a',['a'],[],False,'')), False)
check('observed-stale-refetch scenario 5', solve('observed-stale-refetch', ({'b':N},'b',[],['one','two'],False,None)), False)
check('observed-stale-refetch scenario 6', solve('observed-stale-refetch', ({'a':[]},'a',['b'],[],True,None)), False)
check('unobserved-garbage-collect scenario 1', solve('unobserved-garbage-collect', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 2', solve('unobserved-garbage-collect', ({'a':None},'a',[],[],False,'bad')), True)
check('unobserved-garbage-collect scenario 3', solve('unobserved-garbage-collect', ({},'a',[],['screen'],True,None)), False)
check('unobserved-garbage-collect scenario 4', solve('unobserved-garbage-collect', ({'a':0},'a',['a'],[],False,'')), True)
check('unobserved-garbage-collect scenario 5', solve('unobserved-garbage-collect', ({'b':N},'b',[],['one','two'],False,None)), False)
check('unobserved-garbage-collect scenario 6', solve('unobserved-garbage-collect', ({'a':[]},'a',['b'],[],True,None)), False)
check('resource-error-presence scenario 1', solve('resource-error-presence', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), False)
check('resource-error-presence scenario 2', solve('resource-error-presence', ({'a':None},'a',[],[],False,'bad')), True)
check('resource-error-presence scenario 3', solve('resource-error-presence', ({},'a',[],['screen'],True,None)), False)
check('resource-error-presence scenario 4', solve('resource-error-presence', ({'a':0},'a',['a'],[],False,'')), True)
check('resource-error-presence scenario 5', solve('resource-error-presence', ({'b':N},'b',[],['one','two'],False,None)), False)
check('resource-error-presence scenario 6', solve('resource-error-presence', ({'a':[]},'a',['b'],[],True,None)), False)
check('invalidate-one-resource scenario 1', solve('invalidate-one-resource', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 2', solve('invalidate-one-resource', ({'a':None},'a',[],[],False,'bad')), ['a'])
check('invalidate-one-resource scenario 3', solve('invalidate-one-resource', ({},'a',[],['screen'],True,None)), ['a'])
check('invalidate-one-resource scenario 4', solve('invalidate-one-resource', ({'a':0},'a',['a'],[],False,'')), ['a'])
check('invalidate-one-resource scenario 5', solve('invalidate-one-resource', ({'b':N},'b',[],['one','two'],False,None)), ['b'])
check('invalidate-one-resource scenario 6', solve('invalidate-one-resource', ({'a':[]},'a',['b'],[],True,None)), ['b','a'])
check('evict-resource-key scenario 1', solve('evict-resource-key', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), {'b':0})
check('evict-resource-key scenario 2', solve('evict-resource-key', ({'a':None},'a',[],[],False,'bad')), {})
check('evict-resource-key scenario 3', solve('evict-resource-key', ({},'a',[],['screen'],True,None)), {})
check('evict-resource-key scenario 4', solve('evict-resource-key', ({'a':0},'a',['a'],[],False,'')), {})
check('evict-resource-key scenario 5', solve('evict-resource-key', ({'b':N},'b',[],['one','two'],False,None)), {})
check('evict-resource-key scenario 6', solve('evict-resource-key', ({'a':[]},'a',['b'],[],True,None)), {})
check('subscription-fanout-count scenario 1', solve('subscription-fanout-count', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 2', solve('subscription-fanout-count', ({'a':None},'a',[],[],False,'bad')), 0)
check('subscription-fanout-count scenario 3', solve('subscription-fanout-count', ({},'a',[],['screen'],True,None)), 1)
check('subscription-fanout-count scenario 4', solve('subscription-fanout-count', ({'a':0},'a',['a'],[],False,'')), 0)
check('subscription-fanout-count scenario 5', solve('subscription-fanout-count', ({'b':N},'b',[],['one','two'],False,None)), 2)
check('subscription-fanout-count scenario 6', solve('subscription-fanout-count', ({'a':[]},'a',['b'],[],True,None)), 0)
check('fetch-state-independent-of-data scenario 1', solve('fetch-state-independent-of-data', ({'a':N,'b':0},'a',['a'],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 2', solve('fetch-state-independent-of-data', ({'a':None},'a',[],[],False,'bad')), 'idle')
check('fetch-state-independent-of-data scenario 3', solve('fetch-state-independent-of-data', ({},'a',[],['screen'],True,None)), 'fetching')
check('fetch-state-independent-of-data scenario 4', solve('fetch-state-independent-of-data', ({'a':0},'a',['a'],[],False,'')), 'idle')
check('fetch-state-independent-of-data scenario 5', solve('fetch-state-independent-of-data', ({'b':N},'b',[],['one','two'],False,None)), 'idle')
check('fetch-state-independent-of-data scenario 6', solve('fetch-state-independent-of-data', ({'a':[]},'a',['b'],[],True,None)), 'fetching')
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:
Initial vs background loading.

Client cache presence is independent of payload truthiness. Stale data remains visible during background refresh; first-load status requires absent data. Observers retain resources, and invalidation is idempotent per key. Operation initial-vs-background-loading has the six explicit input/output oracles below.

split: open-access