-
Notifications
You must be signed in to change notification settings - Fork 559
(tree) Update how shared tree codec versions are generated #25752
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
(tree) Update how shared tree codec versions are generated #25752
Conversation
c073de1 to
19b7e94
Compare
packages/dds/tree/src/feature-libraries/schema-edits/schemaChangeCodecs.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/test/feature-libraries/schema-index/codec.spec.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/feature-libraries/chunked-forest/codec/codecs.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
SchemaVersionenum withSchemaFormatVersionconst object - Introduce converter functions (e.g.,
clientVersionToSchemaVersion,clientVersionToMessageFormatVersion) to map fromMinimumVersionForCollabto specific format versions - Remove explicit version parameters from codec factory functions, deriving them from
minVersionForCollabinstead
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 |
packages/dds/tree/src/shared-tree-core/editManagerFormatV1toV4.ts
Outdated
Show resolved
Hide resolved
fix version selection
Undo changes to persistedToSimpleSchema Add changeset
changes to fluid-framework.alpha.api.md
Update list of released formats for FF 2.43
|
🔗 Found some broken links! 💔 Run a link check locally to find them. See linkcheck output |
Josmithr
left a comment
There was a problem hiding this 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.
## 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.
This change updates how the write version for the different codecs in tree are determined.
Currently, there is a mapping of
SharedTreeFormatVersionto a list of write versions for all codecs. TheSharedTreeFormatVersionis 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,
SharedTreeFormatVersionwill be removed. Instead, the write versions for the codecs will be selected based on theminVersionForCollaboption that is also passed during tree creation. TheminVersionForCollabwill 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 constenum-like object and branded values, and a function that generates the right version based on theminVersionForCollab).The mapping from
SharedTreeFormatVersiontominVersionForCollabis as follows:SharedTreeFormatVersion.v1: no longer an optionSharedTreeFormatVersion.v2: no longer an optionSharedTreeFormatVersion.v3:minVersionForCollab: FluidClientVersion.v2_0SharedTreeFormatVersion.v4: was never an option, still not an optionSharedTreeFormatVersion.v5:minVersionForCollab: FluidClientVersion.v2_43SharedTreeFormatVersion.vSharedBranches: no longer an option. UseSharedTreeOptions.enableSharedBranchesinstead.Unchanged: specifying
minVersionForCollab: FluidClientVersion.v2_52will enableDetachedFieldIndexFormatVersion.v2.AB#51463.
Breaking Changes
SharedTreeFormatOptions(internal) no longer has aformatVersionfield.