FA-42341 / Listener lifecycle / Open access
Type-rejected values still invoke a user observer predicate · case 01
Type-rejected values still invoke a user observer predicate; the returned lifecycle plan violates the stated transition contract.
ROOT CAUSE
The predicate_index decision in the filter-stage listener model is computed as [r[1] for r in s['guarded_inputs']], losing a required lifecycle condition.
VERIFIED REPAIR
Compute the predicate_index decision from the complete contract: [r[1] for r in s['guarded_inputs'] if r[0]].
Unsuccessful approach: The partial repair uses [r[1] for r in s['guarded_inputs'] if r[0] and r[1]]; a retained regression distinguishes it from the full transition.
Case contract
Plan a predicate-filter observer stage. The predicate index counts every upstream value, including rejected values. Predicate errors become error notifications and never value notifications. Falsey input values remain valid data. Rejection does not consume downstream credit; an active filtered stage replaces one upstream request when a value is rejected. Predicate evaluation stops after termination. A stipulated pre-predicate type guard records [valid,payload]; only valid entries invoke user code, and falsey valid payloads remain eligible. Evaluate predicate callbacks left-to-right through the first false result inclusive, then stop; return evaluated callback indices. Inputs are finite state snapshots, including transitional and stale states; output fields are the exact independent actions/metadata defined by the corrected expression table. Numeric fixture capacities and counts vary with N. Field definitions, each independently computed from the input snapshot: predicate_index = [r[1] for r in s['guarded_inputs'] if r[0]]; input_index = s['input_index']+int(s['has_value']); output_index = s['output_index']+int(s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed']); value = [s['value']] if s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed'] else []; error = s['predicate_error'] if s['has_value'] and not s['closed'] else None; credit = max(0,s['credit']-int(s['has_value'] and s['accepted'] and s['predicate_error'] is None)); replace_request = s['has_value'] and not s['accepted'] and s['predicate_error'] is None and not s['closed'] and s['upstream_active']; evaluate = list(range(next((i+1 for i,result in enumerate(s['predicate_chain']) if not result),len(s['predicate_chain'])))); terminal = s['closed'] or (s['has_value'] and s['predicate_error'] is not None); predicate_result = None if s['predicate_error'] is not None else s['accepted']
Why this case matters
Observer implementations need to preserve this state while subscriptions enter, execute, and leave their lifecycle.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'predicate_index': [r[1] for r in s['guarded_inputs']],
'input_index': s['input_index']+int(s['has_value']),
'output_index': s['output_index']+int(s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed']),
'value': [s['value']] if s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed'] else [],
'error': s['predicate_error'] if s['has_value'] and not s['closed'] else None,
'credit': max(0,s['credit']-int(s['has_value'] and s['accepted'] and s['predicate_error'] is None)),
'replace_request': s['has_value'] and not s['accepted'] and s['predicate_error'] is None and not s['closed'] and s['upstream_active'],
'evaluate': list(range(next((i+1 for i,result in enumerate(s['predicate_chain']) if not result),len(s['predicate_chain'])))),
'terminal': s['closed'] or (s['has_value'] and s['predicate_error'] is not None),
'predicate_result': None if s['predicate_error'] is not None else s['accepted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 3, 'output_index': 3, 'value': [], 'error': 'bad', 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 2, 'output_index': 0, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': None, 'credit': 4, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 2: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 6, 'credit': 8, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 5, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 1, 'output_index': 6, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 4, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 3: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 9, 'value': [], 'error': 'bad', 'credit': 12, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 4: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 16, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 12, 'value': [], 'error': 'bad', 'credit': 16, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 12, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 12, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': True, 'evaluate': [0], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 8, 'output_index': 12, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': True, 'predicate_error': None, 'input_index': 8, 'output_index': 0, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 8, 'output_index': 12, 'credit': 16, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 16, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 5: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 10, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 16, 'value': [0], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 15, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| transition 0 | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': ['bad', 0, 'ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': [0, 'ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Failed |
| transition 1 | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [0], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | Failed |
| transition 2 | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [0], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Failed |
| transition 3 | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [0], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | Failed |
| transition 4 | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [0], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Failed |
| transition 5 | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 6 | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | Passed |
| transition 7 | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [0], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Failed |
SHA-256 / 8dbd937e0b6f89d5974398389ad556cdf6d02c47b44c9d8aff6acd34f8d8d6de
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'predicate_index': [r[1] for r in s['guarded_inputs'] if r[0] and r[1]],
'input_index': s['input_index']+int(s['has_value']),
'output_index': s['output_index']+int(s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed']),
'value': [s['value']] if s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed'] else [],
'error': s['predicate_error'] if s['has_value'] and not s['closed'] else None,
'credit': max(0,s['credit']-int(s['has_value'] and s['accepted'] and s['predicate_error'] is None)),
'replace_request': s['has_value'] and not s['accepted'] and s['predicate_error'] is None and not s['closed'] and s['upstream_active'],
'evaluate': list(range(next((i+1 for i,result in enumerate(s['predicate_chain']) if not result),len(s['predicate_chain'])))),
'terminal': s['closed'] or (s['has_value'] and s['predicate_error'] is not None),
'predicate_result': None if s['predicate_error'] is not None else s['accepted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 3, 'output_index': 3, 'value': [], 'error': 'bad', 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 2, 'output_index': 0, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': None, 'credit': 4, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 2: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 6, 'credit': 8, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 5, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 1, 'output_index': 6, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 4, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 3: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 9, 'value': [], 'error': 'bad', 'credit': 12, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 4: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 16, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 12, 'value': [], 'error': 'bad', 'credit': 16, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 12, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 12, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': True, 'evaluate': [0], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 8, 'output_index': 12, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': True, 'predicate_error': None, 'input_index': 8, 'output_index': 0, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 8, 'output_index': 12, 'credit': 16, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 16, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 5: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 10, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 16, 'value': [0], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 15, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| transition 0 | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': ['ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': [0, 'ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Failed |
| transition 1 | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | Passed |
| transition 2 | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 3 | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | Passed |
| transition 4 | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 5 | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 6 | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | Passed |
| transition 7 | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
SHA-256 / efd751af80050405dd62038ed3eec5c879fa0d79d45ef918999c62fab8b160b0
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'predicate_index': [r[1] for r in s['guarded_inputs'] if r[0]],
'input_index': s['input_index']+int(s['has_value']),
'output_index': s['output_index']+int(s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed']),
'value': [s['value']] if s['has_value'] and s['accepted'] and s['predicate_error'] is None and not s['closed'] else [],
'error': s['predicate_error'] if s['has_value'] and not s['closed'] else None,
'credit': max(0,s['credit']-int(s['has_value'] and s['accepted'] and s['predicate_error'] is None)),
'replace_request': s['has_value'] and not s['accepted'] and s['predicate_error'] is None and not s['closed'] and s['upstream_active'],
'evaluate': list(range(next((i+1 for i,result in enumerate(s['predicate_chain']) if not result),len(s['predicate_chain'])))),
'terminal': s['closed'] or (s['has_value'] and s['predicate_error'] is not None),
'predicate_result': None if s['predicate_error'] is not None else s['accepted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 3, 'output_index': 3, 'value': [], 'error': 'bad', 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 2, 'output_index': 0, 'credit': 4, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': None, 'credit': 4, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 2, 'output_index': 3, 'credit': 4, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 3, 'output_index': 3, 'value': [], 'error': None, 'credit': 4, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 2: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 6, 'credit': 8, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 5, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 1, 'output_index': 6, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': 'bad', 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 4, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': False}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 4, 'output_index': 6, 'credit': 8, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 5, 'output_index': 6, 'value': [], 'error': None, 'credit': 8, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 3: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 9, 'value': [], 'error': 'bad', 'credit': 12, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 1, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 6, 'output_index': 9, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': True, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 6, 'output_index': 9, 'credit': 12, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 7, 'output_index': 9, 'value': [], 'error': None, 'credit': 12, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 4: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 16, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 12, 'value': [], 'error': 'bad', 'credit': 16, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': False, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 12, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': True, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 12, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 12, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 1, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': True, 'evaluate': [0], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': False, 'predicate_error': None, 'input_index': 8, 'output_index': 12, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 1, 'replace_request': False, 'evaluate': [], 'terminal': True, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': True, 'predicate_error': None, 'input_index': 8, 'output_index': 0, 'credit': 1, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 8, 'output_index': 12, 'credit': 16, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 9, 'output_index': 12, 'value': [], 'error': None, 'credit': 16, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})], 5: [({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None}), ({'value': None, 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 10, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0], 'terminal': False, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 0, 'credit': 1, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 0, 'value': [], 'error': 'bad', 'credit': 1, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 'x', 'accepted': False, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': []}, {'predicate_index': [0, 'ok'], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 0, 'replace_request': True, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 0, 'accepted': True, 'predicate_error': 'bad', 'input_index': 0, 'output_index': 0, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 'bad'], [True, 0], [True, 'ok']], 'predicate_chain': [True, False, True]}, {'predicate_index': [0, 'ok'], 'input_index': 1, 'output_index': 0, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0, 1], 'terminal': True, 'predicate_result': None}), ({'value': 0, 'accepted': True, 'predicate_error': None, 'input_index': 10, 'output_index': 15, 'credit': 0, 'closed': False, 'has_value': True, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [[False, 0]], 'predicate_chain': [True, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 16, 'value': [0], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [0, 1], 'terminal': False, 'predicate_result': True}), ({'value': None, 'accepted': False, 'predicate_error': None, 'input_index': 0, 'output_index': 0, 'credit': 0, 'closed': False, 'has_value': False, 'upstream_active': False, 'evaluated': False, 'guarded_inputs': [], 'predicate_chain': []}, {'predicate_index': [], 'input_index': 0, 'output_index': 0, 'value': [], 'error': None, 'credit': 0, 'replace_request': False, 'evaluate': [], 'terminal': False, 'predicate_result': False}), ({'value': 'x', 'accepted': True, 'predicate_error': 'bad', 'input_index': 10, 'output_index': 15, 'credit': 20, 'closed': True, 'has_value': True, 'upstream_active': True, 'evaluated': True, 'guarded_inputs': [[False, 0]], 'predicate_chain': [False, True]}, {'predicate_index': [], 'input_index': 11, 'output_index': 15, 'value': [], 'error': None, 'credit': 20, 'replace_request': False, 'evaluate': [0], 'terminal': True, 'predicate_result': None})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| transition 0 | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': [0, 'ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 3, 'predicate_index': [0, 'ok'], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 1 | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 1, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': False, 'value': []} | Passed |
| transition 2 | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [0, 1], 'input_index': 1, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 3 | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': True, 'terminal': False, 'value': []} | Passed |
| transition 4 | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 0, 'error': 'bad', 'evaluate': [0, 1], 'input_index': 3, 'output_index': 0, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 5 | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0, 1], 'input_index': 0, 'output_index': 3, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
| transition 6 | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | {'credit': 0, 'error': None, 'evaluate': [], 'input_index': 0, 'output_index': 0, 'predicate_index': [], 'predicate_result': False, 'replace_request': False, 'terminal': False, 'value': []} | Passed |
| transition 7 | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | {'credit': 4, 'error': None, 'evaluate': [0], 'input_index': 3, 'output_index': 3, 'predicate_index': [], 'predicate_result': None, 'replace_request': False, 'terminal': True, 'value': []} | Passed |
SHA-256 / 83a56fd3e27bb2f614f3d8f1a2dba115a002afdccb4cb45be461f8a30e6eed6c
Verification & scope
A deterministic, bounded, single-threaded transition planner. Returned plans model state changes; they do not implement a production event framework. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:43:50.877178+00:00.
Case digest / 276ea390bf90e25d44aa8c89aaa8e71316e8ed75070a47284de0c81611b17ccf