Skip to content

Interval Collection: Maintain interval instances across resubmits #24871

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

anthony-murphy
Copy link
Contributor

@anthony-murphy anthony-murphy commented Jun 18, 2025

This pull request introduces enhancements to the merge-tree and sequence packages, focusing on improving interval rebasing logic, endpoint handling, and reference sliding preferences. The changes aim to make the interval rebasing process more robust and better handle detached intervals.

Enhancements to Interval Rebasing Logic:

  • Simplified rebaseReferenceWithSegmentSlide to always return ({ segment, offset }) instead of simple positions. Thie reduces conversations between segments and non-segments which keep the code simpler and easier to understand.

Improvements to Endpoint Handling:

  • Added a rebaseEndpoints method to the SequenceIntervalClass for rebasing interval endpoints with updated segment and offset details.
    *Modified IntervalAddLocalMetadata and IntervalChangeLocalMetadata interfaces to support the new detached state and detailed endpoint information.

Sliding Preference Updates:

  • Adjusted sliding preference logic to consider interval stickiness instead of relying solely on sliding direction.

Integration with Merge Tree:

  • Added startOfTree and endOfTree getters to the Client class for handling endpoints when intervals slide off the tree.

These changes collectively improve the handling of intervals in collaborative scenarios, ensuring more accurate rebasing and better management of detached endpoints.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: sharedstring base: main PRs targeted against main branch labels Jun 18, 2025
@github-actions github-actions bot added the public api change Changes to a public API label Jun 18, 2025
@github-actions github-actions bot added the area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct label Jun 18, 2025
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

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

Crawling...

Stats:
  225443 links
    1710 destination URLs
    1941 URLs ignored
       0 warnings
       0 errors


@github-actions github-actions bot removed area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API labels Jun 18, 2025
@anthony-murphy anthony-murphy marked this pull request as ready for review June 19, 2025 16:32
@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 16:32
@anthony-murphy anthony-murphy requested a review from a team as a code owner June 19, 2025 16:32
Copy link
Contributor

@Copilot 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 improves interval handling across resubmits by refining the interval rebasing logic, endpoint management, and sliding reference preferences.

  • Introduces a new rebaseEndpoints method and associated updates in the SequenceIntervalClass.
  • Adjusts the rebasing and local metadata schema to support detailed endpoint information and the detached state.
  • Updates sliding preference logic through computed stickiness and adds new client getters for tree endpoints.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/dds/sequence/src/test/intervalIndexTestUtils.ts Improved assert message for start position to enhance test clarity.
packages/dds/sequence/src/intervals/sequenceInterval.ts Added a rebaseEndpoints method and updated interval creation logic to use computed stickiness.
packages/dds/sequence/src/intervalCollectionMapInterfaces.ts Updated the type of the rebased metadata to support detailed endpoint objects and a detached state.
packages/dds/sequence/src/intervalCollection.ts Revised interval rebasing logic with enhanced detached endpoint handling and local interval updates.
packages/dds/merge-tree/src/client.ts Added getters for startOfTree and endOfTree to support new endpoint handling strategies.
Comments suppressed due to low confidence (1)

packages/dds/sequence/src/intervalCollection.ts:1485

  • [nitpick] Add a clarifying comment explaining the rationale for returning 'detached' endpoints in this block to improve future maintainability.
		if (rebasedEndpoint === "detached") {

@@ -782,8 +814,7 @@ export function createSequenceInterval(
op,
fromSnapshot,
slidingPreference: startSlidingPreference,
canSlideToEndpoint:
canSlideToEndpoint && startSlidingPreference === SlidingPreference.BACKWARD,
canSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this condition is a bit suspect, however i think it is correct, as only NONE intervals should become detached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant