Repository navigation
feat(test): run dev-mode tests under the real alchemy dev sidecar topology - #1010
Merged
Merged
Conversation
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/a603ce0@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/a603ce0@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/a603ce0 |
… topology by default
Test.make({ dev: true }) now installs the RpcProviderProxy sidecar topology
the alchemy dev CLI uses, so dev tests can no longer pass in-process while
the real dev path is broken (#1007). Flipping the default surfaced and fixes
two real dev bugs: RPC success values dropping Redacted secrets, and D1's
plain local provider needing workerd services in the main process (now
RPC-backed in the sidecar like its peers). Adds a true alchemy dev CLI e2e
to examples/cloudflare-dev covering every local binding.
Co-authored-by: Cursor <cursoragent@cursor.com>
sam-goodwin
force-pushed
the
test/dev-sidecar-default
branch
from
August 1, 2026 05:41
1df3b53 to
56abfbe
Compare
…t in runMain teardown The platform runMain only force-exits on failure or signal; a successful deploy/destroy lingered ~100s while Cloudflare API keep-alive sockets pinned the event loop. Teardown now always exits once finalizers have run (same pattern as the alchemy-test CLI). Co-authored-by: Cursor <cursoragent@cursor.com>
…rvers don't orphan The node-utils lockfile registers an exit-hook at import time whose SIGTERM handler calls process.exit synchronously, preempting the Effect finalizers that kill CommandExecutor children — on node sidecars this orphaned every Command.Dev process. Register a sync exitHook per spawn that kills the child's process group (the same pattern RpcSpawner uses), unregistered on normal scoped teardown. Extracts killProcessGroup into a shared util. Co-authored-by: Cursor <cursoragent@cursor.com>
- long-running.cjs prints a localhost URL so Dev's 5s URL-readiness budget resolves immediately in lifecycle tests (42s -> 12s) - RpcServer.test.ts runs its runtimes concurrently so the two ~10s parent-connect timeout tests overlap (21s -> 11s) Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dev-mode tests now run local providers behind the same
RpcProviderProxysidecar topology the realalchemy devcommand uses — by default. In-process dev tests masked missing main-process lifecycle dependencies (#1007 shipped broken because onlyTest.makewas ever exercised), and flipping the default immediately surfaced two more real dev bugs, fixed here.Test/Core.ts:sidecaroption defaults to the resolveddevflag. Fully lazy — only a thin proxy facade is installed; the spawner HTTP server starts (and a sidecar child forks) on the first provider session request, so dev files that never build an RPC-backed provider start no processes. One sidecar per file, in its own scope (mid-filedestroy(Stack)closes the shared scope and must not kill it), closed by the adapters' final cleanup hook. All three adapters (alchemy-test, Bun, Vitest) wired.Local/RpcSerialization.ts(dev bug feat: remove most HKTs and simplify types #1): RPC success values now get the sameRedacted/Outputmarker treatment as args. Previously a provider returning attributes containing aRedacted(e.g. a local container's bound env with a minted API token) crashed the sidecar response withTypeError: Cannot serialize value: <redacted>underalchemy dev.Cloudflare/D1/Database.ts(dev bug chore: add README #2, the Local D1 migrations and imports fail in dev: missing cloudflare-runtime/Runtime #1007/fix(cloudflare): provide runtime for local D1 migrations #1009 follow-up): the local provider is now RPC-backed (RpcProvider.effect+ registered in the sidecar entry), so its migration/import lifecycle runs wherelocalRuntimeServices()is real — the explicitlocalD1GatewayRuntimeprovides from fix(cloudflare): provide runtime for local D1 migrations #1009 are removed. In-process (no proxy) still works via the un-gated dual layer and is pinned by a new regression test.examples/cloudflare-dev/test/dev.test.ts: a truealchemy devCLI e2e — spawns the actual CLI (spawner → exec child → provider sidecars), parses the stack outputs, and drives every local binding over HTTP: assets, vars/secrets,self_url, Durable Object, R2, D1 with./migrationsapplied through the real dev path, Queue + Consumer, wasm, Effect-style KV, Workflow to completion, and the sandbox container. Teardown delivers Ctrl-C to the process group and destroys the isolateddev-cli-teststage.test/Local/TestSidecar.test.ts: pins the harness contract (dev: true⇒ proxy installed,sidecar: false⇒ not) — sidecar tests would silently pass in-process if the flag wiring regressed, so this is the only guard.http://localhostdev-marker assertions;Command/Dev.test.ts's typed-CommandErrortest is pinnedsidecar: false(typed errors flatten to defects across the RPC boundary, same as real dev).Verified:
bun tsc -bclean; 50/50 across the 15 dev-mode suites, Container dev matrix 6/6 (previously failing 4 on the Redacted bug), and the CLI e2e passes with 19 assertions and a clean process tree.Pre-existing, unrelated:
test/Local/RpcSpawnerCleanup.test.ts > DevServer child dies after parent receives SIGTERMflakes on unmodifiedmain(verified via stash) — worth a separate look.