FAILURE MAP
← Case archive

FA-18356 / Time representation / Open access

Epoch range check mishandles asymmetric signed bounds · case 01

The decoded time state disagrees with the explicit regression oracle for in_range.

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

ROOT CAUSE

Epoch range check mishandles asymmetric signed bounds.

VERIFIED REPAIR

Preserve the declared coordinate and state contract at in_range: in_range = -32768 <= seconds <= 32767.

Unsuccessful approach: The partial correction still substitutes -32768 <= seconds <= 32768 at the same fault site.

Case contract

A clock uses signed 16-bit seconds relative to configurable epoch E and fractional nanoseconds. Source absolute total nanoseconds is exact integer. Convert to canonical seconds/remainder relative to E, mark representability, and serialize biased unsigned seconds word only if in range. Provide saturation coordinate, loss amount, earliest/latest representable total and exact reconstruction.

Why this case matters

Clock transfer and timestamp consumers require preserved coordinate, phase, validity and elapsed-time semantics.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    relative = r['total'] - r['epoch'] * 1000000000
    seconds = relative // 1000000000
    fraction = relative % 1000000000
    in_range = -32767 <= seconds <= 32767
    word = seconds + 32768 if in_range else None
    low = (r['epoch'] - 32768) * 1000000000
    high = (r['epoch'] + 32768) * 1000000000 - 1
    clamped = min(high,max(low,r['total']))
    lost = r['total'] - clamped
    roundtrip = None if word is None else (word - 32768 + r['epoch']) * 1000000000 + fraction
    return [word,fraction,in_range,clamped,lost,[low,high],roundtrip]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'total': 10000000000, 'epoch': 10}), [32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000])
check('fixture 2', solve({'total': 9999999999, 'epoch': 10}), [32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999])
check('fixture 3', solve({'total': -32758000000000, 'epoch': 10}), [0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000])
check('fixture 4', solve({'total': -32758000000001, 'epoch': 10}), [None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None])
check('fixture 5', solve({'total': 32777999999999, 'epoch': 10}), [65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999])
check('fixture 6', solve({'total': 32778000000000, 'epoch': 10}), [None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None])
check('fixture 7', solve({'total': 32777000000000, 'epoch': 10}), [65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000])
check('fixture 8', solve({'total': 0, 'epoch': 10}), [32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0])
check('fixture 9', solve({'total': -1, 'epoch': 10}), [32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1])
check('fixture 10', solve({'total': 12345678901, 'epoch': 10}), [32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901])
variant = [({'total': 10000000001, 'epoch': 10}, [32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]), ({'total': 10000000002, 'epoch': 10}, [32768, 2, True, 10000000002, 0, [-32758000000000, 32777999999999], 10000000002]), ({'total': 10000000003, 'epoch': 10}, [32768, 3, True, 10000000003, 0, [-32758000000000, 32777999999999], 10000000003]), ({'total': 10000000004, 'epoch': 10}, [32768, 4, True, 10000000004, 0, [-32758000000000, 32777999999999], 10000000004]), ({'total': 10000000005, 'epoch': 10}, [32768, 5, True, 10000000005, 0, [-32758000000000, 32777999999999], 10000000005])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][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[32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000][32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000]Passed
fixture 2[32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999][32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999]Passed
fixture 3[None, 0, False, -32758000000000, 0, [-32758000000000, 32777999999999], None][0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000]Failed
fixture 4[None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None][None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None]Passed
fixture 5[65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999][65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999]Passed
fixture 6[None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None][None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None]Passed
fixture 7[65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000][65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000]Passed
fixture 8[32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0][32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0]Passed
fixture 9[32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1][32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1]Passed
fixture 10[32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901][32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901]Passed
variant capture[32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001][32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]Passed

SHA-256 / 21fb4fdd4790f0d978114fba1774a8fb589999b041b24ebab10bf8e5a9bba54e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    relative = r['total'] - r['epoch'] * 1000000000
    seconds = relative // 1000000000
    fraction = relative % 1000000000
    in_range = -32768 <= seconds <= 32768
    word = seconds + 32768 if in_range else None
    low = (r['epoch'] - 32768) * 1000000000
    high = (r['epoch'] + 32768) * 1000000000 - 1
    clamped = min(high,max(low,r['total']))
    lost = r['total'] - clamped
    roundtrip = None if word is None else (word - 32768 + r['epoch']) * 1000000000 + fraction
    return [word,fraction,in_range,clamped,lost,[low,high],roundtrip]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'total': 10000000000, 'epoch': 10}), [32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000])
