Skip to content

Remove deprecated MinSyncedTicket and MaxCreatedAtMapByActor #969

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

Merged
merged 4 commits into from
May 9, 2025

Conversation

chacha912
Copy link
Contributor

@chacha912 chacha912 commented Apr 2, 2025

What this PR does / why we need it?

This commit removes legacy fields and logic related to Lamport
timestamp synchronization:

  • Removed MinSyncedTicket and its associated logic
  • Removed MaxCreatedAtMapByActor and related code

These were previously retained for backward compatibility during the
migration to VersionVectors and are no longer needed.

Any background context you want to provide?

What are the relevant tickets?

Related yorkie-team/yorkie#1208

Checklist

  • Added relevant tests or not required
  • Addressed and resolved all CodeRabbit review comments
  • Didn't break anything

Summary by CodeRabbit

  • Refactor
    • Streamlined document operations by removing legacy timestamp tracking and simplifying editing and styling methods.
  • Documentation
    • Marked obsolete fields as deprecated in API resources to guide users toward current best practices.
  • Chores
    • Removed unused properties and simplified method interfaces across editing and styling operations for improved clarity and maintainability.

Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

The changes remove legacy handling of actor-specific creation timestamps and the minSyncedTicket field. In the API layer, the conversion functions no longer process or include the createdAtMapByActor data, and corresponding Protobuf fields are now marked as deprecated. Similar removals occur in the CRDT, JSON, and operation modules, where parameters, return values, and member properties related to maxCreatedAtMapByActor have been eliminated. Legacy logic for version vector support in change syncing is also simplified or removed, resulting in streamlined method signatures and reduced complexity.

Changes

File(s) Change Summary
packages/sdk/src/api/…/converter.ts Removed logic for handling createdAtMapByActor and the minSyncedTicket field in conversions between internal operations and Protobuf formats.
packages/sdk/src/api/yorkie/v1/resources.proto Added deprecation comments to the min_synced_ticket and created_at_map_by_actor fields in multiple messages to indicate they are no longer recommended.
packages/sdk/src/api/yorkie/v1/resources_pb.ts Marked fields such as min_synced_ticket and created_at_map_by_actor as deprecated in various classes, updating their comments and documentation without altering functionality.
packages/sdk/src/document/change/change_id.ts Removed legacy conditional logic for generating version vectors, simplifying the syncClocks method.
packages/sdk/src/document/change/change_pack.ts Removed the minSyncedTicket property, constructor parameter, and its accessor method from the ChangePack class.
packages/sdk/src/document/crdt/rga_tree_split.ts Removed the maxCreatedAt parameter from methods (canDelete, canStyle, edit, deleteNodes), streamlining node existence and deletion logic.
packages/sdk/src/document/crdt/text.ts Removed the maxCreatedAtMapByActor parameter from the edit and setStyle methods and adjusted return types accordingly.
packages/sdk/src/document/crdt/tree.ts Removed maxCreatedAt and maxCreatedAtMapByActor parameters from methods (canDelete, canStyle, style, removeStyle, edit), simplifying control flow for tree node operations.
packages/sdk/src/document/json/text.ts Omitted the extraction of maxCreatedAtMapByActor in destructuring the return values of the edit and setStyle methods.
packages/sdk/src/document/json/tree.ts Removed references to maxCreatedAtMapByActor from method return values and internal variable assignments in tree manipulation methods.
packages/sdk/src/document/operation/edit_operation.ts Eliminated the maxCreatedAtMapByActor property and its handling from the constructor, static create method, and removed the associated accessor function in the EditOperation class.
packages/sdk/src/document/operation/style_operation.ts Removed the maxCreatedAtMapByActor property and parameter from the constructor and static method, and deleted its accessor method in the StyleOperation class.
packages/sdk/src/document/operation/tree_edit_operation.ts Removed the maxCreatedAtMapByActor property and its constructor and static method parameters, along with the respective accessor method in the TreeEditOperation class.
packages/sdk/src/document/operation/tree_style_operation.ts Removed the maxCreatedAtMapByActor parameter from the constructor and static methods (create and createTreeRemoveStyleOperation) and eliminated its accessor method in the TreeStyleOperation class, streamlining operation instantiation and execution.

Possibly related PRs

Suggested reviewers

  • JOOHOJANG

Poem

I'm a little rabbit, hopping with glee,
Cleaning up code so clean and free.
No more maps of timestamps to trace,
Simpler operations set a lighter pace.
In fields deprecated, a new breeze flows—
Hop along, dear coder, where logic grows!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/sdk/src/document/crdt/rga_tree_split.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/packages/sdk".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "packages/sdk/.eslintrc.js » ../../.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

packages/sdk/src/document/crdt/text.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/packages/sdk".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "packages/sdk/.eslintrc.js » ../../.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

packages/sdk/src/document/crdt/tree.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/packages/sdk".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "packages/sdk/.eslintrc.js » ../../.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 1 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a94654 and 6c82847.

📒 Files selected for processing (5)
  • packages/sdk/src/api/converter.ts (0 hunks)
  • packages/sdk/src/document/crdt/rga_tree_split.ts (7 hunks)
  • packages/sdk/src/document/crdt/text.ts (5 hunks)
  • packages/sdk/src/document/crdt/tree.ts (11 hunks)
  • packages/sdk/src/document/json/tree.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • packages/sdk/src/api/converter.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/sdk/src/document/json/tree.ts
  • packages/sdk/src/document/crdt/text.ts
  • packages/sdk/src/document/crdt/rga_tree_split.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/sdk/src/document/crdt/tree.ts (4)
packages/sdk/src/document/crdt/gc.ts (1)
  • GCPair (24-27)
packages/sdk/src/document/json/tree.ts (1)
  • TreeChange (61-61)
packages/sdk/src/yorkie.ts (1)
  • TreeChange (114-114)
packages/sdk/src/document/time/ticket.ts (1)
  • MaxLamport (192-192)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (18.x)
🔇 Additional comments (11)
packages/sdk/src/document/crdt/tree.ts (11)

639-640: Simplified node existence check

The code now relies solely on comparing the node's creation Lamport timestamp with clientLamportAtChange instead of using the deprecated maxCreatedAt map, aligning with the Version Vector migration.


655-656: Simplified node existence check in canStyle method

Similar to the canDelete method, node existence check is simplified by directly comparing Lamport timestamps rather than using the previously required maxCreatedAt map.


922-922: Streamlined return type for style method

The return type has been simplified to only return the garbage collection pairs and tree changes, removing the now unnecessary maxCreatedAtMapByActor map from the return values.

Also applies to: 986-986


941-946: Clear handling of local vs. remote edits with version vectors

The code now uses a clean approach to determine clientLamportAtChange:

  • For local edits, it uses MaxLamport (from imported constants)
  • For remote edits, it looks up the lamport time in the version vector

This simplifies the implementation while maintaining the same functionality.


948-948: Simplified canStyle check

The canStyle method is now called with only the necessary parameters (editedAt and clientLamportAtChange), removing the previously required maxCreatedAt map.


997-997: Streamlined return type for removeStyle method

Similar to the style method, the return type has been simplified to only return the garbage collection pairs and tree changes, removing the unnecessary maxCreatedAtMapByActor map.

Also applies to: 1051-1051


1013-1018: Consistent approach for determining clientLamportAtChange

The same pattern for determining clientLamportAtChange is used consistently across methods:

  • Default to MaxLamport for local edits
  • Use version vector lookup for remote edits

This consistent pattern improves code maintainability.


1021-1021: Simplified canStyle check in removeStyle method

The canStyle method call has been updated to remove the maxCreatedAt parameter, consistent with the method signature change.


1065-1065: Streamlined return type for edit method

The return type for the edit method has been simplified to only return changes and garbage collection pairs, removing the now unnecessary maxCreatedAtMapByActor map.

Also applies to: 1218-1218


1102-1107: Consistent client timestamp determination in edit method

The same pattern for determining clientLamportAtChange is applied in the edit method:

  • Default to MaxLamport for local edits
  • Use version vector lookup for remote edits

This makes the code more consistent and easier to maintain.


1112-1112: Simplified canDelete check in edit method

The canDelete method call has been updated to remove the maxCreatedAt parameter, consistent with the updated method signature.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.31%. Comparing base (ff9405c) to head (6c82847).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/sdk/src/document/json/tree.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #969      +/-   ##
==========================================
- Coverage   78.41%   78.31%   -0.10%     
==========================================
  Files          63       63              
  Lines        5602     5521      -81     
  Branches     1039     1013      -26     
==========================================
- Hits         4393     4324      -69     
+ Misses        895      892       -3     
+ Partials      314      305       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hackerwins hackerwins requested a review from Copilot April 2, 2025 10:50
Copy link

@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 removes legacy fields and functionality related to timestamp tracking (e.g., maxCreatedAtMapByActor and minSyncedTicket) that were used during the transition from Lamport timestamps to version vectors. The changes streamline method signatures and update protobuf definitions in multiple modules.

  • Legacy fields and parameters in tree and text operations have been removed.
  • Protobuf resources and API converters are updated to mark deprecated fields.
  • CRDT and RGA tree splitting logic is simplified to rely solely on version vectors.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/sdk/src/document/operation/*.ts Removed legacy maxCreatedAtMapByActor parameter and related assignments in tree, style, edit, and tree edit operations.
packages/sdk/src/document/json/*.ts Updated JSON serialization to no longer pass legacy creation maps.
packages/sdk/src/document/crdt/*.ts Removed legacy comparisons based on maxCreatedAtMapByActor in favor of using only version vectors.
packages/sdk/src/document/change/*.ts Cleaned up unused minSyncedTicket field and related methods.
packages/sdk/src/api/yorkie/v1/* Marked deprecated fields in protobuf and updated API converters accordingly.
packages/sdk/src/api/converter.ts Updated conversion logic to remove references to legacy createdAt map fields.
Comments suppressed due to low confidence (2)

packages/sdk/src/document/crdt/tree.ts:951

  • Ensure that the removal of the legacy maxCreatedAtMapByActor does not affect the correctness of deletion and styling logic by adding tests that verify behavior with version vector comparisons.
return [pairs, changes];

packages/sdk/src/api/converter.ts:396

  • Verify that the removal of legacy createdAtMapByActor conversion logic does not impact client deserialization by ensuring there is adequate test coverage for protobuf serialization/deserialization.
for (const [key, value] of editOperation.getMaxCreatedAtMapByActor()) {

@hackerwins hackerwins changed the title Cleanup of MinSyncedTicket and MaxCreatedAtMapByActor After Version Vector Migration Remove deprecated MinSyncedTicket and MaxCreatedAtMapByActor May 9, 2025
@hackerwins hackerwins self-requested a review May 9, 2025 01:01
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 45c9d3d into main May 9, 2025
2 checks passed
@hackerwins hackerwins deleted the cleanup-lamport branch May 9, 2025 01:02
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