FAILURE MAP
← Case archive

FA-61321 / Bond day-count conventions / Open access

Coupon period lookup for a settlement date: the first period start is a regular period before the first coupon · case 01

Accrual in an irregular first period starts on a date other than issue.

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

ROOT CAUSE

The first period start is derived from the regular period length instead of the issue date.

THE FAILURE

The first period start is derived from the regular period length instead of the issue date.

Unsuccessful approach: Taking the later of issue and the notional start still fails for long first coupons.

Case contract

Inputs issue date, ascending coupon schedule (last = maturity) and settlement. Settlement before issue returns "not issued"; on or after maturity returns "matured". Otherwise return [period start, next coupon] where a settlement on a coupon date belongs to the following period and the first period starts at issue.

Why this case matters

Bond accrual and pricing systems depend on exact day-count arithmetic; a single-day error changes settlement cash.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import bisect
N = 1
observations = []
def solve(issue, schedule, settle):
    I = datetime.date(*issue)
    dates = [datetime.date(*d) for d in schedule]
    S = datetime.date(*settle)
    if S < I:
        return 'not issued'
    if S >= dates[-1]:
        return 'matured'
    i = bisect.bisect_right(dates, S)
    prev = dates[i - 1] if i > 0 else dates[0] - (dates[1] - dates[0])
    nxt = dates[i]
    return [[prev.year, prev.month, prev.day], [nxt.year, nxt.month, nxt.day]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression first period start 1', [[2022, 4, 22], [[2022, 11, 1], [2023, 11, 1], [2024, 11, 1], [2025, 11, 1], [2026, 11, 1]], [2022, 7, 8]], [[2022, 4, 22], [2022, 11, 1]]], ['regression first period start 2', [[2036, 5, 9], [[2037, 3, 31], [2038, 3, 31], [2039, 3, 31], [2040, 3, 31], [2041, 3, 31], [2042, 3, 31]], [2036, 8, 7]], [[2036, 5, 9], [2037, 3, 31]]], ['partial repair probe 1', [[2033, 11, 9], [[2034, 10, 31], [2035, 4, 30], [2035, 10, 31]], [2034, 4, 28]], [[2033, 11, 9], [2034, 10, 31]]], ['partial repair probe 2', [[2031, 5, 5], [[2031, 12, 14], [2032, 3, 14], [2032, 6, 14], [2032, 9, 14]], [2031, 8, 14]], [[2031, 5, 5], [2031, 12, 14]]], ['normal control 1', [[2030, 8, 10], [[2030, 9, 28], [2030, 12, 28], [2031, 3, 28], [2031, 6, 28]], [2030, 12, 28]], [[2030, 12, 28], [2031, 3, 28]]], ['normal control 2', [[2014, 3, 2], [[2014, 6, 30], [2015, 6, 30], [2016, 6, 30]], [2015, 6, 30]], [[2015, 6, 30], [2016, 6, 30]]], ['normal control 3', [[2026, 11, 9], [[2027, 2, 28], [2028, 2, 28], [2029, 2, 28], [2030, 2, 28], [2031, 2, 28], [2032, 2, 28]], [2031, 2, 28]], [[2031, 2, 28], [2032, 2, 28]]], ['normal control 4', [[2014, 11, 28], [[2015, 11, 30], [2016, 5, 30], [2016, 11, 30], [2017, 5, 30], [2017, 11, 30]], [2016, 7, 19]], [[2016, 5, 30], [2016, 11, 30]]]], [['regression first period start 1', [[2016, 4, 6], [[2017, 3, 30], [2017, 6, 30]], [2016, 4, 20]], [[2016, 4, 6], [2017, 3, 30]]], ['regression first period start 2', [[2035, 10, 8], [[2036, 7, 26], [2037, 7, 26], [2038, 7, 26], [2039, 7, 26], [2040, 7, 26]], [2035, 10, 8]], [[2035, 10, 8], [2036, 7, 26]]], ['partial repair probe 1', [[2024, 7, 23], [[2025, 8, 22], [2026, 8, 22], [2027, 8, 22], [2028, 8, 22], [2029, 8, 22], [2030, 8, 22]], [2024, 11, 20]], [[2024, 7, 23], [2025, 8, 22]]], ['partial repair probe 2', [[2023, 8, 29], [[2024, 5, 7], [2024, 8, 7], [2024, 11, 7], [2025, 2, 7], [2025, 5, 7]], [2024, 3, 9]], [[2023, 8, 29], [2024, 5, 7]]], ['normal control 1', [[2020, 2, 14], [[2020, 3, 31], [2021, 3, 31]], [2020, 4, 5]], [[2020, 3, 31], [2021, 3, 31]]], ['normal control 2', [[2037, 1, 13], [[2037, 7, 30], [2037, 10, 30]], [2037, 8, 8]], [[2037, 7, 30], [2037, 10, 30]]], ['normal control 3', [[2027, 2, 22], [[2028, 2, 27], [2028, 8, 27], [2029, 2, 27]], [2027, 2, 17]], 'not issued'], ['normal control 4', [[2030, 8, 22], [[2031, 2, 7], [2031, 5, 7]], [2031, 2, 7]], [[2031, 2, 7], [2031, 5, 7]]]], [['regression first period start 1', [[2012, 11, 24], [[2013, 3, 10], [2014, 3, 10], [2015, 3, 10], [2016, 3, 10], [2017, 3, 10]], [2012, 12, 21]], [[2012, 11, 24], [2013, 3, 10]]], ['regression first period start 2', [[2022, 7, 12], [[2022, 10, 26], [2023, 1, 26], [2023, 4, 26], [2023, 7, 26]], [2022, 10, 19]], [[2022, 7, 12], [2022, 10, 26]]], ['partial repair probe 1', [[2008, 3, 24], [[2008, 8, 31], [2008, 11, 30]], [2008, 5, 21]], [[2008, 3, 24], [2008, 8, 31]]], ['partial repair probe 2', [[2010, 3, 10], [[2011, 4, 9], [2012, 4, 9], [2013, 4, 9], [2014, 4, 9], [2015, 4, 9]], [2010, 11, 21]], [[2010, 3, 10], [2011, 4, 9]]], ['normal control 1', [[2040, 9, 8], [[2040, 11, 30], [2041, 11, 30], [2042, 11, 30], [2043, 11, 30]], [2042, 11, 30]], [[2042, 11, 30], [2043, 11, 30]]], ['normal control 2', [[2039, 8, 28], [[2039, 9, 16], [2040, 9, 16], [2041, 9, 16], [2042, 9, 16], [2043, 9, 16]], [2040, 5, 5]], [[2039, 9, 16], [2040, 9, 16]]], ['normal control 3', [[2013, 12, 25], [[2015, 1, 28], [2015, 7, 28], [2016, 1, 28], [2016, 7, 28]], [2015, 1, 28]], [[2015, 1, 28], [2015, 7, 28]]], ['normal control 4', [[2019, 5, 5], [[2019, 7, 21], [2020, 1, 21], [2020, 7, 21], [2021, 1, 21], [2021, 7, 21]], [2019, 5, 2]], 'not issued']], [['regression first period start 1', [[2034, 12, 8], [[2035, 6, 24], [2035, 9, 24], [2035, 12, 24], [2036, 3, 24], [2036, 6, 24], [2036, 9, 24]], [2034, 12, 28]], [[2034, 12, 8], [2035, 6, 24]]], ['regression first period start 2', [[2014, 3, 28], [[2014, 10, 15], [2015, 4, 15], [2015, 10, 15]], [2014, 6, 2]], [[2014, 3, 28], [2014, 10, 15]]], ['partial repair probe 1', [[2032, 1, 13], [[2032, 11, 30], [2033, 5, 30], [2033, 11, 30], [2034, 5, 30]], [2032, 6, 12]], [[2032, 1, 13], [2032, 11, 30]]], ['partial repair probe 2', [[2028, 10, 15], [[2029, 6, 28], [2029, 9, 28], [2029, 12, 28], [2030, 3, 28], [2030, 6, 28]], [2028, 10, 19]], [[2028, 10, 15], [2029, 6, 28]]], ['normal control 1', [[2025, 7, 31], [[2025, 10, 31], [2026, 1, 31], [2026, 4, 30], [2026, 7, 31]], [2025, 10, 31]], [[2025, 10, 31], [2026, 1, 31]]], ['normal control 2', [[2018, 2, 4], [[2018, 3, 1], [2018, 9, 1], [2019, 3, 1]], [2019, 3, 1]], 'matured'], ['normal control 3', [[2035, 11, 30], [[2035, 12, 31], [2036, 3, 31], [2036, 6, 30], [2036, 9, 30]], [2036, 6, 1]], [[2036, 3, 31], [2036, 6, 30]]], ['normal control 4', [[2017, 11, 10], [[2018, 1, 22], [2019, 1, 22]], [2018, 1, 22]], [[2018, 1, 22], [2019, 1, 22]]]], [['regression first period start 1', [[2025, 5, 28], [[2026, 4, 30], [2026, 7, 30], [2026, 10, 30], [2027, 1, 30], [2027, 4, 30], [2027, 7, 30]], [2026, 2, 21]], [[2025, 5, 28], [2026, 4, 30]]], ['regression first period start 2', [[2005, 4, 18], [[2005, 12, 31], [2006, 3, 31]], [2005, 8, 11]], [[2005, 4, 18], [2005, 12, 31]]], ['partial repair probe 1', [[2016, 3, 1], [[2016, 11, 30], [2017, 5, 30], [2017, 11, 30], [2018, 5, 30]], [2016, 9, 18]], [[2016, 3, 1], [2016, 11, 30]]], ['partial repair probe 2', [[2031, 12, 19], [[2032, 9, 19], [2032, 12, 19]], [2032, 1, 1]], [[2031, 12, 19], [2032, 9, 19]]], ['normal control 1', [[2011, 12, 31], [[2013, 1, 7], [2014, 1, 7], [2015, 1, 7], [2016, 1, 7]], [2015, 1, 7]], [[2015, 1, 7], [2016, 1, 7]]], ['normal control 2', [[2033, 8, 30], [[2033, 11, 23], [2034, 5, 23], [2034, 11, 23], [2035, 5, 23], [2035, 11, 23]], [2034, 1, 12]], [[2033, 11, 23], [2034, 5, 23]]], ['normal control 3', [[2010, 12, 19], [[2011, 11, 11], [2012, 11, 11], [2013, 11, 11]], [2012, 11, 24]], [[2012, 11, 11], [2013, 11, 11]]], ['normal control 4', [[2020, 1, 28], [[2020, 12, 31], [2021, 6, 30], [2021, 12, 31], [2022, 6, 30]], [2021, 6, 28]], [[2020, 12, 31], [2021, 6, 30]]]]]
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
regression first period start 1[[2021, 11, 1], [2022, 11, 1]][[2022, 4, 22], [2022, 11, 1]]Failed
regression first period start 2[[2036, 3, 31], [2037, 3, 31]][[2036, 5, 9], [2037, 3, 31]]Failed
partial repair probe 1[[2034, 5, 3], [2034, 10, 31]][[2033, 11, 9], [2034, 10, 31]]Failed
partial repair probe 2[[2031, 9, 14], [2031, 12, 14]][[2031, 5, 5], [2031, 12, 14]]Failed
normal control 1[[2030, 12, 28], [2031, 3, 28]][[2030, 12, 28], [2031, 3, 28]]Passed
normal control 2[[2015, 6, 30], [2016, 6, 30]][[2015, 6, 30], [2016, 6, 30]]Passed
normal control 3[[2031, 2, 28], [2032, 2, 28]][[2031, 2, 28], [2032, 2, 28]]Passed
normal control 4[[2016, 5, 30], [2016, 11, 30]][[2016, 5, 30], [2016, 11, 30]]Passed

SHA-256 / 67c9278e564d7c12cc842ec87a2ea3befea454c181dfcb7035be5aac6f1d43ef

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import bisect
N = 1
observations = []
def solve(issue, schedule, settle):
    I = datetime.date(*issue)
    dates = [datetime.date(*d) for d in schedule]
    S = datetime.date(*settle)
    if S < I:
        return 'not issued'
    if S >= dates[-1]:
        return 'matured'
    i = bisect.bisect_right(dates, S)
    prev = dates[i - 1] if i > 0 else max(I, dates[0] - (dates[1] - dates[0]))
    nxt = dates[i]
    return [[prev.year, prev.month, prev.day], [nxt.year, nxt.month, nxt.day]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression first period start 1', [[2022, 4, 22], [[2022, 11, 1], [2023, 11, 1], [2024, 11, 1], [2025, 11, 1], [2026, 11, 1]], [2022, 7, 8]], [[2022, 4, 22], [2022, 11, 1]]], ['regression first period start 2', [[2036, 5, 9], [[2037, 3, 31], [2038, 3, 31], [2039, 3, 31], [2040, 3, 31], [2041, 3, 31], [2042, 3, 31]], [2036, 8, 7]], [[2036, 5, 9], [2037, 3, 31]]], ['partial repair probe 1', [[2033, 11, 9], [[2034, 10, 31], [2035, 4, 30], [2035, 10, 31]], [2034, 4, 28]], [[2033, 11, 9], [2034, 10, 31]]], ['partial repair probe 2', [[2031, 5, 5], [[2031, 12, 14], [2032, 3, 14], [2032, 6, 14], [2032, 9, 14]], [2031, 8, 14]], [[2031, 5, 5], [2031, 12, 14]]], ['normal control 1', [[2030, 8, 10], [[2030, 9, 28], [2030, 12, 28], [2031, 3, 28], [2031, 6, 28]], [2030, 12, 28]], [[2030, 12, 28], [2031, 3, 28]]], ['normal control 2', [[2014, 3, 2], [[2014, 6, 30], [2015, 6, 30], [2016, 6, 30]], [2015, 6, 30]], [[2015, 6, 30], [2016, 6, 30]]], ['normal control 3', [[2026, 11, 9], [[2027, 2, 28], [2028, 2, 28], [2029, 2, 28], [2030, 2, 28], [2031, 2, 28], [2032, 2, 28]], [2031, 2, 28]], [[2031, 2, 28], [2032, 2, 28]]], ['normal control 4', [[2014, 11, 28], [[2015, 11, 30], [2016, 5, 30], [2016, 11, 30], [2017, 5, 30], [2017, 11, 30]], [2016, 7, 19]], [[2016, 5, 30], [2016, 11, 30]]]], [['regression first period start 1', [[2016, 4, 6], [[2017, 3, 30], [2017, 6, 30]], [2016, 4, 20]], [[2016, 4, 6], [2017, 3, 30]]], ['regression first period start 2', [[2035, 10, 8], [[2036, 7, 26], [2037, 7, 26], [2038, 7, 26], [2039, 7, 26], [2040, 7, 26]], [2035, 10, 8]], [[2035, 10, 8], [2036, 7, 26]]], ['partial repair probe 1', [[2024, 7, 23], [[2025, 8, 22], [2026, 8, 22], [2027, 8, 22], [2028, 8, 22], [2029, 8, 22], [2030, 8, 22]], [2024, 11, 20]], [[2024, 7, 23], [2025, 8, 22]]], ['partial repair probe 2', [[2023, 8, 29], [[2024, 5, 7], [2024, 8, 7], [2024, 11, 7], [2025, 2, 7], [2025, 5, 7]], [2024, 3, 9]], [[2023, 8, 29], [2024, 5, 7]]], ['normal control 1', [[2020, 2, 14], [[2020, 3, 31], [2021, 3, 31]], [2020, 4, 5]], [[2020, 3, 31], [2021, 3, 31]]], ['normal control 2', [[2037, 1, 13], [[2037, 7, 30], [2037, 10, 30]], [2037, 8, 8]], [[2037, 7, 30], [2037, 10, 30]]], ['normal control 3', [[2027, 2, 22], [[2028, 2, 27], [2028, 8, 27], [2029, 2, 27]], [2027, 2, 17]], 'not issued'], ['normal control 4', [[2030, 8, 22], [[2031, 2, 7], [2031, 5, 7]], [2031, 2, 7]], [[2031, 2, 7], [2031, 5, 7]]]], [['regression first period start 1', [[2012, 11, 24], [[2013, 3, 10], [2014, 3, 10], [2015, 3, 10], [2016, 3, 10], [2017, 3, 10]], [2012, 12, 21]], [[2012, 11, 24], [2013, 3, 10]]], ['regression first period start 2', [[2022, 7, 12], [[2022, 10, 26], [2023, 1, 26], [2023, 4, 26], [2023, 7, 26]], [2022, 10, 19]], [[2022, 7, 12], [2022, 10, 26]]], ['partial repair probe 1', [[2008, 3, 24], [[2008, 8, 31], [2008, 11, 30]], [2008, 5, 21]], [[2008, 3, 24], [2008, 8, 31]]], ['partial repair probe 2', [[2010, 3, 10], [[2011, 4, 9], [2012, 4, 9], [2013, 4, 9], [2014, 4, 9], [2015, 4, 9]], [2010, 11, 21]], [[2010, 3, 10], [2011, 4, 9]]], ['normal control 1', [[2040, 9, 8], [[2040, 11, 30], [2041, 11, 30], [2042, 11, 30], [2043, 11, 30]], [2042, 11, 30]], [[2042, 11, 30], [2043, 11, 30]]], ['normal control 2', [[2039, 8, 28], [[2039, 9, 16], [2040, 9, 16], [2041, 9, 16], [2042, 9, 16], [2043, 9, 16]], [2040, 5, 5]], [[2039, 9, 16], [2040, 9, 16]]], ['normal control 3', [[2013, 12, 25], [[2015, 1, 28], [2015, 7, 28], [2016, 1, 28], [2016, 7, 28]], [2015, 1, 28]], [[2015, 1, 28], [2015, 7, 28]]], ['normal control 4', [[2019, 5, 5], [[2019, 7, 21], [2020, 1, 21], [2020, 7, 21], [2021, 1, 21], [2021, 7, 21]], [2019, 5, 2]], 'not issued']], [['regression first period start 1', [[2034, 12, 8], [[2035, 6, 24], [2035, 9, 24], [2035, 12, 24], [2036, 3, 24], [2036, 6, 24], [2036, 9, 24]], [2034, 12, 28]], [[2034, 12, 8], [2035, 6, 24]]], ['regression first period start 2', [[2014, 3, 28], [[2014, 10, 15], [2015, 4, 15], [2015, 10, 15]], [2014, 6, 2]], [[2014, 3, 28], [2014, 10, 15]]], ['partial repair probe 1', [[2032, 1, 13], [[2032, 11, 30], [2033, 5, 30], [2033, 11, 30], [2034, 5, 30]], [2032, 6, 12]], [[2032, 1, 13], [2032, 11, 30]]], ['partial repair probe 2', [[2028, 10, 15], [[2029, 6, 28], [2029, 9, 28], [2029, 12, 28], [2030, 3, 28], [2030, 6, 28]], [2028, 10, 19]], [[2028, 10, 15], [2029, 6, 28]]], ['normal control 1', [[2025, 7, 31], [[2025, 10, 31], [2026, 1, 31], [2026, 4, 30], [2026, 7, 31]], [2025, 10, 31]], [[2025, 10, 31], [2026, 1, 31]]], ['normal control 2', [[2018, 2, 4], [[2018, 3, 1], [2018, 9, 1], [2019, 3, 1]], [2019, 3, 1]], 'matured'], ['normal control 3', [[2035, 11, 30], [[2035, 12, 31], [2036, 3, 31], [2036, 6, 30], [2036, 9, 30]], [2036, 6, 1]], [[2036, 3, 31], [2036, 6, 30]]], ['normal control 4', [[2017, 11, 10], [[2018, 1, 22], [2019, 1, 22]], [2018, 1, 22]], [[2018, 1, 22], [2019, 1, 22]]]], [['regression first period start 1', [[2025, 5, 28], [[2026, 4, 30], [2026, 7, 30], [2026, 10, 30], [2027, 1, 30], [2027, 4, 30], [2027, 7, 30]], [2026, 2, 21]], [[2025, 5, 28], [2026, 4, 30]]], ['regression first period start 2', [[2005, 4, 18], [[2005, 12, 31], [2006, 3, 31]], [2005, 8, 11]], [[2005, 4, 18], [2005, 12, 31]]], ['partial repair probe 1', [[2016, 3, 1], [[2016, 11, 30], [2017, 5, 30], [2017, 11, 30], [2018, 5, 30]], [2016, 9, 18]], [[2016, 3, 1], [2016, 11, 30]]], ['partial repair probe 2', [[2031, 12, 19], [[2032, 9, 19], [2032, 12, 19]], [2032, 1, 1]], [[2031, 12, 19], [2032, 9, 19]]], ['normal control 1', [[2011, 12, 31], [[2013, 1, 7], [2014, 1, 7], [2015, 1, 7], [2016, 1, 7]], [2015, 1, 7]], [[2015, 1, 7], [2016, 1, 7]]], ['normal control 2', [[2033, 8, 30], [[2033, 11, 23], [2034, 5, 23], [2034, 11, 23], [2035, 5, 23], [2035, 11, 23]], [2034, 1, 12]], [[2033, 11, 23], [2034, 5, 23]]], ['normal control 3', [[2010, 12, 19], [[2011, 11, 11], [2012, 11, 11], [2013, 11, 11]], [2012, 11, 24]], [[2012, 11, 11], [2013, 11, 11]]], ['normal control 4', [[2020, 1, 28], [[2020, 12, 31], [2021, 6, 30], [2021, 12, 31], [2022, 6, 30]], [2021, 6, 28]], [[2020, 12, 31], [2021, 6, 30]]]]]
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
regression first period start 1[[2022, 4, 22], [2022, 11, 1]][[2022, 4, 22], [2022, 11, 1]]Passed
regression first period start 2[[2036, 5, 9], [2037, 3, 31]][[2036, 5, 9], [2037, 3, 31]]Passed
partial repair probe 1[[2034, 5, 3], [2034, 10, 31]][[2033, 11, 9], [2034, 10, 31]]Failed
partial repair probe 2[[2031, 9, 14], [2031, 12, 14]][[2031, 5, 5], [2031, 12, 14]]Failed
normal control 1[[2030, 12, 28], [2031, 3, 28]][[2030, 12, 28], [2031, 3, 28]]Passed
normal control 2[[2015, 6, 30], [2016, 6, 30]][[2015, 6, 30], [2016, 6, 30]]Passed
normal control 3[[2031, 2, 28], [2032, 2, 28]][[2031, 2, 28], [2032, 2, 28]]Passed
normal control 4[[2016, 5, 30], [2016, 11, 30]][[2016, 5, 30], [2016, 11, 30]]Passed

SHA-256 / 3ed4a2c3beec41888a7646af86a731266a29f73cb19c74c1994509d14e9a62d4

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic toy contract stated explicitly in the contract field; no claim of conformance to any published convention text. 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:46:54.209000+00:00.

Case digest / a9d396424a49a9df8a289986e01cf19677bd91e86ec41bda63b74dcfbd6dc467