FAILURE MAP
← Case archive

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

Adjusted versus unadjusted accrual periods: the accrual adjustment flag is inverted · case 01

Unadjusted-accrual swaps accrue on adjusted dates and vice versa.

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

ROOT CAUSE

The flag test is negated.

VERIFIED REPAIR

Adjust accrual dates only when the flag is set.

Unsuccessful approach: Adjusting only the accrual end date when the flag is set leaves the start unadjusted.

Case contract

Inputs an unadjusted schedule (first element is the accrual start), holidays and a flag. Business days are weekdays not in holidays; adjustment is modified following. For each period the payment date is the adjusted end date; accrual days use adjusted start and end if the flag is set, otherwise the unadjusted dates. Return [[payment date, accrual days], ...].

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
N = 1
observations = []
def solve(dates, holidays, adjust_accrual):
    H = {datetime.date(*h) for h in holidays}
    def biz(x):
        return x.weekday() < 5 and x not in H
    def fwd(x):
        while not biz(x):
            x += datetime.timedelta(days=1)
        return x
    def bwd(x):
        while not biz(x):
            x -= datetime.timedelta(days=1)
        return x
    def mf(x):
        f = fwd(x)
        return f if f.month == x.month else bwd(x)
    out = []
    for i in range(1, len(dates)):
        s = datetime.date(*dates[i - 1])
        e = datetime.date(*dates[i])
        pay = mf(e)
        if not adjust_accrual:
            s, e = mf(s), mf(e)
        out.append([[pay.year, pay.month, pay.day], (e - s).days])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression accrual adjustment flag 1', [[[2027, 5, 30], [2027, 6, 30], [2027, 7, 30], [2027, 8, 30], [2027, 9, 30]], [[2027, 9, 30]], True], [[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]], ['regression accrual adjustment flag 2', [[[2029, 7, 31], [2029, 8, 31], [2029, 9, 30], [2029, 10, 31]], [[2029, 9, 30]], False], [[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]], ['partial repair probe 1', [[[2027, 8, 15], [2027, 11, 15]], [[2027, 8, 17], [2027, 11, 15]], True], [[[2027, 11, 16], 92]]], ['partial repair probe 2', [[[2030, 2, 3], [2030, 3, 3]], [[2030, 3, 3]], True], [[[2030, 3, 4], 28]]], ['normal control 1', [[[2022, 2, 17], [2022, 8, 17]], [], True], [[[2022, 8, 17], 181]]], ['normal control 2', [[[2022, 9, 20], [2023, 3, 20], [2023, 9, 20], [2024, 3, 20], [2024, 9, 20]], [[2024, 3, 22]], True], [[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]], ['normal control 3', [[[2029, 2, 28], [2029, 3, 28]], [], False], [[[2029, 3, 28], 28]]], ['normal control 4', [[[2024, 9, 5], [2025, 3, 5], [2025, 9, 5]], [], False], [[[2025, 3, 5], 181], [[2025, 9, 5], 184]]]], [['regression accrual adjustment flag 1', [[[2019, 9, 30], [2019, 10, 30], [2019, 11, 30], [2019, 12, 30]], [[2019, 12, 2], [2020, 1, 1]], False], [[[2019, 10, 30], 30], [[2019, 11, 29], 31], [[2019, 12, 30], 30]]], ['regression accrual adjustment flag 2', [[[2020, 11, 30], [2021, 2, 28], [2021, 5, 30]], [[2021, 3, 1]], True], [[[2021, 2, 26], 88], [[2021, 5, 31], 94]]], ['partial repair probe 1', [[[2026, 1, 5], [2026, 4, 5]], [[2026, 1, 5]], True], [[[2026, 4, 6], 90]]], ['partial repair probe 2', [[[2029, 7, 29], [2030, 1, 29]], [[2030, 1, 29]], True], [[[2030, 1, 30], 184]]], ['normal control 1', [[[2026, 5, 25], [2026, 8, 25], [2026, 11, 25], [2027, 2, 25]], [[2026, 8, 26], [2026, 11, 26]], False], [[[2026, 8, 25], 92], [[2026, 11, 25], 92], [[2027, 2, 25], 92]]], ['normal control 2', [[[2026, 9, 30], [2026, 12, 30], [2027, 3, 30], [2027, 6, 30], [2027, 9, 30]], [[2027, 4, 1]], True], [[[2026, 12, 30], 91], [[2027, 3, 30], 90], [[2027, 6, 30], 92], [[2027, 9, 30], 92]]], ['normal control 3', [[[2025, 10, 30], [2026, 4, 30]], [], True], [[[2026, 4, 30], 182]]], ['normal control 4', [[[2025, 12, 31], [2026, 3, 31], [2026, 6, 30], [2026, 9, 30]], [[2026, 4, 2], [2026, 7, 1]], False], [[[2026, 3, 31], 90], [[2026, 6, 30], 91], [[2026, 9, 30], 92]]]], [['regression accrual adjustment flag 1', [[[2027, 4, 30], [2027, 10, 30], [2028, 4, 30], [2028, 10, 30], [2029, 4, 30]], [[2027, 4, 30]], True], [[[2027, 10, 29], 183], [[2028, 4, 28], 182], [[2028, 10, 30], 185], [[2029, 4, 30], 182]]], ['regression accrual adjustment flag 2', [[[2023, 2, 28], [2023, 5, 28], [2023, 8, 28], [2023, 11, 28]], [[2023, 5, 30]], True], [[[2023, 5, 29], 90], [[2023, 8, 28], 91], [[2023, 11, 28], 92]]], ['partial repair probe 1', [[[2024, 5, 31], [2024, 11, 30]], [[2024, 5, 31], [2024, 12, 1]], True], [[[2024, 11, 29], 183]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2029, 8, 28], [2030, 2, 28], [2030, 8, 28], [2031, 2, 28], [2031, 8, 28]], [[2029, 8, 30], [2030, 8, 30], [2031, 8, 30]], False], [[[2030, 2, 28], 184], [[2030, 8, 28], 181], [[2031, 2, 28], 184], [[2031, 8, 28], 181]]], ['normal control 2', [[[2023, 3, 1], [2023, 9, 1]], [[2023, 3, 2]], True], [[[2023, 9, 1], 184]]], ['normal control 3', [[[2022, 3, 16], [2022, 6, 16], [2022, 9, 16], [2022, 12, 16], [2023, 3, 16]], [[2022, 9, 18], [2023, 3, 17]], False], [[[2022, 6, 16], 92], [[2022, 9, 16], 92], [[2022, 12, 16], 91], [[2023, 3, 16], 90]]], ['normal control 4', [[[2029, 12, 22], [2030, 6, 22]], [], False], [[[2030, 6, 24], 182]]]], [['regression accrual adjustment flag 1', [[[2023, 10, 11], [2024, 4, 11], [2024, 10, 11], [2025, 4, 11]], [[2023, 10, 13], [2024, 4, 12], [2024, 10, 11]], True], [[[2024, 4, 11], 183], [[2024, 10, 14], 186], [[2025, 4, 11], 179]]], ['regression accrual adjustment flag 2', [[[2030, 9, 28], [2030, 12, 28], [2031, 3, 28]], [[2031, 3, 28]], True], [[[2030, 12, 30], 91], [[2031, 3, 31], 91]]], ['partial repair probe 1', [[[2021, 9, 30], [2021, 10, 30]], [[2021, 9, 30]], True], [[[2021, 10, 29], 30]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 3, 31], [2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2019, 2, 27], [2019, 5, 27]], [[2019, 5, 29]], False], [[[2019, 5, 27], 89]]], ['normal control 2', [[[2020, 6, 1], [2020, 12, 1], [2021, 6, 1], [2021, 12, 1]], [], False], [[[2020, 12, 1], 183], [[2021, 6, 1], 182], [[2021, 12, 1], 183]]], ['normal control 3', [[[2020, 12, 1], [2021, 3, 1], [2021, 6, 1]], [[2021, 3, 2]], True], [[[2021, 3, 1], 90], [[2021, 6, 1], 92]]], ['normal control 4', [[[2020, 3, 18], [2020, 6, 18], [2020, 9, 18]], [], True], [[[2020, 6, 18], 92], [[2020, 9, 18], 92]]]], [['regression accrual adjustment flag 1', [[[2029, 5, 28], [2029, 6, 28]], [[2029, 5, 29], [2029, 6, 28]], True], [[[2029, 6, 29], 32]]], ['regression accrual adjustment flag 2', [[[2019, 6, 22], [2019, 12, 22], [2020, 6, 22], [2020, 12, 22], [2021, 6, 22]], [[2019, 12, 24]], False], [[[2019, 12, 23], 183], [[2020, 6, 22], 183], [[2020, 12, 22], 183], [[2021, 6, 22], 182]]], ['partial repair probe 1', [[[2019, 8, 31], [2019, 11, 30]], [[2019, 9, 1], [2019, 12, 1]], True], [[[2019, 11, 29], 91]]], ['partial repair probe 2', [[[2026, 1, 31], [2026, 4, 30]], [[2026, 4, 30]], True], [[[2026, 4, 29], 89]]], ['normal control 1', [[[2024, 12, 31], [2025, 3, 31]], [], False], [[[2025, 3, 31], 90]]], ['normal control 2', [[[2022, 9, 30], [2023, 3, 30]], [[2022, 10, 1]], False], [[[2023, 3, 30], 181]]], ['normal control 3', [[[2020, 11, 30], [2020, 12, 30]], [[2021, 1, 1]], False], [[[2020, 12, 30], 30]]], ['normal control 4', [[[2021, 9, 28], [2021, 12, 28], [2022, 3, 28], [2022, 6, 28], [2022, 9, 28]], [[2022, 9, 29]], False], [[[2021, 12, 28], 91], [[2022, 3, 28], 90], [[2022, 6, 28], 92], [[2022, 9, 28], 92]]]]]
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 accrual adjustment flag 1[[[2027, 6, 30], 31], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 31]][[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]Failed
regression accrual adjustment flag 2[[[2029, 8, 31], 31], [[2029, 9, 28], 28], [[2029, 10, 31], 33]][[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]Failed
partial repair probe 1[[[2027, 11, 16], 92]][[[2027, 11, 16], 92]]Passed
partial repair probe 2[[[2030, 3, 4], 28]][[[2030, 3, 4], 28]]Passed
normal control 1[[[2022, 8, 17], 181]][[[2022, 8, 17], 181]]Passed
normal control 2[[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]][[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]Passed
normal control 3[[[2029, 3, 28], 28]][[[2029, 3, 28], 28]]Passed
normal control 4[[[2025, 3, 5], 181], [[2025, 9, 5], 184]][[[2025, 3, 5], 181], [[2025, 9, 5], 184]]Passed

SHA-256 / 8dd62ed933a091123018eb8664f76166d249b345d55c557748c24d9f1b655f99

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(dates, holidays, adjust_accrual):
    H = {datetime.date(*h) for h in holidays}
    def biz(x):
        return x.weekday() < 5 and x not in H
    def fwd(x):
        while not biz(x):
            x += datetime.timedelta(days=1)
        return x
    def bwd(x):
        while not biz(x):
            x -= datetime.timedelta(days=1)
        return x
    def mf(x):
        f = fwd(x)
        return f if f.month == x.month else bwd(x)
    out = []
    for i in range(1, len(dates)):
        s = datetime.date(*dates[i - 1])
        e = datetime.date(*dates[i])
        pay = mf(e)
        if adjust_accrual:
            e = mf(e)
        out.append([[pay.year, pay.month, pay.day], (e - s).days])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression accrual adjustment flag 1', [[[2027, 5, 30], [2027, 6, 30], [2027, 7, 30], [2027, 8, 30], [2027, 9, 30]], [[2027, 9, 30]], True], [[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]], ['regression accrual adjustment flag 2', [[[2029, 7, 31], [2029, 8, 31], [2029, 9, 30], [2029, 10, 31]], [[2029, 9, 30]], False], [[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]], ['partial repair probe 1', [[[2027, 8, 15], [2027, 11, 15]], [[2027, 8, 17], [2027, 11, 15]], True], [[[2027, 11, 16], 92]]], ['partial repair probe 2', [[[2030, 2, 3], [2030, 3, 3]], [[2030, 3, 3]], True], [[[2030, 3, 4], 28]]], ['normal control 1', [[[2022, 2, 17], [2022, 8, 17]], [], True], [[[2022, 8, 17], 181]]], ['normal control 2', [[[2022, 9, 20], [2023, 3, 20], [2023, 9, 20], [2024, 3, 20], [2024, 9, 20]], [[2024, 3, 22]], True], [[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]], ['normal control 3', [[[2029, 2, 28], [2029, 3, 28]], [], False], [[[2029, 3, 28], 28]]], ['normal control 4', [[[2024, 9, 5], [2025, 3, 5], [2025, 9, 5]], [], False], [[[2025, 3, 5], 181], [[2025, 9, 5], 184]]]], [['regression accrual adjustment flag 1', [[[2019, 9, 30], [2019, 10, 30], [2019, 11, 30], [2019, 12, 30]], [[2019, 12, 2], [2020, 1, 1]], False], [[[2019, 10, 30], 30], [[2019, 11, 29], 31], [[2019, 12, 30], 30]]], ['regression accrual adjustment flag 2', [[[2020, 11, 30], [2021, 2, 28], [2021, 5, 30]], [[2021, 3, 1]], True], [[[2021, 2, 26], 88], [[2021, 5, 31], 94]]], ['partial repair probe 1', [[[2026, 1, 5], [2026, 4, 5]], [[2026, 1, 5]], True], [[[2026, 4, 6], 90]]], ['partial repair probe 2', [[[2029, 7, 29], [2030, 1, 29]], [[2030, 1, 29]], True], [[[2030, 1, 30], 184]]], ['normal control 1', [[[2026, 5, 25], [2026, 8, 25], [2026, 11, 25], [2027, 2, 25]], [[2026, 8, 26], [2026, 11, 26]], False], [[[2026, 8, 25], 92], [[2026, 11, 25], 92], [[2027, 2, 25], 92]]], ['normal control 2', [[[2026, 9, 30], [2026, 12, 30], [2027, 3, 30], [2027, 6, 30], [2027, 9, 30]], [[2027, 4, 1]], True], [[[2026, 12, 30], 91], [[2027, 3, 30], 90], [[2027, 6, 30], 92], [[2027, 9, 30], 92]]], ['normal control 3', [[[2025, 10, 30], [2026, 4, 30]], [], True], [[[2026, 4, 30], 182]]], ['normal control 4', [[[2025, 12, 31], [2026, 3, 31], [2026, 6, 30], [2026, 9, 30]], [[2026, 4, 2], [2026, 7, 1]], False], [[[2026, 3, 31], 90], [[2026, 6, 30], 91], [[2026, 9, 30], 92]]]], [['regression accrual adjustment flag 1', [[[2027, 4, 30], [2027, 10, 30], [2028, 4, 30], [2028, 10, 30], [2029, 4, 30]], [[2027, 4, 30]], True], [[[2027, 10, 29], 183], [[2028, 4, 28], 182], [[2028, 10, 30], 185], [[2029, 4, 30], 182]]], ['regression accrual adjustment flag 2', [[[2023, 2, 28], [2023, 5, 28], [2023, 8, 28], [2023, 11, 28]], [[2023, 5, 30]], True], [[[2023, 5, 29], 90], [[2023, 8, 28], 91], [[2023, 11, 28], 92]]], ['partial repair probe 1', [[[2024, 5, 31], [2024, 11, 30]], [[2024, 5, 31], [2024, 12, 1]], True], [[[2024, 11, 29], 183]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2029, 8, 28], [2030, 2, 28], [2030, 8, 28], [2031, 2, 28], [2031, 8, 28]], [[2029, 8, 30], [2030, 8, 30], [2031, 8, 30]], False], [[[2030, 2, 28], 184], [[2030, 8, 28], 181], [[2031, 2, 28], 184], [[2031, 8, 28], 181]]], ['normal control 2', [[[2023, 3, 1], [2023, 9, 1]], [[2023, 3, 2]], True], [[[2023, 9, 1], 184]]], ['normal control 3', [[[2022, 3, 16], [2022, 6, 16], [2022, 9, 16], [2022, 12, 16], [2023, 3, 16]], [[2022, 9, 18], [2023, 3, 17]], False], [[[2022, 6, 16], 92], [[2022, 9, 16], 92], [[2022, 12, 16], 91], [[2023, 3, 16], 90]]], ['normal control 4', [[[2029, 12, 22], [2030, 6, 22]], [], False], [[[2030, 6, 24], 182]]]], [['regression accrual adjustment flag 1', [[[2023, 10, 11], [2024, 4, 11], [2024, 10, 11], [2025, 4, 11]], [[2023, 10, 13], [2024, 4, 12], [2024, 10, 11]], True], [[[2024, 4, 11], 183], [[2024, 10, 14], 186], [[2025, 4, 11], 179]]], ['regression accrual adjustment flag 2', [[[2030, 9, 28], [2030, 12, 28], [2031, 3, 28]], [[2031, 3, 28]], True], [[[2030, 12, 30], 91], [[2031, 3, 31], 91]]], ['partial repair probe 1', [[[2021, 9, 30], [2021, 10, 30]], [[2021, 9, 30]], True], [[[2021, 10, 29], 30]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 3, 31], [2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2019, 2, 27], [2019, 5, 27]], [[2019, 5, 29]], False], [[[2019, 5, 27], 89]]], ['normal control 2', [[[2020, 6, 1], [2020, 12, 1], [2021, 6, 1], [2021, 12, 1]], [], False], [[[2020, 12, 1], 183], [[2021, 6, 1], 182], [[2021, 12, 1], 183]]], ['normal control 3', [[[2020, 12, 1], [2021, 3, 1], [2021, 6, 1]], [[2021, 3, 2]], True], [[[2021, 3, 1], 90], [[2021, 6, 1], 92]]], ['normal control 4', [[[2020, 3, 18], [2020, 6, 18], [2020, 9, 18]], [], True], [[[2020, 6, 18], 92], [[2020, 9, 18], 92]]]], [['regression accrual adjustment flag 1', [[[2029, 5, 28], [2029, 6, 28]], [[2029, 5, 29], [2029, 6, 28]], True], [[[2029, 6, 29], 32]]], ['regression accrual adjustment flag 2', [[[2019, 6, 22], [2019, 12, 22], [2020, 6, 22], [2020, 12, 22], [2021, 6, 22]], [[2019, 12, 24]], False], [[[2019, 12, 23], 183], [[2020, 6, 22], 183], [[2020, 12, 22], 183], [[2021, 6, 22], 182]]], ['partial repair probe 1', [[[2019, 8, 31], [2019, 11, 30]], [[2019, 9, 1], [2019, 12, 1]], True], [[[2019, 11, 29], 91]]], ['partial repair probe 2', [[[2026, 1, 31], [2026, 4, 30]], [[2026, 4, 30]], True], [[[2026, 4, 29], 89]]], ['normal control 1', [[[2024, 12, 31], [2025, 3, 31]], [], False], [[[2025, 3, 31], 90]]], ['normal control 2', [[[2022, 9, 30], [2023, 3, 30]], [[2022, 10, 1]], False], [[[2023, 3, 30], 181]]], ['normal control 3', [[[2020, 11, 30], [2020, 12, 30]], [[2021, 1, 1]], False], [[[2020, 12, 30], 30]]], ['normal control 4', [[[2021, 9, 28], [2021, 12, 28], [2022, 3, 28], [2022, 6, 28], [2022, 9, 28]], [[2022, 9, 29]], False], [[[2021, 12, 28], 91], [[2022, 3, 28], 90], [[2022, 6, 28], 92], [[2022, 9, 28], 92]]]]]
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 accrual adjustment flag 1[[[2027, 6, 30], 31], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]][[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]Failed
regression accrual adjustment flag 2[[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]][[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]Passed
partial repair probe 1[[[2027, 11, 16], 93]][[[2027, 11, 16], 92]]Failed
partial repair probe 2[[[2030, 3, 4], 29]][[[2030, 3, 4], 28]]Failed
normal control 1[[[2022, 8, 17], 181]][[[2022, 8, 17], 181]]Passed
normal control 2[[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]][[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]Passed
normal control 3[[[2029, 3, 28], 28]][[[2029, 3, 28], 28]]Passed
normal control 4[[[2025, 3, 5], 181], [[2025, 9, 5], 184]][[[2025, 3, 5], 181], [[2025, 9, 5], 184]]Passed

SHA-256 / 8c3d9345d027bf27eff5789fc8fff5ed0657d46f4284656b7afe48c082a21932

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(dates, holidays, adjust_accrual):
    H = {datetime.date(*h) for h in holidays}
    def biz(x):
        return x.weekday() < 5 and x not in H
    def fwd(x):
        while not biz(x):
            x += datetime.timedelta(days=1)
        return x
    def bwd(x):
        while not biz(x):
            x -= datetime.timedelta(days=1)
        return x
    def mf(x):
        f = fwd(x)
        return f if f.month == x.month else bwd(x)
    out = []
    for i in range(1, len(dates)):
        s = datetime.date(*dates[i - 1])
        e = datetime.date(*dates[i])
        pay = mf(e)
        if adjust_accrual:
            s, e = mf(s), mf(e)
        out.append([[pay.year, pay.month, pay.day], (e - s).days])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression accrual adjustment flag 1', [[[2027, 5, 30], [2027, 6, 30], [2027, 7, 30], [2027, 8, 30], [2027, 9, 30]], [[2027, 9, 30]], True], [[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]], ['regression accrual adjustment flag 2', [[[2029, 7, 31], [2029, 8, 31], [2029, 9, 30], [2029, 10, 31]], [[2029, 9, 30]], False], [[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]], ['partial repair probe 1', [[[2027, 8, 15], [2027, 11, 15]], [[2027, 8, 17], [2027, 11, 15]], True], [[[2027, 11, 16], 92]]], ['partial repair probe 2', [[[2030, 2, 3], [2030, 3, 3]], [[2030, 3, 3]], True], [[[2030, 3, 4], 28]]], ['normal control 1', [[[2022, 2, 17], [2022, 8, 17]], [], True], [[[2022, 8, 17], 181]]], ['normal control 2', [[[2022, 9, 20], [2023, 3, 20], [2023, 9, 20], [2024, 3, 20], [2024, 9, 20]], [[2024, 3, 22]], True], [[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]], ['normal control 3', [[[2029, 2, 28], [2029, 3, 28]], [], False], [[[2029, 3, 28], 28]]], ['normal control 4', [[[2024, 9, 5], [2025, 3, 5], [2025, 9, 5]], [], False], [[[2025, 3, 5], 181], [[2025, 9, 5], 184]]]], [['regression accrual adjustment flag 1', [[[2019, 9, 30], [2019, 10, 30], [2019, 11, 30], [2019, 12, 30]], [[2019, 12, 2], [2020, 1, 1]], False], [[[2019, 10, 30], 30], [[2019, 11, 29], 31], [[2019, 12, 30], 30]]], ['regression accrual adjustment flag 2', [[[2020, 11, 30], [2021, 2, 28], [2021, 5, 30]], [[2021, 3, 1]], True], [[[2021, 2, 26], 88], [[2021, 5, 31], 94]]], ['partial repair probe 1', [[[2026, 1, 5], [2026, 4, 5]], [[2026, 1, 5]], True], [[[2026, 4, 6], 90]]], ['partial repair probe 2', [[[2029, 7, 29], [2030, 1, 29]], [[2030, 1, 29]], True], [[[2030, 1, 30], 184]]], ['normal control 1', [[[2026, 5, 25], [2026, 8, 25], [2026, 11, 25], [2027, 2, 25]], [[2026, 8, 26], [2026, 11, 26]], False], [[[2026, 8, 25], 92], [[2026, 11, 25], 92], [[2027, 2, 25], 92]]], ['normal control 2', [[[2026, 9, 30], [2026, 12, 30], [2027, 3, 30], [2027, 6, 30], [2027, 9, 30]], [[2027, 4, 1]], True], [[[2026, 12, 30], 91], [[2027, 3, 30], 90], [[2027, 6, 30], 92], [[2027, 9, 30], 92]]], ['normal control 3', [[[2025, 10, 30], [2026, 4, 30]], [], True], [[[2026, 4, 30], 182]]], ['normal control 4', [[[2025, 12, 31], [2026, 3, 31], [2026, 6, 30], [2026, 9, 30]], [[2026, 4, 2], [2026, 7, 1]], False], [[[2026, 3, 31], 90], [[2026, 6, 30], 91], [[2026, 9, 30], 92]]]], [['regression accrual adjustment flag 1', [[[2027, 4, 30], [2027, 10, 30], [2028, 4, 30], [2028, 10, 30], [2029, 4, 30]], [[2027, 4, 30]], True], [[[2027, 10, 29], 183], [[2028, 4, 28], 182], [[2028, 10, 30], 185], [[2029, 4, 30], 182]]], ['regression accrual adjustment flag 2', [[[2023, 2, 28], [2023, 5, 28], [2023, 8, 28], [2023, 11, 28]], [[2023, 5, 30]], True], [[[2023, 5, 29], 90], [[2023, 8, 28], 91], [[2023, 11, 28], 92]]], ['partial repair probe 1', [[[2024, 5, 31], [2024, 11, 30]], [[2024, 5, 31], [2024, 12, 1]], True], [[[2024, 11, 29], 183]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2029, 8, 28], [2030, 2, 28], [2030, 8, 28], [2031, 2, 28], [2031, 8, 28]], [[2029, 8, 30], [2030, 8, 30], [2031, 8, 30]], False], [[[2030, 2, 28], 184], [[2030, 8, 28], 181], [[2031, 2, 28], 184], [[2031, 8, 28], 181]]], ['normal control 2', [[[2023, 3, 1], [2023, 9, 1]], [[2023, 3, 2]], True], [[[2023, 9, 1], 184]]], ['normal control 3', [[[2022, 3, 16], [2022, 6, 16], [2022, 9, 16], [2022, 12, 16], [2023, 3, 16]], [[2022, 9, 18], [2023, 3, 17]], False], [[[2022, 6, 16], 92], [[2022, 9, 16], 92], [[2022, 12, 16], 91], [[2023, 3, 16], 90]]], ['normal control 4', [[[2029, 12, 22], [2030, 6, 22]], [], False], [[[2030, 6, 24], 182]]]], [['regression accrual adjustment flag 1', [[[2023, 10, 11], [2024, 4, 11], [2024, 10, 11], [2025, 4, 11]], [[2023, 10, 13], [2024, 4, 12], [2024, 10, 11]], True], [[[2024, 4, 11], 183], [[2024, 10, 14], 186], [[2025, 4, 11], 179]]], ['regression accrual adjustment flag 2', [[[2030, 9, 28], [2030, 12, 28], [2031, 3, 28]], [[2031, 3, 28]], True], [[[2030, 12, 30], 91], [[2031, 3, 31], 91]]], ['partial repair probe 1', [[[2021, 9, 30], [2021, 10, 30]], [[2021, 9, 30]], True], [[[2021, 10, 29], 30]]], ['partial repair probe 2', [[[2029, 3, 31], [2029, 6, 30]], [[2029, 3, 31], [2029, 7, 1]], True], [[[2029, 6, 29], 91]]], ['normal control 1', [[[2019, 2, 27], [2019, 5, 27]], [[2019, 5, 29]], False], [[[2019, 5, 27], 89]]], ['normal control 2', [[[2020, 6, 1], [2020, 12, 1], [2021, 6, 1], [2021, 12, 1]], [], False], [[[2020, 12, 1], 183], [[2021, 6, 1], 182], [[2021, 12, 1], 183]]], ['normal control 3', [[[2020, 12, 1], [2021, 3, 1], [2021, 6, 1]], [[2021, 3, 2]], True], [[[2021, 3, 1], 90], [[2021, 6, 1], 92]]], ['normal control 4', [[[2020, 3, 18], [2020, 6, 18], [2020, 9, 18]], [], True], [[[2020, 6, 18], 92], [[2020, 9, 18], 92]]]], [['regression accrual adjustment flag 1', [[[2029, 5, 28], [2029, 6, 28]], [[2029, 5, 29], [2029, 6, 28]], True], [[[2029, 6, 29], 32]]], ['regression accrual adjustment flag 2', [[[2019, 6, 22], [2019, 12, 22], [2020, 6, 22], [2020, 12, 22], [2021, 6, 22]], [[2019, 12, 24]], False], [[[2019, 12, 23], 183], [[2020, 6, 22], 183], [[2020, 12, 22], 183], [[2021, 6, 22], 182]]], ['partial repair probe 1', [[[2019, 8, 31], [2019, 11, 30]], [[2019, 9, 1], [2019, 12, 1]], True], [[[2019, 11, 29], 91]]], ['partial repair probe 2', [[[2026, 1, 31], [2026, 4, 30]], [[2026, 4, 30]], True], [[[2026, 4, 29], 89]]], ['normal control 1', [[[2024, 12, 31], [2025, 3, 31]], [], False], [[[2025, 3, 31], 90]]], ['normal control 2', [[[2022, 9, 30], [2023, 3, 30]], [[2022, 10, 1]], False], [[[2023, 3, 30], 181]]], ['normal control 3', [[[2020, 11, 30], [2020, 12, 30]], [[2021, 1, 1]], False], [[[2020, 12, 30], 30]]], ['normal control 4', [[[2021, 9, 28], [2021, 12, 28], [2022, 3, 28], [2022, 6, 28], [2022, 9, 28]], [[2022, 9, 29]], False], [[[2021, 12, 28], 91], [[2022, 3, 28], 90], [[2022, 6, 28], 92], [[2022, 9, 28], 92]]]]]
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 accrual adjustment flag 1[[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]][[[2027, 6, 30], 30], [[2027, 7, 30], 30], [[2027, 8, 30], 31], [[2027, 9, 29], 30]]Passed
regression accrual adjustment flag 2[[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]][[[2029, 8, 31], 31], [[2029, 9, 28], 30], [[2029, 10, 31], 31]]Passed
partial repair probe 1[[[2027, 11, 16], 92]][[[2027, 11, 16], 92]]Passed
partial repair probe 2[[[2030, 3, 4], 28]][[[2030, 3, 4], 28]]Passed
normal control 1[[[2022, 8, 17], 181]][[[2022, 8, 17], 181]]Passed
normal control 2[[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]][[[2023, 3, 20], 181], [[2023, 9, 20], 184], [[2024, 3, 20], 182], [[2024, 9, 20], 184]]Passed
normal control 3[[[2029, 3, 28], 28]][[[2029, 3, 28], 28]]Passed
normal control 4[[[2025, 3, 5], 181], [[2025, 9, 5], 184]][[[2025, 3, 5], 181], [[2025, 9, 5], 184]]Passed

SHA-256 / f786be7fff49e1039eb5bf3667ab227a781c35e96f971b40f4cf5a8198fe180d

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

Case digest / d8131e85d6b03b22e3af0bb18e9c0cbef270ab2ddbd54116e47c49aaa92f9635