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

N = 1
observations = []
def solve(x):
    v0 = x["challenger"] in x["participants"] and x["challenger"]!=x["winner"]
    v1 = [g for g in x["grounds"] if g in x["permitted"]]
    v2 = x["filed"]<=x["deadline"]
    v3 = set(x["evidence"])<=set(x["received"])
    v4 = not (set(x["objections"])-set(x["resolved"])-set(x["withdrawn"]))
    v5 = [i for i in x["awarded"] if i not in x["affected"]] if x["upheld"] else x["awarded"]
    v6 = [o for o in x["objections"] if o not in x["withdrawn"]]
    v7 = 0 if x["frivolous"] else x["deposit"]
    v8 = sorted(set(x["participants"])-set(x["notified"]))
    v9 = x["upheld"]
    return {'challenger-standing':v0,'admissible-grounds':v1,'filing-deadline':v2,'evidence-completeness':v3,'open-objection-finality':v4,'remedy-lot-scope':v5,'withdrawn-hearing-removal':v6,'objection-deposit-disposition':v7,'hearing-notice-parties':v8,'upheld-live-objections':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('all withdrawn', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1', 'o2'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []]), ('ground order / all withdrawn', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['procedure', 'eligibility'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1', 'o2'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []]), ('normal contract', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('ground order', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['procedure', 'eligibility'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('nonparticipant', {'challenger': 'c', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('winner challenges own award', {'challenger': 'a', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('deadline filing', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 6, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('late filing', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 7, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('all evidence received', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1', 'e2'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('all objections resolved', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1', 'o2'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('none upheld', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': [], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []])]
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))['upheld-live-objections'], 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["challenger"] in x["participants"] and x["challenger"]!=x["winner"]
    v1 = [g for g in x["grounds"] if g in x["permitted"]]
    v2 = x["filed"]<=x["deadline"]
    v3 = set(x["evidence"])<=set(x["received"])
    v4 = not (set(x["objections"])-set(x["resolved"])-set(x["withdrawn"]))
    v5 = [i for i in x["awarded"] if i not in x["affected"]] if x["upheld"] else x["awarded"]
    v6 = [o for o in x["objections"] if o not in x["withdrawn"]]
    v7 = 0 if x["frivolous"] else x["deposit"]
    v8 = sorted(set(x["participants"])-set(x["notified"]))
    v9 = [o for o in x["upheld"] if o in x["resolved"]]
    return {'challenger-standing':v0,'admissible-grounds':v1,'filing-deadline':v2,'evidence-completeness':v3,'open-objection-finality':v4,'remedy-lot-scope':v5,'withdrawn-hearing-removal':v6,'objection-deposit-disposition':v7,'hearing-notice-parties':v8,'upheld-live-objections':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('all withdrawn', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1', 'o2'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []]), ('ground order / all withdrawn', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['procedure', 'eligibility'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1', 'o2'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []]), ('normal contract', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('ground order', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['procedure', 'eligibility'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('nonparticipant', {'challenger': 'c', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('winner challenges own award', {'challenger': 'a', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('deadline filing', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 6, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('late filing', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 7, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('all evidence received', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1', 'e2'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('all objections resolved', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1', 'o2'], 'objections': ['o1', 'o2'], 'upheld': ['o2'], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [['o2'], ['o2'], ['o2'], ['o2'], ['o2']]), ('none upheld', {'challenger': 'b', 'participants': ['a', 'b'], 'winner': 'a', 'grounds': ['eligibility', 'price'], 'permitted': ['eligibility', 'procedure'], 'filed': 5, 'deadline': 6, 'evidence': ['e1', 'e2'], 'received': ['e1'], 'resolved': ['o1'], 'objections': ['o1', 'o2'], 'upheld': [], 'affected': ['L2'], 'awarded': ['L1', 'L2'], 'withdrawn': ['o1'], 'deposit': 4, 'frivolous': False, 'notified': ['a']}, [[], [], [], [], []])]
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))['upheld-live-objections'], 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:
Withdrawn or unfiled objections can drive the award remedy.

A provisional award challenge has bidder standing, grounds, evidence receipt, hearing outcomes and a limited remedy. Filing preserves the award but blocks finality until all admissible objections are resolved. Dates are ticks and list entries retain filing order. Named decision upheld-live-objections: For upheld live objections, apply the stipulated decision [o for o in x["upheld"] if o in x["objections"] and o not in x["withdrawn"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["face"]
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110])]
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))['callable-face'], 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 = max(0,x["face"]-x["paid_claims"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110])]
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))['callable-face'], 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:
Unpaid bond calls fail to consume callable face value.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision callable-face: For callable face, apply the stipulated decision max(0,x["face"]-x["called"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],x["face"])
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [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))['claim-call-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 = max(0,x["face"]-x["called"])
    v1 = x["request"]
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [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))['claim-call-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:
A new bond claim exceeds the uncalled bond remainder.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision claim-call-cap: For claim call cap, apply the stipulated decision min(x["request"],max(0,x["face"]-x["called"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('partly guaranteed claim / expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [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))['expiry-call-block'], 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 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else x["request"]
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('partly guaranteed claim / expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [22, 44, 66, 88, 110]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [0, 0, 0, 0, 0]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [10, 20, 30, 40, 50]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [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))['expiry-call-block'], 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:
Expired performance guarantees accept fresh calls.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision expiry-call-block: For expiry call block, apply the stipulated decision 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = 0 if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [4, 8, 12, 16, 20]), ('partly guaranteed claim / completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [4, 8, 12, 16, 20]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150])]
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))['retention-after-completion'], 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 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [4, 8, 12, 16, 20]), ('partly guaranteed claim / completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [4, 8, 12, 16, 20]), ('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150])]
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))['retention-after-completion'], 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:
Completion returns the defect-retention bond tranche early.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision retention-after-completion: For retention after completion, apply the stipulated decision x["retention"] if x["completion"] else x["face"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(x["tranches"]) if x["done"] else 0
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60])]
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))['milestone-tranche-release'], 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 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m not in x["done"])
    v5 = x["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [30, 60, 90, 120, 150]), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60]), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [12, 24, 36, 48, 60])]
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))['milestone-tranche-release'], 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:
One completed milestone releases every bond tranche.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision milestone-tranche-release: For milestone tranche release, apply the stipulated decision sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["proposed"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s2', 's2', 's2', 's2', 's2']), ('partly guaranteed claim / substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s2', 's2', 's2', 's2', 's2']), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1'])]
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))['surety-substitution-approval'], 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 = max(0,x["face"]-x["called"])
    v1 = min(x["request"],max(0,x["face"]-x["called"]))
    v2 = 0 if x["expired"] else min(x["request"],max(0,x["face"]-x["called"]))
    v3 = x["retention"] if x["completion"] else x["face"]
    v4 = sum(q for m,q in zip(x["milestones"],x["tranches"]) if m in x["done"])
    v5 = x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = set(x["claim_lots"])<=set(x["guaranteed"])
    v8 = x["claimant"]==x["beneficiary"] and not x["expired"]
    v9 = [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]]
    return {'callable-face':v0,'claim-call-cap':v1,'expiry-call-block':v2,'retention-after-completion':v3,'milestone-tranche-release':v4,'surety-substitution-approval':v5,'old-bond-discharge':v6,'guarantee-lot-coverage':v7,'beneficiary-claim-authority':v8,'timely-claim-survives-expiry':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('partly guaranteed claim', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s2', 's2', 's2', 's2', 's2']), ('partly guaranteed claim / substitution approved', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1', 's2'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s2', 's2', 's2', 's2', 's2']), ('claim too large', {'face': 30, 'called': 8, 'request': 40, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('bond exhausted', {'face': 30, 'called': 30, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('expired', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': True, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('completion', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': True, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('all milestones', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship', 'inspect'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': False, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1']), ('substitution finalized', {'face': 30, 'called': 8, 'request': 10, 'paid_claims': 5, 'expired': False, 'completion': False, 'retention': 4, 'milestones': ['ship', 'inspect'], 'done': ['ship'], 'tranches': [12, 18], 'surety': 's1', 'proposed': 's2', 'approved': ['s1'], 'replaced': True, 'guaranteed': ['L1', 'L2'], 'claim_lots': ['L2'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, ['s1', 's1', 's1', 's1', 's1'])]
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))['surety-substitution-approval'], 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 unapproved substitute surety replaces the guaranteed party.

A toy winning-bid bond secures post-award performance separately from payment. Bond tranches mature on distinct milestones; surety substitutions require explicit approval; partial calls consume the remaining callable face amount. Bond identifiers are unique strings. Named decision surety-substitution-approval: For surety substitution approval, apply the stipulated decision x["proposed"] if x["proposed"] in x["approved"] else x["surety"].

split: open-access