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

N = 1
observations = []
def solve(d):
    return {'staged-known':([x for x in d['incoming'] if x['field'] in d['fields']]), 'unresolved-review':([x for x in d['incoming'] if x['field'] not in d['fields']]), 'review-trigger':(d['scope']!=d['import_scope'] or d['version']!=d['import_version']), 'duplicate-policy':(list({(x['field'],x['value']):x for x in d['incoming']}.values()) if d['deduplicate'] else d['incoming']), 'publish-reviewed':(d['confirmed'] and all(x['field'] in d['fields'] for x in d['incoming'])), 'import-replacement':(d['existing']+d['incoming'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]})], 2: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]})], 3: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]})], 4: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]})], 5: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]})]}
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 {'staged-known':([x for x in d['incoming'] if x['field'] in d['fields']]), 'unresolved-review':([x for x in d['incoming'] if x['field'] not in d['fields']]), 'review-trigger':(d['scope']!=d['import_scope'] or d['version']!=d['import_version']), 'duplicate-policy':(list({(x['field'],x['value']):x for x in d['incoming']}.values()) if d['deduplicate'] else d['incoming']), 'publish-reviewed':(d['confirmed'] and all(x['field'] in d['fields'] for x in d['incoming'])), 'import-replacement':(d['incoming'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]})], 2: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]})], 3: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]})], 4: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': True, 'confirmed': False, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'old', 'value': 3}, {'field': 'gone', 'value': 2}]})], 5: [({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': False, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': False, 'import-replacement': []}), ({'incoming': [], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': True, 'confirmed': True, 'replace': False, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [], 'publish-reviewed': True, 'import-replacement': [{'field': 'old', 'value': 3}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': False, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'unresolved-review': [], 'review-trigger': True, 'duplicate-policy': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}], 'publish-reviewed': True, 'import-replacement': [{'field': 'a', 'value': 0}, {'field': 'a', 'value': 0}, {'field': 'a', 'value': 1}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': False, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 's', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 1, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]}), ({'incoming': [{'field': 'gone', 'value': 2}], 'fields': ['a'], 'scope': 's', 'import_scope': 'x', 'version': 1, 'import_version': 2, 'deduplicate': False, 'confirmed': True, 'replace': True, 'existing': [{'field': 'old', 'value': 3}]}, {'staged-known': [], 'unresolved-review': [{'field': 'gone', 'value': 2}], 'review-trigger': True, 'duplicate-policy': [{'field': 'gone', 'value': 2}], 'publish-reviewed': False, 'import-replacement': [{'field': 'gone', 'value': 2}]})]}
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:
The import replace option controls whether previous filter criteria survive is violated by the widget projection.

Importing filter configurations stages known and unresolved constraints, applies an explicit duplicate policy, and requires review when scope or version differs. This example checks: The import replace option controls whether previous filter criteria survive.

split: open-access


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

N = 1
observations = []
def solve(match_ok, range_valid, body):
    return [400, ""] if not range_valid else ([206,body] if match_ok else [412,""])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('precondition-before-range fixture 0', solve(False,False,"x"*N), [412,""])
check('precondition-before-range fixture 1', solve(False,True,"x"*N), [412,""])
check('precondition-before-range fixture 2', solve(True,False,"x"*N), [400,""])
check('precondition-before-range fixture 3', solve(True,True,"x"*N), [206,"x"*N])
check('precondition-before-range fixture 4', solve(False,False,""), [412,""])
check('precondition-before-range fixture 5', solve(True,True,""), [206,""])
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(match_ok, range_valid, body):
    return [412, ""] if not match_ok and range_valid else ([206,body] if range_valid else [400,""])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('precondition-before-range fixture 0', solve(False,False,"x"*N), [412,""])
check('precondition-before-range fixture 1', solve(False,True,"x"*N), [412,""])
check('precondition-before-range fixture 2', solve(True,False,"x"*N), [400,""])
check('precondition-before-range fixture 3', solve(True,True,"x"*N), [206,"x"*N])
check('precondition-before-range fixture 4', solve(False,False,""), [412,""])
check('precondition-before-range fixture 5', solve(True,True,""), [206,""])
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:
Failed write-independent preconditions precede range parsing.

