Skip to content

(tree) Unify summarize and getAttachSummary methods on summarizables #24761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 12, 2025

Conversation

agarwal-navin
Copy link
Contributor

@agarwal-navin agarwal-navin commented Jun 3, 2025

Description

This PR makes the following changes:

  1. Removed the getAttachSummary method from Summarizable in shared tree and replaces it with the existing summarize method.
    These methods are supposed to be used in two different scenarios - getAttachSummary for the summary that is synchronously generated during container attach and summarize for the summary that is asynchronously generated during regular summarization in case tree wants to support async summarization for scenarios like virtualization.
    However, currently only getAttachSummary is used in both these scenarios since DDSes do not do async summarization. Some of the summarizables implement both of these methods and some only implement one of them. This leads to some confusion and also using the method "getAttachSummary" for regular summarization is also misleading.
    So, this PR keeps the summarize method and makes in syncronous. The async version of this method can be added later when it is needed.
  2. Added a fullTree param to the summarizeCore method in SharedObject. This is needed for tree (or any DDS) to support incremental summarization. If this param is true, a full tree must be generated without any incrementality.
  3. In SharedTreeCore's summarizeCore method, append the sub-tree path's to the incremental summary context before passing it to the individual summarizables. This will keep the logic in one place without having each summarizable do it and also, the summarizables shouldn't know about its parent's incremental summary details.

AB#40395

@Copilot Copilot AI review requested due to automatic review settings June 3, 2025 20:56
@agarwal-navin agarwal-navin requested review from a team as code owners June 3, 2025 20:56
@agarwal-navin agarwal-navin changed the title (tree) Unfiy summarize and getAttachSummary methods on summarizables (tree) Unify summarize and getAttachSummary methods on summarizables Jun 3, 2025
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree changeset-present public api change Changes to a public API base: main PRs targeted against main branch labels Jun 3, 2025
Copy link
Contributor

@Copilot 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 unifies the summarization interface by removing getAttachSummary, making summarize synchronous, and adding a fullTree flag and incremental context propagation.

  • Replace all getAttachSummary methods and calls with the new synchronous summarize signature
  • Add an optional fullTree parameter to summarizeCore and propagate it through SharedTreeCore, kernel, and public APIs
  • Update tests and feature-libraries to use summarize and wire up incremental summary paths

Reviewed Changes

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

Show a summary per file
File Description
packages/dds/tree/src/test/shared-tree-core/sharedTreeCore.spec.ts Removed summarizeAsync, updated mock to use summarize, and adjusted event interface
packages/dds/tree/src/test/feature-libraries/chunked-forest/chunkEncodingEndToEnd.spec.ts Replaced getAttachSummary with summarize in forest end-to-end tests
packages/dds/tree/src/shared-tree-core/sharedTreeCore.ts Added fullTree argument, and prepend each summarizable’s path in the incremental context
packages/dds/tree/src/shared-tree-core/sharedTreeCore.ts (interface) Dropped getAttachSummary declaration and updated summarize signature
packages/dds/tree/src/shared-tree-core/editManagerSummarizer.ts Renamed getAttachSummary to summarize, removed async stub
packages/dds/tree/src/feature-libraries/schema-index/schemaSummarizer.ts Made summarize sync, defaulted fullTree, and updated incremental path logic
packages/dds/tree/src/feature-libraries/forest-summary/forestSummarizer.ts Renamed to synchronous summarize and accept incremental context
packages/dds/tree/src/feature-libraries/detachedFieldIndexSummarizer.ts Renamed to synchronous summarize and accept incremental context
packages/dds/shared-object-base/src/sharedObjectKernel.ts Added fullTree parameter to kernel’s summarizeCore call
packages/dds/shared-object-base/src/sharedObject.ts Propagated fullTree through public summarize into summarizeCore
packages/dds/shared-object-base/api-report/shared-object-base.legacy.alpha.api.md Updated API report to include new fullTree parameter in summarizeCore signature
.changeset/loud-dolls-appear.md Documented the new fullTree parameter in the release notes

"@fluidframework/shared-object-base": minor
"__section": legacy
---
Added an optional boolean parameter `fullTree` to `SharedObject`'s `summarizeCore` method
Copy link
Contributor

Choose a reason for hiding this comment

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

Our most recent guidance for changeset titles is to not use inlineCode syntax (to prevent the generated changelogs from appearing too noisy). This still needs to be documented in a more accessible place, but here are the guidelines we're using when reviewing: https://eng.ms/docs/experiences-devices/opg/office-shared/fluid-framework/fluid-framework-internal/fluid-framework/docs/on-call/release/release-prep

Suggested change
Added an optional boolean parameter `fullTree` to `SharedObject`'s `summarizeCore` method
Added an optional boolean parameter "fullTree" to SharedObject's summarizeCore method

Added an optional boolean parameter `fullTree` to `SharedObject`'s `summarizeCore` method

This parameter tells the shared object that it should generate a full tree summary, i.e., it must not summarize incrementally.
Currently no known SharedObjects's do incremental summaries; however any that do exist or are made in the future must take this "fullTree" parameter into consideration to function correctly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit (we do like inlineCode syntax in the changeset body when referring to APIs)

Suggested change
Currently no known SharedObjects's do incremental summaries; however any that do exist or are made in the future must take this "fullTree" parameter into consideration to function correctly.
Currently no known `SharedObjects`'s do incremental summaries; however, any that do exist or are made in the future must take this "fullTree" parameter into consideration to function correctly.

/**
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
* @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.
* @param fullTree - flag indicating whether the attempt should generate a full
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we call out the default value explicitly here? Also, I'm pushing for us to use full sentence casing consistently when possible.

Suggested change
* @param fullTree - flag indicating whether the attempt should generate a full
* @param fullTree - A flag indicating whether the attempt should generate a full

@Josmithr Josmithr requested a review from a team June 9, 2025 23:42
Copy link
Contributor

@CraigMacomber CraigMacomber left a comment

Choose a reason for hiding this comment

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

Still some active suggestions that I think would be good, but approving for tree.

Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  224682 links
    1708 destination URLs
    1939 URLs ignored
       0 warnings
       0 errors


@agarwal-navin
Copy link
Contributor Author

@Josmithr Could you please review this PR again. I addressed your comments.

@agarwal-navin agarwal-navin merged commit 1e24967 into microsoft:main Jun 12, 2025
42 checks passed
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 changeset-present public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants