FAILURE MAP
← Case archive

FA-59221 / Payroll withholding rules / Open access

Pay dates in a calendar year: first pay date ceiling · case 01

The first pay date reported for a year falls in December of the prior year.

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

ROOT CAUSE

The offset to the first in-year pay date is floored instead of ceiled.

VERIFIED REPAIR

Restore the contract rule at the first pay date ceiling step: use `k = -(-off // x['step'])`.

Unsuccessful approach: The attempt adds one step, skipping a pay date that falls exactly on January 1.

Case contract

Input {anchor [y,m,d] (any pay date), step 7|14 days, year}. Pay dates are anchor + k*step for all integers k. Return [count of pay dates within Jan 1..Dec 31 of year inclusive, ISO date of the first one, whether the count exceeds the nominal periods (26 biweekly, 52 weekly)].

Why this case matters

Annualization factors change in 27-pay-period years; missing or extra pay dates distort per-period withholding.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    anchor = datetime.date(*x['anchor'])
    lo = datetime.date(x['year'], 1, 1)
    hi = datetime.date(x['year'], 12, 31)
    off = (lo - anchor).days
    k = off // x['step']
    first = anchor + datetime.timedelta(days=k * x['step'])
    count = (hi - first).days // x['step'] + 1
    periods = 26 if x['step'] == 14 else 52
    return [count, first.isoformat(), count > periods]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('partial-repair probe (boundary)', {'anchor': [2026, 1, 1], 'step': 14, 'year': 2026}, [27, '2026-01-01', True]), ('partial-repair probe', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('partial-repair probe', {'anchor': [2024, 10, 14], 'step': 7, 'year': 2024}, [53, '2024-01-01', True]), ('partial-repair probe', {'anchor': [2021, 1, 17], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('partial-repair probe', {'anchor': [2019, 8, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('partial-repair probe', {'anchor': [2025, 3, 13], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False])], [('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('partial-repair probe', {'anchor': [2024, 10, 27], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2018, 3, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False])], [('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('regression', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('partial-repair probe', {'anchor': [2021, 5, 2], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2025, 9, 4], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False]), ('additional oracle', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), 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 (boundary) 0[28, '2019-12-19', True][27, '2020-01-02', True]Failed
regression (boundary) 1[27, '2023-12-22', True][26, '2024-01-05', False]Failed
partial-repair probe (boundary) 2[27, '2026-01-01', True][27, '2026-01-01', True]Passed
partial-repair probe 3[27, '2023-01-01', True][27, '2023-01-01', True]Passed
additional oracle 4[27, '2023-12-28', True][26, '2024-01-11', False]Failed
additional oracle 5[27, '2023-12-31', True][26, '2024-01-14', False]Failed
additional oracle 6[27, '2019-12-30', True][26, '2020-01-13', False]Failed

SHA-256 / 72c737cc95120db401c2770d6ae9b311bfada8fc2906eb0637040cf3bad6543e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    anchor = datetime.date(*x['anchor'])
    lo = datetime.date(x['year'], 1, 1)
    hi = datetime.date(x['year'], 12, 31)
    off = (lo - anchor).days
    k = off // x['step'] + 1
    first = anchor + datetime.timedelta(days=k * x['step'])
    count = (hi - first).days // x['step'] + 1
    periods = 26 if x['step'] == 14 else 52
    return [count, first.isoformat(), count > periods]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('partial-repair probe (boundary)', {'anchor': [2026, 1, 1], 'step': 14, 'year': 2026}, [27, '2026-01-01', True]), ('partial-repair probe', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('partial-repair probe', {'anchor': [2024, 10, 14], 'step': 7, 'year': 2024}, [53, '2024-01-01', True]), ('partial-repair probe', {'anchor': [2021, 1, 17], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('partial-repair probe', {'anchor': [2019, 8, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('partial-repair probe', {'anchor': [2025, 3, 13], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False])], [('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('partial-repair probe', {'anchor': [2024, 10, 27], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2018, 3, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False])], [('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('regression', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('partial-repair probe', {'anchor': [2021, 5, 2], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2025, 9, 4], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False]), ('additional oracle', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), 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 (boundary) 0[27, '2020-01-02', True][27, '2020-01-02', True]Passed
regression (boundary) 1[26, '2024-01-05', False][26, '2024-01-05', False]Passed
partial-repair probe (boundary) 2[26, '2026-01-15', False][27, '2026-01-01', True]Failed
partial-repair probe 3[26, '2023-01-15', False][27, '2023-01-01', True]Failed
additional oracle 4[26, '2024-01-11', False][26, '2024-01-11', False]Passed
additional oracle 5[26, '2024-01-14', False][26, '2024-01-14', False]Passed
additional oracle 6[26, '2020-01-13', False][26, '2020-01-13', False]Passed

SHA-256 / 74c330b7196df0c9c2fb809957559beca28fbaa7e3c7ba4e70992020450af3d9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    anchor = datetime.date(*x['anchor'])
    lo = datetime.date(x['year'], 1, 1)
    hi = datetime.date(x['year'], 12, 31)
    off = (lo - anchor).days
    k = -(-off // x['step'])
    first = anchor + datetime.timedelta(days=k * x['step'])
    count = (hi - first).days // x['step'] + 1
    periods = 26 if x['step'] == 14 else 52
    return [count, first.isoformat(), count > periods]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('partial-repair probe (boundary)', {'anchor': [2026, 1, 1], 'step': 14, 'year': 2026}, [27, '2026-01-01', True]), ('partial-repair probe', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('partial-repair probe', {'anchor': [2024, 10, 14], 'step': 7, 'year': 2024}, [53, '2024-01-01', True]), ('partial-repair probe', {'anchor': [2021, 1, 17], 'step': 14, 'year': 2023}, [27, '2023-01-01', True]), ('additional oracle (boundary)', {'anchor': [2020, 12, 31], 'step': 14, 'year': 2020}, [27, '2020-01-02', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False])], [('regression', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('partial-repair probe', {'anchor': [2019, 8, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('partial-repair probe', {'anchor': [2025, 3, 13], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle (boundary)', {'anchor': [2024, 1, 5], 'step': 14, 'year': 2024}, [26, '2024-01-05', False]), ('additional oracle', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False])], [('regression', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('partial-repair probe', {'anchor': [2024, 10, 27], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2018, 3, 28], 'step': 14, 'year': 2020}, [27, '2020-01-01', True]), ('additional oracle', {'anchor': [2023, 8, 10], 'step': 14, 'year': 2024}, [26, '2024-01-11', False]), ('additional oracle', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False])], [('regression', {'anchor': [2020, 3, 23], 'step': 14, 'year': 2020}, [26, '2020-01-13', False]), ('regression', {'anchor': [2019, 7, 21], 'step': 7, 'year': 2020}, [52, '2020-01-05', False]), ('partial-repair probe', {'anchor': [2021, 5, 2], 'step': 7, 'year': 2023}, [53, '2023-01-01', True]), ('partial-repair probe', {'anchor': [2025, 9, 4], 'step': 7, 'year': 2026}, [53, '2026-01-01', True]), ('additional oracle', {'anchor': [2024, 3, 10], 'step': 14, 'year': 2024}, [26, '2024-01-14', False]), ('additional oracle', {'anchor': [2021, 6, 11], 'step': 7, 'year': 2023}, [52, '2023-01-06', False]), ('additional oracle', {'anchor': [2021, 6, 20], 'step': 14, 'year': 2023}, [27, '2023-01-01', True])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), 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 (boundary) 0[27, '2020-01-02', True][27, '2020-01-02', True]Passed
regression (boundary) 1[26, '2024-01-05', False][26, '2024-01-05', False]Passed
partial-repair probe (boundary) 2[27, '2026-01-01', True][27, '2026-01-01', True]Passed
partial-repair probe 3[27, '2023-01-01', True][27, '2023-01-01', True]Passed
additional oracle 4[26, '2024-01-11', False][26, '2024-01-11', False]Passed
additional oracle 5[26, '2024-01-14', False][26, '2024-01-14', False]Passed
additional oracle 6[26, '2020-01-13', False][26, '2020-01-13', False]Passed

SHA-256 / 75890b16fa91057aa29f651cc6a7dcfb1d2f735346e9bc8d0a0b2ee474ecd7b6

Verification & scope

A deterministic teaching model of a stipulated payroll rule with toy thresholds and rates. It makes no claim of conformance to any tax authority, statute or jurisdiction and is not payroll software. 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:34.168441+00:00.

Case digest / 1094cbe5f3ac9b80be901399f103c16e3e4a8ec805a5b15a8a8350273a8137af