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"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"]
    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 = [('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}, [False, False, False, False, False]), ('partly guaranteed claim / 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': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False])]
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))['old-bond-discharge'], 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["proposed"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = 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 = [('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}, [False, False, False, False, False]), ('partly guaranteed claim / 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': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False])]
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))['old-bond-discharge'], 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:
Old bond discharges before both substitution approval and completion.

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 old-bond-discharge: For old bond discharge, apply the stipulated decision x["replaced"] and x["proposed"] in x["approved"].

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"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = True
    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 = [('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}, [False, False, False, False, False]), ('unguaranteed lot', {'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': ['L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('partly guaranteed claim / 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': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['guarantee-lot-coverage'], 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["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"] if x["proposed"] in x["approved"] else x["surety"]
    v6 = x["replaced"] and x["proposed"] in x["approved"]
    v7 = bool(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 = [('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}, [False, False, False, False, False]), ('unguaranteed lot', {'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': ['L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('partly guaranteed claim / 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': ['L1', 'L3'], 'returned': 3, 'beneficiary': 'seller', 'claimant': 'seller', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['guarantee-lot-coverage'], 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:
Bond claims include lots outside the guaranteed award schedule.

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 guarantee-lot-coverage: For guarantee lot coverage, apply the stipulated decision set(x["claim_lots"])<=set(x["guaranteed"]).

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"] 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"]
    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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('wrong claimant', {'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': 'buyer', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('partly guaranteed claim / wrong claimant', {'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': 'buyer', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['beneficiary-claim-authority'], 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["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 = 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}, [False, False, False, False, False]), ('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}, [False, False, False, False, False]), ('wrong claimant', {'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': 'buyer', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('partly guaranteed claim / wrong claimant', {'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': 'buyer', 'claim_ids': ['c1', 'c2', 'c1'], 'presented_claims': [['c1', 3], ['c2', 7]], 'claim_deadline': 5}, [False, False, False, False, False]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True]), ('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}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['beneficiary-claim-authority'], 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 unauthorized claimant or expired bond initiates a call.

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 beneficiary-claim-authority: For beneficiary claim authority, apply the stipulated decision x["claimant"]==x["beneficiary"] and not x["expired"].

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"] 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 = [] if x["expired"] else [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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']])]
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))['timely-claim-survives-expiry'], 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["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"] and not x["completion"]]
    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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']]), ('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}, [['c1'], ['c1'], ['c1'], ['c1'], ['c1']])]
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))['timely-claim-survives-expiry'], 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:
Bond expiration or award completion destroys claims properly presented before the claim deadline.

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 timely-claim-survives-expiry: For timely claim survives expiry, apply the stipulated decision [i for i,t in x["presented_claims"] if t<=x["claim_deadline"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = True
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('member not signer / outsider signs', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['representative-membership'], 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["representative"] in x["signers"]
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('member not signer / outsider signs', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['representative-membership'], 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 outside representative submits a consortium offer.

A consortium submits one joint bid with named members and a designated representative. Member approvals are scope-specific. Award shares are literal integer units, member exits cannot strand assigned units, and affiliate conflicts are checked against both consortiums. Named decision representative-membership: For representative membership, apply the stipulated decision x["representative"] in x["members"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["representative"] in x["members"]
    v1 = x["representative"] in x["signers"]
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / outsider signs', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False])]
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))['unanimous-bid-signature'], 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["representative"] in x["members"]
    v1 = len(x["signers"])>=len(x["members"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / outsider signs', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False])]
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))['unanimous-bid-signature'], 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:
Representative signature substitutes for all required joint-bid approvals.

A consortium submits one joint bid with named members and a designated representative. Member approvals are scope-specific. Award shares are literal integer units, member exits cannot strand assigned units, and affiliate conflicts are checked against both consortiums. Named decision unanimous-bid-signature: For unanimous bid signature, apply the stipulated decision set(x["members"])<=set(x["signers"]).

split: open-access