Public: anyone can read this; the crew can change it.

forge.json schedules that are malformed are refused at deploy with a message naming the entry and the field #15119

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

main already refuses malformed schedules at deploy; this change makes the message name the entry by its name as well as its index. The new tests and the schedule suites I ran pass (28 tests); tsc and gate.ts are clean. I did not run the full suite or the preview.

Notes

shipped production is serving it deploy 621b196

opened this

main already refuses malformed schedules at deploy; this change makes the message name the entry by its name as well as its index. The new tests and the schedule suites I ran pass (28 tests); tsc and gate.ts are clean. I did not run the full suite or the preview.

What was already there. parseSchedules refuses a bad cron string, a missing path and a duplicate name, and manifest.ts turns that into an invalid manifest. I did not trace the deploy path, so the claim that the app's earlier schedules keep running rests only on a refused manifest never replacing the running one.

What changed. The error line now reads forge.json: schedules[1] ("nightly").cron … when the entry's name is a valid one. The name is echoed only if it matches the name pattern. An invalid name is still reported by index only, so nothing unsafe gets echoed. The change is in src/apps/schedule_spec.ts; what a valid schedule means is untouched.

Tests. test/schedule-spec-refusals.test.ts is new. It covers a bad cron, a missing path, a duplicate name, a bad name, and a valid schedule still parsing. Only the three tests that assert the entry's name in the message would fail without the change.

Left out.

  • The issue's "missing command" has no field to check, because a schedule calls a path and has no command. The missing-path refusal is the equivalent.
  • I added no test of the deploy path keeping the old schedules.

Try it. Put two schedules in forge.json with the same name and deploy. The refusal names schedules[1] ("print").

Closes #15102

1 earlier comment · 1 event
commented

main already refuses malformed schedules at deploy; this change makes the message name the entry by its name as well as its index. The new tests and the schedule suites I ran pass (28 tests); tsc and gate.ts are clean. I did not run the full suite or the preview.

What was already there. parseSchedules refuses a bad cron string, a missing path and a duplicate name, and manifest.ts turns that into an invalid manifest. I did not trace the deploy path, so the claim that the app's earlier schedules keep running rests only on a refused manifest never replacing the running one.

What changed. The error line now reads forge.json: schedules[1] ("nightly").cron … when the entry's name is a valid one. The name is echoed only if it matches the name pattern. An invalid name is still reported by index only, so nothing unsafe gets echoed. The change is in src/apps/schedule_spec.ts; what a valid schedule means is untouched.

Tests. test/schedule-spec-refusals.test.ts is new. It covers a bad cron, a missing path, a duplicate name, a bad name, and a valid schedule still parsing. Only the three tests that assert the entry's name in the message would fail without the change.

Left out.

  • The issue's "missing command" has no field to check, because a schedule calls a path and has no command. The missing-path refusal is the equivalent.
  • I added no test of the deploy path keeping the old schedules.

Try it. Put two schedules in forge.json with the same name and deploy. The refusal names schedules[1] ("print").

Approved

Small, safe, does what it says: the name is echoed only after it matches NAME, so nothing unsafe reaches the message. Not a page change, so nothing to judge on the preview. Two things I would do next: (1) add a test through manifest.ts/deploy that a refused schedules block leaves the previous schedules running, since that claim is still unproven; (2) the duplicate message now reads schedules[1] ("print").name "print" is used twice, so drop the repeated name there.

commented

Left #15102 open: 1 unticked item remain (The app's earlier schedules keep running).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs