Skip to content

Port FieldBatchCodec and ForestCodec to ClientVersionDispatchingCodecBuilder#26534

Open
CraigMacomber wants to merge 5 commits intomicrosoft:mainfrom
CraigMacomber:moreCodecBuilder
Open

Port FieldBatchCodec and ForestCodec to ClientVersionDispatchingCodecBuilder#26534
CraigMacomber wants to merge 5 commits intomicrosoft:mainfrom
CraigMacomber:moreCodecBuilder

Conversation

@CraigMacomber
Copy link
Contributor

Description

Port FieldBatchCodec and ForestCodec to ClientVersionDispatchingCodecBuilder.

Reviewer Guidance

The review process is outlined on this wiki page.

Copilot AI review requested due to automatic review settings February 25, 2026 00:37
@CraigMacomber CraigMacomber requested a review from a team as a code owner February 25, 2026 00:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the FieldBatchCodec and ForestCodec implementations from the older makeVersionedValidatedCodec pattern to use the newer ClientVersionDispatchingCodecBuilder pattern. This modernizes the codec infrastructure and provides better type safety and consistency with other codecs in the codebase.

Changes:

  • Replaced makeFieldBatchCodec function with fieldBatchCodecBuilder constant using ClientVersionDispatchingCodecBuilder
  • Replaced makeForestSummarizerCodec function with forestCodecBuilder constant using ClientVersionDispatchingCodecBuilder
  • Updated all usage sites to call .build() on the codec builders instead of calling factory functions
  • Updated error message regex patterns in tests to match the new JSON array format for version lists
  • Changed EncodedFieldBatch export from value export to type-only export
  • Added type narrowing assertions in tests where codec return types became more generic
  • Added type cast in treeAlpha.ts due to loss of specific return type information

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/dds/tree/src/feature-libraries/chunked-forest/codec/codecs.ts Refactored to use ClientVersionDispatchingCodecBuilder pattern, extracting codec logic into helper function
packages/dds/tree/src/feature-libraries/chunked-forest/codec/index.ts Changed EncodedFieldBatch export to type-only and replaced function export with builder
packages/dds/tree/src/feature-libraries/chunked-forest/index.ts Updated exports to use fieldBatchCodecBuilder
packages/dds/tree/src/feature-libraries/forest-summary/codec.ts Complete refactor to use ClientVersionDispatchingCodecBuilder with ForestCodecOptions interface
packages/dds/tree/src/feature-libraries/forest-summary/index.ts Updated exports to use forestCodecBuilder
packages/dds/tree/src/feature-libraries/forest-summary/forestSummarizer.ts Updated to call forestCodecBuilder.build()
packages/dds/tree/src/feature-libraries/index.ts Updated public API exports
packages/dds/tree/src/shared-tree/*.ts Updated usage sites to call .build() on codec builders
packages/dds/tree/src/test/**/*.spec.ts Updated tests to use new builder pattern and adjusted error message assertions

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.

3 participants