Skip to content

refactor(rsc): decrypt cache captures once - #1403

Draft
hi-ogawa wants to merge 23 commits into
mainfrom
refactor/use-cache-single-decode
Draft

refactor(rsc): decrypt cache captures once#1403
hi-ogawa wants to merge 23 commits into
mainfrom
refactor/use-cache-single-decode

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The protected-captures demo currently decrypts an envelope once for logical cache identity and again inside the hoister-generated implementation. This changes the framework adapter so the cache runtime decrypts the transport envelope once, uses flattened captures for cache identity, and passes the decoded capture array to the private implementation.

The existing transform hooks are sufficient: encode still creates the encrypted envelope, while decode emits direct capture-array destructuring because the runtime now owns decryption. No core transform change is required.

Verification:

  • pnpm build
  • pnpm tsc in packages/plugin-rsc
  • pnpm test-e2e use-cache-callable.test.ts in packages/plugin-rsc (22 passed)

hi-ogawa and others added 22 commits August 5, 2026 09:26
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Exclude React form transport fields from cache identity while preserving the original FormData for execution.

Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Keep FormData cache identity unchanged and point to custom form adaptation as the framework-level improvement path.

Co-authored-by: OpenCode <noreply@opencode.ai>
Store the asynchronous encryption result in the envelope so the cache wrapper can inspect its sentinel without awaiting the argument.

Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Adapt encrypted transport arguments to decoded implementation arguments in the cache runtime, allowing the generated implementation to destructure captures directly.

Co-authored-by: OpenCode <noreply@opencode.ai>
Base automatically changed from fix/issue-1393 to main August 5, 2026 09:19
Co-authored-by: OpenCode <noreply@opencode.ai>

# Conflicts:
#	packages/plugin-rsc/examples/use-cache-callable/callable-cache-plugin.ts
#	packages/plugin-rsc/examples/use-cache-callable/src/framework/use-cache-runtime.tsx
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.

1 participant