FAILURE MAP
← Case archive

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

Business day adjustment conventions: holiday lists are compared against date objects · case 01

Holidays are never honored, only weekends.

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

ROOT CAUSE

The holiday collection keeps [y,m,d] lists, so membership tests against dates never match.

VERIFIED REPAIR

Convert every holiday into a date before building the lookup set.

Unsuccessful approach: Converting holidays to ISO strings still compares strings against dates.

Case contract

Inputs a date [y,m,d], a convention code and a list of holiday dates. Saturdays, Sundays and holidays are non-business days. F rolls forward, P rolls back, MF rolls forward unless that changes the month in which case it rolls back, MP rolls back unless that changes the month in which case it rolls forward, U leaves the date unadjusted; other codes return "unknown convention". Return the adjusted [y,m,d].

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
from fractions import Fraction
N = 1
observations = []
def solve(d, conv, holidays):
    D = datetime.date(*d)
    H = [h for h in holidays]
    def bad(x):
        return x.weekday() >= 5 or x in H
    def roll(x, step):
        while bad(x):
            x += datetime.timedelta(days=step)
        return x
    if conv == 'F':
        r = roll(D, 1)
    elif conv == 'MF':
        r = roll(D, 1)
        if r.month != D.month:
            r = roll(D, -1)
    elif conv == 'P':
        r = roll(D, -1)
    elif conv == 'MP':
        r = roll(D, -1)
        if r.month != D.month:
            r = roll(D, 1)
    elif conv == 'U':
        r = D
    else:
        return 'unknown convention'
    return [r.year, r.month, r.day]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression holiday membership type 1', [[2022, 7, 31], 'P', [[2022, 8, 2], [2022, 7, 29], [2022, 7, 31]]], [2022, 7, 28]], ['regression holiday membership type 2', [[2030, 9, 29], 'MP', [[2030, 9, 29], [2030, 9, 27], [2030, 10, 1]]], [2030, 9, 26]], ['partial repair probe 1', [[2024, 12, 31], 'MF', [[2024, 12, 28], [2024, 12, 31], [2025, 1, 2]]], [2024, 12, 30]], ['partial repair probe 2', [[2026, 12, 31], 'MF', [[2026, 12, 31]]], [2026, 12, 30]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 31], 'MP', [[2031, 1, 4], [2031, 1, 4]]], [2030, 12, 31]], ['normal control 2', [[2023, 8, 29], 'P', [[2023, 8, 26]]], [2023, 8, 29]]], [['regression holiday membership type 1', [[2024, 12, 31], 'MF', [[2024, 12, 31], [2024, 12, 31], [2024, 12, 29]]], [2024, 12, 30]], ['regression holiday membership type 2', [[2023, 6, 3], 'F', [[2023, 6, 6], [2023, 6, 5]]], [2023, 6, 7]], ['partial repair probe 1', [[2023, 3, 30], 'P', [[2023, 3, 30], [2023, 4, 2]]], [2023, 3, 29]], ['partial repair probe 2', [[2026, 11, 14], 'MP', [[2026, 11, 13]]], [2026, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2019, 4, 29], 'F', []], [2019, 4, 29]], ['normal control 2', [[2023, 2, 28], 'F', [[2023, 3, 2], [2023, 2, 25], [2023, 2, 25]]], [2023, 2, 28]]], [['regression holiday membership type 1', [[2029, 4, 30], 'MF', [[2029, 4, 28], [2029, 4, 30], [2029, 5, 2]]], [2029, 4, 27]], ['regression holiday membership type 2', [[2021, 5, 31], 'MF', [[2021, 5, 28], [2021, 6, 1], [2021, 5, 31]]], [2021, 5, 27]], ['partial repair probe 1', [[2028, 12, 1], 'MP', [[2028, 12, 2], [2028, 12, 5], [2028, 12, 1]]], [2028, 12, 4]], ['partial repair probe 2', [[2023, 3, 1], 'MF', [[2023, 3, 1], [2023, 3, 5]]], [2023, 3, 2]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2026, 5, 31], 'F', []], [2026, 6, 1]], ['normal control 2', [[2022, 1, 1], 'X', [[2022, 1, 4], [2022, 1, 2], [2022, 1, 3]]], 'unknown convention']], [['regression holiday membership type 1', [[2030, 1, 30], 'MF', [[2030, 1, 30], [2030, 2, 3]]], [2030, 1, 31]], ['regression holiday membership type 2', [[2026, 3, 24], 'MF', [[2026, 3, 24]]], [2026, 3, 25]], ['partial repair probe 1', [[2025, 10, 9], 'P', [[2025, 10, 9], [2025, 10, 7]]], [2025, 10, 8]], ['partial repair probe 2', [[2020, 8, 31], 'MF', [[2020, 8, 31], [2020, 8, 28], [2020, 9, 3]]], [2020, 8, 27]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2024, 3, 20], 'X', [[2024, 3, 21]]], 'unknown convention'], ['normal control 2', [[2021, 1, 2], 'P', [[2021, 1, 5]]], [2021, 1, 1]]], [['regression holiday membership type 1', [[2027, 6, 30], 'MP', [[2027, 7, 3], [2027, 6, 27], [2027, 6, 30]]], [2027, 6, 29]], ['regression holiday membership type 2', [[2026, 6, 6], 'F', [[2026, 6, 9], [2026, 6, 8], [2026, 6, 10]]], [2026, 6, 11]], ['partial repair probe 1', [[2026, 2, 27], 'MP', [[2026, 2, 27], [2026, 2, 27]]], [2026, 2, 26]], ['partial repair probe 2', [[2024, 11, 10], 'F', [[2024, 11, 8], [2024, 11, 13], [2024, 11, 11]]], [2024, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2021, 7, 31], 'X', [[2021, 7, 30]]], 'unknown convention'], ['normal control 2', [[2029, 10, 31], 'X', [[2029, 11, 3], [2029, 11, 3]]], 'unknown convention']]]
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 holiday membership type 1[2022, 7, 29][2022, 7, 28]Failed
regression holiday membership type 2[2030, 9, 27][2030, 9, 26]Failed
partial repair probe 1[2024, 12, 31][2024, 12, 30]Failed
partial repair probe 2[2026, 12, 31][2026, 12, 30]Failed
boundary control 1[2024, 6, 3][2024, 6, 3]Passed
boundary control 2[2024, 12, 30][2024, 12, 30]Passed
normal control 1[2030, 12, 31][2030, 12, 31]Passed
normal control 2[2023, 8, 29][2023, 8, 29]Passed

