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

N = 1
observations = []
def solve(d):
    return {'replace-user':(d['saved'] if d['mode']=='replace' else [x for i,x in enumerate(d['current']+d['saved']) if x not in (d['current']+d['saved'])[:i]]), 'enforced-separation':(d['enforced']+d['saved']), 'overlay-provenance':('view' if d['mode']=='replace' else 'mixed'), 'hidden-retention':([]), 'field-overlay-policy':([x for x in d['current'] if d['policies'].get(x[0])!='replace']+[x for x in d['saved'] if d['policies'].get(x[0])!='keep']), 'effective-view-count':(len(d['saved'])+len(d['enforced']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 2: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2})], 3: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2})], 4: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 5: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 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)

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

N = 1
observations = []
def solve(d):
    return {'replace-user':(d['saved'] if d['mode']=='replace' else [x for i,x in enumerate(d['current']+d['saved']) if x not in (d['current']+d['saved'])[:i]]), 'enforced-separation':(d['enforced']+d['saved']), 'overlay-provenance':('view' if d['mode']=='replace' else 'mixed'), 'hidden-retention':([x for x in d['current'] if x[0] not in d['visible']]), 'field-overlay-policy':([x for x in d['current'] if d['policies'].get(x[0])!='replace']+[x for x in d['saved'] if d['policies'].get(x[0])!='keep']), 'effective-view-count':(len(d['saved'])+len(d['enforced']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 2: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2})], 3: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2})], 4: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 5: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 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:
Overlay preserves hidden current criteria while replacement clears them is violated by the widget projection.

Applying a saved view may replace or overlay editable filters, but it never replaces enforced scope and retains hidden selected criteria unless replace mode explicitly clears them. This example checks: Overlay preserves hidden current criteria while replacement clears them.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'replace-user':(d['saved'] if d['mode']=='replace' else [x for i,x in enumerate(d['current']+d['saved']) if x not in (d['current']+d['saved'])[:i]]), 'enforced-separation':(d['enforced']+d['saved']), 'overlay-provenance':('view' if d['mode']=='replace' else 'mixed'), 'hidden-retention':([x for x in d['current'] if x[0] not in d['visible']] if d['mode']=='overlay' else []), 'field-overlay-policy':(d['current']+d['saved']), 'effective-view-count':(len(d['saved'])+len(d['enforced']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 2: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2})], 3: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2})], 4: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 5: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 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 {'replace-user':(d['saved'] if d['mode']=='replace' else [x for i,x in enumerate(d['current']+d['saved']) if x not in (d['current']+d['saved'])[:i]]), 'enforced-separation':(d['enforced']+d['saved']), 'overlay-provenance':('view' if d['mode']=='replace' else 'mixed'), 'hidden-retention':([x for x in d['current'] if x[0] not in d['visible']] if d['mode']=='overlay' else []), 'field-overlay-policy':([x for x in d['current'] if x[0] not in [y[0] for y in d['saved']]]+d['saved']), 'effective-view-count':(len(d['saved'])+len(d['enforced']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 2: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2})], 3: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2})], 4: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2})], 5: [({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['b', 'x']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'overlay', 'visible': ['a'], 'scope': 'ss', 'view_scope': 's', 'policies': {'a': 'keep'}}, {'replace-user': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'enforced-separation': [['a', 'required'], ['b', 'x']], 'overlay-provenance': 'mixed', 'hidden-retention': [['hidden', 'z']], 'field-overlay-policy': [['a', 'old'], ['hidden', 'z'], ['b', 'x']], 'effective-view-count': 2}), ({'saved': [['a', 'new']], 'current': [['a', 'old'], ['hidden', 'z']], 'enforced': [['a', 'required']], 'mode': 'replace', 'visible': ['a'], 'scope': 's', 'view_scope': 's', 'policies': {'a': 'replace'}}, {'replace-user': [['a', 'new']], 'enforced-separation': [['a', 'required'], ['a', 'new']], 'overlay-provenance': 'view', 'hidden-retention': [], 'field-overlay-policy': [['hidden', 'z'], ['a', 'new']], 'effective-view-count': 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:
Saved view overlay follows each field keep replace or append policy is violated by the widget projection.

Applying a saved view may replace or overlay editable filters, but it never replaces enforced scope and retains hidden selected criteria unless replace mode explicitly clears them. This example checks: Saved view overlay follows each field keep replace or append policy.

split: open-access