Skip to content

Conversation

@yann-achard-MS
Copy link
Contributor

Description

This PR addresses two limitations of the current revision replacement capabilities:

  1. The inability to handle inputs where the same localId value is used in the context of different revisions.
  2. The inability to map the same ChangeAtomId input value to the same ChangeAtomId output value across multiple modular changesets.

See the new tests in src/test/shared-tree/sharedTreeChangeFamily.spec.ts for more details on the relevant scenarios.

Motivation

Both limitations need to be addressed in order for merging and reverting to be supported within open transactions.

Breaking Changes

None

Copilot AI review requested due to automatic review settings December 31, 2025 21:38
@yann-achard-MS yann-achard-MS requested a review from a team as a code owner December 31, 2025 21:38
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 the revision replacement system to support more general scenarios by introducing a new RevisionReplacer interface. The refactoring addresses two key limitations: handling inputs where the same localId appears in different revisions, and maintaining consistent ChangeAtomId mappings across multiple modular changesets. These improvements are necessary to support merging and reverting within open transactions.

Key Changes

  • Introduced a new RevisionReplacer interface and DefaultRevisionReplacer implementation that intelligently handles local ID conflicts during revision replacement
  • Updated the changeRevision method signature across all change rebasers to accept a RevisionReplacer parameter instead of separate old/new revision parameters
  • Removed the replaceAtomRevisions utility function in favor of the new replacer pattern

Reviewed changes

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

Show a summary per file
File Description
packages/dds/tree/src/core/rebase/changeRebaser.ts Defines new RevisionReplacer interface and updates ChangeRebaser.changeRevision signature
packages/dds/tree/src/core/rebase/types.ts Removes deprecated replaceAtomRevisions utility function
packages/dds/tree/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts Implements DefaultRevisionReplacer with conflict detection and resolution logic
packages/dds/tree/src/feature-libraries/modular-schema/modularChangeFamily.ts Updates changeRevision to use new replacer pattern across all changeset types
packages/dds/tree/src/feature-libraries/sequence-field/replaceRevisions.ts Refactors to use RevisionReplacer interface for updating marks and IDs
packages/dds/tree/src/feature-libraries/optional-field/optionalField.ts Adapts replaceRevisions to work with new replacer pattern
packages/dds/tree/src/feature-libraries/modular-schema/genericFieldKind.ts Updates generic field kind to use replacer for atom ID updates
packages/dds/tree/src/shared-tree/sharedTreeChangeFamily.ts Simplifies changeRevision implementation using the new replacer
packages/dds/tree/src/test/shared-tree/sharedTreeChangeFamily.spec.ts Adds comprehensive tests for local ID collision handling and consistency
packages/dds/tree/src/test/feature-libraries/modular-schema/defaultRevisionReplacer.spec.ts New test file with full coverage of replacer functionality
Multiple test utility files Updates test utilities to create and use DefaultRevisionReplacer instances

@microsoft microsoft deleted a comment from Copilot AI Dec 31, 2025
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.

2 participants