DX-2705: feat: eager-start QStash dev server on serve() across all adapters#203
DX-2705: feat: eager-start QStash dev server on serve() across all adapters#203ytkimirti wants to merge 2 commits into
Conversation
- call startDevServer() in all 10 platform adapters - also in nextjs servePagesRouter and express serveMany - derive devMode onto the serve-side Client in multi-region handlers - add dev-server-eager-start unit tests; update multi-region + integration tests - pin @upstash/qstash to CI snapshot for integration testing
|
CI note: the only failing job is Sveltekit Local Build. It fails at the SvelteKit prerender/analyse step with: Root cause: This is a transitional failure tied to the qstash-js release: it will clear once the qstash change (upstash/qstash-js#269) ships as a stable release that |
There was a problem hiding this comment.
Pull request overview
This PR makes local development “just work” by eagerly starting the QStash dev server whenever a workflow route is defined via serve() (and the relevant serveMany()/pages-router variants), and ensures multi-region handler construction respects dev mode derived from adapter-provided environment bindings (e.g. Cloudflare env).
Changes:
- Eager-start the QStash dev server by calling
startDevServer()atserve()factory-call time across adapters and the framework-agnosticsrc/serveentry. - Propagate
devMode(derived from the adapter-provided environment) into the multi-regionClientconstruction so client behavior matches receiver behavior. - Add/adjust tests to pin the eager-start behavior and validate multi-region dev mode + integration reachability.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/serve/index.ts | Calls startDevServer() when serve() is invoked. |
| platforms/astro.ts | Eager-start dev server when Astro serve() defines a route. |
| platforms/cloudflare.ts | Eager-start dev server when Cloudflare serve() defines a route. |
| platforms/express.ts | Eager-start dev server in Express serve() and serveMany(). |
| platforms/h3.ts | Eager-start dev server when H3 serve() defines a route. |
| platforms/hono.ts | Eager-start dev server when Hono serve() defines a route. |
| platforms/nextjs.ts | Eager-start dev server in Next.js app + pages-router serve*() variants. |
| platforms/react-router.ts | Eager-start dev server when React Router serve() defines a route. |
| platforms/solidjs.ts | Eager-start dev server when SolidJS serve() defines a route. |
| platforms/svelte.ts | Eager-start dev server when SvelteKit serve() defines a route. |
| platforms/tanstack.ts | Eager-start dev server when TanStack serve() defines a route. |
| src/serve/dev-server-eager-start.test.ts | New unit test that mocks startDevServer and asserts eager-start across factories. |
| src/serve/multi-region/handlers.ts | Mirrors receiver dev-mode decision onto the constructed QStash Client in multi/single-region paths. |
| src/serve/multi-region/multi-region.test.ts | Adds unit tests that assert serve-side client dev mode is derived from environment bindings. |
| src/serve/multi-region/dev-server-integration.test.ts | Adds an integration assertion that the dev server is reachable immediately after serve() (before any inbound request). |
| package.json | Pins @upstash/qstash to a CI snapshot to access startDevServer. |
| bun.lock | Updates lockfile to match the pinned @upstash/qstash snapshot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const client = new Client({ | ||
| ...clientOptions, | ||
| baseUrl: clientEnv.QSTASH_URL!, | ||
| token: clientEnv.QSTASH_TOKEN!, | ||
| // Mirror the receiver's dev-mode decision so a single QSTASH_DEV=true points |
| routeFunction: RouteFunction<TInitialPayload, TResult>, | ||
| options?: WorkflowServeOptions<TInitialPayload, TResult> | ||
| ): ReturnType<typeof serveBase<TInitialPayload, TRequest, TResponse, TResult>> => { | ||
| void startDevServer(); |
| }, | ||
| "dependencies": { | ||
| "@upstash/qstash": "^2.11.0" | ||
| "@upstash/qstash": "0.0.0-ci.8c658c13532090cf00f778d2216eacbad68f85f9-20260618065901" |
Summary
Eager-starts the QStash dev server whenever
serve()is called, so local dev "just works" without manually running the dev binary.void startDevServer()in all 10 platform adapters (astro, cloudflare, express, h3, hono, nextjs, react-router, solidjs, svelte, tanstack), plusnextjsservePagesRouterandexpressserveMany.devModeonto the serve-sideClientinsrc/serve/multi-region/handlers.tsso the multi-region path respects dev mode.src/serve/dev-server-eager-start.test.ts; updates tomulti-region.test.tsanddev-server-integration.test.ts(the integration test spawns the real dev binary).Dependency
Pins
@upstash/qstashto CI snapshot0.0.0-ci.8c658c13532090cf00f778d2216eacbad68f85f9-20260618065901(which exportsstartDevServer) for integration testing.Depends on / pins the qstash-js CI snapshot from upstash/qstash-js#269. To be repinned to a stable
@upstash/qstashrelease before merge.Local verification
tsc --noEmitcleaneslintcleanbun run buildsucceeds