FA-76011 / Chat ordering and read receipts / Open access
Insert local day separators into a message list: today in local zone · case 01
Shortly after local midnight the current day is labelled "Yesterday" because "today" is computed in UTC.
ROOT CAUSE
The today in local zone decision evaluates `today = now // 86400` where the contract requires `today = local_day(now)`.
VERIFIED REPAIR
Use `today = local_day(now)` for the today in local zone decision and keep every other rule of the model unchanged.
Unsuccessful approach: Applying the offset only for eastern zones keeps the bug for viewers west of UTC. The attempted `today = local_day(now) if offset_min >= 0 else now // 86400` still disagrees with a fixture.
Case contract
stamps are ascending unix seconds; offset_min is the viewer's UTC offset in minutes. A separator [index, label] precedes the first message of each local calendar day: "Today" for the local day containing now, "Yesterday" for the one before, otherwise the ISO local date.
Why this case matters
Day headers anchor chat history in time; zone mistakes split or merge days around midnight.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date, timedelta
N = 1
observations = []
def solve(stamps, offset_min, now):
def local_day(t):
return (t + offset_min * 60) // 86400
today = now // 86400
out = []
prev = None
for i, t in enumerate(stamps):
d = local_day(t)
if d != prev:
if d == today:
label = 'Today'
elif d == today - 1:
label = 'Yesterday'
else:
label = str(date(1970, 1, 1) + timedelta(days=d))
out.append([i, label])
prev = d
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('east of UTC late evening', ([8712000, 8722800], 330, 9072001), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144060), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449601), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355001), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055201), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592201), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 1), [])], 2: [('east of UTC late evening', ([8712000, 8722800], 330, 9072002), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144120), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449602), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355002), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055202), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592202), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 2), [])], 3: [('east of UTC late evening', ([8712000, 8722800], 330, 9072003), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144180), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449603), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355003), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055203), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592203), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 3), [])], 4: [('east of UTC late evening', ([8712000, 8722800], 330, 9072004), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144240), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449604), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355004), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055204), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592204), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 4), [])], 5: [('east of UTC late evening', ([8712000, 8722800], 330, 9072005), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144300), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449605), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355005), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055205), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592205), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160, 605220], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 5), [])]}
for _label, _args, _expected in _CASES[N]:
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 |
|---|---|---|---|
| east of UTC late evening | [[0, '1970-04-12']] | [[0, '1970-04-12']] | Passed |
| west of UTC early morning | [[0, '1970-07-19'], [1, '1970-07-20']] | [[0, '1970-07-19'], [1, '1970-07-20']] | Passed |
| today and yesterday | [[0, 'Yesterday'], [1, 'Today']] | [[0, 'Yesterday'], [1, 'Today']] | Passed |
| east of UTC after local midnight | [[0, '1970-03-04']] | [[0, 'Today']] | Failed |
| west of UTC before local midnight | [[0, 'Yesterday']] | [[0, 'Today']] | Failed |
| skewed future message | [[0, 'Today'], [1, '1970-02-01']] | [[0, 'Today'], [1, '1970-02-01']] | Passed |
| many messages one day | [[0, '1970-01-08']] | [[0, '1970-01-08']] | Passed |
| empty | [] | [] | Passed |
SHA-256 / 00cb46f9a603cba1506d97aa93d2d30281c32ca79dadd878ca41aebcb46541bd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date, timedelta
N = 1
observations = []
def solve(stamps, offset_min, now):
def local_day(t):
return (t + offset_min * 60) // 86400
today = local_day(now) if offset_min >= 0 else now // 86400
out = []
prev = None
for i, t in enumerate(stamps):
d = local_day(t)
if d != prev:
if d == today:
label = 'Today'
elif d == today - 1:
label = 'Yesterday'
else:
label = str(date(1970, 1, 1) + timedelta(days=d))
out.append([i, label])
prev = d
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('east of UTC late evening', ([8712000, 8722800], 330, 9072001), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144060), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449601), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355001), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055201), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592201), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 1), [])], 2: [('east of UTC late evening', ([8712000, 8722800], 330, 9072002), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144120), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449602), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355002), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055202), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592202), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 2), [])], 3: [('east of UTC late evening', ([8712000, 8722800], 330, 9072003), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144180), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449603), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355003), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055203), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592203), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 3), [])], 4: [('east of UTC late evening', ([8712000, 8722800], 330, 9072004), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144240), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449604), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355004), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055204), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592204), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 4), [])], 5: [('east of UTC late evening', ([8712000, 8722800], 330, 9072005), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144300), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449605), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355005), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055205), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592205), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160, 605220], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 5), [])]}
for _label, _args, _expected in _CASES[N]:
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 |
|---|---|---|---|
| east of UTC late evening | [[0, '1970-04-12']] | [[0, '1970-04-12']] | Passed |
| west of UTC early morning | [[0, '1970-07-19'], [1, '1970-07-20']] | [[0, '1970-07-19'], [1, '1970-07-20']] | Passed |
| today and yesterday | [[0, 'Yesterday'], [1, 'Today']] | [[0, 'Yesterday'], [1, 'Today']] | Passed |
| east of UTC after local midnight | [[0, 'Today']] | [[0, 'Today']] | Passed |
| west of UTC before local midnight | [[0, 'Yesterday']] | [[0, 'Today']] | Failed |
| skewed future message | [[0, 'Today'], [1, '1970-02-01']] | [[0, 'Today'], [1, '1970-02-01']] | Passed |
| many messages one day | [[0, '1970-01-08']] | [[0, '1970-01-08']] | Passed |
| empty | [] | [] | Passed |
SHA-256 / de8b2a0a9ae4e92d1bc0834356eef3e43751edf39ec57942134b0981e12b2a79
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date, timedelta
N = 1
observations = []
def solve(stamps, offset_min, now):
def local_day(t):
return (t + offset_min * 60) // 86400
today = local_day(now)
out = []
prev = None
for i, t in enumerate(stamps):
d = local_day(t)
if d != prev:
if d == today:
label = 'Today'
elif d == today - 1:
label = 'Yesterday'
else:
label = str(date(1970, 1, 1) + timedelta(days=d))
out.append([i, label])
prev = d
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('east of UTC late evening', ([8712000, 8722800], 330, 9072001), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144060), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449601), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355001), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055201), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592201), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 1), [])], 2: [('east of UTC late evening', ([8712000, 8722800], 330, 9072002), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144120), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449602), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355002), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055202), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592202), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 2), [])], 3: [('east of UTC late evening', ([8712000, 8722800], 330, 9072003), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144180), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449603), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355003), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055203), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592203), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 3), [])], 4: [('east of UTC late evening', ([8712000, 8722800], 330, 9072004), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144240), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449604), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355004), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055204), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592204), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 4), [])], 5: [('east of UTC late evening', ([8712000, 8722800], 330, 9072005), [[0, '1970-04-12']]), ('west of UTC early morning', ([17287200, 17301600], -300, 18144300), [[0, '1970-07-19'], [1, '1970-07-20']]), ('today and yesterday', ([4402800, 4442400, 4446000], 0, 4449605), [[0, 'Yesterday'], [1, 'Today']]), ('east of UTC after local midnight', ([5350200], 120, 5355005), [[0, 'Today']]), ('west of UTC before local midnight', ([6051600], -300, 6055205), [[0, 'Today']]), ('skewed future message', ([2592100, 2678500], 0, 2592205), [[0, 'Today'], [1, '1970-02-01']]), ('many messages one day', ([604800, 604860, 604920, 604980, 605040, 605100, 605160, 605220], 60, 777600), [[0, '1970-01-08']]), ('empty', ([], 0, 5), [])]}
for _label, _args, _expected in _CASES[N]:
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 |
|---|---|---|---|
| east of UTC late evening | [[0, '1970-04-12']] | [[0, '1970-04-12']] | Passed |
| west of UTC early morning | [[0, '1970-07-19'], [1, '1970-07-20']] | [[0, '1970-07-19'], [1, '1970-07-20']] | Passed |
| today and yesterday | [[0, 'Yesterday'], [1, 'Today']] | [[0, 'Yesterday'], [1, 'Today']] | Passed |
| east of UTC after local midnight | [[0, 'Today']] | [[0, 'Today']] | Passed |
| west of UTC before local midnight | [[0, 'Today']] | [[0, 'Today']] | Passed |
| skewed future message | [[0, 'Today'], [1, '1970-02-01']] | [[0, 'Today'], [1, '1970-02-01']] | Passed |
| many messages one day | [[0, '1970-01-08']] | [[0, '1970-01-08']] | Passed |
| empty | [] | [] | Passed |
SHA-256 / 2d1bba23be0cda4bfe97be3269edb778eb4cd20321bb17d200d1221ddc34c65a
Verification & scope
Stipulated offline chat model; not a complete messaging protocol, client or server 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:49:12.199989+00:00.
Case digest / 6ab3352a2b060c5704732389efd59ee4a4d4504af9102cb69880c6101dbecd8e