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

Refactor package structure #210

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Refactor package structure #210

merged 3 commits into from
Jun 24, 2024

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Jun 21, 2024

What this PR does / why we need it?

Move presence-related classes to the presence package, aligning with the JS SDK structure.

Any background context you want to provide?

What are the relevant tickets?

Fixes #

Checklist

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

Summary by CodeRabbit

  • Chores

    • Updated dependencies to align with the new package structure for presence handling.
    • Updated Docker image version for yorkie service from 0.4.22 to 0.4.24.
  • Tests

    • Added annotation to prevent TooManyRequestsException in JsonTree-related tests.

@7hong13 7hong13 added the cleanup 🧹 Paying off technical debt label Jun 21, 2024
@7hong13 7hong13 requested a review from skhugh June 21, 2024 08:56
@7hong13 7hong13 self-assigned this Jun 21, 2024
Copy link

coderabbitai bot commented Jun 21, 2024

Walkthrough

The primary change involves refactoring the handling of presence information within the Yorkie project. Presence-related classes and imports have been moved from the dev.yorkie.core package to the dev.yorkie.document.presence package. This reorganization aims to improve the modular structure and separation of concerns. Additionally, Docker image versions have been updated to ensure the latest functionality and fixes are employed, and a new annotation has been introduced to manage test exceptions.

Changes

File(s) Change Summary
examples/texteditor/.../EditorViewModel.kt Import PresenceInfo from dev.yorkie.document.presence instead of dev.yorkie.core
yorkie/src/androidTest/kotlin/dev/yorkie/core/PresenceTest.kt Import PresenceInfo from dev.yorkie.document.presence
yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeTest.kt Replaced import dev.yorkie.core.Presence with dev.yorkie.document.presence.Presence
yorkie/src/main/kotlin/dev/yorkie/api/ElementConverter.kt Switched imports from dev.yorkie.core.P to dev.yorkie.document.presence.P
yorkie/src/main/kotlin/dev/yorkie/api/PresenceConverter.kt Updated imports to reference dev.yorkie.document.presence.P and PresenceChange instead of dev.yorkie.core.P and PresenceChange
yorkie/src/main/kotlin/dev/yorkie/core/Client.kt Reorganized imports for PresenceInfo and Presences from dev.yorkie.document.presence
yorkie/src/main/kotlin/dev/yorkie/document/Document.kt, Change.kt, ChangeContext.kt Replaced presence-related imports from dev.yorkie.core to dev.yorkie.document.presence
yorkie/src/main/kotlin/dev/yorkie/document/.../Presence.kt, Presences.kt Updated package declaration from dev.yorkie.core to dev.yorkie.document.presence
yorkie/src/test/kotlin/dev/yorkie/api/ConverterTest.kt, ClientTest.kt Modified imports from dev.yorkie.core.PresenceChange to dev.yorkie.document.presence.PresenceChange
docker/docker-compose-ci.yml, docker/docker-compose.yml Updated Docker image version for the yorkie service from 0.4.22 to 0.4.24
yorkie/src/androidTest/kotlin/dev/yorkie/TestAnnotations.kt Added TreeTest annotation with a description to prevent TooManyRequestsException in JsonTree-related tests

Poem

In code rearranged, our presence now resides,
From core to document, it gently glides.
Docker ships a newer ship, on waters more secure,
Tests gain an annotation, exceptions they'll endure.
Yorkie grows in modules wise,
With every change, it climbs the skies. 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 11a63a1 and c6b5a84.