SHA-256 / 92e2809ff82d307f4ec884e143e7796cbb28c76d5ff0ed562bf1286b0a00f5b3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
from fractions import Fraction
N = 1
observations = []
def solve(d, conv, holidays):
    D = datetime.date(*d)
    H = {datetime.date(*h).isoformat() for h in holidays}
    def bad(x):
        return x.weekday() >= 5 or x in H
    def roll(x, step):
        while bad(x):
            x += datetime.timedelta(days=step)
        return x
    if conv == 'F':
        r = roll(D, 1)
    elif conv == 'MF':
        r = roll(D, 1)
        if r.month != D.month:
            r = roll(D, -1)
    elif conv == 'P':
        r = roll(D, -1)
    elif conv == 'MP':
        r = roll(D, -1)
        if r.month != D.month:
            r = roll(D, 1)
    elif conv == 'U':
        r = D
    else:
        return 'unknown convention'
    return [r.year, r.month, r.day]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression holiday membership type 1', [[2022, 7, 31], 'P', [[2022, 8, 2], [2022, 7, 29], [2022, 7, 31]]], [2022, 7, 28]], ['regression holiday membership type 2', [[2030, 9, 29], 'MP', [[2030, 9, 29], [2030, 9, 27], [2030, 10, 1]]], [2030, 9, 26]], ['partial repair probe 1', [[2024, 12, 31], 'MF', [[2024, 12, 28], [2024, 12, 31], [2025, 1, 2]]], [2024, 12, 30]], ['partial repair probe 2', [[2026, 12, 31], 'MF', [[2026, 12, 31]]], [2026, 12, 30]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 31], 'MP', [[2031, 1, 4], [2031, 1, 4]]], [2030, 12, 31]], ['normal control 2', [[2023, 8, 29], 'P', [[2023, 8, 26]]], [2023, 8, 29]]], [['regression holiday membership type 1', [[2024, 12, 31], 'MF', [[2024, 12, 31], [2024, 12, 31], [2024, 12, 29]]], [2024, 12, 30]], ['regression holiday membership type 2', [[2023, 6, 3], 'F', [[2023, 6, 6], [2023, 6, 5]]], [2023, 6, 7]], ['partial repair probe 1', [[2023, 3, 30], 'P', [[2023, 3, 30], [2023, 4, 2]]], [2023, 3, 29]], ['partial repair probe 2', [[2026, 11, 14], 'MP', [[2026, 11, 13]]], [2026, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2019, 4, 29], 'F', []], [2019, 4, 29]], ['normal control 2', [[2023, 2, 28], 'F', [[2023, 3, 2], [2023, 2, 25], [2023, 2, 25]]], [2023, 2, 28]]], [['regression holiday membership type 1', [[2029, 4, 30], 'MF', [[2029, 4, 28], [2029, 4, 30], [2029, 5, 2]]], [2029, 4, 27]], ['regression holiday membership type 2', [[2021, 5, 31], 'MF', [[2021, 5, 28], [2021, 6, 1], [2021, 5, 31]]], [2021, 5, 27]], ['partial repair probe 1', [[2028, 12, 1], 'MP', [[2028, 12, 2], [2028, 12, 5], [2028, 12, 1]]], [2028, 12, 4]], ['partial repair probe 2', [[2023, 3, 1], 'MF', [[2023, 3, 1], [2023, 3, 5]]], [2023, 3, 2]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2026, 5, 31], 'F', []], [2026, 6, 1]], ['normal control 2', [[2022, 1, 1], 'X', [[2022, 1, 4], [2022, 1, 2], [2022, 1, 3]]], 'unknown convention']], [['regression holiday membership type 1', [[2030, 1, 30], 'MF', [[2030, 1, 30], [2030, 2, 3]]], [2030, 1, 31]], ['regression holiday membership type 2', [[2026, 3, 24], 'MF', [[2026, 3, 24]]], [2026, 3, 25]], ['partial repair probe 1', [[2025, 10, 9], 'P', [[2025, 10, 9], [2025, 10, 7]]], [2025, 10, 8]], ['partial repair probe 2', [[2020, 8, 31], 'MF', [[2020, 8, 31], [2020, 8, 28], [2020, 9, 3]]], [2020, 8, 27]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2024, 3, 20], 'X', [[2024, 3, 21]]], 'unknown convention'], ['normal control 2', [[2021, 1, 2], 'P', [[2021, 1, 5]]], [2021, 1, 1]]], [['regression holiday membership type 1', [[2027, 6, 30], 'MP', [[2027, 7, 3], [2027, 6, 27], [2027, 6, 30]]], [2027, 6, 29]], ['regression holiday membership type 2', [[2026, 6, 6], 'F', [[2026, 6, 9], [2026, 6, 8], [2026, 6, 10]]], [2026, 6, 11]], ['partial repair probe 1', [[2026, 2, 27], 'MP', [[2026, 2, 27], [2026, 2, 27]]], [2026, 2, 26]], ['partial repair probe 2', [[2024, 11, 10], 'F', [[2024, 11, 8], [2024, 11, 13], [2024, 11, 11]]], [2024, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2021, 7, 31], 'X', [[2021, 7, 30]]], 'unknown convention'], ['normal control 2', [[2029, 10, 31], 'X', [[2029, 11, 3], [2029, 11, 3]]], 'unknown convention']]]
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 holiday membership type 1[2022, 7, 29][2022, 7, 28]Failed
regression holiday membership type 2[2030, 9, 27][2030, 9, 26]Failed
partial repair probe 1[2024, 12, 31][2024, 12, 30]Failed
partial repair probe 2[2026, 12, 31][2026, 12, 30]Failed
boundary control 1[2024, 6, 3][2024, 6, 3]Passed
boundary control 2[2024, 12, 30][2024, 12, 30]Passed
normal control 1[2030, 12, 31][2030, 12, 31]Passed
normal control 2[2023, 8, 29][2023, 8, 29]Passed

