feat(engine,rivetkit): align local dev with envoy-mode design#4653
feat(engine,rivetkit): align local dev with envoy-mode design#4653brittianwarner wants to merge 1 commit into04-14-break_this_up_wip_patchesfrom
Conversation
|
This PR was not deployed automatically as @brittianwarner does not have access to the Railway project. In order to get automatic PR deploys, please add @brittianwarner to your workspace on Railway. |
PR Review: feat(engine,rivetkit): align local dev with envoy-mode designOverviewThis PR renames Breaking Changes Not Called Out
Specific Issues1. Broken inspector URL when When running in envoy mode with no HTTP server, 2. Duplicated mode-resolution logic The 3. Signal-handler accumulation in If 4. Duplicate error for production without endpoint A Zod 5. The 6. Hardcoded The suffix is hardcoded in both 7. When Minor
SummaryThe rename from |
Preview packages published to npmInstall with: npm install rivetkit@pr-4653All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-7179278
docker pull rivetdev/engine:full-7179278Individual packagesnpm install rivetkit@pr-4653
npm install @rivetkit/react@pr-4653
npm install @rivetkit/rivetkit-native@pr-4653
npm install @rivetkit/workflow-engine@pr-4653 |
Implements Nathan's envoy-mode dev architecture in rivetkit while keeping
all engine-side changes out of scope (reverted from earlier attempt).
## Decision matrix (enforced at schema + start())
| Default (dev) | NODE_ENV=prod | mode=envoy override
spawn_engine | y | error if no | n
| | RIVET_ENDPOINT|
mode | envoy | serverless | envoy
Localdev always uses envoy unless the user explicitly sets
`runtime.mode`. RIVET_ENDPOINT alone does NOT flip to serverless in dev
— an envoy-mode app can still connect to a remote engine.
## Config shape: discriminated `runtime` block
Per Nathan's sketch, mode-specific config lives inside `runtime`:
setup({
use: { counter },
runtime: { mode: "envoy", spawnEngine: true, poolName: "..." }
})
// OR
setup({
use: { counter },
runtime: {
mode: "serverless",
configurePool: { url: "..." },
publicEndpoint: "...",
}
})
TypeScript narrows available fields per mode — a serverless-only field
like `configurePool` is a type error inside `mode: "envoy"`, and vice
versa. Legacy top-level `serverless`/`envoy` blocks are kept as
`@deprecated` back-compat; the transform normalizes runtime → legacy so
every existing downstream reader of `config.serverless.*` /
`config.envoy.*` keeps working unchanged.
## manager → http rename
58 identifiers renamed across the rivetkit package per Nathan's TODO:
`serveManager` → `serveHttp`, `managerPort` → `httpPort`,
`managerHost` → `httpHost`, `managerBasePath` → `httpBasePath`,
`configuredManagerPort` → `configuredHttpPort`. Prose updated in
comments, log messages, and landing pages. Actor-internal
Manager classes (ConnectionManager, QueueManager, etc.) left untouched —
unrelated to the HTTP router concept.
## Operational fixes
* `runtime/index.ts` + `serverless/configure.ts` — `ensureLocalRunnerConfig`
and `configureServerlessPool` now register both the main pool and the
native-DB pool (`${poolName}-native-db`). Fixes `actor_ready_timeout`
for any actor using `rivetkit/db` whose native envoy couldn't register
with the engine.
* `src/engine-process/mod.ts` — install exit/SIGINT/SIGTERM/SIGHUP
handlers that SIGTERM the spawned engine child. Prevents orphaned
engine processes across `tsx --watch` restarts that used to hold
port 6420 and confuse the next dev run.
* `src/common/websocket.ts` — add `/* @vite-ignore */` to the dynamic
`ws` import so Vite stops warning about unresolvable dynamic imports
in browser builds.
* `src/test/mod.ts` — DTS type cast for `closable` (fixes `tsup`
DTS build: `closeIdleConnections` / `closeAllConnections` exist on
`http.Server` but not `Http2Server`).
* `src/inspector/utils.ts` — `getInspectorUrl` prefers the engine
endpoint so the banner's Inspector line reads 6420 (where the engine
serves `/ui/` natively) even when a legacy manager port is reported.
* `src/registry/config/index.ts` — `httpPort` default 6420 → 8080 so it
never collides with the engine's fixed port 6420.
* `runtime/index.ts` — `#printWelcome` computes the inspector URL even
when no HTTP server is running (envoy-mode dev case).
## Engine-side: unchanged
Earlier experiment extending engine's `/metadata` to emit registry
info is fully reverted per Nathan's feedback. Client SDKs work against
the engine's minimal `/metadata` response because the client only
consumes `clientEndpoint` and logs `runtime`/`version` — all other
fields are optional at runtime.
## Outstanding TODOs (Nathan-owned)
* remove "runner" terminology codebase-wide
* dispatch `registry.start()` to `startServerless` when mode=serverless
(currently warns and proceeds as envoy — requires access to user's
HTTP framework for auto-mount)
* collapse legacy `config.serverless.*` / `config.envoy.*` reads into
`config.runtime.*` throughout the codebase, then delete the
`@deprecated` schema blocks
* mounting-router setup for dev & prod (TBD)
ee1c9b3 to
1bb26f5
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: