fix(tree): ensure chunkers use the correct schema when chunking edits - #28367
Abram Sanderson (Abe27342) wants to merge 2 commits into
Conversation
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>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The consumer-visible SharedTree fix needs the required changeset for release documentation.
Review effort: Balanced
Findings: 1
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.
|
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:
How this works
|
Bundle size comparisonBase commit: Notable changesNo bundles changed by ≥ 500 bytes parsed. Per-bundle deltas
|

Description
Fix
0xaf9("missing schema") when editing a fork after its parent's schema upgrade loses a rebase. The root cause here is thattryShapeFromNodeSchema(in the before of this PR) closed over the schema object when the chunker was initially created, meaning callingcloneon 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
clonetime), so simply avoiding closing over it and passing the schema as an argument to the function inChunkersuffices 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