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

N = 1
observations = []
def solve(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(not d['loading']), 'request-parent':({'parent':d['parent']} if d['parent'] is not None else None), 'parent-reset-child':([] if d['parent'] is None else list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(d['parent'] is not None), 'request-parent':({'parent':d['parent']} if d['parent'] is not None else None), 'parent-reset-child':([] if d['parent'] is None else list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Dependent editors wait for both parent scope and loaded options is violated by the widget projection.

A child facet is meaningful only inside its selected parent scope. Parent changes invalidate incompatible child selections but retain compatible identities. This example checks: Dependent editors wait for both parent scope and loaded options.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(d['parent'] is not None and not d['loading']), 'request-parent':({'parent':d['parent']}), 'parent-reset-child':([] if d['parent'] is None else list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

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(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(d['parent'] is not None and not d['loading']), 'request-parent':({'parent':d['parent']} if d['parent'] else None), 'parent-reset-child':([] if d['parent'] is None else list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Empty-string parent identities still scope dependent option requests is violated by the widget projection.

A child facet is meaningful only inside its selected parent scope. Parent changes invalidate incompatible child selections but retain compatible identities. This example checks: Empty-string parent identities still scope dependent option requests.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(d['parent'] is not None and not d['loading']), 'request-parent':({'parent':d['parent']} if d['parent'] is not None else None), 'parent-reset-child':(list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    return {'compatible-child':([x for x in d['selected'] if x in d['allowed']]), 'child-editor-enabled':(d['parent'] is not None and not d['loading']), 'request-parent':({'parent':d['parent']} if d['parent'] is not None else None), 'parent-reset-child':([] if not d['parent'] else list(d['selected'])), 'pending-validation':(d['parent'] is not None and d['loading'] and bool(d['selected'])), 'invalid-child-notice':([x for x in d['selected'] if x not in d['allowed']] if not d['loading'] else [])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']})], 2: [({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []})], 3: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 4: [({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': 'p', 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a', 'z']}), ({'parent': None, 'loading': True, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': [], 'allowed': ['a']}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []})], 5: [({'parent': None, 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a', 'z'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': None, 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': None, 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': None, 'loading': True, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': False, 'request-parent': None, 'parent-reset-child': [], 'pending-validation': False, 'invalid-child-notice': []}), ({'parent': '', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']}), ({'parent': '', 'loading': False, 'selected': ['a', 'z'], 'allowed': ['a']}, {'compatible-child': ['a'], 'child-editor-enabled': True, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a', 'z'], 'pending-validation': False, 'invalid-child-notice': ['z']}), ({'parent': '', 'loading': True, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': False, 'request-parent': {'parent': ''}, 'parent-reset-child': ['a'], 'pending-validation': True, 'invalid-child-notice': []}), ({'parent': 'p', 'loading': False, 'selected': ['a'], 'allowed': []}, {'compatible-child': [], 'child-editor-enabled': True, 'request-parent': {'parent': 'p'}, 'parent-reset-child': ['a'], 'pending-validation': False, 'invalid-child-notice': ['a']})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Removing a parent clears its dependent criteria is violated by the widget projection.

A child facet is meaningful only inside its selected parent scope. Parent changes invalidate incompatible child selections but retain compatible identities. This example checks: Removing a parent clears its dependent criteria.

split: open-access