- docs/using-d1.md and docs/using-cron.md for module authors - architecture, codebase-summary, adding-a-module, code-standards, deployment-guide refreshed - CLAUDE.md module contract shows optional crons[] and sql in init - docs/todo.md tracks manual follow-ups (D1 UUID, first deploy, smoke tests)
1.7 KiB
TODO
Manual follow-ups after the D1 + Cron infra rollout (plan: plans/260415-1010-d1-cron-infra/).
Pre-deploy (required before next npm run deploy)
-
Create the D1 database:
npx wrangler d1 create miti99bot-dbCopy the returned UUID.
-
Replace
REPLACE_ME_D1_UUIDinwrangler.toml([[d1_databases]]→database_id) with the real UUID. -
Commit
wrangler.tomlwith the real UUID (the ID is not a secret).
First deploy verification
-
Run
npm run db:migrate -- --dry-run— confirm it listssrc/modules/trading/migrations/0001_trades.sqlas pending. -
Run
npm run deploy— chain iswrangler deploy→npm run db:migrate→npm run register. -
Verify in Cloudflare dashboard:
- D1 database
miti99bot-dbshowstrading_trades+_migrationstables - Worker shows a cron trigger
0 17 * * *
- D1 database
Post-deploy smoke tests
-
Send
/buy VNM 10 80000(or whatever the real buy syntax is) via Telegram, then/history— expect 1 row. -
Manually fire the cron to verify retention:
npx wrangler dev --test-scheduled # in another terminal: curl "http://localhost:8787/__scheduled?cron=0+17+*+*+*"Check logs for
trim-tradesoutput.
Nice-to-have (not blocking)
-
End-to-end test of
wrangler dev --test-scheduleddocumented with real output snippet indocs/using-cron.md. -
Decide on migration rollback story (currently forward-only). Either document "write a new migration to undo" explicitly, or add a
down/convention. -
Tune
trim-tradesschedule if 17:00 UTC conflicts with anything — currently chosen as ~00:00 ICT. -
Consider per-environment D1 (staging vs prod) if a staging bot is added later.