Skip to content
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

Remove jstype=string from resources.proto #1040

Merged

Conversation

Aswinr24
Copy link
Contributor

@Aswinr24 Aswinr24 commented Oct 18, 2024

What this PR does / why we need it:
Removes jstype=string notation from resources.proto file since javascript supports Bigint from ES2020
One of the two PRs addressing this issue, the other PR is for the js-sdk repository replacing Long with BigInt.

Which issue(s) this PR fixes:

One of the two PRs that should Fix #1023

Special notes for your reviewer:

Does this PR introduce a user-facing change?:
No

NONE

Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • Bug Fixes
    • Streamlined data representation for ChangeID, Checkpoint, and TimeTicket messages by reverting certain fields to numeric types, enhancing compatibility and performance.

These changes improve the overall efficiency of data handling within the application without altering existing functionalities.

Copy link

coderabbitai bot commented Oct 18, 2024

Walkthrough

The changes in this pull request focus on the resources.proto file, specifically modifying the data types of certain fields within the ChangeID, Checkpoint, and TimeTicket messages. The jstype = JS_STRING option has been removed from the server_seq and lamport fields in the ChangeID and Checkpoint messages, as well as from the lamport field in the TimeTicket message. This adjustment reverts these fields to their default numeric representation in Protocol Buffers without altering the overall structure or functionality of the messages.

Changes

File Change Summary
api/yorkie/v1/resources.proto Removed jstype = JS_STRING from server_seq and lamport fields in ChangeID message.
api/yorkie/v1/resources.proto Removed jstype = JS_STRING from server_seq field in Checkpoint message.
api/yorkie/v1/resources.proto Removed jstype = JS_STRING from lamport field in TimeTicket message.

Assessment against linked issues

Objective Addressed Explanation
Remove jstype=string from .proto
Replace Long with Bigint in js-sdk (not addressed in this PR) Changes related to Bigint are not included.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.

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 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.

@CLAassistant
Copy link

CLAassistant commented Oct 18, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
api/yorkie/v1/resources.proto (1)

60-61: Summary: Successfully removed jstype=JS_STRING from all relevant fields

The changes in this file consistently remove the jstype = JS_STRING option from int64 fields in the ChangeID, Checkpoint, and TimeTicket messages. These modifications align with the PR objectives and leverage JavaScript's native BigInt support introduced in ES2020.

To ensure a smooth transition and maintain the quality of the codebase:

  1. Coordinate with the js-sdk team to ensure that the corresponding changes (replacing Long with BigInt) are implemented in parallel.
  2. Update any relevant documentation, especially API references or client guidelines, to reflect the expectation of BigInt usage for these fields.
  3. Consider adding inline comments in the protobuf file to explain the rationale behind removing jstype = JS_STRING. This can be helpful for future maintainers and contributors.
  4. Plan for a comprehensive testing phase, particularly focusing on JavaScript clients, to ensure that the transition to BigInt doesn't introduce any unexpected behaviors or performance issues.
  5. If not already in place, consider implementing a migration guide or deprecation notice for any clients that may be affected by this change, especially if they are using older JavaScript environments that don't support BigInt.

These steps will help ensure a successful transition and maintain the robustness of the Yorkie project across its ecosystem.

Also applies to: 335-335, 346-346

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d1b173b and 2451d58.

📒 Files selected for processing (1)
  • api/yorkie/v1/resources.proto (3 hunks)
🧰 Additional context used
🔇 Additional comments (3)
api/yorkie/v1/resources.proto (3)

60-61: LGTM. Verify js-sdk compatibility.

The removal of jstype = JS_STRING from the server_seq and lamport fields aligns with the PR objectives. This change reflects the ability to use BigInt in JavaScript since ES2020.

To ensure compatibility, please verify that the corresponding changes in the js-sdk repository (replacing Long with BigInt) have been implemented or are planned. This will maintain consistency between the protobuf definitions and the JavaScript implementation.


335-335: LGTM. Consistent with previous changes.

The removal of jstype = JS_STRING from the server_seq field in the Checkpoint message is consistent with the changes made to the ChangeID message. This maintains uniformity across the protobuf definitions.


346-346: LGTM. Completes the removal of jstype=JS_STRING.

The removal of jstype = JS_STRING from the lamport field in the TimeTicket message is consistent with the previous changes and completes the task of updating all relevant int64 fields in this file.

These changes collectively update the protobuf definitions to leverage JavaScript's native BigInt support, which should simplify the generated JavaScript code and improve consistency with modern JavaScript practices.

To ensure a smooth transition:

  1. Confirm that all consumers of this protobuf file (especially JavaScript clients) are prepared to handle int64 values as BigInt.
  2. Update any documentation or client guidelines to reflect the expectation of BigInt usage for these fields.
  3. Consider adding a comment in the protobuf file to explain why jstype = JS_STRING is no longer used, which could be helpful for future maintainers.

@hackerwins
Copy link
Member

@Aswinr24 Thanks for your contribution. Could you sign the CLA?
https://github.com/yorkie-team/yorkie/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla

@Aswinr24
Copy link
Contributor Author

@Aswinr24 Thanks for your contribution. Could you sign the CLA? https://github.com/yorkie-team/yorkie/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla

Done !

@hackerwins hackerwins self-requested a review October 19, 2024 02:42
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 changed the title Fix: Removed jstype=string notation from resources.proto Remove jstype=string from resources.proto Oct 19, 2024
@hackerwins hackerwins merged commit 36d5b88 into yorkie-team:main Oct 19, 2024
5 checks passed
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.

Remove jstype=string from .proto and replace Long with Bigintin js-sdk
3 participants