test(common): pin the Beijing weekend shift with edge instants - #1114
test(common): pin the Beijing weekend shift with edge instants#1114rekty wants to merge 1 commit into
Conversation
Closes CodebuffAI#1090 The two weekend tests sat at 02:00Z, where the +8h shift and a plain getUTCDay() agree — deleting the shift left the suite green. Export isBeijingWeekend and pin its four edges (Fri 15:00Z/16:00Z, Sun 15:00Z/16:00Z), the only instants where the calendars disagree, so the predicate can no longer silently regress to UTC days.
|
Good catch. The existing weekend tests at 02:00Z sit inside the band where the Beijing shift and a naive The math checks out: 2026-08-28T15:00Z (Fri 23:00 Beijing, weekday) vs 16:00Z (Sat 00:00 Beijing, weekend), and the symmetric Sunday/Monday pair. These are exactly the four instants where a plain UTC day-of-week and the shifted one diverge, so the test can only pass if the Exporting Small, focused, in scope ( |
{
"title": "test(common): pin the Beijing weekend shift with edge instants",
"head": "rekty:fix/pin-beijing-weekend-shift-tests",
"base": "main",
"body": "Closes #1090\n\n## Problem\n\nBoth weekend tests sit at
02:00Z, inside the band where the+8hBeijing shift and a plaingetUTCDay()agree. Deleting the shift leavesdeepseekPricingWindowreturning identical answers for all 168 hours of a week — the suite stays green, and the file only starts lying the day DeepSeek moves a window past 16:00Z.\n\n## Fix\n\n1. ExportisBeijingWeekendfromfreebuff-peak-hours.ts(doc-comment explains why: the weekend band Fri 16:00Z → Sun 16:00Z never overlaps the peak windows, so only the predicate can pin the shift directly).\n2. Add four edge-pinning tests at the exact instants where the two calendars disagree:\n\n| instant | Beijing | weekend |\n|---|---|---|\n|2026-08-28T15:00:00Z| Fri 23:00 | no |\n|2026-08-28T16:00:00Z| Sat 00:00 | yes |\n|2026-08-30T15:00:00Z| Sun 23:00 | yes |\n|2026-08-30T16:00:00Z| Mon 00:00 | no |\n\n## Verification\n\n- All 24 tests in the file pass with the fix in place.\n- Mutation check: removing the+ 8 * 60 * 60 * 1000shift makes exactly the two boundary tests fail (16:00ZFriday and16:00ZSunday), confirming the suite now catches the regression.\n"}