fix(doctor): tolerate invalid cron atMs · openclaw/openclaw@4385e57
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -287,6 +287,35 @@ describe("normalizeStoredCronJobs", () => {
|
287 | 287 | expect(schedule.atMs).toBeUndefined(); |
288 | 288 | }); |
289 | 289 | |
| 290 | +it("leaves Date-invalid legacy atMs for persisted shape validation", () => { |
| 291 | +const { job, result } = normalizeOneJob( |
| 292 | +makeLegacyJob({ |
| 293 | +id: "job-invalid-at", |
| 294 | +schedule: { kind: "at", atMs: 8_700_000_000_000_000 }, |
| 295 | +}), |
| 296 | +); |
| 297 | + |
| 298 | +expect(result.mutated).toBe(true); |
| 299 | +expect(result.issues.invalidSchedule).toBe(1); |
| 300 | +expect(job).toBeUndefined(); |
| 301 | +}); |
| 302 | + |
| 303 | +it("drops Date-invalid legacy atMs when canonical at is valid", () => { |
| 304 | +const at = "2026-04-01T10:00:00.000Z"; |
| 305 | +const { job, result } = normalizeOneJob( |
| 306 | +makeLegacyJob({ |
| 307 | +id: "job-valid-at-invalid-at-ms", |
| 308 | +schedule: { kind: "at", at, atMs: 8_700_000_000_000_000 }, |
| 309 | +}), |
| 310 | +); |
| 311 | + |
| 312 | +const schedule = job.schedule as Record<string, unknown>; |
| 313 | +expect(result.mutated).toBe(true); |
| 314 | +expect(result.issues.invalidSchedule).toBeUndefined(); |
| 315 | +expect(schedule.at).toBe(at); |
| 316 | +expect(schedule.atMs).toBeUndefined(); |
| 317 | +}); |
| 318 | + |
290 | 319 | it("preserves stored custom session targets", () => { |
291 | 320 | const { job } = normalizeOneJob( |
292 | 321 | makeLegacyJob({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。