Skip to content

Conversation

@agarwal-navin
Copy link
Contributor

@agarwal-navin agarwal-navin commented Oct 24, 2025

This change updates how the write version for the different codecs in tree are determined.
Currently, there is a mapping of SharedTreeFormatVersion to a list of write versions for all codecs. The SharedTreeFormatVersion is one of the options that can be passed when creating a tree and the codecs version are selected from the mapping based on this value.

With this change, SharedTreeFormatVersion will be removed. Instead, the write versions for the codecs will be selected based on the minVersionForCollab option that is also passed during tree creation. The minVersionForCollab will be passed down to each codec and it can decide what write version it wants based on this.

This PR also standardizes how the various versions are maintained by the codecs (using an as const enum-like object and branded values, and a function that generates the right version based on the minVersionForCollab).

The mapping from SharedTreeFormatVersion to minVersionForCollab is as follows:

  • SharedTreeFormatVersion.v1: no longer an option
  • SharedTreeFormatVersion.v2: no longer an option
  • SharedTreeFormatVersion.v3: minVersionForCollab: FluidClientVersion.v2_0
  • SharedTreeFormatVersion.v4: was never an option, still not an option
  • SharedTreeFormatVersion.v5: minVersionForCollab: FluidClientVersion.v2_43
  • SharedTreeFormatVersion.vSharedBranches: no longer an option. Use SharedTreeOptions.enableSharedBranches instead.

Unchanged: specifying minVersionForCollab: FluidClientVersion.v2_52 will enable DetachedFieldIndexFormatVersion.v2.

AB#51463.

Breaking Changes

SharedTreeFormatOptions (internal) no longer has a formatVersion field.

@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 Oct 24, 2025
@github-actions github-actions bot added the public api change Changes to a public API label Oct 27, 2025
@agarwal-navin agarwal-navin marked this pull request as ready for review October 28, 2025 22:16
@agarwal-navin agarwal-navin requested a review from a team as a code owner October 28, 2025 22:16
Copilot AI review requested due to automatic review settings October 28, 2025 22:16
Copy link
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

This PR refactors version handling across the codebase by standardizing on MinimumVersionForCollab (from @fluidframework/runtime-definitions) as the primary versioning mechanism, replacing various explicit format version numbers and enums. The changes introduce currentVersion as a constant defaulting to FluidClientVersion.v2_0 and update codec creation to accept CodecWriteOptions instead of explicit version parameters.

Key changes include:

  • Replace SchemaVersion enum with SchemaFormatVersion const object
  • Introduce converter functions (e.g., clientVersionToSchemaVersion, clientVersionToMessageFormatVersion) to map from MinimumVersionForCollab to specific format versions
  • Remove explicit version parameters from codec factory functions, deriving them from minVersionForCollab instead

Reviewed Changes

Copilot reviewed 64 out of 64 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/dds/tree/src/codec/index.ts Exports currentVersion constant
packages/dds/tree/src/core/schema-stored/schema.ts Converts SchemaVersion enum to SchemaFormatVersion const object
packages/dds/tree/src/feature-libraries/schema-index/codec.ts Adds clientVersionToSchemaVersion converter; updates makeSchemaCodec signature
packages/dds/tree/src/feature-libraries/chunked-forest/codec/codecs.ts Adds clientVersionToFieldBatchVersion converter; removes fluidVersionToFieldBatchCodecWriteVersion
packages/dds/tree/src/shared-tree-core/messageCodecs.ts Moves MessageFormatVersion to separate file; adds clientVersionToMessageFormatVersion
packages/dds/tree/src/shared-tree-core/editManagerCodecs.ts Adds clientVersionToEditManagerFormatVersion converter
packages/dds/tree/src/shared-tree/sharedTree.ts Removes large ExplicitCodecVersions mapping; simplifies codec tree generation
Test files Updates to use currentVersion and new codec signatures

@agarwal-navin agarwal-navin changed the title Prototype: Update how shared tree codec versions are generated Update how shared tree codec versions are generated Oct 28, 2025
@github-actions github-actions bot added the area: examples Changes that focus on our examples label Oct 29, 2025
@yann-achard-MS yann-achard-MS requested a review from a team as a code owner November 1, 2025 00:40
@github-actions github-actions bot removed the area: examples Changes that focus on our examples label Nov 3, 2025
@github-actions github-actions bot added the area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct label Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

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

 ELIFECYCLE  Command failed with exit code 1.

Copy link
Contributor

@Josmithr Josmithr left a comment

Choose a reason for hiding this comment

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

Docs and API changes look good.

@agarwal-navin agarwal-navin merged commit df53390 into microsoft:main Nov 3, 2025
39 of 40 checks passed
@agarwal-navin agarwal-navin deleted the treeCodecVersioning branch November 3, 2025 22:28
@agarwal-navin agarwal-navin changed the title Update how shared tree codec versions are generated (tree) Update how shared tree codec versions are generated Nov 14, 2025
yann-achard-MS added a commit that referenced this pull request Nov 18, 2025
## Description

Removes reading and writing capabilities for the following formats:
* EditManager: v1, v2
* Message: vUndefined, v1, v2
* SharedTreeChangeFormatVersion:  v1, v2
* ModularChangeFormatVersion: v1, v2
* OptionalChangeset: v1
* SequenceChangeset: v1

Removing these formats reduces the package size and reduces the burden
of maintenance when introducing new in-memory representations.

## Breaking Changes

* Removes `SharedTreeFormatVersion` (exposed as alpha). It no longer
serves a purpose (and should have been removed with
#25752)
* Summaries and ops with `SharedTreeFormatVersion.v1` or
`SharedTreeFormatVersion.v2` configurations are no longer loadable (a
usage error explaining as much will be thrown). This is not expected to
cause issues because such formats were only used by default prior to
releasing FF 2.0 and have only been usable since through alpha APIs. We
do not know of any customer (1st or 3rd party) that depends on such
formats.
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: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct 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.

4 participants