Skip to content

fix(tree): ensure chunkers use the correct schema when chunking edits - #28367

Open
Abram Sanderson (Abe27342) wants to merge 2 commits into
microsoft:mainfrom
Abe27342:abe27342-fork-schema-chunking
Open

Abram Sanderson (Abe27342) wants to merge 2 commits into
microsoft:mainfrom
Abe27342:abe27342-fork-schema-chunking

Conversation

@Abe27342

@Abe27342 Abram Sanderson (Abe27342) commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix 0xaf9 ("missing schema") when editing a fork after its parent's schema upgrade loses a rebase. The root cause here is that tryShapeFromNodeSchema (in the before of this PR) closed over the schema object when the chunker was initially created, meaning calling clone on a chunker incorrectly coupled the schema used to encode a branch and its fork.

The correct schema to use is already available to the chunker (passed in at clone time), so simply avoiding closing over it and passing the schema as an argument to the function in Chunker suffices to fix the bug. I've also renamed the function slightly for clarity (and to avoid shadowing the free function with the same name)

Historical context

Pass each chunker's schema explicitly to its shared shape lookup callback and restore the fork/schema regression and Comparison Forest seed 1.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 18:10
@Abe27342
Abram Sanderson (Abe27342) requested a review from a team as a code owner October 1, 2026 18:10
@github-actions github-actions Bot added area: tools area: dds Issues related to distributed data structures area: repo Repo related work area: website area: dds: tree base: main PRs targeted against main branch labels Oct 1, 2026
@Abe27342 Abram Sanderson (Abe27342) changed the title fix(tree): use the fork's schema when chunking edits fix(tree): ensure chunkers use the correct schema when chunking edits Oct 1, 2026

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 review overview

🟡 Changes recommended

The consumer-visible SharedTree fix needs the required changeset for release documentation.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Fixes forked SharedTree edits so chunking uses the fork’s current schema rather than its parent’s captured schema.

Changes:

  • Passes each chunker’s schema into shape lookup.
  • Updates custom chunker callbacks.
  • Re-enables the minimized regression and fuzz seed 1.
File Description
chunkTree.ts Makes schema lookup clone-aware.
chunkedForest.spec.ts Updates test chunker callbacks.
chunkEncodingEndToEnd.spec.ts Updates encoding test callback.
treeCheckout.spec.ts Enables the fork/schema regression.
topLevel.fuzz.spec.ts Restores Comparison Forest seed 1.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/dds/tree/src/feature-libraries/chunked-forest/chunkTree.ts
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

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

Based on the diff (60 lines, 5 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
  • Documentation / Developer Experience — missing or misleading docs, examples, and developer-facing guidance

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

Comment thread packages/dds/tree/src/test/shared-tree/treeCheckout.spec.ts Outdated
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 82d8bc3e0cb60738eb0be7730dc9e639b0514a87
Head commit: 0951e5fcbc3ef45c11d523c240c464a34a4412a0

Notable changes

No bundles changed by ≥ 500 bytes parsed.

Per-bundle deltas

@fluid-example/bundle-size-tests

  • fluidFrameworkAllAlpha.js: parsed 809701 → 809755 (+54), gzip 222862 → 222937 (+75)
  • azureClient.js: parsed 639218 → 639213 (-5), gzip 171360 → 171444 (+84)
  • odspClient.js: parsed 611177 → 611286 (+109), gzip 164282 → 164413 (+131)
  • aqueduct.js: parsed 537657 → 537670 (+13), gzip 144495 → 144530 (+35)
  • fluidFramework.js: parsed 417668 → 417701 (+33), gzip 118455 → 118511 (+56)
  • sharedTree.js: parsed 407047 → 407073 (+26), gzip 115905 → 115941 (+36)
  • containerRuntime.js: parsed 319562 → 319546 (-16), gzip 87674 → 87668 (-6)
  • sharedString.js: parsed 170105 → 170112 (+7), gzip 48456 → 48462 (+6)
  • experimentalSharedTree.js: parsed 161846 → 161846 (0), gzip 46722 → 46722 (0)
  • matrix.js: parsed 153720 → 153727 (+7), gzip 44381 → 44388 (+7)
  • loader.js: parsed 147328 → 147344 (+16), gzip 40039 → 40049 (+10)
  • odspDriver.js: parsed 106728 → 106786 (+58), gzip 33236 → 33304 (+68)
  • directory.js: parsed 65669 → 65676 (+7), gzip 18493 → 18502 (+9)
  • 578.js: parsed 58686 → 58686 (0), gzip 17657 → 17657 (0)
  • odspPrefetchSnapshot.js: parsed 46463 → 46444 (-19), gzip 15512 → 15522 (+10)
  • map.js: parsed 45820 → 45827 (+7), gzip 14120 → 14127 (+7)
  • 252.js: parsed 44384 → 44384 (0), gzip 13741 → 13741 (0)
  • summarizerDelayLoadedModule.js: parsed 31287 → 31287 (0), gzip 7929 → 7929 (0)
  • socketModule.js: parsed 27108 → 27078 (-30), gzip 8067 → 8103 (+36)
  • createNewModule.js: parsed 12464 → 12464 (0), gzip 4792 → 4805 (+13)
  • summaryModule.js: parsed 3888 → 3888 (0), gzip 1874 → 1874 (0)
  • connectionState.js: parsed 909 → 909 (0), gzip 500 → 500 (0)
  • sharedTreeAttributes.js: parsed 845 → 852 (+7), gzip 496 → 506 (+10)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 419 → 419 (0), gzip 313 → 313 (0)

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 area: repo Repo related work area: tools area: website base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants