(tree) Update chunking algorithm to use polymorphic shape for incremental fields#25400
Merged
agarwal-navin merged 7 commits intomicrosoft:mainfrom Oct 9, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Updates the chunking algorithm to use polymorphic shapes for fields marked as incremental, ensuring proper incremental summarization by preventing monomorphic fields from being combined into uniform chunks with their parents.
- Replaces
shouldEncodeFieldIncrementallyparameter withIncrementalEncodingPolicytype - Integrates incremental encoding policy into shape determination logic
- Updates all related functions and interfaces to use the new policy type
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/tree/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts | Defines new IncrementalEncodingPolicy type and default implementation |
| packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts | Updates tryShapeFromSchema to return polymorphic shapes for incremental fields |
| packages/dds/tree/src/shared-tree/sharedTree.ts | Updates interfaces and forest configuration to use new policy type |
| packages/dds/tree/src/feature-libraries/forest-summary/forestSummarizer.ts | Simplifies parameter handling with new policy type |
| Multiple test files | Updates test code to use new IncrementalEncodingPolicy type |
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
agarwal-navin
commented
Sep 4, 2025
agarwal-navin
commented
Sep 4, 2025
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/test/feature-libraries/chunked-forest/chunkTree.spec.ts
Outdated
Show resolved
Hide resolved
CraigMacomber
approved these changes
Oct 9, 2025
CraigMacomber
approved these changes
Oct 9, 2025
anthony-murphy-agent
pushed a commit
to anthony-murphy-agent/FluidFramework
that referenced
this pull request
Jan 14, 2026
…ntal fields (microsoft#25400) Currently, fields that are specified as incremental via the `shouldEncodeIncrementally` callback can be monomorphic causing them to be combined in a uniform chunk with its parent. This will make the field to not be incrementally summarized - When incremental summary builder calls `ChunkedForest::chunkField` for such fields, it will return a new chunk every time causing it to encode the chunk again and not re-using a summary handle for it. This PR changes the chunking algorithm so that it always uses polymorphic shape for nodes / fields that are specified as incremental. This is done by plumbing the `shouldEncodeIncrementally` function to the `tryShapeFromSchema` function which decides the shapes for fields and nodes. If `shouldEncodeIncrementally` returns true, a polymorphic shape is returned. [AB#41866](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/41866)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, fields that are specified as incremental via the
shouldEncodeIncrementallycallback can be monomorphic causing them to be combined in a uniform chunk with its parent.This will make the field to not be incrementally summarized - When incremental summary builder calls
ChunkedForest::chunkFieldfor such fields, it will return a new chunk every time causing it to encode the chunk again and not re-using a summary handle for it.This PR changes the chunking algorithm so that it always uses polymorphic shape for nodes / fields that are specified as incremental. This is done by plumbing the
shouldEncodeIncrementallyfunction to thetryShapeFromSchemafunction which decides the shapes for fields and nodes. IfshouldEncodeIncrementallyreturns true, a polymorphic shape is returned.AB#41866