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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],x["award"])
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [5, 10, 15, 20, 25]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['undelivered-assignment-cap'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = x["assign"]
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [5, 10, 15, 20, 25]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['undelivered-assignment-cap'], expected[N-1])
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:
Assignment transfers units already delivered under the award.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision undelivered-assignment-cap: For undelivered assignment cap, apply the stipulated decision min(x["assign"],max(0,x["award"]-x["delivered"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['remaining-original-obligation'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [1, 2, 3, 4, 5]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['remaining-original-obligation'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Partial assignment misstates the original bidder remaining delivery obligation.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision remaining-original-obligation: For remaining original obligation, apply the stipulated decision max(0,x["award"]-x["delivered"]-x["assign"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = x["assign"]
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [6, 12, 18, 24, 30]), ('fully prepaid', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 8, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assigned-unpaid-units'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = max(0,x["assign"]-x["paid_units"])
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [6, 12, 18, 24, 30]), ('fully prepaid', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 8, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assigned-unpaid-units'], expected[N-1])
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:
Assignment charges prepaid units or applies all prepayment to only the transferred tranche.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision assigned-unpaid-units: For assigned unpaid units, apply the stipulated decision min(x["assign"],max(0,x["award"]-x["paid_units"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('complete transfer', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': True, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee / complete transfer', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': True, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('novation approved', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': True, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee / novation approved', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': True, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['guarantee-novation'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('complete transfer', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': True, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee / complete transfer', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': True, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('novation approved', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': True, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee / novation approved', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': True, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [10, 20, 30, 40, 50])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['guarantee-novation'], expected[N-1])
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:
Original guarantee releases before completed novation.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision guarantee-novation: For guarantee novation, apply the stipulated decision 0 if x["novation"] and x["completed"] else x["guarantee"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('approved banned assignee / fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('approved banned assignee / banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'c', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assignee-admission'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('approved banned assignee / fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('approved banned assignee / banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'c', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [False, False, False, False, False]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assignee-admission'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An approved-but-banned or unapproved assignee receives a regulated award.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision assignee-admission: For assignee admission, apply the stipulated decision x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = x["assign"]
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('self assignment', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'a', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['a', 'b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('approved banned assignee / self assignment', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'a', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['a', 'b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [7, 14, 21, 28, 35]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['self-assignment-noop'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0
    v7 = [x["new_id"],x["source_id"],x["original"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('self assignment', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'a', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['a', 'b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('approved banned assignee / self assignment', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'a', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['a', 'b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [0, 0, 0, 0, 0]), ('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [7, 14, 21, 28, 35]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['self-assignment-noop'], expected[N-1])
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:
Self-assignment consumes award capacity as if a different buyer received it.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision self-assignment-noop: For self assignment noop, apply the stipulated decision 0 if x["assignee"]==x["original"] else x["assign"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["new_id"],x["assignee"],x["assignee"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assignment-provenance'], expected[N-1])
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(x):
    v0 = x["seller_consents"] and x["buyer_consents"] and x["assignee_accepts"]
    v1 = min(x["assign"],max(0,x["award"]-x["delivered"]))
    v2 = max(0,x["award"]-x["delivered"]-x["assign"])
    v3 = min(x["assign"],max(0,x["award"]-x["paid_units"]))
    v4 = 0 if x["novation"] and x["completed"] else x["guarantee"]
    v5 = x["assignee"] in x["approved_assignees"] and x["assignee"] not in x["banned"]
    v6 = 0 if x["assignee"]==x["original"] else x["assign"]
    v7 = [x["new_id"],x["source_id"],x["assignee"],x["original"]]
    v8 = x["new_id"]!=x["source_id"]
    v9 = x["escrow"]>=x["required_escrow"]+x["assignment_fee"]
    return {'three-party-consent':v0,'undelivered-assignment-cap':v1,'remaining-original-obligation':v2,'assigned-unpaid-units':v3,'guarantee-novation':v4,'assignee-admission':v5,'self-assignment-noop':v6,'assignment-provenance':v7,'distinct-assignment-id':v8,'escrow-and-assignment-fee':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('approved banned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['b'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('unapproved unbanned assignee', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': [], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('fee exceeds residual escrow', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 9, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('all consents', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': True, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('seller refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': False, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('buyer refuses', {'award': 8, 'delivered': 3, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': False, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('overassignment', {'award': 8, 'delivered': 3, 'assign': 7, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']]), ('all delivered', {'award': 8, 'delivered': 8, 'assign': 4, 'original': 'a', 'assignee': 'b', 'seller_consents': True, 'buyer_consents': True, 'assignee_accepts': False, 'paid_units': 2, 'guarantee': 10, 'novation': False, 'approved_assignees': ['b'], 'banned': ['c'], 'assignments': [['b', 2], ['c', 1]], 'source_id': 'w1', 'new_id': 'w2', 'completed': False, 'escrow': 12, 'required_escrow': 8, 'assignment_fee': 2}, [['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b'], ['w2', 'w1', 'a', 'b']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['assignment-provenance'], expected[N-1])
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:
Assignment overwrites original award provenance or reverses transfer parties.

A winning bidder assigns an award subject to buyer, seller and assignee consents. Assignment transfers only undelivered units and the matching unpaid obligation. Partial assignments preserve original provenance and do not release an original guarantee without novation. Named decision assignment-provenance: For assignment provenance, apply the stipulated decision [x["new_id"],x["source_id"],x["original"],x["assignee"]].

split: open-access