{ "$schema": "node_modules/wrangler/config-schema.json", "main": "./src/server.ts", "name": "openstory", // Newest date workerd@1.20261001.1 (wrangler 4.147.0) will start. // A later date refuses to boot local dev and e2e. Still includes the // 2026-08-04 Node.js default and the 2026-10-01 Durable Object I/O // change. Production and test inherit it. Review: docs/deployment/cloudflare.md (#1999). "compatibility_date": "2026-10-08", // vite-plugin 1.67 emits Worker sourcemaps by default; ours exceed Cloudflare's 60 MiB cap (#2318). "upload_source_maps": false, // nodejs_compat is redundant at this date (Wrangler ignores it) and stays // so the intent is visible. enable_request_signal has no default date: // realtime closes its upstream DO streams on request.signal abort, and // without it disconnected SSE clients leave subscriptions and heartbeat // timers alive. Inherited by production/test. "compatibility_flags": ["nodejs_compat", "enable_request_signal"], "triggers": { // Sweep stuck generating-status rows every 5 minutes (#727) and refresh // the model_pricing table daily (#1069 — the expression must match // FAL_PRICING_CRON in src/billing/server/refresh-fal-pricing.ts). Hourly at // :53, diff this deployment's BytePlus asset group against the ledger // (#1519 — BYTEPLUS_ASSETS_RECONCILE_CRON). Production's same tick also // deletes leftover `openstory-virtual-pr-*` groups whose PRs are closed // (#1635). "crons": ["*/5 * * * *", "17 3 * * *", "37 * * * *", "53 * * * *"], }, "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "enabled": true, "head_sampling_rate": 1, "persist": true, // Disabled: redundant with our LogTape middleware (see // src/platform/middleware.fn.ts loggerMiddleware) which already emits // per-serverFn timing/outcome. The CF-emitted "fetch OK" / "GET OK" // lines flooded the dashboard with empty headlines. "invocation_logs": false, }, "traces": { "enabled": true, "persist": true, "head_sampling_rate": 1, }, }, // ───────────────────────────────────────────────────────────────────────── // DEFAULT env = local dev. The D1 here uses a placeholder `database_id` so // it can ONLY resolve to a local Miniflare D1 — there is no real Cloudflare // D1 with this id. If @cloudflare/vite-plugin ever auto-promotes a binding // to remote (it has done in the past with `remoteBindings` defaulting to // true), the request would 404 against Cloudflare rather than silently // writing to production. // // PROD D1 lives in [env.production] below. Prod builds MUST set // CLOUDFLARE_ENV=production (a Workers Builds build env var; see // docs/deployment/cloudflare.md) and the migrate step MUST pass // `--env=production` (wired in the `deploy:production` package script). // PR-preview deploys patch this default block in CI before deploying. // ───────────────────────────────────────────────────────────────────────── "d1_databases": [ { "binding": "DB", "database_name": "openstory-dev", "database_id": "dev-local-d1", // Flat *.sql rendering of drizzle/migrations (which nests files as //