Skip to content

(tree) Update chunking algorithm to use polymorphic shape for incremental fields#25400

Merged
agarwal-navin merged 7 commits intomicrosoft:mainfrom
agarwal-navin:incrSummaryChunking
Oct 9, 2025
Merged

(tree) Update chunking algorithm to use polymorphic shape for incremental fields#25400
agarwal-navin merged 7 commits intomicrosoft:mainfrom
agarwal-navin:incrSummaryChunking

Conversation

@agarwal-navin
Copy link
Copy Markdown
Contributor

@agarwal-navin agarwal-navin commented Sep 4, 2025

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

Copilot AI review requested due to automatic review settings September 4, 2025 20:27
@agarwal-navin agarwal-navin requested a review from a team as a code owner September 4, 2025 20:27
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels Sep 4, 2025
Copy link
Copy Markdown
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

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 shouldEncodeFieldIncrementally parameter with IncrementalEncodingPolicy type
  • 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

@agarwal-navin agarwal-navin merged commit ff4e1c5 into microsoft:main Oct 9, 2025
35 checks passed
@agarwal-navin agarwal-navin deleted the incrSummaryChunking branch October 9, 2025 19:50
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants