Skip to content

feat(tree): option to retain history - #27696

Merged
yann-achard-MS merged 5 commits into
microsoft:mainfrom
yann-achard-MS:keep-history
Jul 15, 2026
Merged

feat(tree): option to retain history#27696
yann-achard-MS merged 5 commits into
microsoft:mainfrom
yann-achard-MS:keep-history

Conversation

@yann-achard-MS

Copy link
Copy Markdown
Contributor

Description

Adds a new retainHistory flag to SharedTreeOptions (defaults to false).
Setting retainHistory to true will prevent SharedTree from garbage-collecting historical data about old changes.

Note that this will cause unbounded growth both in memory on the client and in summaries/snapshots (the at-rest data representing a Fluid document). For these reasons, this option is only intended for debugging and experimentation.

This option is needed by an FF customer that is experimenting with history-management features.

Breaking Changes

None

Copilot AI review requested due to automatic review settings July 15, 2026 17:08
@yann-achard-MS
yann-achard-MS requested review from a team as code owners July 15, 2026 17:08
@github-actions

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (120 lines, 7 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Comment thread .changeset/swift-buses-hang.md Outdated
Comment thread packages/dds/tree/src/shared-tree-core/sharedTreeCore.ts Outdated
Comment thread packages/dds/tree/src/shared-tree/sharedTree.ts Outdated
yann-achard-MS and others added 2 commits July 15, 2026 13:15
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output

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-website@0.0.0 serve
> docusaurus serve --no-open

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

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

Crawling...

Stats:
  298156 links
    1937 destination URLs
    2187 URLs ignored
       0 warnings
       0 errors


@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 8fc2876c6ba2e81a93d07c56fdc122edf79bf023
Head commit: a5d17d9d4478a65bfa029332d53c73bdab04f64a

Notable changes

  • 🔴 fluidFramework.js: parsed 394194 → 394843 (+649), gzip 111941 → 112131 (+190)
  • 🔴 sharedTree.js: parsed 383581 → 384223 (+642), gzip 109327 → 109509 (+182)
Per-bundle deltas

@fluid-example/bundle-size-tests

  • azureClient.js: parsed 619911 → 619967 (+56), gzip 164958 → 165000 (+42)
  • odspClient.js: parsed 592637 → 592693 (+56), gzip 159070 → 159112 (+42)
  • aqueduct.js: parsed 526400 → 526435 (+35), gzip 140839 → 140869 (+30)
  • 🔴 fluidFramework.js: parsed 394194 → 394843 (+649), gzip 111941 → 112131 (+190)
  • 🔴 sharedTree.js: parsed 383581 → 384223 (+642), gzip 109327 → 109509 (+182)
  • containerRuntime.js: parsed 304750 → 304764 (+14), gzip 83332 → 83340 (+8)
  • sharedString.js: parsed 175984 → 175991 (+7), gzip 49445 → 49452 (+7)
  • experimentalSharedTree.js: parsed 160798 → 160798 (0), gzip 45804 → 45804 (0)
  • matrix.js: parsed 159845 → 159852 (+7), gzip 45411 → 45418 (+7)
  • loader.js: parsed 145256 → 145270 (+14), gzip 39063 → 39075 (+12)
  • odspDriver.js: parsed 104329 → 104350 (+21), gzip 32625 → 32634 (+9)
  • directory.js: parsed 66616 → 66623 (+7), gzip 18532 → 18540 (+8)
  • 748.js: parsed 58793 → 58793 (0), gzip 17827 → 17827 (0)
  • map.js: parsed 46709 → 46716 (+7), gzip 14310 → 14317 (+7)
  • odspPrefetchSnapshot.js: parsed 45642 → 45656 (+14), gzip 15277 → 15284 (+7)
  • 985.js: parsed 44491 → 44491 (0), gzip 13726 → 13726 (0)
  • summarizerDelayLoadedModule.js: parsed 30749 → 30749 (0), gzip 7753 → 7753 (0)
  • socketModule.js: parsed 26476 → 26483 (+7), gzip 7887 → 7894 (+7)
  • createNewModule.js: parsed 12480 → 12480 (0), gzip 4786 → 4786 (0)
  • summaryModule.js: parsed 3797 → 3797 (0), gzip 1860 → 1860 (0)
  • connectionState.js: parsed 724 → 724 (0), gzip 429 → 429 (0)
  • sharedTreeAttributes.js: parsed 666 → 673 (+7), gzip 432 → 441 (+9)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 422 → 422 (0), gzip 316 → 316 (0)

@yann-achard-MS
yann-achard-MS merged commit 2fa44c6 into microsoft:main Jul 15, 2026
36 checks passed
@yann-achard-MS
yann-achard-MS deleted the keep-history branch July 17, 2026 18:47
Noah Encke (noencke) added a commit that referenced this pull request Aug 21, 2026
## Description

`retainHistory` on `SharedTreeOptions` was documented as causing growth
in both memory and summaries/snapshots, but it only ever prevented trunk
commits from being evicted from memory. Summaries continued to contain
just the collaboration window, so retained history was discarded at the
next summary and was unavailable to clients that loaded from it.

This was an oversight, not an intentional design choice — confirmed
against the original PR (#27696) that introduced the option, whose
shipped changeset already documented the intended (summary-inclusive)
behavior.

Summaries produced by a client with `retainHistory` enabled now contain
the full trunk. History accumulated while the flag is enabled survives
summarization and is available to clients that join later. History from
before the flag was enabled (already evicted in a prior session) cannot
be recovered. There is no change to the default (`retainHistory: false`)
behavior, and no change to the persisted format.

New tests confirm 3 of them fail without the production fix (proving
they exercise it); the full `@fluidframework/tree` suite (15,203 tests)
passes with no regressions.

## Reviewer Guidance

The review process is outlined in [the pull request
guidelines](../docs/content/Contributing/PR-Guidelines.md#guidelines).

This PR received an automated rigorous code-review pass; one test
assertion was strengthened as a result (exact equality instead of `<=`
on retained commit count).
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