FA-60986 / Bond day-count conventions / Open access
Business day adjustment conventions: the month-crossing fallback steps back from the rolled date · case 01
Modified following behaves like plain following at month end.
ROOT CAUSE
After detecting a month change the fallback rolls back from the already-rolled business date, which does not move.
VERIFIED REPAIR
Roll back from the original date when the forward roll leaves the month.
Unsuccessful approach: Stepping back exactly one calendar day from the original date can land on another non-business day.
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 = {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(r, -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 modified following fallback 1', [[2027, 12, 31], 'MF', [[2027, 12, 31]]], [2027, 12, 30]], ['regression modified following fallback 2', [[2025, 8, 30], 'MF', [[2025, 9, 2], [2025, 8, 31]]], [2025, 8, 29]], ['partial repair probe 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2024, 1, 4], [2023, 12, 29]]], [2023, 12, 28]], ['boundary control 1', [[2024, 5, 15], 'X', []], 'unknown convention'], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 21], 'F', [[2030, 12, 18], [2030, 12, 20], [2030, 12, 18]]], [2030, 12, 23]], ['normal control 2', [[2024, 7, 31], 'MP', [[2024, 8, 2], [2024, 7, 29]]], [2024, 7, 31]]], [['regression modified following fallback 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['regression modified following fallback 2', [[2026, 2, 28], 'MF', []], [2026, 2, 27]], ['partial repair probe 1', [[2023, 4, 30], 'MF', [[2023, 4, 29], [2023, 5, 1]]], [2023, 4, 28]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2023, 12, 31]]], [2023, 12, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2023, 11, 4], 'F', []], [2023, 11, 6]], ['normal control 2', [[2025, 9, 1], 'X', [[2025, 9, 4]]], 'unknown convention']], [['regression modified following fallback 1', [[2030, 3, 31], 'MF', [[2030, 3, 28], [2030, 4, 4]]], [2030, 3, 29]], ['regression modified following fallback 2', [[2024, 8, 29], 'MF', [[2024, 8, 30], [2024, 8, 29]]], [2024, 8, 28]], ['partial repair probe 1', [[2024, 6, 29], 'MF', [[2024, 7, 2], [2024, 6, 28]]], [2024, 6, 27]], ['partial repair probe 2', [[2028, 12, 31], 'MF', [[2028, 12, 29], [2029, 1, 1]]], [2028, 12, 28]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2026, 1, 18], 'MP', [[2026, 1, 21]]], [2026, 1, 16]], ['normal control 2', [[2020, 6, 1], 'MP', [[2020, 5, 30], [2020, 6, 5], [2020, 5, 30]]], [2020, 6, 1]]], [['regression modified following fallback 1', [[2020, 5, 31], 'MF', []], [2020, 5, 29]], ['regression modified following fallback 2', [[2022, 12, 31], 'MF', []], [2022, 12, 30]], ['partial repair probe 1', [[2021, 10, 31], 'MF', []], [2021, 10, 29]], ['partial repair probe 2', [[2019, 3, 31], 'MF', [[2019, 3, 30]]], [2019, 3, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2028, 4, 30], 'P', []], [2028, 4, 28]], ['normal control 2', [[2028, 11, 30], 'X', []], 'unknown convention']], [['regression modified following fallback 1', [[2025, 12, 31], 'MF', [[2025, 12, 31]]], [2025, 12, 30]], ['regression modified following fallback 2', [[2027, 1, 31], 'MF', []], [2027, 1, 29]], ['partial repair probe 1', [[2024, 3, 31], 'MF', [[2024, 3, 30]]], [2024, 3, 29]], ['partial repair probe 2', [[2028, 12, 31], 'MF', []], [2028, 12, 29]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2023, 3, 29], 'MP', [[2023, 3, 28], [2023, 3, 31]]], [2023, 3, 29]], ['normal control 2', [[2026, 10, 1], 'MP', []], [2026, 10, 1]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression modified following fallback 1 | [2028, 1, 3] | [2027, 12, 30] | Failed |
| regression modified following fallback 2 | [2025, 9, 1] | [2025, 8, 29] | Failed |
| partial repair probe 1 | [2024, 1, 1] | [2023, 12, 29] | Failed |
| partial repair probe 2 | [2024, 1, 1] | [2023, 12, 28] | Failed |
| boundary control 1 | unknown convention | unknown convention | Passed |
| boundary control 2 | [2024, 12, 30] | [2024, 12, 30] | Passed |
| normal control 1 | [2030, 12, 23] | [2030, 12, 23] | Passed |
| normal control 2 | [2024, 7, 31] | [2024, 7, 31] | Passed |
SHA-256 / 8210aac703efad7c74c19ae6446902770358c8060219ebc67f2064e68c6ad8dc
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) 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 = D - datetime.timedelta(days=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 modified following fallback 1', [[2027, 12, 31], 'MF', [[2027, 12, 31]]], [2027, 12, 30]], ['regression modified following fallback 2', [[2025, 8, 30], 'MF', [[2025, 9, 2], [2025, 8, 31]]], [2025, 8, 29]], ['partial repair probe 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2024, 1, 4], [2023, 12, 29]]], [2023, 12, 28]], ['boundary control 1', [[2024, 5, 15], 'X', []], 'unknown convention'], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 21], 'F', [[2030, 12, 18], [2030, 12, 20], [2030, 12, 18]]], [2030, 12, 23]], ['normal control 2', [[2024, 7, 31], 'MP', [[2024, 8, 2], [2024, 7, 29]]], [2024, 7, 31]]], [['regression modified following fallback 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['regression modified following fallback 2', [[2026, 2, 28], 'MF', []], [2026, 2, 27]], ['partial repair probe 1', [[2023, 4, 30], 'MF', [[2023, 4, 29], [2023, 5, 1]]], [2023, 4, 28]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2023, 12, 31]]], [2023, 12, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2023, 11, 4], 'F', []], [2023, 11, 6]], ['normal control 2', [[2025, 9, 1], 'X', [[2025, 9, 4]]], 'unknown convention']], [['regression modified following fallback 1', [[2030, 3, 31], 'MF', [[2030, 3, 28], [2030, 4, 4]]], [2030, 3, 29]], ['regression modified following fallback 2', [[2024, 8, 29], 'MF', [[2024, 8, 30], [2024, 8, 29]]], [2024, 8, 28]], ['partial repair probe 1', [[2024, 6, 29], 'MF', [[2024, 7, 2], [2024, 6, 28]]], [2024, 6, 27]], ['partial repair probe 2', [[2028, 12, 31], 'MF', [[2028, 12, 29], [2029, 1, 1]]], [2028, 12, 28]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2026, 1, 18], 'MP', [[2026, 1, 21]]], [2026, 1, 16]], ['normal control 2', [[2020, 6, 1], 'MP', [[2020, 5, 30], [2020, 6, 5], [2020, 5, 30]]], [2020, 6, 1]]], [['regression modified following fallback 1', [[2020, 5, 31], 'MF', []], [2020, 5, 29]], ['regression modified following fallback 2', [[2022, 12, 31], 'MF', []], [2022, 12, 30]], ['partial repair probe 1', [[2021, 10, 31], 'MF', []], [2021, 10, 29]], ['partial repair probe 2', [[2019, 3, 31], 'MF', [[2019, 3, 30]]], [2019, 3, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2028, 4, 30], 'P', []], [2028, 4, 28]], ['normal control 2', [[2028, 11, 30], 'X', []], 'unknown convention']], [['regression modified following fallback 1', [[2025, 12, 31], 'MF', [[2025, 12, 31]]], [2025, 12, 30]], ['regression modified following fallback 2', [[2027, 1, 31], 'MF', []], [2027, 1, 29]], ['partial repair probe 1', [[2024, 3, 31], 'MF', [[2024, 3, 30]]], [2024, 3, 29]], ['partial repair probe 2', [[2028, 12, 31], 'MF', []], [2028, 12, 29]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2023, 3, 29], 'MP', [[2023, 3, 28], [2023, 3, 31]]], [2023, 3, 29]], ['normal control 2', [[2026, 10, 1], 'MP', []], [2026, 10, 1]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression modified following fallback 1 | [2027, 12, 30] | [2027, 12, 30] | Passed |
| regression modified following fallback 2 | [2025, 8, 29] | [2025, 8, 29] | Passed |
| partial repair probe 1 | [2023, 12, 30] | [2023, 12, 29] | Failed |
| partial repair probe 2 | [2023, 12, 30] | [2023, 12, 28] | Failed |
| boundary control 1 | unknown convention | unknown convention | Passed |
| boundary control 2 | [2024, 12, 30] | [2024, 12, 30] | Passed |
| normal control 1 | [2030, 12, 23] | [2030, 12, 23] | Passed |
| normal control 2 | [2024, 7, 31] | [2024, 7, 31] | Passed |
SHA-256 / 1f8bbd021c6b5f0eeecacc0e2a2b945eca854dd1ee2de6fd496246605acc77c5
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 modified following fallback 1', [[2027, 12, 31], 'MF', [[2027, 12, 31]]], [2027, 12, 30]], ['regression modified following fallback 2', [[2025, 8, 30], 'MF', [[2025, 9, 2], [2025, 8, 31]]], [2025, 8, 29]], ['partial repair probe 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2024, 1, 4], [2023, 12, 29]]], [2023, 12, 28]], ['boundary control 1', [[2024, 5, 15], 'X', []], 'unknown convention'], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2030, 12, 21], 'F', [[2030, 12, 18], [2030, 12, 20], [2030, 12, 18]]], [2030, 12, 23]], ['normal control 2', [[2024, 7, 31], 'MP', [[2024, 8, 2], [2024, 7, 29]]], [2024, 7, 31]]], [['regression modified following fallback 1', [[2023, 12, 31], 'MF', []], [2023, 12, 29]], ['regression modified following fallback 2', [[2026, 2, 28], 'MF', []], [2026, 2, 27]], ['partial repair probe 1', [[2023, 4, 30], 'MF', [[2023, 4, 29], [2023, 5, 1]]], [2023, 4, 28]], ['partial repair probe 2', [[2023, 12, 31], 'MF', [[2023, 12, 31]]], [2023, 12, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['normal control 1', [[2023, 11, 4], 'F', []], [2023, 11, 6]], ['normal control 2', [[2025, 9, 1], 'X', [[2025, 9, 4]]], 'unknown convention']], [['regression modified following fallback 1', [[2030, 3, 31], 'MF', [[2030, 3, 28], [2030, 4, 4]]], [2030, 3, 29]], ['regression modified following fallback 2', [[2024, 8, 29], 'MF', [[2024, 8, 30], [2024, 8, 29]]], [2024, 8, 28]], ['partial repair probe 1', [[2024, 6, 29], 'MF', [[2024, 7, 2], [2024, 6, 28]]], [2024, 6, 27]], ['partial repair probe 2', [[2028, 12, 31], 'MF', [[2028, 12, 29], [2029, 1, 1]]], [2028, 12, 28]], ['boundary control 1', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2026, 1, 18], 'MP', [[2026, 1, 21]]], [2026, 1, 16]], ['normal control 2', [[2020, 6, 1], 'MP', [[2020, 5, 30], [2020, 6, 5], [2020, 5, 30]]], [2020, 6, 1]]], [['regression modified following fallback 1', [[2020, 5, 31], 'MF', []], [2020, 5, 29]], ['regression modified following fallback 2', [[2022, 12, 31], 'MF', []], [2022, 12, 30]], ['partial repair probe 1', [[2021, 10, 31], 'MF', []], [2021, 10, 29]], ['partial repair probe 2', [[2019, 3, 31], 'MF', [[2019, 3, 30]]], [2019, 3, 29]], ['boundary control 1', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['boundary control 2', [[2024, 5, 15], 'X', []], 'unknown convention'], ['normal control 1', [[2028, 4, 30], 'P', []], [2028, 4, 28]], ['normal control 2', [[2028, 11, 30], 'X', []], 'unknown convention']], [['regression modified following fallback 1', [[2025, 12, 31], 'MF', [[2025, 12, 31]]], [2025, 12, 30]], ['regression modified following fallback 2', [[2027, 1, 31], 'MF', []], [2027, 1, 29]], ['partial repair probe 1', [[2024, 3, 31], 'MF', [[2024, 3, 30]]], [2024, 3, 29]], ['partial repair probe 2', [[2028, 12, 31], 'MF', []], [2028, 12, 29]], ['boundary control 1', [[2024, 6, 1], 'MP', []], [2024, 6, 3]], ['boundary control 2', [[2024, 12, 28], 'F', []], [2024, 12, 30]], ['normal control 1', [[2023, 3, 29], 'MP', [[2023, 3, 28], [2023, 3, 31]]], [2023, 3, 29]], ['normal control 2', [[2026, 10, 1], 'MP', []], [2026, 10, 1]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression modified following fallback 1 | [2027, 12, 30] | [2027, 12, 30] | Passed |
| regression modified following fallback 2 | [2025, 8, 29] | [2025, 8, 29] | Passed |
| partial repair probe 1 | [2023, 12, 29] | [2023, 12, 29] | Passed |
| partial repair probe 2 | [2023, 12, 28] | [2023, 12, 28] | Passed |
| boundary control 1 | unknown convention | unknown convention | Passed |
| boundary control 2 | [2024, 12, 30] | [2024, 12, 30] | Passed |
| normal control 1 | [2030, 12, 23] | [2030, 12, 23] | Passed |
| normal control 2 | [2024, 7, 31] | [2024, 7, 31] | Passed |
SHA-256 / 8dbf135f7126be5f3ac832bb130de8cc2b8bde5632e459af2249d3f98ac506aa
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.722542+00:00.
Case digest / 5ee0fe7e3a771bf6b5b8a51f35b083fc5471d1185c8b5b83e9f89c2c57830bcd