fix: land cron tz one-shot handling and prerelease config warnings (#53224) (thanks @RolfHegr)

This commit is contained in:
Peter Steinberger
2026-03-23 19:25:03 -07:00
parent 9aac5582d6
commit 0cbf6d5fed
7 changed files with 78 additions and 17 deletions

View File

@@ -658,6 +658,27 @@ describe("cron cli", () => {
expect(params.schedule.at).toBe("2026-03-23T21:00:00.000Z");
});
it("applies --tz to --at correctly across DST boundaries on cron add", async () => {
await runCronCommand([
"cron",
"add",
"--name",
"tz-at-dst-test",
"--at",
"2026-03-29T01:30:00",
"--tz",
"Europe/Oslo",
"--session",
"isolated",
"--message",
"test",
]);
const params = getGatewayCallParams<{ schedule: { kind: string; at: string } }>("cron.add");
expect(params.schedule.kind).toBe("at");
expect(params.schedule.at).toBe("2026-03-29T00:30:00.000Z");
});
it("sets explicit stagger for cron edit", async () => {
await runCronCommand(["cron", "edit", "job-1", "--cron", "0 * * * *", "--stagger", "30s"]);
@@ -685,6 +706,24 @@ describe("cron cli", () => {
await expectCronEditWithScheduleLookupExit({ kind: "every", everyMs: 60_000 }, ["--exact"]);
});
it("applies --tz to --at for offset-less datetimes on cron edit", async () => {
const patch = await runCronEditAndGetPatch([
"--at",
"2026-03-23T23:00:00",
"--tz",
"Europe/Oslo",
]);
expect(patch?.patch?.schedule).toEqual({
kind: "at",
at: "2026-03-23T22:00:00.000Z",
});
});
it("rejects --tz with --every on cron edit", async () => {
await expectCronCommandExit(["cron", "edit", "job-1", "--every", "10m", "--tz", "UTC"]);
});
it("patches failure alert settings on cron edit", async () => {
callGatewayFromCli.mockClear();