check('fixture 2', solve({'total': 9999999999, 'epoch': 10}), [32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999])
check('fixture 3', solve({'total': -32758000000000, 'epoch': 10}), [0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000])
check('fixture 4', solve({'total': -32758000000001, 'epoch': 10}), [None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None])
check('fixture 5', solve({'total': 32777999999999, 'epoch': 10}), [65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999])
check('fixture 6', solve({'total': 32778000000000, 'epoch': 10}), [None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None])
check('fixture 7', solve({'total': 32777000000000, 'epoch': 10}), [65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000])
check('fixture 8', solve({'total': 0, 'epoch': 10}), [32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0])
check('fixture 9', solve({'total': -1, 'epoch': 10}), [32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1])
check('fixture 10', solve({'total': 12345678901, 'epoch': 10}), [32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901])
variant = [({'total': 10000000001, 'epoch': 10}, [32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]), ({'total': 10000000002, 'epoch': 10}, [32768, 2, True, 10000000002, 0, [-32758000000000, 32777999999999], 10000000002]), ({'total': 10000000003, 'epoch': 10}, [32768, 3, True, 10000000003, 0, [-32758000000000, 32777999999999], 10000000003]), ({'total': 10000000004, 'epoch': 10}, [32768, 4, True, 10000000004, 0, [-32758000000000, 32777999999999], 10000000004]), ({'total': 10000000005, 'epoch': 10}, [32768, 5, True, 10000000005, 0, [-32758000000000, 32777999999999], 10000000005])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][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[32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000][32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000]Passed
fixture 2[32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999][32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999]Passed
fixture 3[0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000][0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000]Passed
fixture 4[None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None][None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None]Passed
fixture 5[65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999][65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999]Passed
fixture 6[65536, 0, True, 32777999999999, 1, [-32758000000000, 32777999999999], 32778000000000][None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None]Failed
fixture 7[65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000][65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000]Passed
fixture 8[32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0][32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0]Passed
fixture 9[32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1][32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1]Passed
fixture 10[32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901][32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901]Passed
variant capture[32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001][32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]Passed

SHA-256 / 8103be3190443c6a9a5ba03552a85075a33dae3cde14f406381eafa800f3c414

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    relative = r['total'] - r['epoch'] * 1000000000
    seconds = relative // 1000000000
    fraction = relative % 1000000000
    in_range = -32768 <= seconds <= 32767
    word = seconds + 32768 if in_range else None
    low = (r['epoch'] - 32768) * 1000000000
    high = (r['epoch'] + 32768) * 1000000000 - 1
    clamped = min(high,max(low,r['total']))
    lost = r['total'] - clamped
    roundtrip = None if word is None else (word - 32768 + r['epoch']) * 1000000000 + fraction
    return [word,fraction,in_range,clamped,lost,[low,high],roundtrip]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'total': 10000000000, 'epoch': 10}), [32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000])
check('fixture 2', solve({'total': 9999999999, 'epoch': 10}), [32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999])
check('fixture 3', solve({'total': -32758000000000, 'epoch': 10}), [0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000])
check('fixture 4', solve({'total': -32758000000001, 'epoch': 10}), [None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None])
check('fixture 5', solve({'total': 32777999999999, 'epoch': 10}), [65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999])
check('fixture 6', solve({'total': 32778000000000, 'epoch': 10}), [None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None])
check('fixture 7', solve({'total': 32777000000000, 'epoch': 10}), [65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000])
check('fixture 8', solve({'total': 0, 'epoch': 10}), [32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0])
check('fixture 9', solve({'total': -1, 'epoch': 10}), [32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1])
check('fixture 10', solve({'total': 12345678901, 'epoch': 10}), [32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901])
variant = [({'total': 10000000001, 'epoch': 10}, [32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]), ({'total': 10000000002, 'epoch': 10}, [32768, 2, True, 10000000002, 0, [-32758000000000, 32777999999999], 10000000002]), ({'total': 10000000003, 'epoch': 10}, [32768, 3, True, 10000000003, 0, [-32758000000000, 32777999999999], 10000000003]), ({'total': 10000000004, 'epoch': 10}, [32768, 4, True, 10000000004, 0, [-32758000000000, 32777999999999], 10000000004]), ({'total': 10000000005, 'epoch': 10}, [32768, 5, True, 10000000005, 0, [-32758000000000, 32777999999999], 10000000005])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][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[32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000][32768, 0, True, 10000000000, 0, [-32758000000000, 32777999999999], 10000000000]Passed
fixture 2[32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999][32767, 999999999, True, 9999999999, 0, [-32758000000000, 32777999999999], 9999999999]Passed
fixture 3[0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000][0, 0, True, -32758000000000, 0, [-32758000000000, 32777999999999], -32758000000000]Passed
fixture 4[None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None][None, 999999999, False, -32758000000000, -1, [-32758000000000, 32777999999999], None]Passed
fixture 5[65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999][65535, 999999999, True, 32777999999999, 0, [-32758000000000, 32777999999999], 32777999999999]Passed
fixture 6[None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None][None, 0, False, 32777999999999, 1, [-32758000000000, 32777999999999], None]Passed
fixture 7[65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000][65535, 0, True, 32777000000000, 0, [-32758000000000, 32777999999999], 32777000000000]Passed
fixture 8[32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0][32758, 0, True, 0, 0, [-32758000000000, 32777999999999], 0]Passed
fixture 9[32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1][32757, 999999999, True, -1, 0, [-32758000000000, 32777999999999], -1]Passed
fixture 10[32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901][32770, 345678901, True, 12345678901, 0, [-32758000000000, 32777999999999], 12345678901]Passed
variant capture[32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001][32768, 1, True, 10000000001, 0, [-32758000000000, 32777999999999], 10000000001]Passed

SHA-256 / b0d35299e4e9ffeea7edf1e5efe9ca9f741bd0e18617a455fdc1c64ce5539a88

Verification & scope

Deterministic integer reference model with stipulated units and policies; not a complete clock, wire standard or platform implementation. 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:39:56.855186+00:00.

Case digest / 6df046f24e24598af64fe138e3af3cd1f8ed9e6fdf9b5147593a7d9154eab672