Split TEncodeContext and TDecodeContext#27338
Conversation
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (307 lines, 3 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the codec type system to allow different context types for encoding vs decoding, enabling future scenarios like distinct session/compression inputs on each side.
Changes:
- Split
TContextintoTEncodeContextandTDecodeContextacross codec interfaces and version-dispatching codec builder types. - Propagate the new context typing through versioned codec normalization/build paths.
- Add a test covering distinct encode/decode context typing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/dds/tree/src/test/codec/versioned/codec.spec.ts | Adds a regression test ensuring encode/decode can use distinct context types. |
| packages/dds/tree/src/codec/versioned/codec.ts | Refactors versioned codec builder/normalization types to support separate encode/decode contexts. |
| packages/dds/tree/src/codec/codec.ts | Updates core codec interfaces/utilities (IJsonCodec, ICodecFamily, withSchemaValidation, etc.) to support split contexts. |
| IDecoder<TDecoded, TValidate, TContext> { | ||
| TEncodeContext = void, | ||
| TDecodeContext = TEncodeContext, | ||
| > extends IEncoder<TDecoded, TEncoded, TEncodeContext>, |
There was a problem hiding this comment.
Should we update TContext (line 175) in the doc comments now that it's TEncodeContext and TDecodeContext?
| export interface VersionDispatchingCodec< | ||
| TDecoded, | ||
| TContext, | ||
| TEncodeContext, |
There was a problem hiding this comment.
Update TContext to TEncodeContext
Description
Allow codecs to have distinct encode and decode context types, to allow for better management of id-compressor sessions, and other compression and session related inputs in the future.
Reviewer Guidance
The review process is outlined on this wiki page.