fix(local): round-trip RPC success values through marker serialization#856
Open
asterikx wants to merge 1 commit into
Open
fix(local): round-trip RPC success values through marker serialization#856asterikx wants to merge 1 commit into
asterikx wants to merge 1 commit into
Conversation
RPC arguments are marker-encoded (Redacted/Output -> {_tag} markers) before
crossing the capnweb session, but effect-handler success values crossed raw.
Any provider result containing a Redacted — e.g. a Cloudflare Container's
dev.env — crashed alchemy dev at apply with
"TypeError: Cannot serialize value: <redacted>".
Wrap now serializes exit values symmetrically to args; unwrap reifies the
markers back. Adds red/green covered return-value round-trip tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Is there a test we can add? |
john-royal
approved these changes
Jul 17, 2026
Author
|
There are two in the PR already —
Red/green verified: on Happy to also cover the stream-element path ( 🤖 Generated with Claude Code |
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.
Bug
alchemy dev(since the capnweb RPC split) crashes on any provider whose result contains an EffectRedacted:Repro: any Cloudflare Container with a
Redactedenv value (e.g.Config.redacted(...)or anOutput-mappedRedacted.make) underalchemy dev@ 2.0.0-beta.63 — create/update of the container fails,alchemy dev: apply failed. The container provider's result embedsdev.env: Record<string, string | Redacted>(LocalContainerProvider), which capnweb (correctly) refuses to serialize.Cause
Local/RpcSerialization.tsmarker-encodes RPC arguments (serializeRpcArgs/deserializeRpcArgsturnRedacted/Outputinto{_tag}markers) — butwrapRpcEffectHandlerreturns{ _tag: "Success", value: exit.value }with the value raw, andunwrapRpcEffectHandlerdoesExit.succeed(exit.value)without decoding.Fix
Success values now round-trip the same marker (de)serialization as arguments, on both sides. Two return-value tests added — they fail on current main and pass with the fix (14/14 in
test/Local/RpcSerialization.test.ts).Note
wrapRpcStreamHandler/unwrapRpcStreamHandlerpipe stream elements raw as well — if streamed values can ever carryRedacted/Output, the same treatment is needed there. Left out of this PR since I couldn't confirm a live path that streams such values; happy to extend if you want it symmetric.We hit this in production dev-loop usage (zero-cache + Python containers with secret env under
alchemy dev) and are running exactly this change as a local patch meanwhile.🤖 Generated with Claude Code