FAILURE MAP
← Case archive

FA-62951 / Insurance premium rating / Open access

Increased limits factor layer pricing: The largest tabulated limit is treated as beyond the table · case 01

A layer that exhausts exactly at the maximum limit is unrated.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The range check excludes the maximum limit itself.

VERIFIED REPAIR

Return None only for limits strictly above the last row.

Unsuccessful approach: Checking against the penultimate row rejects even more legitimate limits.

Case contract

Input basic (premium at basic limit), ilf table [[limit, factor*1000]] ascending, attachment, layer_limit. ILF(0)=0 and ILF is linear between tabulated points (including from 0 to the basic limit); limits above the table are unrated. Layer premium = floor(basic*(ILF(att+lim)-ILF(att))/1000+1/2). layer_limit<=0 or attachment<0 -> 'invalid'.

Why this case matters

Premium rating engines apply ordered tabular rules where one misplaced boundary or step silently misprices policies.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
    tab=[[0,0]]+x['ilf']
    def ilf(L):
        if L>=tab[-1][0]: return None
        for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
            if l0<=L<=l1:
                return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
    top=ilf(x['attachment']+x['layer_limit']); bot=ilf(x['attachment'])
    if top is None or bot is None: return 'unrated'
    return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
primary basic limit4374743747Passed
primary interpolated limit150130150130Passed
excess layer 500 xs 5002294422944Passed
excess layer interpolated4729847298Passed
layer up to maximumunrated14897Failed
layer beyond maximumunratedunratedPassed
limit below basic6600466004Passed
zero width layer rejectedinvalidinvalidPassed
negative attachment rejectedinvalidinvalidPassed
high excess layer3031930319Passed

SHA-256 / 0ae8daf7ca33bfe2ad2a08758d36fe4fbf002abaa9165c138b298422a9cdd39b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
    tab=[[0,0]]+x['ilf']
    def ilf(L):
        if L>tab[-2][0]: return None
        for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
            if l0<=L<=l1:
                return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
    top=ilf(x['attachment']+x['layer_limit']); bot=ilf(x['attachment'])
    if top is None or bot is None: return 'unrated'
    return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
primary basic limit4374743747Passed
primary interpolated limit150130150130Passed
excess layer 500 xs 5002294422944Passed
excess layer interpolated4729847298Passed
layer up to maximumunrated14897Failed
layer beyond maximumunratedunratedPassed
limit below basic6600466004Passed
zero width layer rejectedinvalidinvalidPassed
negative attachment rejectedinvalidinvalidPassed
high excess layer3031930319Passed

SHA-256 / 24e2a4a1a83bb92c7f3b3b25ef25fc486a3abf72416625a2c8212072534284e8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
    tab=[[0,0]]+x['ilf']
    def ilf(L):
        if L>tab[-1][0]: return None
        for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
            if l0<=L<=l1:
                return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
    top=ilf(x['attachment']+x['layer_limit']); bot=ilf(x['attachment'])
    if top is None or bot is None: return 'unrated'
    return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
primary basic limit4374743747Passed
primary interpolated limit150130150130Passed
excess layer 500 xs 5002294422944Passed
excess layer interpolated4729847298Passed
layer up to maximum1489714897Passed
layer beyond maximumunratedunratedPassed
limit below basic6600466004Passed
zero width layer rejectedinvalidinvalidPassed
negative attachment rejectedinvalidinvalidPassed
high excess layer3031930319Passed

SHA-256 / e2e3d07c004686436b5bb96f0891d7e1db9e30acf1560be07023527514a697fb

Verification & scope

A deterministic bounded teaching model of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:09.524558+00:00.

Case digest / f677b55a9dfe568d11da949c9e664a486b793617e396d2ee41107617eca2bd86