FA-60981 / Bond day-count conventions / Open access
Business day adjustment conventions: Saturdays are treated as business days · case 01
Payments scheduled on a Saturday are made on the Saturday.
ROOT CAUSE
The weekend predicate checks weekday() > 5, which only matches Sunday.
THE FAILURE
The weekend predicate checks weekday() > 5, which only matches Sunday.
Unsuccessful approach: Checking only for Saturday then lets Sunday payments through.
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(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 weekend test 1', [[2023, 12, 30], 'MF', []], [2023, 12, 29]], ['regression weekend test 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['partial repair probe 1', [[2026, 5, 31], 'F', [[2026, 6, 1]]], [2026, 6, 2]], ['partial repair probe 2', [[2029, 9, 1], 'MF', [[2029, 9, 3], [2029, 9, 1]]], [2029, 9, 4]], ['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', [[2024, 12, 31], 'F', []], [2024, 12, 31]], ['normal control 2', [[2028, 4, 30], 'U', []], [2028, 4, 30]]], [['regression weekend test 1', [[2023, 7, 1], 'MF', [[2023, 7, 3]]], [2023, 7, 4]], ['regression weekend test 2', [[2022, 7, 30], 'P', [[2022, 8, 3], [2022, 7, 29]]], [2022, 7, 28]], ['partial repair probe 1', [[2024, 3, 30], 'MF', [[2024, 3, 27], [2024, 3, 30]]], [2024, 3, 29]], ['partial repair probe 2', [[2024, 12, 29], 'MF', [[2024, 12, 31]]], [2024, 12, 30]], ['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', [[2024, 10, 23], 'MP', [[2024, 10, 23], [2024, 10, 22], [2024, 10, 22]]], [2024, 10, 21]], ['normal control 2', [[2025, 2, 4], 'P', [[2025, 2, 2], [2025, 2, 1], [2025, 2, 2]]], [2025, 2, 4]]], [['regression weekend test 1', [[2020, 2, 1], 'MF', [[2020, 2, 3]]], [2020, 2, 4]], ['regression weekend test 2', [[2029, 6, 30], 'P', []], [2029, 6, 29]], ['partial repair probe 1', [[2022, 1, 2], 'MF', []], [2022, 1, 3]], ['partial repair probe 2', [[2028, 1, 30], 'MF', []], [2028, 1, 31]], ['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', [[2027, 12, 1], 'U', []], [2027, 12, 1]], ['normal control 2', [[2023, 1, 19], 'MF', [[2023, 1, 22], [2023, 1, 21], [2023, 1, 16]]], [2023, 1, 19]]], [['regression weekend test 1', [[2021, 5, 31], 'P', [[2021, 5, 31], [2021, 6, 4], [2021, 6, 1]]], [2021, 5, 28]], ['regression weekend test 2', [[2028, 12, 31], 'MF', []], [2028, 12, 29]], ['partial repair probe 1', [[2026, 11, 22], 'F', [[2026, 11, 25]]], [2026, 11, 23]], ['partial repair probe 2', [[2029, 12, 30], 'MF', []], [2029, 12, 31]], ['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', [[2029, 10, 31], 'MP', []], [2029, 10, 31]], ['normal control 2', [[2024, 1, 3], 'MF', []], [2024, 1, 3]]], [['regression weekend test 1', [[2028, 7, 8], 'MF', [[2028, 7, 11]]], [2028, 7, 10]], ['regression weekend test 2', [[2020, 8, 9], 'MP', [[2020, 8, 9]]], [2020, 8, 7]], ['partial repair probe 1', [[2024, 12, 29], 'MF', [[2024, 12, 31]]], [2024, 12, 30]], ['partial repair probe 2', [[2028, 4, 30], 'F', [[2028, 4, 28]]], [2028, 5, 1]], ['boundary control 1', [[2024, 5, 15], 'X', []], 'unknown convention'], ['boundary control 2', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['normal control 1', [[2030, 4, 30], 'MP', [[2030, 4, 28]]], [2030, 4, 30]], ['normal control 2', [[2020, 1, 2], 'U', []], [2020, 1, 2]]]]
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 weekend test 1 | [2023, 12, 30] | [2023, 12, 29] | Failed |
| regression weekend test 2 | [2024, 3, 30] | [2024, 3, 29] | Failed |
| partial repair probe 1 | [2026, 6, 2] | [2026, 6, 2] | Passed |
| partial repair probe 2 | [2029, 9, 4] | [2029, 9, 4] | Passed |
| boundary control 1 | [2024, 5, 16] | [2024, 5, 16] | Passed |
| boundary control 2 | unknown convention | unknown convention | Passed |
| normal control 1 | [2024, 12, 31] | [2024, 12, 31] | Passed |
| normal control 2 | [2028, 4, 30] | [2028, 4, 30] | Passed |
SHA-256 / 6660b6e17aa2156d305e21ac87489f2d96ebf17901d7b15eea94e3dd001bcf45
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 = 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 weekend test 1', [[2023, 12, 30], 'MF', []], [2023, 12, 29]], ['regression weekend test 2', [[2024, 3, 30], 'MF', []], [2024, 3, 29]], ['partial repair probe 1', [[2026, 5, 31], 'F', [[2026, 6, 1]]], [2026, 6, 2]], ['partial repair probe 2', [[2029, 9, 1], 'MF', [[2029, 9, 3], [2029, 9, 1]]], [2029, 9, 4]], ['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', [[2024, 12, 31], 'F', []], [2024, 12, 31]], ['normal control 2', [[2028, 4, 30], 'U', []], [2028, 4, 30]]], [['regression weekend test 1', [[2023, 7, 1], 'MF', [[2023, 7, 3]]], [2023, 7, 4]], ['regression weekend test 2', [[2022, 7, 30], 'P', [[2022, 8, 3], [2022, 7, 29]]], [2022, 7, 28]], ['partial repair probe 1', [[2024, 3, 30], 'MF', [[2024, 3, 27], [2024, 3, 30]]], [2024, 3, 29]], ['partial repair probe 2', [[2024, 12, 29], 'MF', [[2024, 12, 31]]], [2024, 12, 30]], ['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', [[2024, 10, 23], 'MP', [[2024, 10, 23], [2024, 10, 22], [2024, 10, 22]]], [2024, 10, 21]], ['normal control 2', [[2025, 2, 4], 'P', [[2025, 2, 2], [2025, 2, 1], [2025, 2, 2]]], [2025, 2, 4]]], [['regression weekend test 1', [[2020, 2, 1], 'MF', [[2020, 2, 3]]], [2020, 2, 4]], ['regression weekend test 2', [[2029, 6, 30], 'P', []], [2029, 6, 29]], ['partial repair probe 1', [[2022, 1, 2], 'MF', []], [2022, 1, 3]], ['partial repair probe 2', [[2028, 1, 30], 'MF', []], [2028, 1, 31]], ['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', [[2027, 12, 1], 'U', []], [2027, 12, 1]], ['normal control 2', [[2023, 1, 19], 'MF', [[2023, 1, 22], [2023, 1, 21], [2023, 1, 16]]], [2023, 1, 19]]], [['regression weekend test 1', [[2021, 5, 31], 'P', [[2021, 5, 31], [2021, 6, 4], [2021, 6, 1]]], [2021, 5, 28]], ['regression weekend test 2', [[2028, 12, 31], 'MF', []], [2028, 12, 29]], ['partial repair probe 1', [[2026, 11, 22], 'F', [[2026, 11, 25]]], [2026, 11, 23]], ['partial repair probe 2', [[2029, 12, 30], 'MF', []], [2029, 12, 31]], ['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', [[2029, 10, 31], 'MP', []], [2029, 10, 31]], ['normal control 2', [[2024, 1, 3], 'MF', []], [2024, 1, 3]]], [['regression weekend test 1', [[2028, 7, 8], 'MF', [[2028, 7, 11]]], [2028, 7, 10]], ['regression weekend test 2', [[2020, 8, 9], 'MP', [[2020, 8, 9]]], [2020, 8, 7]], ['partial repair probe 1', [[2024, 12, 29], 'MF', [[2024, 12, 31]]], [2024, 12, 30]], ['partial repair probe 2', [[2028, 4, 30], 'F', [[2028, 4, 28]]], [2028, 5, 1]], ['boundary control 1', [[2024, 5, 15], 'X', []], 'unknown convention'], ['boundary control 2', [[2024, 5, 15], 'F', [[2024, 5, 15]]], [2024, 5, 16]], ['normal control 1', [[2030, 4, 30], 'MP', [[2030, 4, 28]]], [2030, 4, 30]], ['normal control 2', [[2020, 1, 2], 'U', []], [2020, 1, 2]]]]
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 weekend test 1 | [2023, 12, 31] | [2023, 12, 29] | Failed |
| regression weekend test 2 | [2024, 3, 31] | [2024, 3, 29] | Failed |
| partial repair probe 1 | [2026, 5, 31] | [2026, 6, 2] | Failed |
| partial repair probe 2 | [2029, 9, 2] | [2029, 9, 4] | Failed |
| boundary control 1 | [2024, 5, 16] | [2024, 5, 16] | Passed |
| boundary control 2 | unknown convention | unknown convention | Passed |
| normal control 1 | [2024, 12, 31] | [2024, 12, 31] | Passed |
| normal control 2 | [2028, 4, 30] | [2028, 4, 30] | Passed |
SHA-256 / b43ab91f3773ebb25f9ecab45854d0295b917203840826219e4829757675d171
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:50.675576+00:00.
Case digest / 0fa32e6d52e60337ff0717880c602910ae6a012c3272ce6f64ec16527097c6d4