Skip to content

Commit e076665

Browse files
Mark LTakhoffman
andauthored
test(cron): add Asia/Shanghai year-regression coverage [AI-assisted] (#30565) thanks @liuxiaopai-ai
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: liuxiaopai-ai <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent 65e13c7 commit e076665

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Docs: https://docs.openclaw.ai
181181
- Memory/Hybrid recall: when strict hybrid scoring yields no hits, preserve keyword-backed matches using a text-weight floor so freshly indexed lexical canaries no longer disappear behind `minScore` filtering. (#29112) Thanks @ceo-nada.
182182
- Android/Notifications auth race: return `NOT_AUTHORIZED` when `POST_NOTIFICATIONS` is revoked between authorization precheck and delivery, instead of returning success while dropping the notification. (#30726) Thanks @obviyus.
183183
- Cron/Reminder session routing: preserve `job.sessionKey` for `sessionTarget="main"` runs so queued reminders wake and deliver in the originating scoped session/channel instead of being forced to the agent main session.
184+
- Cron/Timezone regression guard: add explicit schedule coverage for `0 8 * * *` with `Asia/Shanghai` to ensure `nextRunAtMs` never rolls back to a past year and always advances to the next valid occurrence. (#30351)
184185
- Agents/Sessions list transcript paths: resolve `sessions_list` `transcriptPath` via agent-aware session path options and ignore combined-store sentinel paths (`(multiple)`) so listed transcript paths always point to the state directory. (#28379) Thanks @fafuzuoluo.
185186
- Podman/Quadlet setup: fix `sed` escaping and UID mismatch in Podman Quadlet setup. (#26414) Thanks @KnHack and @vincentkoc.
186187
- Browser/Navigate: resolve the correct `targetId` in navigate responses after renderer swaps. (#25326) Thanks @stone-jin and @vincentkoc.

src/cron/schedule.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ describe("cron schedule", () => {
1313
expect(next).toBe(Date.parse("2025-12-17T17:00:00.000Z"));
1414
});
1515

16+
it("does not roll back year for Asia/Shanghai daily cron schedules (#30351)", () => {
17+
// 2026-03-01 08:00:00 in Asia/Shanghai
18+
const nowMs = Date.parse("2026-03-01T00:00:00.000Z");
19+
const next = computeNextRunAtMs(
20+
{ kind: "cron", expr: "0 8 * * *", tz: "Asia/Shanghai" },
21+
nowMs,
22+
);
23+
24+
// Next 08:00 local should be the following day, not a past year.
25+
expect(next).toBe(Date.parse("2026-03-02T00:00:00.000Z"));
26+
expect(next).toBeGreaterThan(nowMs);
27+
expect(new Date(next ?? 0).getUTCFullYear()).toBe(2026);
28+
});
29+
1630
it("throws a clear error when cron expr is missing at runtime", () => {
1731
const nowMs = Date.parse("2025-12-13T00:00:00.000Z");
1832
expect(() =>

0 commit comments

Comments
 (0)