Return [status,body]: failed If-Match is 412 before examining a malformed range; otherwise malformed range is 400 and valid range 206.

split: open-access


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

N = 1
observations = []
def solve(fresh, satisfiable, body):
    return [416, ""] if not satisfiable else ([304,""] if fresh else [206,body])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('not-modified-before-unsatisfied fixture 0', solve(True,False,"x"*N), [304,""])
check('not-modified-before-unsatisfied fixture 1', solve(True,True,"x"*N), [304,""])
check('not-modified-before-unsatisfied fixture 2', solve(False,False,"x"*N), [416,""])
check('not-modified-before-unsatisfied fixture 3', solve(False,True,"x"*N), [206,"x"*N])
check('not-modified-before-unsatisfied fixture 4', solve(True,False,""), [304,""])
check('not-modified-before-unsatisfied fixture 5', solve(False,True,""), [206,""])
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(fresh, satisfiable, body):
    return [304, ""] if fresh and satisfiable else ([206,body] if satisfiable else [416,""])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('not-modified-before-unsatisfied fixture 0', solve(True,False,"x"*N), [304,""])
check('not-modified-before-unsatisfied fixture 1', solve(True,True,"x"*N), [304,""])
check('not-modified-before-unsatisfied fixture 2', solve(False,False,"x"*N), [416,""])
check('not-modified-before-unsatisfied fixture 3', solve(False,True,"x"*N), [206,"x"*N])
check('not-modified-before-unsatisfied fixture 4', solve(True,False,""), [304,""])
check('not-modified-before-unsatisfied fixture 5', solve(False,True,""), [206,""])
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:
A matching cache validator suppresses range unsatisfiability.

A matching GET cache validator produces [304,empty]; only stale requests evaluate ranges, yielding 206 or 416.

split: open-access


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

