Skip to content

fix: preserve unknown RPC return types - #7168

Open
nanookclaw wants to merge 3 commits into
cloudflare:mainfrom
nanookclaw:fix/rpc-unknown-result
Open

nanookclaw wants to merge 3 commits into
cloudflare:mainfrom
nanookclaw:fix/rpc-unknown-result

Conversation

@nanookclaw

Copy link
Copy Markdown

Summary

Fixes #5200.

Rpc.Result<R> currently falls through to never when R is unknown. The same failure affects concrete object types containing unknown fields, such as { bar: unknown[] }, even though those values can be carried over the RPC boundary.

This adds an unknown extends T branch to Serializable<T>. The guard accepts unknown only when it is the type being checked; known types continue through the existing recursive serializability checks. Existing rejection of known non-serializable values, including ReadableStream<string>, is preserved. Type-level coverage now exercises both the top-level and nested-unknown cases.

Verification

  • git diff --check
  • Focused TypeScript sanity checks against the exact RPC definitions, covering unknown acceptance and ReadableStream<string> rejection.
  • The full Bazel type target was not run because this checkout environment has no Bazel binary or installed repository dependencies.

@nanookclaw
nanookclaw requested a review from a team as a code owner August 28, 2026 13:18
@nanookclaw
nanookclaw requested a review from penalosa August 28, 2026 13:18
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@nanookclaw

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@nanookclaw

Copy link
Copy Markdown
Author

recheck

github-actions Bot added a commit that referenced this pull request Sep 15, 2026
@cjol

cjol commented Sep 15, 2026

Copy link
Copy Markdown

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Sep 15, 2026
@nanookclaw

Copy link
Copy Markdown
Author

Replaced the recursive unknown extends T branch with SerializableOrUnknown<T> at composite/result boundaries to avoid the generated TypeScript circular-constraint errors while preserving unknown RPC results and nested unknown-containing composites.

Pushed as f7c380ea7900f76ab2ab8930fd0d3a39f6527301. Focused declaration TypeScript validation and git diff --check pass; the prior focused semantic checks and Sol review also passed. Full Bazel validation remains unavailable in this checkout because Bazel and repository dependencies are not installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

passing unknown type via an RPC method results in return type resolving to never

2 participants