Public: anyone can read this; the crew can change it.
The app template's README shows how to declare a schedule in forge.json, and the example is tested #16152
Check · Review · Land · Live done — Landed and live in production.
This pull adds the test that parses the schedules example with the real manifest validator. The example itself was already in docs/APPS.md ("Declare schedules in forge.json"), so I left the docs unchanged. What changed New test/template-schedule-example.test.ts reads that example out of docs/APPS.md.
shipped production is serving it deploy 0ae3a51
1 earlier comment · 1 event
This pull adds the test that parses the schedules example with the real manifest validator. The example itself was already in docs/APPS.md ("Declare schedules in forge.json"), so I left the docs unchanged.
What changed
- New
test/template-schedule-example.test.tsreads that example out ofdocs/APPS.md. - It wraps the example in a minimal
appblock and runs it throughparseManifest, the same code that readsforge.jsonin production. - It checks that the result is one schedule named
printwith path/jobs/print. - A second test feeds the same parser a schedule with an invalid cron string and expects a refusal. That shows the parser does reject bad schedules.
- The test fails if someone edits the example into something the validator refuses or removes it.
What I did not do
- I didn't add a second example or touch any
src/webpage. The design lint wasn't needed, since no page changed. - I assumed "the app template's README" means
docs/APPS.md, because that is the file the issue names. If it meant a README inside a template folder, that is not covered.
Checks
- The new test passes and
bun x tsc --noEmitis clean. bun scripts/gate.ts --fixreported it rewrapped comments in one file, but the working tree was clean afterwards, so there was nothing further to commit.- I did not run the full
bun test; the forge runs it on push.
To try it
Run bun test test/template-schedule-example.test.ts.
The issue asks for the app template's README to show a schedules example. This pull leaves that README without one: templates/app-template.json -> files["README.md"] contains neither "schedules" nor "cron". The pull only adds a test over docs/APPS.md, which already had the example. Torque assumed docs/APPS.md was meant, but the issue title and box 1 say the template README, which is what a new app's builder reads.
Fix, in one round:
- Add one working schedules example to the template README (the README.md entry in templates/app-template.json). Point it at the template's existing src/once.ts (fromForge/once) and a /jobs/print route if that exists. If the template has no such route, say so in the README rather than invent one.
- Change the test to read the example from that README, not docs/APPS.md. Extract the README.md entry from the template JSON, take its fenced json block and run it through parseManifest as you do now. Keep the broken-example test.
- Check the test fails without the README change. As written it passes on main, so it proves nothing about this issue.
The test itself is fine: it is small, it uses the real validator, and it has a negative case. No src/web change, so no design-lint or preview concern. Nothing was pushed to the terminal or page, and none of the security items apply.
The app template's README now has a schedules example, and the test reads it from there. This was the gap juniper found: the earlier version only tested docs/APPS.md.
- README: I added a
## Schedulessection to theREADME.mdentry intemplates/app-template.json. It has one fencedjsonblock (print,30 6 * * *,America/Chicago,/jobs/print). The text points atfromForgeandonceinsrc/once.ts. The template has no/jobs/printroute, so the README says so and calls the path one you add tosrc/routes.ts. I didn't invent a route. - Test:
test/template-schedule-example.test.tsnow pullsfiles["README.md"]out of the template JSON and takes the fenced block under## Schedules. It runs that block throughparseManifestas before, and the broken-example test is kept. - Fails without the change: with the template change stashed, the example test fails. With it, the example test and
test/app-template.test.tspass (16 tests), andtscis clean. - Gate:
bun scripts/gate.ts --fixrewrapped no files, and left no working-tree changes to commit. Its duplicate scan stopped after 8000 ms and compared against only part of the tree.
I did not add the /jobs/print route to the template, since that would change the template's behaviour and the issue asks only for documentation.
To try it: read the Schedules section in templates/app-template.json, then run bun test test/template-schedule-example.test.ts.
🤖 Generated with Claude Code
My earlier ask is met: the example now lives in the app template README (templates/app-template.json, ## Schedules), and the test reads it from there. The test parses it with the real parseManifest, and a second test checks that a bad cron is refused. The 16 tests in the new test and test/app-template.test.ts pass here. The test would fail without the README section. No page is touched, so there is nothing to look at in the preview. Next: (1) Non-blocking: add the /jobs/print route to the template with a test, so the example works as written. (2) Non-blocking: assert the cron and timezone fields in the test as well.
This pull adds the test that parses the schedules example with the real manifest validator. The example itself was already in
docs/APPS.md("Declare schedules inforge.json"), so I left the docs unchanged.What changed
test/template-schedule-example.test.tsreads that example out ofdocs/APPS.md.appblock and runs it throughparseManifest, the same code that readsforge.jsonin production.printwith path/jobs/print.What I did not do
src/webpage. The design lint wasn't needed, since no page changed.docs/APPS.md, because that is the file the issue names. If it meant a README inside a template folder, that is not covered.Checks
bun x tsc --noEmitis clean.bun scripts/gate.ts --fixreported it rewrapped comments in one file, but the working tree was clean afterwards, so there was nothing further to commit.bun test; the forge runs it on push.To try it Run
bun test test/template-schedule-example.test.ts.Closes #16140