N = 1
observations = []
def solve(exists, tag, body):
    return [200,body] if tag else [412,""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-match-wildcard-existence fixture 0', solve(True,None,"x"*N), [200,"x"*N])
check('if-match-wildcard-existence fixture 1', solve(True,"","x"*N), [200,"x"*N])
check('if-match-wildcard-existence fixture 2', solve(False,"old","x"*N), [412,""])
check('if-match-wildcard-existence fixture 3', solve(False,None,""), [412,""])
check('if-match-wildcard-existence fixture 4', solve(True,"v", ""), [200,""])
check('if-match-wildcard-existence fixture 5', solve(True,"v","z"*N), [200,"z"*N])
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(exists, tag, body):
    return [200,body] if exists and tag is not None else [412,""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-match-wildcard-existence fixture 0', solve(True,None,"x"*N), [200,"x"*N])
check('if-match-wildcard-existence fixture 1', solve(True,"","x"*N), [200,"x"*N])
check('if-match-wildcard-existence fixture 2', solve(False,"old","x"*N), [412,""])
check('if-match-wildcard-existence fixture 3', solve(False,None,""), [412,""])
check('if-match-wildcard-existence fixture 4', solve(True,"v", ""), [200,""])
check('if-match-wildcard-existence fixture 5', solve(True,"v","z"*N), [200,"z"*N])
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:
Wildcard preconditions test representation existence without requiring a stored tag.

For an If-Match wildcard, return [200,body] for any existing representation, including an untagged one, else [412,empty].

split: open-access


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

N = 1
observations = []
def solve(requested, current, body):
    return [304, ""] if any(t in current for t in requested) else [206,body]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('etag-list-not-substring fixture 0', solve( ["v"],"v"+str(N),"p"*N), [206,"p"*N])
check('etag-list-not-substring fixture 1', solve(["old","v"+str(N)],"v"+str(N),"p"), [304,""])
check('etag-list-not-substring fixture 2', solve([],"v","p"*N), [206,"p"*N])
check('etag-list-not-substring fixture 3', solve(["v"],"v","p"), [304,""])
check('etag-list-not-substring fixture 4', solve([""],"v","p"), [206,"p"])
check('etag-list-not-substring fixture 5', solve(["a","b"],"c","p"), [206,"p"])
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(requested, current, body):
    return [304, ""] if requested and requested[0] == current else [206,body]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('etag-list-not-substring fixture 0', solve( ["v"],"v"+str(N),"p"*N), [206,"p"*N])
check('etag-list-not-substring fixture 1', solve(["old","v"+str(N)],"v"+str(N),"p"), [304,""])
check('etag-list-not-substring fixture 2', solve([],"v","p"*N), [206,"p"*N])
check('etag-list-not-substring fixture 3', solve(["v"],"v","p"), [304,""])
check('etag-list-not-substring fixture 4', solve([""],"v","p"), [206,"p"])
check('etag-list-not-substring fixture 5', solve(["a","b"],"c","p"), [206,"p"])
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:
An If-None-Match list compares complete opaque values.

Inputs are parsed weak-normalized opaque tag strings. Return 304 if current is a complete member; otherwise return [206,body].

split: open-access


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

N = 1
observations = []
def solve(modified_ms, condition_s, body):
    return [304, ""] if modified_ms <= condition_s*1000 else [206,body]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('date-precision-normalization fixture 0', solve(N*1000+900,N,"p"*N), [304,""])
check('date-precision-normalization fixture 1', solve(N*1000+1,N,"p"), [304,""])
check('date-precision-normalization fixture 2', solve(N*1000,N,"p"), [304,""])
check('date-precision-normalization fixture 3', solve((N+1)*1000,N,"p"*N), [206,"p"*N])
check('date-precision-normalization fixture 4', solve(0,0,"p"), [304,""])
check('date-precision-normalization fixture 5', solve(0,N,"p"), [304,""])
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(modified_ms, condition_s, body):
    return [304, ""] if round(modified_ms/1000) <= condition_s else [206,body]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('date-precision-normalization fixture 0', solve(N*1000+900,N,"p"*N), [304,""])
check('date-precision-normalization fixture 1', solve(N*1000+1,N,"p"), [304,""])
check('date-precision-normalization fixture 2', solve(N*1000,N,"p"), [304,""])
check('date-precision-normalization fixture 3', solve((N+1)*1000,N,"p"*N), [206,"p"*N])
check('date-precision-normalization fixture 4', solve(0,0,"p"), [304,""])
check('date-precision-normalization fixture 5', solve(0,N,"p"), [304,""])
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:
Subsecond storage timestamps do not spuriously invalidate second-granularity dates.

For this local date condition compare floor(modified_ms/1000) to condition_s. Return [304,empty] if not newer, otherwise [206,body]. Nonnegative integer times.

split: open-access


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

N = 1
observations = []
def solve(equal, stable, full, part):
    return [206,part] if equal else [200,full]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-range-date-strength fixture 0', solve(True,False,"full"*N,"p"*N), [200,"full"*N])
check('if-range-date-strength fixture 1', solve(False,True,"full"*N,"p"), [200,"full"*N])
check('if-range-date-strength fixture 2', solve(True,True,"full"*N,"p"*N), [206,"p"*N])
check('if-range-date-strength fixture 3', solve(False,False,"f","p"), [200,"f"])
check('if-range-date-strength fixture 4', solve(True,False,"",""), [200,""])
check('if-range-date-strength fixture 5', solve(True,True,"f",""), [206,""])
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(equal, stable, full, part):
    return [206,part] if stable else [200,full]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-range-date-strength fixture 0', solve(True,False,"full"*N,"p"*N), [200,"full"*N])
check('if-range-date-strength fixture 1', solve(False,True,"full"*N,"p"), [200,"full"*N])
check('if-range-date-strength fixture 2', solve(True,True,"full"*N,"p"*N), [206,"p"*N])
check('if-range-date-strength fixture 3', solve(False,False,"f","p"), [200,"f"])
check('if-range-date-strength fixture 4', solve(True,False,"",""), [200,""])
check('if-range-date-strength fixture 5', solve(True,True,"f",""), [206,""])
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:
A date validator with uncertain revision ordering falls back to the full representation.

The local If-Range date policy permits [206,part] only for equal dates backed by stable revision ordering; otherwise [200,full].

split: open-access


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

N = 1
observations = []
def solve(validator_ok, full, part, range_header):
    return [206,part,range_header] if validator_ok else [200,full,range_header]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-range-fallback-clears-range-headers fixture 0', solve(False,"f"*N,"p","bytes 0-0/9"), [200,"f"*N,None])
check('if-range-fallback-clears-range-headers fixture 1', solve(False,"","","bytes */0"), [200,"",None])
check('if-range-fallback-clears-range-headers fixture 2', solve(True,"fff","p","bytes 0-0/3"), [206,"p","bytes 0-0/3"])
check('if-range-fallback-clears-range-headers fixture 3', solve(True,"f"*N,"p"*N,"r"), [206,"p"*N,"r"])
check('if-range-fallback-clears-range-headers fixture 4', solve(False,"abc","b","r"), [200,"abc",None])
check('if-range-fallback-clears-range-headers fixture 5', solve(True,"f","","r"), [206,"","r"])
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(validator_ok, full, part, range_header):
    return [206,part,range_header] if validator_ok else [200,full,""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-range-fallback-clears-range-headers fixture 0', solve(False,"f"*N,"p","bytes 0-0/9"), [200,"f"*N,None])
check('if-range-fallback-clears-range-headers fixture 1', solve(False,"","","bytes */0"), [200,"",None])
check('if-range-fallback-clears-range-headers fixture 2', solve(True,"fff","p","bytes 0-0/3"), [206,"p","bytes 0-0/3"])
check('if-range-fallback-clears-range-headers fixture 3', solve(True,"f"*N,"p"*N,"r"), [206,"p"*N,"r"])
check('if-range-fallback-clears-range-headers fixture 4', solve(False,"abc","b","r"), [200,"abc",None])
check('if-range-fallback-clears-range-headers fixture 5', solve(True,"f","","r"), [206,"","r"])
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:
Full-response fallback removes partial Content-Range metadata.

Return [status,body,Content-Range-or-null]. Failed If-Range sends the full body and no Content-Range.

split: open-access


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

N = 1
observations = []
def solve(tags_present, tag_hit, date_hit, part):
    return [304, ""] if tag_hit or date_hit else [206,part]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-none-match-suppresses-date fixture 0', solve(True,False,True,"p"*N), [206,"p"*N])
check('if-none-match-suppresses-date fixture 1', solve(False,False,True,"p"), [304,""])
check('if-none-match-suppresses-date fixture 2', solve(True,True,False,"p"), [304,""])
check('if-none-match-suppresses-date fixture 3', solve(True,False,False,"p"*N), [206,"p"*N])
check('if-none-match-suppresses-date fixture 4', solve(False,False,False,"p"), [206,"p"])
check('if-none-match-suppresses-date fixture 5', solve(False,True,False,"p"), [206,"p"])
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(tags_present, tag_hit, date_hit, part):
    return [304, ""] if tag_hit else [206,part]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-none-match-suppresses-date fixture 0', solve(True,False,True,"p"*N), [206,"p"*N])
check('if-none-match-suppresses-date fixture 1', solve(False,False,True,"p"), [304,""])
check('if-none-match-suppresses-date fixture 2', solve(True,True,False,"p"), [304,""])
check('if-none-match-suppresses-date fixture 3', solve(True,False,False,"p"*N), [206,"p"*N])
check('if-none-match-suppresses-date fixture 4', solve(False,False,False,"p"), [206,"p"])
check('if-none-match-suppresses-date fixture 5', solve(False,True,False,"p"), [206,"p"])
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:
An explicit nonmatching entity condition takes precedence over a matching date.

For this GET model use tag_hit whenever a tag condition was present, otherwise date_hit. Return [304,empty] or [206,part].

split: open-access


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

N = 1
observations = []
def solve(tag_present, tag_ok, date_ok, part):
    return [206,part] if tag_ok and date_ok else [412,""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-match-suppresses-unmodified-date fixture 0', solve(True,True,False,"p"*N), [206,"p"*N])
check('if-match-suppresses-unmodified-date fixture 1', solve(False,False,True,"p"*N), [206,"p"*N])
check('if-match-suppresses-unmodified-date fixture 2', solve(True,False,True,"p"), [412,""])
check('if-match-suppresses-unmodified-date fixture 3', solve(False,True,False,"p"), [412,""])
check('if-match-suppresses-unmodified-date fixture 4', solve(True,True,True,"p"), [206,"p"])
check('if-match-suppresses-unmodified-date fixture 5', solve(False,False,False,""), [412,""])
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(tag_present, tag_ok, date_ok, part):
    return [206,part] if tag_ok else [412,""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('if-match-suppresses-unmodified-date fixture 0', solve(True,True,False,"p"*N), [206,"p"*N])
check('if-match-suppresses-unmodified-date fixture 1', solve(False,False,True,"p"*N), [206,"p"*N])
check('if-match-suppresses-unmodified-date fixture 2', solve(True,False,True,"p"), [412,""])
check('if-match-suppresses-unmodified-date fixture 3', solve(False,True,False,"p"), [412,""])
check('if-match-suppresses-unmodified-date fixture 4', solve(True,True,True,"p"), [206,"p"])
check('if-match-suppresses-unmodified-date fixture 5', solve(False,False,False,""), [412,""])
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:
Successful entity preconditions suppress a stale secondary date condition.

If tag condition is present, its result alone decides 412; otherwise the unmodified-date condition decides. Accepted output is [206,part].

split: open-access


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

N = 1
observations = []
def solve(method, full, part):
    return [206,len(part),part] if method == "GET" else [206,len(part),""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('head-ignores-range-body fixture 0', solve("HEAD","abc"*N,"b"*N), [200,3*N,""])
check('head-ignores-range-body fixture 1', solve("GET","abc"*N,"b"*N), [206,N,"b"*N])
check('head-ignores-range-body fixture 2', solve("HEAD","",""), [200,0,""])
check('head-ignores-range-body fixture 3', solve("HEAD","abcd",""), [200,4,""])
check('head-ignores-range-body fixture 4', solve("GET","abcd",""), [206,0,""])
check('head-ignores-range-body fixture 5', solve("GET","abcd","abcd"), [206,4,"abcd"])
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(method, full, part):
    return [206,len(part),part] if method == "GET" else [200,len(part),""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('head-ignores-range-body fixture 0', solve("HEAD","abc"*N,"b"*N), [200,3*N,""])
check('head-ignores-range-body fixture 1', solve("GET","abc"*N,"b"*N), [206,N,"b"*N])
check('head-ignores-range-body fixture 2', solve("HEAD","",""), [200,0,""])
check('head-ignores-range-body fixture 3', solve("HEAD","abcd",""), [200,4,""])
check('head-ignores-range-body fixture 4', solve("GET","abcd",""), [206,0,""])
check('head-ignores-range-body fixture 5', solve("GET","abcd","abcd"), [206,4,"abcd"])
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:
HEAD retains full representation metadata while suppressing the body.

Only GET honors the already resolved range. HEAD returns [200,full-length,empty], GET [206,part-length,part]. Inputs are ASCII strings.

split: open-access


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

N = 1
observations = []
def solve(identity, encoded, use_encoded, start, stop):
    return identity[start:stop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encoded-offset-domain fixture 0', solve("abcdef"*N,"XYZ"*N,True,0,2), "XY")
check('encoded-offset-domain fixture 1', solve("abcdef","XYZ",False,1,3), "bc")
check('encoded-offset-domain fixture 2', solve("abcdef","XYZ",True,1,3), "YZ")
check('encoded-offset-domain fixture 3', solve("","",True,0,1), "")
check('encoded-offset-domain fixture 4', solve("ab","WXYZ",True,0,2), "WX")
check('encoded-offset-domain fixture 5', solve("abc","X",False,0,1), "a")
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(identity, encoded, use_encoded, start, stop):
    return encoded[start:stop] if use_encoded and len(encoded)>len(identity) else identity[start:stop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encoded-offset-domain fixture 0', solve("abcdef"*N,"XYZ"*N,True,0,2), "XY")
check('encoded-offset-domain fixture 1', solve("abcdef","XYZ",False,1,3), "bc")
check('encoded-offset-domain fixture 2', solve("abcdef","XYZ",True,1,3), "YZ")
check('encoded-offset-domain fixture 3', solve("","",True,0,1), "")
check('encoded-offset-domain fixture 4', solve("ab","WXYZ",True,0,2), "WX")
check('encoded-offset-domain fixture 5', solve("abc","X",False,0,1), "a")
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:
Byte offsets address the selected encoded representation.

ASCII identity and encoded are distinct stored representations. Slice [start:stop] from the negotiated representation without decoding.

split: open-access


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

N = 1
observations = []
def solve(plain, encoded, coding, start, stop):
    return [start,stop,len(plain)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('selected-length-metadata fixture 0', solve("abcdef"*N,"XYZ"*N,"encoded",0,1), [0,1,3*N])
check('selected-length-metadata fixture 1', solve("ab","WXYZ","identity",0,1), [0,1,2])
check('selected-length-metadata fixture 2', solve("abc","X","identity",0,0), [0,0,3])
check('selected-length-metadata fixture 3', solve("abc","X","encoded",0,0), [0,0,1])
check('selected-length-metadata fixture 4', solve("xy","XY","encoded",0,1), [0,1,2])
check('selected-length-metadata fixture 5', solve("abcd","XX","encoded",1,1), [1,1,2])
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(plain, encoded, coding, start, stop):
    return [start,stop,max(len(plain),len(encoded))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('selected-length-metadata fixture 0', solve("abcdef"*N,"XYZ"*N,"encoded",0,1), [0,1,3*N])
check('selected-length-metadata fixture 1', solve("ab","WXYZ","identity",0,1), [0,1,2])
check('selected-length-metadata fixture 2', solve("abc","X","identity",0,0), [0,0,3])
check('selected-length-metadata fixture 3', solve("abc","X","encoded",0,0), [0,0,1])
check('selected-length-metadata fixture 4', solve("xy","XY","encoded",0,1), [0,1,2])
check('selected-length-metadata fixture 5', solve("abcd","XX","encoded",1,1), [1,1,2])
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:
Range metadata uses the negotiated variant length.

Return content-range metadata as [start,stop,selected-length] for already valid inclusive bounds; selected encoding is identity or encoded.

split: open-access


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

N = 1
observations = []
def solve(coding, tags):
    return tags["identity"]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variant-etag-selection fixture 0', solve("gzip",{"identity":"i","gzip":"g"+str(N)}), "g"+str(N))
check('variant-etag-selection fixture 1', solve("gzip",{"identity":"i","gzip":""}), "")
check('variant-etag-selection fixture 2', solve("identity",{"identity":"i","gzip":"g"}), "i")
check('variant-etag-selection fixture 3', solve("gzip",{"identity":"same","gzip":"same"}), "same")
check('variant-etag-selection fixture 4', solve("identity",{"identity":"","gzip":"g"}), "")
check('variant-etag-selection fixture 5', solve("gzip",{"identity":"a","gzip":"b"}), "b")
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(coding, tags):
    return tags[coding] or tags["identity"]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variant-etag-selection fixture 0', solve("gzip",{"identity":"i","gzip":"g"+str(N)}), "g"+str(N))
check('variant-etag-selection fixture 1', solve("gzip",{"identity":"i","gzip":""}), "")
check('variant-etag-selection fixture 2', solve("identity",{"identity":"i","gzip":"g"}), "i")
check('variant-etag-selection fixture 3', solve("gzip",{"identity":"same","gzip":"same"}), "same")
check('variant-etag-selection fixture 4', solve("identity",{"identity":"","gzip":"g"}), "")
check('variant-etag-selection fixture 5', solve("gzip",{"identity":"a","gzip":"b"}), "b")
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:
An encoded partial response carries its own representation validator.

tags contains identity and gzip strings; return the selected tag, with no truthiness fallback for an intentionally empty opaque value.

split: open-access


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

N = 1
observations = []
def solve(identity_q, compressed_seekable, payload):
    return ["compressed206" if compressed_seekable else "identity206",payload]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('identity-quality-zero fixture 0', solve(0,False,"p"*N), ["406",""])
check('identity-quality-zero fixture 1', solve(1,False,"p"*N), ["identity206","p"*N])
check('identity-quality-zero fixture 2', solve(0,True,"p"), ["compressed206","p"])
check('identity-quality-zero fixture 3', solve(0.5,False,"p"), ["identity206","p"])
check('identity-quality-zero fixture 4', solve(1,True,""), ["compressed206",""])
check('identity-quality-zero fixture 5', solve(0,False,""), ["406",""])
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(identity_q, compressed_seekable, payload):
    return ["compressed206",payload] if compressed_seekable else (["identity206",payload] if identity_q>=0 else ["406",""])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('identity-quality-zero fixture 0', solve(0,False,"p"*N), ["406",""])
check('identity-quality-zero fixture 1', solve(1,False,"p"*N), ["identity206","p"*N])
check('identity-quality-zero fixture 2', solve(0,True,"p"), ["compressed206","p"])
check('identity-quality-zero fixture 3', solve(0.5,False,"p"), ["identity206","p"])
check('identity-quality-zero fixture 4', solve(1,True,""), ["compressed206",""])
check('identity-quality-zero fixture 5', solve(0,False,""), ["406",""])
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:
Explicit identity exclusion prevents uncompressed range fallback.

Local negotiation returns compressed206 if seekable; otherwise identity206 only for positive identity quality, else 406. payload propagates for accepted responses.

split: open-access


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

N = 1
observations = []
def solve(vary, selected_by_encoding):
    return ["accept-encoding"] if selected_by_encoding else vary
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variant-vary-union fixture 0', solve( ["accept-language"],True), ["accept-encoding","accept-language"])
check('variant-vary-union fixture 1', solve(["accept-encoding"],True), ["accept-encoding"])
check('variant-vary-union fixture 2', solve([],True), ["accept-encoding"])
check('variant-vary-union fixture 3', solve([],False), [])
check('variant-vary-union fixture 4', solve(["x-"+str(N)],False), ["x-"+str(N)])
check('variant-vary-union fixture 5', solve(["accept-language","accept-language"],False), ["accept-language"])
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(vary, selected_by_encoding):
    return sorted(vary+["accept-encoding"]) if selected_by_encoding else sorted(vary)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variant-vary-union fixture 0', solve( ["accept-language"],True), ["accept-encoding","accept-language"])
check('variant-vary-union fixture 1', solve(["accept-encoding"],True), ["accept-encoding"])
check('variant-vary-union fixture 2', solve([],True), ["accept-encoding"])
check('variant-vary-union fixture 3', solve([],False), [])
check('variant-vary-union fixture 4', solve(["x-"+str(N)],False), ["x-"+str(N)])
check('variant-vary-union fixture 5', solve(["accept-language","accept-language"],False), ["accept-language"])
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:
Range negotiation preserves preexisting Vary dimensions.

Return sorted unique Vary names, adding accept-encoding when negotiated by encoding. Existing names are already lowercase.

split: open-access


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

N = 1
observations = []
def solve(static_seekable, selected_dynamic, dynamic_seekable):
    return "bytes" if static_seekable else "none"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('range-unit-capability-advertisement fixture 0', solve(True,True,False), "none")
check('range-unit-capability-advertisement fixture 1', solve(False,False,True), "none")
check('range-unit-capability-advertisement fixture 2', solve(False,True,True), "bytes")
check('range-unit-capability-advertisement fixture 3', solve(True,False,False), "bytes")
check('range-unit-capability-advertisement fixture 4', solve(False,True,False), "none")
check('range-unit-capability-advertisement fixture 5', solve(True,True,True), "bytes")
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(static_seekable, selected_dynamic, dynamic_seekable):
    return "bytes" if static_seekable or dynamic_seekable else "none"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('range-unit-capability-advertisement fixture 0', solve(True,True,False), "none")
check('range-unit-capability-advertisement fixture 1', solve(False,False,True), "none")
check('range-unit-capability-advertisement fixture 2', solve(False,True,True), "bytes")
check('range-unit-capability-advertisement fixture 3', solve(True,False,False), "bytes")
check('range-unit-capability-advertisement fixture 4', solve(False,True,False), "none")
check('range-unit-capability-advertisement fixture 5', solve(True,True,True), "bytes")
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:
Accept-Ranges reflects the chosen representation source capability.

Local advertisement is bytes only when the selected source supports seek. A dynamic selection uses its own capability, not the static source capability.

split: open-access


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

N = 1
observations = []
def solve(header_revision, body_revision, body):
    return ["ok",body]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('representation-pin-revision fixture 0', solve(N,N+1,"p"*N), ["restart",""])
check('representation-pin-revision fixture 1', solve(N+1,N,"p"), ["restart",""])
check('representation-pin-revision fixture 2', solve(N,N,"p"*N), ["ok","p"*N])
check('representation-pin-revision fixture 3', solve(0,0,""), ["ok",""])
check('representation-pin-revision fixture 4', solve(0,N,"p"), ["restart",""])
check('representation-pin-revision fixture 5', solve(N,0,"p"), ["restart",""])
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(header_revision, body_revision, body):
    return ["ok",body] if body_revision>=header_revision else ["restart",""]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('representation-pin-revision fixture 0', solve(N,N+1,"p"*N), ["restart",""])
check('representation-pin-revision fixture 1', solve(N+1,N,"p"), ["restart",""])
check('representation-pin-revision fixture 2', solve(N,N,"p"*N), ["ok","p"*N])
check('representation-pin-revision fixture 3', solve(0,0,""), ["ok",""])
check('representation-pin-revision fixture 4', solve(0,N,"p"), ["restart",""])
check('representation-pin-revision fixture 5', solve(N,0,"p"), ["restart",""])
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:
A range read is rejected if metadata and body revisions diverge.

Pinned response plan requires exact revision equality; return [ok,body] or [restart,empty]. Revisions are nonnegative integers.

split: open-access


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

N = 1
observations = []
def solve(uri, language, coding):
    return [uri,coding]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('language-variant-cache-key fixture 0', solve("/r"+str(N),"en","gzip"), ["/r"+str(N),"en","gzip"])
check('language-variant-cache-key fixture 1', solve("/r","fr","identity"), ["/r","fr","identity"])
check('language-variant-cache-key fixture 2', solve("/r","","identity"), ["/r","","identity"])
check('language-variant-cache-key fixture 3', solve("/x","en","identity"), ["/x","en","identity"])
check('language-variant-cache-key fixture 4', solve("/r","en","br"), ["/r","en","br"])
check('language-variant-cache-key fixture 5', solve("/r","fr","gzip"), ["/r","fr","gzip"])
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(uri, language, coding):
    return [uri,language]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('language-variant-cache-key fixture 0', solve("/r"+str(N),"en","gzip"), ["/r"+str(N),"en","gzip"])
check('language-variant-cache-key fixture 1', solve("/r","fr","identity"), ["/r","fr","identity"])
check('language-variant-cache-key fixture 2', solve("/r","","identity"), ["/r","","identity"])
check('language-variant-cache-key fixture 3', solve("/x","en","identity"), ["/x","en","identity"])
check('language-variant-cache-key fixture 4', solve("/r","en","br"), ["/r","en","br"])
check('language-variant-cache-key fixture 5', solve("/r","fr","gzip"), ["/r","fr","gzip"])
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:
Partial cache entries distinguish selected language variants.

Return composite partial-object cache identity [uri,language,coding]. Empty language represents the default variant and is retained.

split: open-access


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

N = 1
observations = []
def solve(transformed, source_tag, derived_tag):
    return source_tag
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('transformation-invalidates-validator fixture 0', solve(True,"s"+str(N),None), None)
check('transformation-invalidates-validator fixture 1', solve(True,"s","d"+str(N)), "d"+str(N))
check('transformation-invalidates-validator fixture 2', solve(False,"s","d"), "s")
check('transformation-invalidates-validator fixture 3', solve(False,None,"d"), None)
check('transformation-invalidates-validator fixture 4', solve(True,"s",""), "")
check('transformation-invalidates-validator fixture 5', solve(True,None,"d"), "d")
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(transformed, source_tag, derived_tag):
    return derived_tag or source_tag if transformed else source_tag
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('transformation-invalidates-validator fixture 0', solve(True,"s"+str(N),None), None)
check('transformation-invalidates-validator fixture 1', solve(True,"s","d"+str(N)), "d"+str(N))
check('transformation-invalidates-validator fixture 2', solve(False,"s","d"), "s")
check('transformation-invalidates-validator fixture 3', solve(False,None,"d"), None)
check('transformation-invalidates-validator fixture 4', solve(True,"s",""), "")
check('transformation-invalidates-validator fixture 5', solve(True,None,"d"), "d")
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:
Body rewriting removes source validators from range responses.

Return derived tag after transformation, including None for unavailable derived validators; unchanged responses retain source tag.

split: open-access