Skip to content

chore(protocol): auto-serialize SerializedValue in validators#40798

Open
dgozman wants to merge 2 commits into
microsoft:mainfrom
dgozman:serialized-value-validator
Open

chore(protocol): auto-serialize SerializedValue in validators#40798
dgozman wants to merge 2 commits into
microsoft:mainfrom
dgozman:serialized-value-validator

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@dgozman dgozman commented May 12, 2026

Summary

  • Move SerializedValue conversion from manual serializeResult/parseResult call sites in dispatchers and channel owners into the validator pipeline.
  • Rename the raw protocol struct to SerializedArgumentValue; the name SerializedValue becomes a marker that the generator emits as UnserializedValue = any on the TS side and tSerializedValue on the validator side.
  • ValidatorContext.binary is replaced with direction: 'toWire' | 'fromWire' + optional rawBuffers?: boolean. tBinary rewritten against the new context.
  • Drops ~50 manual conversion call sites across dispatchers and channel owners. The SerializedArgument-with-handles flow stays manual.

Move SerializedValue conversion from manual `serializeResult`/`parseResult`
call sites in dispatchers and channel owners into the validator pipeline.

- Rename the raw protocol struct to `SerializedArgumentValue`; the name
  `SerializedValue` is now a marker that the generator turns into a TS
  `UnserializedValue = any` alias and a `tSerializedValue` validator that
  serializes/deserializes based on direction.
- `ValidatorContext`: replace `binary: 'toBase64'|'fromBase64'|'buffer'`
  with `direction: 'toWire'|'fromWire'` + optional `rawBuffers?: boolean`.
  `tBinary` rewritten against the new context.
- Drop ~50 manual conversion call sites across dispatchers and channel
  owners. The `SerializedArgument`-with-handles flow stays manual.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

After moving SerializedValue handling into the validator, the client
ExpectResult and protocol FrameExpectResult are structurally identical.
The dispatcher can return the server result directly, and the client can
return the channel result directly. Alias `ExpectResult` to
`channels.FrameExpectResult` and drop the unused client `ExpectReceived`.
@dgozman dgozman force-pushed the serialized-value-validator branch from f9ff1f5 to cc0cdcb Compare May 12, 2026 13:39
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chromium] › mcp/cli-save-as.spec.ts:19 › screenshot @mcp-macos-latest-chromium
❌ [chromium] › mcp/annotate.spec.ts:137 › should abort MCP annotation when last screenshot is removed @mcp-windows-latest-chromium
❌ [webkit] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md @mcp-macos-latest-webkit

7067 passed, 1068 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [installation tests] › screencast.spec.ts:18 › screencast works `@package-installations-windows-latest`
⚠️ [chromium-library] › library/video.spec.ts:275 › screencast › should capture navigation `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/video.spec.ts:647 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node24`

41757 passed, 850 skipped


Merge workflow run.

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.

2 participants