Files selected for processing (13)
  • examples/texteditor/src/main/java/com/example/texteditor/EditorViewModel.kt (1 hunks)
  • yorkie/src/androidTest/kotlin/dev/yorkie/core/PresenceTest.kt (1 hunks)
  • yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeTest.kt (2 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/api/ElementConverter.kt (2 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/api/PresenceConverter.kt (1 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/core/Client.kt (1 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/document/Document.kt (2 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/document/change/Change.kt (1 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/document/change/ChangeContext.kt (1 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/document/presence/Presence.kt (1 hunks)
  • yorkie/src/main/kotlin/dev/yorkie/document/presence/Presences.kt (1 hunks)
  • yorkie/src/test/kotlin/dev/yorkie/api/ConverterTest.kt (2 hunks)
  • yorkie/src/test/kotlin/dev/yorkie/core/ClientTest.kt (1 hunks)
Files skipped from review due to trivial changes (3)
  • yorkie/src/main/kotlin/dev/yorkie/api/PresenceConverter.kt
  • yorkie/src/main/kotlin/dev/yorkie/core/Client.kt
  • yorkie/src/main/kotlin/dev/yorkie/document/change/Change.kt
Additional comments not posted (14)
yorkie/src/main/kotlin/dev/yorkie/document/presence/Presence.kt (2)

1-1: Package Declaration Correctness

The package declaration package dev.yorkie.document.presence aligns with the PR's objective of restructuring presence-related classes. This is a good practice for maintaining a modular and organized codebase.


Line range hint 1-22: Class Definition and Method Implementation

The Presence class and its methods put and clear are well-defined. The use of internal visibility for PresenceChange ensures encapsulation within the module. The methods manipulate the presence data and register changes using the ChangeContext, which is a clean and effective way to handle state changes.
[APROVED]

yorkie/src/main/kotlin/dev/yorkie/document/presence/Presences.kt (2)

1-1: Package Declaration Correctness

The package declaration package dev.yorkie.document.presence is correct and reflects the new structure intended by the PR.


Line range hint 1-40: Class Definition and Method Implementation

The Presences class and its methods are well-implemented. The use of the Map delegation (by map) is a Kotlin idiomatic way to provide map functionalities directly through the Presences class, enhancing code readability and maintainability.

yorkie/src/main/kotlin/dev/yorkie/document/change/ChangeContext.kt (2)

8-8: Import Statement Update

The import statement import dev.yorkie.document.presence.PresenceChange correctly reflects the new package structure. This ensures that the ChangeContext class can properly utilize the PresenceChange class.


Line range hint 8-56: Class Functionality and Structure

The ChangeContext class is well-structured. It effectively handles operations and presence changes, ensuring that all modifications are tracked and can be reverted or committed as needed. The methods are clear and perform their intended functions without unnecessary complexity.

examples/texteditor/src/main/java/com/example/texteditor/EditorViewModel.kt (2)

15-15: Import Statement Update

The import statement import dev.yorkie.document.presence.PresenceInfo is updated to reflect the new package structure, ensuring the EditorViewModel class can correctly utilize the PresenceInfo data class.


Line range hint 15-98: Class Functionality and Implementation

The EditorViewModel class is robust, handling various aspects of text editing and presence management efficiently. The methods are well-organized, and the class leverages Kotlin's coroutines for asynchronous tasks, which is suitable for the operations it performs.

yorkie/src/test/kotlin/dev/yorkie/core/ClientTest.kt (1)

29-29: Import Update: Correctly updated to new package.

The import for PresenceChange has been updated to reflect the new package structure. This change aligns with the PR's objective of restructuring presence-related classes.

yorkie/src/test/kotlin/dev/yorkie/api/ConverterTest.kt (1)

42-42: Import Update: Correctly updated to new package.

The import for PresenceChange has been updated to reflect the new package structure. This change aligns with the PR's objective of restructuring presence-related classes.

yorkie/src/main/kotlin/dev/yorkie/api/ElementConverter.kt (1)

49-49: Import Update: Correctly updated to new package.

The import for P has been updated to reflect the new package structure. This change aligns with the PR's objective of restructuring presence-related classes.

yorkie/src/main/kotlin/dev/yorkie/document/Document.kt (1)

21-27: Updated import statements align with new package structure.

The import statements for presence-related classes have been correctly updated to reflect their new location under dev.yorkie.document.presence. This change is consistent with the PR's objective of aligning with the JavaScript SDK structure.

yorkie/src/androidTest/kotlin/dev/yorkie/core/PresenceTest.kt (1)

11-11: Approved: Updated import statement for PresenceInfo.

The import statement for PresenceInfo has been correctly updated to reflect its new package location. Ensure that any other code or files that depend on PresenceInfo are also updated accordingly.

yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeTest.kt (1)

25-25: Updated import statement to reflect new package structure.

The import statement for Presence has been updated to reflect its new location under dev.yorkie.document.presence, aligning with the project's restructured package organization.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c6b5a84 and 0543a79.

Files selected for processing (3)
  • docker/docker-compose-ci.yml (1 hunks)
  • docker/docker-compose.yml (1 hunks)
  • yorkie/src/androidTest/kotlin/dev/yorkie/TestAnnotations.kt (1 hunks)
Files skipped from review due to trivial changes (3)
  • docker/docker-compose-ci.yml
  • docker/docker-compose.yml
  • yorkie/src/androidTest/kotlin/dev/yorkie/TestAnnotations.kt

@7hong13 7hong13 merged commit 44f8ec9 into main Jun 24, 2024
4 of 6 checks passed
@7hong13 7hong13 deleted the refactor_package branch June 24, 2024 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Paying off technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants