FAILURE MAP
← Case archive

FA-6511 / Calendar arithmetic / Open access

Fiscal quarter offset start month · case 01

Calendar quarters ignore the fiscal start month.

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

ROOT CAUSE

Calendar quarters ignore the fiscal start month.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return ((month-start)%12)//3+1

Unsuccessful approach: Absolute month distance loses year wrap direction.

Case contract

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. month,start are 1..12; fiscal quarter one starts at start and lasts three months. Exact operational definition: ((month-start)%12)//3+1

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Calendar conventions results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month, start):
    return (month-1)//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 4)', solve(*(4, 4)), 1)
check('fixture 2: (3, 4)', solve(*(3, 4)), 4)
check('fixture 3: (1, 10)', solve(*(1, 10)), 2)
check('fixture 4: (12, 10)', solve(*(12, 10)), 1)
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
fixture 1: (4, 4)21Failed
fixture 2: (3, 4)14Failed
fixture 3: (1, 10)12Failed
fixture 4: (12, 10)41Failed

SHA-256 / 7156f64e304f3811fb9530bc5a95ccd5686701d2986b34a442340cc8f83ffc29

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month, start):
    return abs(month-start)//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 4)', solve(*(4, 4)), 1)
check('fixture 2: (3, 4)', solve(*(3, 4)), 4)
check('fixture 3: (1, 10)', solve(*(1, 10)), 2)
check('fixture 4: (12, 10)', solve(*(12, 10)), 1)
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
fixture 1: (4, 4)11Passed
fixture 2: (3, 4)14Failed
fixture 3: (1, 10)42Failed
fixture 4: (12, 10)11Passed

SHA-256 / 51b97aff4f569c6d7584a7b8b8cf6e7c4212a03737f39084184e06708ba2d5b6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month, start):
    return ((month-start)%12)//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 4)', solve(*(4, 4)), 1)
check('fixture 2: (3, 4)', solve(*(3, 4)), 4)
check('fixture 3: (1, 10)', solve(*(1, 10)), 2)
check('fixture 4: (12, 10)', solve(*(12, 10)), 1)
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
fixture 1: (4, 4)11Passed
fixture 2: (3, 4)44Passed
fixture 3: (1, 10)22Passed
fixture 4: (12, 10)11Passed

SHA-256 / a5bf196c64676d4c31d84731fd888e5b89849261a9f0a5d5fc2910f100446ae6

Verification & scope

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

Case digest / 9a98ad5be32a1b01dd6a7b530506db8168c2cf4095329130704ae83bf24d0a1b