SHA-256 / 899a64dae7e56b7de80c55440ef0e515f3e154c8c9bf06841109f1f96876f5a9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
from fractions import Fraction
N = 1
observations = []
def solve(d, conv, holidays):
    D = datetime.date(*d)
    H = {datetime.date(*h) for h in holidays}
    def bad(x):
        return x.weekday() >= 5 or x in H
    def roll(x, step):
        while bad(x):
            x += datetime.timedelta(days=step)
        return x
    if conv == 'F':
        r = roll(D, 1)
    elif conv == 'MF':
        r = roll(D, 1)
        if r.month != D.month:
            r = roll(D, -1)
    elif conv == 'P':
        r = roll(D, -1)
    elif conv == 'MP':
        r = roll(D, -1)
        if r.month != D.month:
            r = roll(D, 1)
    elif conv == 'U':
        r = D
    else:
        return 'unknown convention'
    return [r.year, r.month, r.day]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression holiday membership type 1', [[2022, 7, 31], 'P', [[2022, 8, 2], [2022, 7, 29], [2022, 7, 31]]], [2022, 7, 28]], ['regression holiday membership type 2', [[2030, 9, 29], 'MP', [[2030, 9, 29], [2030, 9, 27], [2030, 10, 1]]], [2030, 9, 26]], ['partial repair probe 1', [[2024, 12, 31], 'MF', [[2024, 12, 28], [2024, 12, 31], [2025, 1, 2]]], [2024, 12, 30]], ['partial repair probe 2', [[2026, 12, 31], 'MF', [[2026, 12, 31]]], [2026, 12, 30]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 31], 'MP', [[2031, 1, 4], [2031, 1, 4]]], [2030, 12, 31]], ['normal control 2', [[2023, 8, 29], 'P', [[2023, 8, 26]]], [2023, 8, 29]]], [['regression holiday membership type 1', [[2024, 12, 31], 'MF', [[2024, 12, 31], [2024, 12, 31], [2024, 12, 29]]], [2024, 12, 30]], ['regression holiday membership type 2', [[2023, 6, 3], 'F', [[2023, 6, 6], [2023, 6, 5]]], [2023, 6, 7]], ['partial repair probe 1', [[2023, 3, 30], 'P', [[2023, 3, 30], [2023, 4, 2]]], [2023, 3, 29]], ['partial repair probe 2', [[2026, 11, 14], 'MP', [[2026, 11, 13]]], [2026, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2019, 4, 29], 'F', []], [2019, 4, 29]], ['normal control 2', [[2023, 2, 28], 'F', [[2023, 3, 2], [2023, 2, 25], [2023, 2, 25]]], [2023, 2, 28]]], [['regression holiday membership type 1', [[2029, 4, 30], 'MF', [[2029, 4, 28], [2029, 4, 30], [2029, 5, 2]]], [2029, 4, 27]], ['regression holiday membership type 2', [[2021, 5, 31], 'MF', [[2021, 5, 28], [2021, 6, 1], [2021, 5, 31]]], [2021, 5, 27]], ['partial repair probe 1', [[2028, 12, 1], 'MP', [[2028, 12, 2], [2028, 12, 5], [2028, 12, 1]]], [2028, 12, 4]], ['partial repair probe 2', [[2023, 3, 1], 'MF', [[2023, 3, 1], [2023, 3, 5]]], [2023, 3, 2]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2026, 5, 31], 'F', []], [2026, 6, 1]], ['normal control 2', [[2022, 1, 1], 'X', [[2022, 1, 4], [2022, 1, 2], [2022, 1, 3]]], 'unknown convention']], [['regression holiday membership type 1', [[2030, 1, 30], 'MF', [[2030, 1, 30], [2030, 2, 3]]], [2030, 1, 31]], ['regression holiday membership type 2', [[2026, 3, 24], 'MF', [[2026, 3, 24]]], [2026, 3, 25]], ['partial repair probe 1', [[2025, 10, 9], 'P', [[2025, 10, 9], [2025, 10, 7]]], [2025, 10, 8]], ['partial repair probe 2', [[2020, 8, 31], 'MF', [[2020, 8, 31], [2020, 8, 28], [2020, 9, 3]]], [2020, 8, 27]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['normal control 1', [[2024, 3, 20], 'X', [[2024, 3, 21]]], 'unknown convention'], ['normal control 2', [[2021, 1, 2], 'P', [[2021, 1, 5]]], [2021, 1, 1]]], [['regression holiday membership type 1', [[2027, 6, 30], 'MP', [[2027, 7, 3], [2027, 6, 27], [2027, 6, 30]]], [2027, 6, 29]], ['regression holiday membership type 2', [[2026, 6, 6], 'F', [[2026, 6, 9], [2026, 6, 8], [2026, 6, 10]]], [2026, 6, 11]], ['partial repair probe 1', [[2026, 2, 27], 'MP', [[2026, 2, 27], [2026, 2, 27]]], [2026, 2, 26]], ['partial repair probe 2', [[2024, 11, 10], 'F', [[2024, 11, 8], [2024, 11, 13], [2024, 11, 11]]], [2024, 11, 12]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2021, 7, 31], 'X', [[2021, 7, 30]]], 'unknown convention'], ['normal control 2', [[2029, 10, 31], 'X', [[2029, 11, 3], [2029, 11, 3]]], 'unknown convention']]]
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 holiday membership type 1[2022, 7, 28][2022, 7, 28]Passed
regression holiday membership type 2[2030, 9, 26][2030, 9, 26]Passed
partial repair probe 1[2024, 12, 30][2024, 12, 30]Passed
partial repair probe 2[2026, 12, 30][2026, 12, 30]Passed
boundary control 1[2024, 6, 3][2024, 6, 3]Passed
boundary control 2[2024, 12, 30][2024, 12, 30]Passed
normal control 1[2030, 12, 31][2030, 12, 31]Passed
normal control 2[2023, 8, 29][2023, 8, 29]Passed

SHA-256 / 4ad6c87f005835bd205dd411f5ada8bf20a3ea55ef7777183f8fe782f58006b3

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:50.956572+00:00.

Case digest / da6fa994b1a8220b334f5569f345b6bf3946046c4f975fb1f4406c62e5fe95bf