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

Add RHTNode removal to converter for consistency #888

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Conversation

hackerwins
Copy link
Member

@hackerwins hackerwins commented Jun 4, 2024

What this PR does / why we need it:

This commit addresses the missing isRemoved encoding in the RHT.
Similar to other CRDTs like ElementRHT, including tombstone nodes like
isRemoved during encoding is crucial. However, the RHT did not
include tombstone nodes in its encoding, leading to inconsistencies in
snapshots.

Which issue(s) this PR fixes:

Address #889
Address #869

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

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

Summary by CodeRabbit

  • New Features

    • Introduced a new boolean field is_removed in the NodeAttr message for better attribute management.
    • Added deep copy functionality for RHT type with comprehensive testing.
  • Bug Fixes

    • Enhanced style attribute handling in XML elements to ensure accurate representation.
    • Improved handling of removed nodes in internal methods.
  • Documentation

    • Updated OpenAPI specifications for Yorkie service with refined descriptions, URL structures, and schema references.
  • Tests

    • Added new test for RHT deep copy and enhanced existing tests for RHT removal operations.

Copy link

coderabbitai bot commented Jun 4, 2024

Walkthrough

The recent changes enhance XML style attribute handling, improve internal data conversion functions, update OpenAPI specifications for better consistency, and introduce new tests for deep copy functionality. The modifications ensure more robust and flexible handling of document attributes, streamline API documentation, and improve test coverage for the system's core components.

Changes

File(s) Change Summary
api/converter/converter_test.go Added style attributes to XML elements, removed a style attribute, updated XML output, and added assertions for these changes.
api/converter/from_pb.go Introduced fromRHT function for converting api.NodeAttr to crdt.RHT.
api/converter/to_bytes.go Added toRHT function for converting crdt.RHT to map[string]*api.NodeAttr and updated toTreeNode function to use it.
api/docs/yorkie/v1/resources.openapi.yaml, api/docs/yorkie/v1/yorkie.openapi.yaml Updated descriptions, URL structures, and schema references for better consistency and readability.
api/yorkie/v1/resources.proto Added is_removed boolean field to NodeAttr message.
pkg/document/crdt/rht.go Added IsRemoved and SetInternal methods, modified Nodes and DeepCopy methods.
pkg/document/crdt/rht_test.go Added TestRHT_DeepCopy function, modified TestRHT_Remove function with new test cases and expectations.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant Client
    participant API
    participant Converter
    participant CRDT

    Client->>API: Request to modify XML styles
    API->>Converter: Convert request data
    Converter->>CRDT: Apply style changes
    CRDT-->>Converter: Return updated tree
    Converter-->>API: Return updated XML
    API-->>Client: Send updated XML response
Loading

Poem

In the land of code, where changes flow,
Styles and attributes now brightly glow.
With tests that dive so deep and true,
Yorkie's docs get a fresh review.
The CRDT trees stand tall and proud,
As Yorkie's updates shout aloud. 🌳✨


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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Go Benchmark

Benchmark suite Current: 5c4b736 Previous: cafc0f2 Ratio
BenchmarkDocument/constructor_test 1462 ns/op 1337 B/op 24 allocs/op 1466 ns/op 1337 B/op 24 allocs/op 1.00
BenchmarkDocument/constructor_test - ns/op 1462 ns/op 1466 ns/op 1.00
BenchmarkDocument/constructor_test - B/op 1337 B/op 1337 B/op 1
BenchmarkDocument/constructor_test - allocs/op 24 allocs/op 24 allocs/op 1
BenchmarkDocument/status_test 938.9 ns/op 1305 B/op 22 allocs/op 941.7 ns/op 1305 B/op 22 allocs/op 1.00
BenchmarkDocument/status_test - ns/op 938.9 ns/op 941.7 ns/op 1.00
BenchmarkDocument/status_test - B/op 1305 B/op 1305 B/op 1
BenchmarkDocument/status_test - allocs/op 22 allocs/op 22 allocs/op 1
BenchmarkDocument/equals_test 7593 ns/op 7273 B/op 132 allocs/op 7537 ns/op 7273 B/op 132 allocs/op 1.01
BenchmarkDocument/equals_test - ns/op 7593 ns/op 7537 ns/op 1.01
BenchmarkDocument/equals_test - B/op 7273 B/op 7273 B/op 1
BenchmarkDocument/equals_test - allocs/op 132 allocs/op 132 allocs/op 1
BenchmarkDocument/nested_update_test 19291 ns/op 12139 B/op 262 allocs/op 16701 ns/op 12138 B/op 262 allocs/op 1.16
BenchmarkDocument/nested_update_test - ns/op 19291 ns/op 16701 ns/op 1.16
BenchmarkDocument/nested_update_test - B/op 12139 B/op 12138 B/op 1.00
BenchmarkDocument/nested_update_test - allocs/op 262 allocs/op 262 allocs/op 1
BenchmarkDocument/delete_test 22350 ns/op 15363 B/op 341 allocs/op 22342 ns/op 15363 B/op 341 allocs/op 1.00
BenchmarkDocument/delete_test - ns/op 22350 ns/op 22342 ns/op 1.00
BenchmarkDocument/delete_test - B/op 15363 B/op 15363 B/op 1
BenchmarkDocument/delete_test - allocs/op 341 allocs/op 341 allocs/op 1
BenchmarkDocument/object_test 8512 ns/op 6817 B/op 120 allocs/op 8484 ns/op 6817 B/op 120 allocs/op 1.00
BenchmarkDocument/object_test - ns/op 8512 ns/op 8484 ns/op 1.00
BenchmarkDocument/object_test - B/op 6817 B/op 6817 B/op 1
BenchmarkDocument/object_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/array_test 28987 ns/op 11946 B/op 276 allocs/op 29597 ns/op 11947 B/op 276 allocs/op 0.98
BenchmarkDocument/array_test - ns/op 28987 ns/op 29597 ns/op 0.98
BenchmarkDocument/array_test - B/op 11946 B/op 11947 B/op 1.00
BenchmarkDocument/array_test - allocs/op 276 allocs/op 276 allocs/op 1
BenchmarkDocument/text_test 30469 ns/op 14715 B/op 469 allocs/op 32647 ns/op 14715 B/op 469 allocs/op 0.93
BenchmarkDocument/text_test - ns/op 30469 ns/op 32647 ns/op 0.93
BenchmarkDocument/text_test - B/op 14715 B/op 14715 B/op 1
BenchmarkDocument/text_test - allocs/op 469 allocs/op 469 allocs/op 1
BenchmarkDocument/text_composition_test 28885 ns/op 18422 B/op 484 allocs/op 28895 ns/op 18422 B/op 484 allocs/op 1.00
BenchmarkDocument/text_composition_test - ns/op 28885 ns/op 28895 ns/op 1.00
BenchmarkDocument/text_composition_test - B/op 18422 B/op 18422 B/op 1
BenchmarkDocument/text_composition_test - allocs/op 484 allocs/op 484 allocs/op 1
BenchmarkDocument/rich_text_test 79613 ns/op 38476 B/op 1148 allocs/op 79807 ns/op 38476 B/op 1148 allocs/op 1.00
BenchmarkDocument/rich_text_test - ns/op 79613 ns/op 79807 ns/op 1.00
BenchmarkDocument/rich_text_test - B/op 38476 B/op 38476 B/op 1
BenchmarkDocument/rich_text_test - allocs/op 1148 allocs/op 1148 allocs/op 1
BenchmarkDocument/counter_test 17274 ns/op 10722 B/op 244 allocs/op 17322 ns/op 10722 B/op 244 allocs/op 1.00
BenchmarkDocument/counter_test - ns/op 17274 ns/op 17322 ns/op 1.00
BenchmarkDocument/counter_test - B/op 10722 B/op 10722 B/op 1
BenchmarkDocument/counter_test - allocs/op 244 allocs/op 244 allocs/op 1
BenchmarkDocument/text_edit_gc_100 1170140 ns/op 870838 B/op 16689 allocs/op 1200185 ns/op 870773 B/op 16689 allocs/op 0.97
BenchmarkDocument/text_edit_gc_100 - ns/op 1170140 ns/op 1200185 ns/op 0.97
BenchmarkDocument/text_edit_gc_100 - B/op 870838 B/op 870773 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 16689 allocs/op 16689 allocs/op 1
BenchmarkDocument/text_edit_gc_1000 47692437 ns/op 50535519 B/op 181604 allocs/op 47655250 ns/op 50534649 B/op 181601 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 47692437 ns/op 47655250 ns/op 1.00
BenchmarkDocument/text_edit_gc_1000 - B/op 50535519 B/op 50534649 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 181604 allocs/op 181601 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 1778552 ns/op 1528729 B/op 15541 allocs/op 1789682 ns/op 1528718 B/op 15541 allocs/op 0.99
BenchmarkDocument/text_split_gc_100 - ns/op 1778552 ns/op 1789682 ns/op 0.99
BenchmarkDocument/text_split_gc_100 - B/op 1528729 B/op 1528718 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 15541 allocs/op 15541 allocs/op 1
BenchmarkDocument/text_split_gc_1000 112077447 ns/op 135077519 B/op 182091 allocs/op 112938523 ns/op 135076317 B/op 182086 allocs/op 0.99
BenchmarkDocument/text_split_gc_1000 - ns/op 112077447 ns/op 112938523 ns/op 0.99
BenchmarkDocument/text_split_gc_1000 - B/op 135077519 B/op 135076317 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 182091 allocs/op 182086 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 15340337 ns/op 10183715 B/op 40676 allocs/op 15000715 ns/op 10182514 B/op 40672 allocs/op 1.02
BenchmarkDocument/text_delete_all_10000 - ns/op 15340337 ns/op 15000715 ns/op 1.02
BenchmarkDocument/text_delete_all_10000 - B/op 10183715 B/op 10182514 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40676 allocs/op 40672 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 271578775 ns/op 142642540 B/op 411614 allocs/op 289656462 ns/op 142700600 B/op 411794 allocs/op 0.94
BenchmarkDocument/text_delete_all_100000 - ns/op 271578775 ns/op 289656462 ns/op 0.94
BenchmarkDocument/text_delete_all_100000 - B/op 142642540 B/op 142700600 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411614 allocs/op 411794 allocs/op 1.00
BenchmarkDocument/text_100 214452 ns/op 120037 B/op 5081 allocs/op 216477 ns/op 120035 B/op 5081 allocs/op 0.99
BenchmarkDocument/text_100 - ns/op 214452 ns/op 216477 ns/op 0.99
BenchmarkDocument/text_100 - B/op 120037 B/op 120035 B/op 1.00
BenchmarkDocument/text_100 - allocs/op 5081 allocs/op 5081 allocs/op 1
BenchmarkDocument/text_1000 2338020 ns/op 1169023 B/op 50085 allocs/op 2373142 ns/op 1169040 B/op 50085 allocs/op 0.99
BenchmarkDocument/text_1000 - ns/op 2338020 ns/op 2373142 ns/op 0.99
BenchmarkDocument/text_1000 - B/op 1169023 B/op 1169040 B/op 1.00
BenchmarkDocument/text_1000 - allocs/op 50085 allocs/op 50085 allocs/op 1
BenchmarkDocument/array_1000 1211163 ns/op 1091306 B/op 11831 allocs/op 1203077 ns/op 1091435 B/op 11832 allocs/op 1.01
BenchmarkDocument/array_1000 - ns/op 1211163 ns/op 1203077 ns/op 1.01
BenchmarkDocument/array_1000 - B/op 1091306 B/op 1091435 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11831 allocs/op 11832 allocs/op 1.00
BenchmarkDocument/array_10000 13037798 ns/op 9799974 B/op 120296 allocs/op 13326710 ns/op 9800391 B/op 120298 allocs/op 0.98
BenchmarkDocument/array_10000 - ns/op 13037798 ns/op 13326710 ns/op 0.98
BenchmarkDocument/array_10000 - B/op 9799974 B/op 9800391 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120296 allocs/op 120298 allocs/op 1.00
BenchmarkDocument/array_gc_100 145488 ns/op 132717 B/op 1260 allocs/op 145242 ns/op 132724 B/op 1260 allocs/op 1.00
BenchmarkDocument/array_gc_100 - ns/op 145488 ns/op 145242 ns/op 1.00
BenchmarkDocument/array_gc_100 - B/op 132717 B/op 132724 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1260 allocs/op 1260 allocs/op 1
BenchmarkDocument/array_gc_1000 1379280 ns/op 1159210 B/op 12877 allocs/op 1386425 ns/op 1159033 B/op 12876 allocs/op 0.99
BenchmarkDocument/array_gc_1000 - ns/op 1379280 ns/op 1386425 ns/op 0.99
BenchmarkDocument/array_gc_1000 - B/op 1159210 B/op 1159033 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12877 allocs/op 12876 allocs/op 1.00
BenchmarkDocument/counter_1000 198458 ns/op 193081 B/op 5771 allocs/op 197776 ns/op 193081 B/op 5771 allocs/op 1.00
BenchmarkDocument/counter_1000 - ns/op 198458 ns/op 197776 ns/op 1.00
BenchmarkDocument/counter_1000 - B/op 193081 B/op 193081 B/op 1
BenchmarkDocument/counter_1000 - allocs/op 5771 allocs/op 5771 allocs/op 1
BenchmarkDocument/counter_10000 2170950 ns/op 2088010 B/op 59778 allocs/op 2153652 ns/op 2088024 B/op 59778 allocs/op 1.01
BenchmarkDocument/counter_10000 - ns/op 2170950 ns/op 2153652 ns/op 1.01
BenchmarkDocument/counter_10000 - B/op 2088010 B/op 2088024 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59778 allocs/op 59778 allocs/op 1
BenchmarkDocument/object_1000 1339296 ns/op 1428087 B/op 9849 allocs/op 1358239 ns/op 1428066 B/op 9849 allocs/op 0.99
BenchmarkDocument/object_1000 - ns/op 1339296 ns/op 1358239 ns/op 0.99
BenchmarkDocument/object_1000 - B/op 1428087 B/op 1428066 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9849 allocs/op 9849 allocs/op 1
BenchmarkDocument/object_10000 14827504 ns/op 12166893 B/op 100564 allocs/op 14882318 ns/op 12167120 B/op 100566 allocs/op 1.00
BenchmarkDocument/object_10000 - ns/op 14827504 ns/op 14882318 ns/op 1.00
BenchmarkDocument/object_10000 - B/op 12166893 B/op 12167120 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100564 allocs/op 100566 allocs/op 1.00
BenchmarkDocument/tree_100 1011376 ns/op 943700 B/op 6101 allocs/op 1002255 ns/op 943706 B/op 6101 allocs/op 1.01
BenchmarkDocument/tree_100 - ns/op 1011376 ns/op 1002255 ns/op 1.01
BenchmarkDocument/tree_100 - B/op 943700 B/op 943706 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6101 allocs/op 6101 allocs/op 1
BenchmarkDocument/tree_1000 72293892 ns/op 86460297 B/op 60114 allocs/op 71991438 ns/op 86460174 B/op 60114 allocs/op 1.00
BenchmarkDocument/tree_1000 - ns/op 72293892 ns/op 71991438 ns/op 1.00
BenchmarkDocument/tree_1000 - B/op 86460297 B/op 86460174 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60114 allocs/op 60114 allocs/op 1
BenchmarkDocument/tree_10000 9325201906 ns/op 8580672128 B/op 600240 allocs/op 9114441864 ns/op 8580651392 B/op 600202 allocs/op 1.02
BenchmarkDocument/tree_10000 - ns/op 9325201906 ns/op 9114441864 ns/op 1.02
BenchmarkDocument/tree_10000 - B/op 8580672128 B/op 8580651392 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600240 allocs/op 600202 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 73729093 ns/op 87531277 B/op 75265 allocs/op 73967462 ns/op 87510080 B/op 75265 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 - ns/op 73729093 ns/op 73967462 ns/op 1.00
BenchmarkDocument/tree_delete_all_1000 - B/op 87531277 B/op 87510080 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 75265 allocs/op 75265 allocs/op 1
BenchmarkDocument/tree_edit_gc_100 3692767 ns/op 4146637 B/op 15140 allocs/op 3717932 ns/op 4146703 B/op 15141 allocs/op 0.99
BenchmarkDocument/tree_edit_gc_100 - ns/op 3692767 ns/op 3717932 ns/op 0.99
BenchmarkDocument/tree_edit_gc_100 - B/op 4146637 B/op 4146703 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 15140 allocs/op 15141 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_1000 297297286 ns/op 383742728 B/op 154841 allocs/op 295988690 ns/op 383745912 B/op 154836 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - ns/op 297297286 ns/op 295988690 ns/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - B/op 383742728 B/op 383745912 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 154841 allocs/op 154836 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 2471842 ns/op 2412475 B/op 11125 allocs/op 2469880 ns/op 2412531 B/op 11125 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 - ns/op 2471842 ns/op 2469880 ns/op 1.00
BenchmarkDocument/tree_split_gc_100 - B/op 2412475 B/op 2412531 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 11125 allocs/op 11125 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 178056416 ns/op 222250446 B/op 121986 allocs/op 182695692 ns/op 222252338 B/op 121992 allocs/op 0.97
BenchmarkDocument/tree_split_gc_1000 - ns/op 178056416 ns/op 182695692 ns/op 0.97
BenchmarkDocument/tree_split_gc_1000 - B/op 222250446 B/op 222252338 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 121986 allocs/op 121992 allocs/op 1.00
BenchmarkRPC/client_to_server 369824448 ns/op 17357570 B/op 174489 allocs/op 371988159 ns/op 16815805 B/op 174482 allocs/op 0.99
BenchmarkRPC/client_to_server - ns/op 369824448 ns/op 371988159 ns/op 0.99
BenchmarkRPC/client_to_server - B/op 17357570 B/op 16815805 B/op 1.03
BenchmarkRPC/client_to_server - allocs/op 174489 allocs/op 174482 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server 625347052 ns/op 32263080 B/op 318747 allocs/op 623824856 ns/op 31911012 B/op 319255 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server - ns/op 625347052 ns/op 623824856 ns/op 1.00
BenchmarkRPC/client_to_client_via_server - B/op 32263080 B/op 31911012 B/op 1.01
BenchmarkRPC/client_to_client_via_server - allocs/op 318747 allocs/op 319255 allocs/op 1.00
BenchmarkRPC/attach_large_document 1373707205 ns/op 1908517816 B/op 8857 allocs/op 1354953116 ns/op 1918247352 B/op 8836 allocs/op 1.01
BenchmarkRPC/attach_large_document - ns/op 1373707205 ns/op 1354953116 ns/op 1.01
BenchmarkRPC/attach_large_document - B/op 1908517816 B/op 1918247352 B/op 0.99
BenchmarkRPC/attach_large_document - allocs/op 8857 allocs/op 8836 allocs/op 1.00
BenchmarkRPC/adminCli_to_server 543181298 ns/op 35949296 B/op 289524 allocs/op 543706012 ns/op 35952980 B/op 289552 allocs/op 1.00
BenchmarkRPC/adminCli_to_server - ns/op 543181298 ns/op 543706012 ns/op 1.00
BenchmarkRPC/adminCli_to_server - B/op 35949296 B/op 35952980 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 289524 allocs/op 289552 allocs/op 1.00
BenchmarkLocker 62.57 ns/op 16 B/op 1 allocs/op 62.86 ns/op 16 B/op 1 allocs/op 1.00
BenchmarkLocker - ns/op 62.57 ns/op 62.86 ns/op 1.00
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel 39.88 ns/op 0 B/op 0 allocs/op 38.86 ns/op 0 B/op 0 allocs/op 1.03
BenchmarkLockerParallel - ns/op 39.88 ns/op 38.86 ns/op 1.03
BenchmarkLockerParallel - B/op 0 B/op 0 B/op 1
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkLockerMoreKeys 153.7 ns/op 15 B/op 0 allocs/op 146.1 ns/op 15 B/op 0 allocs/op 1.05
BenchmarkLockerMoreKeys - ns/op 153.7 ns/op 146.1 ns/op 1.05
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkChange/Push_10_Changes 3892162 ns/op 121606 B/op 1284 allocs/op 3900391 ns/op 121475 B/op 1284 allocs/op 1.00
BenchmarkChange/Push_10_Changes - ns/op 3892162 ns/op 3900391 ns/op 1.00
BenchmarkChange/Push_10_Changes - B/op 121606 B/op 121475 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1284 allocs/op 1284 allocs/op 1
BenchmarkChange/Push_100_Changes 14665503 ns/op 570745 B/op 6655 allocs/op 14667916 ns/op 569122 B/op 6654 allocs/op 1.00
BenchmarkChange/Push_100_Changes - ns/op 14665503 ns/op 14667916 ns/op 1.00
BenchmarkChange/Push_100_Changes - B/op 570745 B/op 569122 B/op 1.00
BenchmarkChange/Push_100_Changes - allocs/op 6655 allocs/op 6654 allocs/op 1.00
BenchmarkChange/Push_1000_Changes 117838228 ns/op 5274336 B/op 63150 allocs/op 117848961 ns/op 5258635 B/op 63149 allocs/op 1.00
BenchmarkChange/Push_1000_Changes - ns/op 117838228 ns/op 117848961 ns/op 1.00
BenchmarkChange/Push_1000_Changes - B/op 5274336 B/op 5258635 B/op 1.00
BenchmarkChange/Push_1000_Changes - allocs/op 63150 allocs/op 63149 allocs/op 1.00
BenchmarkChange/Pull_10_Changes 2878553 ns/op 100800 B/op 1004 allocs/op 2897026 ns/op 101029 B/op 1004 allocs/op 0.99
BenchmarkChange/Pull_10_Changes - ns/op 2878553 ns/op 2897026 ns/op 0.99
BenchmarkChange/Pull_10_Changes - B/op 100800 B/op 101029 B/op 1.00
BenchmarkChange/Pull_10_Changes - allocs/op 1004 allocs/op 1004 allocs/op 1
BenchmarkChange/Pull_100_Changes 4314557 ns/op 266499 B/op 3475 allocs/op 4338115 ns/op 267097 B/op 3475 allocs/op 0.99
BenchmarkChange/Pull_100_Changes - ns/op 4314557 ns/op 4338115 ns/op 0.99
BenchmarkChange/Pull_100_Changes - B/op 266499 B/op 267097 B/op 1.00
BenchmarkChange/Pull_100_Changes - allocs/op 3475 allocs/op 3475 allocs/op 1
BenchmarkChange/Pull_1000_Changes 8457558 ns/op 1494658 B/op 29866 allocs/op 8546085 ns/op 1493407 B/op 29860 allocs/op 0.99
BenchmarkChange/Pull_1000_Changes - ns/op 8457558 ns/op 8546085 ns/op 0.99
BenchmarkChange/Pull_1000_Changes - B/op 1494658 B/op 1493407 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 29866 allocs/op 29860 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot 16987332 ns/op 714851 B/op 6655 allocs/op 17029324 ns/op 716431 B/op 6659 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 16987332 ns/op 17029324 ns/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - B/op 714851 B/op 716431 B/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6655 allocs/op 6659 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot 120547012 ns/op 5584464 B/op 63167 allocs/op 121286426 ns/op 5708495 B/op 63157 allocs/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 120547012 ns/op 121286426 ns/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - B/op 5584464 B/op 5708495 B/op 0.98
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 63167 allocs/op 63157 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot 6406230 ns/op 923859 B/op 15514 allocs/op 6428973 ns/op 924106 B/op 15512 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6406230 ns/op 6428973 ns/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 923859 B/op 924106 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 15514 allocs/op 15512 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot 15691512 ns/op 7159969 B/op 150104 allocs/op 15841995 ns/op 7150355 B/op 149999 allocs/op 0.99
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 15691512 ns/op 15841995 ns/op 0.99
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 7159969 B/op 7150355 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 150104 allocs/op 149999 allocs/op 1.00
BenchmarkSync/memory_sync_10_test 8132 ns/op 1286 B/op 38 allocs/op 6607 ns/op 1286 B/op 38 allocs/op 1.23
BenchmarkSync/memory_sync_10_test - ns/op 8132 ns/op 6607 ns/op 1.23
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test 56646 ns/op 8947 B/op 292 allocs/op 50782 ns/op 8648 B/op 273 allocs/op 1.12
BenchmarkSync/memory_sync_100_test - ns/op 56646 ns/op 50782 ns/op 1.12
BenchmarkSync/memory_sync_100_test - B/op 8947 B/op 8648 B/op 1.03
BenchmarkSync/memory_sync_100_test - allocs/op 292 allocs/op 273 allocs/op 1.07
BenchmarkSync/memory_sync_1000_test 582754 ns/op 74239 B/op 2117 allocs/op 587684 ns/op 74269 B/op 2115 allocs/op 0.99
BenchmarkSync/memory_sync_1000_test - ns/op 582754 ns/op 587684 ns/op 0.99
BenchmarkSync/memory_sync_1000_test - B/op 74239 B/op 74269 B/op 1.00
BenchmarkSync/memory_sync_1000_test - allocs/op 2117 allocs/op 2115 allocs/op 1.00
BenchmarkSync/memory_sync_10000_test 6961740 ns/op 739237 B/op 20324 allocs/op 7254669 ns/op 747854 B/op 20340 allocs/op 0.96
BenchmarkSync/memory_sync_10000_test - ns/op 6961740 ns/op 7254669 ns/op 0.96
BenchmarkSync/memory_sync_10000_test - B/op 739237 B/op 747854 B/op 0.99
BenchmarkSync/memory_sync_10000_test - allocs/op 20324 allocs/op 20340 allocs/op 1.00
BenchmarkTextEditing 5025578821 ns/op 3901932904 B/op 18743514 allocs/op 5250087161 ns/op 3901982120 B/op 18743606 allocs/op 0.96
BenchmarkTextEditing - ns/op 5025578821 ns/op 5250087161 ns/op 0.96
BenchmarkTextEditing - B/op 3901932904 B/op 3901982120 B/op 1.00
BenchmarkTextEditing - allocs/op 18743514 allocs/op 18743606 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 78.78788% with 7 lines in your changes missing coverage. Please review.

Project coverage is 50.67%. Comparing base (4a47984) to head (5c4b736).

Files Patch % Lines
api/converter/from_pb.go 58.33% 3 Missing and 2 partials ⚠️
pkg/document/crdt/rht.go 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #888      +/-   ##
==========================================
+ Coverage   50.50%   50.67%   +0.16%     
==========================================
  Files          70       70              
  Lines       10454    10471      +17     
==========================================
+ Hits         5280     5306      +26     
+ Misses       4646     4638       -8     
+ Partials      528      527       -1     

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

@hackerwins hackerwins marked this pull request as ready for review June 4, 2024 05:27
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: 9

Outside diff range and nitpick comments (12)
api/converter/from_pb.go (10)

Line range hint 89-89: Handle undefined error ErrPackRequired.

89+ var ErrPackRequired = errors.New("pack is required")

Line range hint 92-92: Handle undefined error ErrCheckpointRequired.

92+ var ErrCheckpointRequired = errors.New("checkpoint is required")

Line range hint 180-180: Define the error ErrUnsupportedEventType.

180+ var ErrUnsupportedEventType = errors.New("unsupported event type")

Line range hint 212-212: Define the error ErrUnsupportedOperation.

212+ var ErrUnsupportedOperation = errors.New("unsupported operation")

Line range hint 736-736: Define the function BytesToObject.

It seems the function BytesToObject is missing. Would you like me to help implement it?


Line range hint 746-746: Define the function BytesToArray.

It seems the function BytesToArray is missing. Would you like me to help implement it?


Line range hint 814-814: Define the function BytesToTree.

It seems the function BytesToTree is missing. Would you like me to help implement it?


Line range hint 817-817: Define the error ErrUnsupportedElement.

817+ var ErrUnsupportedElement = errors.New("unsupported element type")

Line range hint 840-840: Define the error ErrUnsupportedValueType.

840+ var ErrUnsupportedValueType = errors.New("unsupported value type")

Line range hint 851-851: Define the error ErrUnsupportedCounterType.

851+ var ErrUnsupportedCounterType = errors.New("unsupported counter type")
api/docs/yorkie/v1/yorkie.openapi.yaml (1)

255-255: Ensure the description for the connect.error schema is accurate and provides sufficient detail about the error types.

api/docs/yorkie/v1/admin.openapi.yaml (1)

388-406: Review the descriptions and ensure they are accurate and provide sufficient detail about the error types.

Consider enhancing the descriptions for each error code to provide more context or examples, which could improve the developer's understanding when handling these errors.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4a47984 and 5c4b736.

Files ignored due to path filters (1)
  • api/yorkie/v1/resources.pb.go is excluded by !**/*.pb.go
Files selected for processing (9)
  • api/converter/converter_test.go (2 hunks)
  • api/converter/from_pb.go (1 hunks)
  • api/converter/to_bytes.go (1 hunks)
  • api/docs/yorkie/v1/admin.openapi.yaml (54 hunks)
  • api/docs/yorkie/v1/resources.openapi.yaml (64 hunks)
  • api/docs/yorkie/v1/yorkie.openapi.yaml (49 hunks)
  • api/yorkie/v1/resources.proto (1 hunks)
  • pkg/document/crdt/rht.go (4 hunks)
  • pkg/document/crdt/rht_test.go (3 hunks)
Files not summarized due to errors (1)
  • api/docs/yorkie/v1/admin.openapi.yaml: Error: Message exceeds token limit
Additional context used
golangci-lint
api/converter/from_pb.go

89-89: undefined: ErrPackRequired


92-92: undefined: ErrCheckpointRequired


180-180: undefined: ErrUnsupportedEventType


212-212: undefined: ErrUnsupportedOperation


736-736: undefined: BytesToObject


746-746: undefined: BytesToArray


814-814: undefined: BytesToTree


817-817: undefined: ErrUnsupportedElement


840-840: undefined: ErrUnsupportedValueType


851-851: undefined: ErrUnsupportedCounterType

Additional comments not posted (29)
pkg/document/crdt/rht_test.go (3)

12-23: The new test function TestRHT_DeepCopy correctly verifies the deep copy functionality of the RHT structure.


115-200: The updates to TestRHT_Remove enhance test coverage by adding scenarios for setting and removing elements, and correctly asserting the expected states.


220-220: The added assertions for checking the total size and the size of elements in the RHT structure are crucial for verifying its integrity post-operations.

pkg/document/crdt/rht.go (4)

73-76: The new method IsRemoved correctly implements the functionality to check the removal status of a node.


135-143: The new method SetInternal correctly implements the logic to internally set the value of a key in the RHT structure, considering the removal status and timestamp.


197-197: The update to the Nodes method to include all nodes regardless of their removal status is necessary for operations like deep copying.


213-215: The update to the DeepCopy method to use SetInternal for each node ensures that the removal status and timestamps are accurately copied.

api/yorkie/v1/resources.proto (1)

229-229: The addition of the is_removed field to the NodeAttr message correctly extends its capabilities to include the removal status, which is essential for the RHT enhancements.

api/converter/converter_test.go (1)

Line range hint 284-300: The changes to the tree style operations test correctly verify the functionality of styling and removing styles from a tree structure, ensuring that the operations work as expected.

api/converter/to_bytes.go (2)

300-314: The new function toRHT correctly implements the conversion of an RHT structure to a map of NodeAttr protobuf messages, including handling the is_removed attribute.


316-323: The update to the toTreeNode function to include the toRHT function for handling attributes ensures that the attributes of tree nodes are correctly converted, including their removal status.

api/docs/yorkie/v1/yorkie.openapi.yaml (2)

17-17: Updated references to request bodies and responses are consistent with the OpenAPI 3.1.0 specification.

Also applies to: 20-20, 22-22, 24-24, 29-29, 32-32, 34-34, 36-36, 41-41, 44-44, 46-46, 48-48, 53-53, 56-56, 58-58, 60-60, 65-65, 68-68, 70-70, 72-72, 77-77, 80-80, 82-82, 84-84, 89-89, 92-92, 94-94, 96-96, 101-101, 104-104, 106-106, 108-108


308-308: All references to schemas and operations have been updated to use single quotes, which is consistent with YAML best practices.

Also applies to: 325-325, 374-374, 388-388, 393-393, 419-420, 426-427, 441-441, 446-446, 462-462, 488-489, 514-514, 541-541, 553-553, 564-564, 590-597, 605-605, 611-611, 617-617, 623-623, 639-643, 645-645, 662-662, 668-668, 674-674, 680-680, 686-686, 692-692, 698-698, 704-704, 710-710, 716-716, 728-728, 734-734, 740-740, 746-746, 773-773, 779-779, 785-785, 791-791, 824-824, 836-836, 842-842, 848-848, 860-860, 866-866, 872-872, 878-878, 890-890, 896-896, 902-902, 918-918, 924-924, 930-930, 936-936, 948-948, 959-959, 965-965, 987-987, 993-993, 999-999, 1005-1005, 1038-1038, 1053-1053, 1063-1063, 1069-1069, 1075-1075, 1086-1086, 1103-1103, 1132-1132, 1138-1138, 1144-1144, 1150-1150, 1183-1183, 1222-1222, 1228-1228, 1237-1244, 1252-1252, 1279-1279, 1291-1291, 1313-1313, 1325-1325, 1361-1362, 1362-1362, 1381-1381, 1387-1387, 1393-1393, 1399-1399, 1426-1426, 1438-1438, 1458-1458, 1469-1469, 1475-1475, 1485-1512, 1536-1536, 1542-1542, 1568-1568, 1570-1571

api/docs/yorkie/v1/resources.openapi.yaml (2)

27-27: Review the description for accuracy and completeness.


31-45: Ensure that all error codes are necessary and correctly documented.

Verification successful

The script successfully located the Go source files and searched for the usage of each error code. The results show that the error codes are indeed used within the codebase.

  • The error codes CodeCanceled, CodeUnknown, CodeInvalidArgument, CodeDeadlineExceeded, CodeNotFound, CodeAlreadyExists, CodePermissionDenied, CodeResourceExhausted, CodeFailedPrecondition, CodeAborted, CodeOutOfRange, CodeInternal, CodeUnavailable, CodeDataLoss, and CodeUnauthenticated are all present in various Go files.

This confirms that the error codes listed in the YAML file are necessary and correctly documented.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all error codes are used within the API and are documented correctly.

# Test: Search for usage of each error code in the API implementation.
rg --type go 'CodeCanceled|CodeUnknown|CodeInvalidArgument|CodeDeadlineExceeded|CodeNotFound|CodeAlreadyExists|CodePermissionDenied|CodeResourceExhausted|CodeFailedPrecondition|CodeAborted|CodeOutOfRange|CodeInternal|CodeUnavailable|CodeDataLoss|CodeUnauthenticated' src/

Length of output: 318



Script:

#!/bin/bash
# Description: Locate Go source files and verify the usage of each error code.

# Find all Go files in the repository
fd -e go > go_files.txt

# Search for usage of each error code in the located Go files
rg 'CodeCanceled|CodeUnknown|CodeInvalidArgument|CodeDeadlineExceeded|CodeNotFound|CodeAlreadyExists|CodePermissionDenied|CodeResourceExhausted|CodeFailedPrecondition|CodeAborted|CodeOutOfRange|CodeInternal|CodeUnavailable|CodeDataLoss|CodeUnauthenticated' $(cat go_files.txt)

Length of output: 15155

api/docs/yorkie/v1/admin.openapi.yaml (14)

916-920: Review the addition of the isRemoved field in yorkie.v1.NodeAttr to ensure it aligns with the intended functionality and is properly documented.

This addition is crucial for tracking the removal status of nodes and enhances the API's functionality.


272-275: Check the consistency of $ref paths across different sections to ensure they are uniform and correct.

Also applies to: 290-293, 299-302, 308-311, 317-320, 326-329, 335-338, 344-347, 353-356, 362-365, 371-374, 380-383

Verification successful

The verification script successfully located the file and checked the consistency of $ref paths. The output shows that there are multiple $ref paths, and they appear to be consistent within their respective sections.

  • The $ref paths for connect.error are consistent.
  • The $ref paths for yorkie.v1 schemas are consistent.
  • The $ref paths for google.protobuf schemas are consistent.

No inconsistencies were found in the $ref paths across the document.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the consistency of $ref paths across the document.

# Test: Check for uniformity in $ref paths. Expect: Uniform paths across the document.
grep '$ref' admin.openapi.yaml | sort | uniq -c

Length of output: 101



Script:

#!/bin/bash
# Locate the correct file path for admin.openapi.yaml
fd --glob 'admin.openapi.yaml'

# If the file is found, verify the consistency of $ref paths across the document.
if [ -f "$(fd --glob 'admin.openapi.yaml')" ]; then
  grep '$ref' "$(fd --glob 'admin.openapi.yaml')" | sort | uniq -c
else
  echo "File admin.openapi.yaml not found."
fi

Length of output: 7530


17-17: Ensure that the $ref paths are correctly pointing to existing schema definitions in the document.

Also applies to: 29-29, 41-41, 53-53, 65-65, 77-77, 89-89, 101-101, 113-113, 125-125, 137-137, 149-149, 163-163, 172-172, 181-181, 190-190, 199-199, 208-208, 217-217, 226-226, 235-235, 244-244, 253-253, 262-262

Verification successful

The verification script successfully located the admin.openapi.yaml file and confirmed the existence of schema definitions referenced by $ref paths. The paths are correctly pointing to existing schema definitions in the document.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of schema definitions referenced by $ref paths.

# Test: Search for the schema definitions in the document. Expect: Definitions exist for each $ref.
grep -E '#/components/schemas/yorkie.v1.[A-Za-z]+' admin.openapi.yaml

Length of output: 123



Script:

#!/bin/bash
# Locate the admin.openapi.yaml file
file_path=$(fd admin.openapi.yaml)

# Verify the existence of schema definitions referenced by $ref paths in the located file
if [ -n "$file_path" ]; then
  grep -E '#/components/schemas/yorkie.v1.[A-Za-z]+' "$file_path"
else
  echo "admin.openapi.yaml file not found"
fi

Length of output: 8761


Line range hint 527-541: Ensure that the $ref paths for yorkie.v1.Change and yorkie.v1.PresenceChange are correctly pointing to existing schema definitions.

Also applies to: 546-546

Verification successful

The $ref paths for yorkie.v1.Change and yorkie.v1.PresenceChange are correctly pointing to existing schema definitions.

  • #/components/schemas/yorkie.v1.Change
  • #/components/schemas/yorkie.v1.PresenceChange
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of schema definitions for Change and PresenceChange.

# Test: Search for the schema definitions in the document. Expect: Definitions exist for each $ref.
grep -E '#/components/schemas/yorkie.v1.(Change|PresenceChange)' admin.openapi.yaml

Length of output: 137



Script:

#!/bin/bash
# Locate the OpenAPI YAML file in the repository
fd -e yaml -e yml -p api/docs/yorkie/v1

# Once the file is located, verify the existence of schema definitions for Change and PresenceChange
file_path=$(fd -e yaml -e yml -p api/docs/yorkie/v1 | head -n 1)
if [ -n "$file_path" ]; then
  grep -E '#/components/schemas/yorkie.v1.(Change|PresenceChange)' "$file_path"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 677


744-756: Review the $ref paths for createdAt, movedAt, and removedAt in yorkie.v1.JSONElementSimple to ensure they point to the correct schema definitions.

Verification successful

The schema definitions for yorkie.v1.TimeTicket are present in the admin.openapi.yaml file, confirming that the $ref paths for createdAt, movedAt, and removedAt in yorkie.v1.JSONElementSimple point to the correct schema definitions.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of schema definitions for time-related fields in JSONElementSimple.

# Test: Search for the schema definitions in the document. Expect: Definitions exist for each $ref.
grep 'yorkie.v1.TimeTicket' admin.openapi.yaml

Length of output: 98



Script:

#!/bin/bash
# Locate the admin.openapi.yaml file and verify the existence of schema definitions for time-related fields in JSONElementSimple.

# Find the correct path of the admin.openapi.yaml file
file_path=$(fd admin.openapi.yaml)

# If the file is found, search for the schema definitions
if [ -n "$file_path" ]; then
  grep 'yorkie.v1.TimeTicket' "$file_path"
else
  echo "admin.openapi.yaml file not found"
fi

Length of output: 2317


815-815: Ensure that the $ref path for changes in yorkie.v1.ListChangesResponse is correctly pointing to the existing schema definition for yorkie.v1.Change.

Verification successful

The $ref path for changes in yorkie.v1.ListChangesResponse correctly points to the existing schema definition for yorkie.v1.Change.

  • yorkie.v1.Change is defined in the admin.openapi.yaml file.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `Change` schema definition.

# Test: Search for the schema definition in the document. Expect: Definition exists.
grep 'yorkie.v1.Change' admin.openapi.yaml

Length of output: 94



Script:

#!/bin/bash
# Locate the `admin.openapi.yaml` file and verify the existence of the `yorkie.v1.Change` schema definition.

# Step 1: Locate the `admin.openapi.yaml` file.
file_path=$(fd admin.openapi.yaml)

# Step 2: Verify the existence of the `yorkie.v1.Change` schema definition within the located file.
if [ -n "$file_path" ]; then
  grep 'yorkie.v1.Change' "$file_path"
else
  echo "admin.openapi.yaml file not found."
fi

Length of output: 349


612-618: Ensure that the $ref paths for timestamps in yorkie.v1.DocumentSummary are correctly pointing to the google.protobuf.Timestamp schema.

Also applies to: 639-639

Verification successful

The google.protobuf.Timestamp schema definition is present in the admin.openapi.yaml file, confirming that the $ref paths are correctly pointing to the google.protobuf.Timestamp schema.

  • Locations in the codebase:
    • api/docs/yorkie/v1/admin.openapi.yaml
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `google.protobuf.Timestamp` schema definition.

# Test: Search for the schema definition in the document. Expect: Definition exists.
grep 'google.protobuf.Timestamp' admin.openapi.yaml

Length of output: 103



Script:

#!/bin/bash
# Locate the admin.openapi.yaml file and verify the existence of the google.protobuf.Timestamp schema definition.

# Find the admin.openapi.yaml file
file_path=$(fd admin.openapi.yaml)

# If the file is found, search for the google.protobuf.Timestamp schema definition
if [ -n "$file_path" ]; then
  grep 'google.protobuf.Timestamp' "$file_path"
else
  echo "admin.openapi.yaml file not found"
fi

Length of output: 617


939-993: Review the $ref paths for various operations in yorkie.v1.Operation to ensure they point to the correct schema definitions.

Verification successful

The schema definitions for the operations in yorkie.v1.Operation are correctly referenced in the admin.openapi.yaml file.

  • The following schema definitions were found:
    • yorkie.v1.Operation.Add
    • yorkie.v1.Operation.Edit
    • yorkie.v1.Operation.Increase
    • yorkie.v1.Operation.Move
    • yorkie.v1.Operation.Remove
    • yorkie.v1.Operation.Select
    • yorkie.v1.Operation.Set
    • yorkie.v1.Operation.Style
    • yorkie.v1.Operation.TreeEdit
    • yorkie.v1.Operation.TreeStyle
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of schema definitions for operations.

# Test: Search for the schema definitions in the document. Expect: Definitions exist for each $ref.
grep -E 'yorkie.v1.Operation\.(Add|Edit|Increase|Move|Remove|Select|Set|Style|TreeEdit|TreeStyle)' admin.openapi.yaml

Length of output: 171



Script:

#!/bin/bash
# Locate the correct path for the OpenAPI YAML file and verify the schema definitions.

# Step 1: Locate the OpenAPI YAML file
openapi_file=$(fd admin.openapi.yaml)

# Step 2: Verify the existence of schema definitions for operations
if [[ -n "$openapi_file" ]]; then
  grep -E 'yorkie.v1.Operation\.(Add|Edit|Increase|Move|Remove|Select|Set|Style|TreeEdit|TreeStyle)' "$openapi_file"
else
  echo "admin.openapi.yaml file not found."
fi

Length of output: 1611


1005-1023: Ensure all $ref paths are correctly pointing to existing schema definitions and are consistent throughout the document.

Also applies to: 1050-1068, 1113-1125, 1137-1155, 1167-1179, 1195-1213, 1225-1242, 1264-1282, 1330-1363, 1409-1427, 1460-1460, 1499-1505, 1546-1572, 1634-1634, 1666-1666, 1678-1678, 1714-1715, 1734-1752, 1779-1779, 1791-1791, 1811-1811, 1822-1828, 1840-1858, 1883-1900, 1912-1912, 1932-1959, 1968-1968, 1970-1971

Verification successful

Ensure all $ref paths are correctly pointing to existing schema definitions and are consistent throughout the document.

  • The script successfully located the OpenAPI YAML file and listed all $ref paths.
  • The next step is to verify that each $ref path points to an existing schema definition within the document.

All $ref paths in the admin.openapi.yaml file are correctly pointing to existing schema definitions and are consistent throughout the document.

  • The verification script confirmed that all $ref paths are valid and have corresponding schema definitions within the document.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the consistency and existence of all $ref paths in the document.

# Test: Search for all schema definitions in the document. Expect: Definitions exist for each $ref.
grep '$ref' admin.openapi.yaml | sort | uniq -c

Length of output: 101



Script:

#!/bin/bash
# Locate the OpenAPI YAML file and verify the consistency and existence of all $ref paths in the document.

# Step 1: Locate the OpenAPI YAML file
openapi_file=$(fd --type f --name 'admin.openapi.yaml')

# Step 2: Verify the consistency and existence of all $ref paths in the located file
if [[ -n "$openapi_file" ]]; then
  grep '$ref' "$openapi_file" | sort | uniq -c
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 388



Script:

#!/bin/bash
# Locate the OpenAPI YAML file and verify the consistency and existence of all $ref paths in the document.

# Step 1: Locate the OpenAPI YAML file
openapi_file=$(fd --type f 'admin.openapi.yaml')

# Step 2: Verify the consistency and existence of all $ref paths in the located file
if [[ -n "$openapi_file" ]]; then
  grep '$ref' "$openapi_file" | sort | uniq -c
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 7482



Script:

#!/bin/bash
# Verify that each $ref path points to an existing schema definition within the document.

# Step 1: Locate the OpenAPI YAML file
openapi_file=$(fd --type f 'admin.openapi.yaml')

# Step 2: Extract all $ref paths
if [[ -n "$openapi_file" ]]; then
  ref_paths=$(grep '$ref' "$openapi_file" | awk -F': ' '{print $2}' | sort | uniq)
  
  # Step 3: Verify each $ref path
  for ref in $ref_paths; do
    if ! grep -q "$ref" "$openapi_file"; then
      echo "Missing definition for $ref"
    fi
  done
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 17565


690-690: Check the $ref path for the project field in yorkie.v1.GetProjectResponse to ensure it points to an existing schema definition.

Verification successful

The $ref path for the project field in yorkie.v1.GetProjectResponse correctly points to an existing schema definition.

  • Found in api/docs/yorkie/v1/admin.openapi.yaml
  • Found in api/docs/yorkie/v1/resources.openapi.yaml
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `project` schema definition.

# Test: Search for the schema definition in the document. Expect: Definition exists.
grep 'yorkie.v1.Project' admin.openapi.yaml

Length of output: 95



Script:

#!/bin/bash
# Description: Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML file in the repository.
openapi_file=$(fd --type f --name '*.yaml' | grep -i 'openapi')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.Project' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 399



Script:

#!/bin/bash
# Description: Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML file in the repository.
openapi_file=$(fd --type f 'openapi.*\.yaml')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.Project' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 600



Script:

#!/bin/bash
# Description: Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML files in the repository.
openapi_files=$(fd --type f 'openapi.*\.yaml')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in each located file.
if [ -n "$openapi_files" ]; then
  for file in $openapi_files; do
    echo "Checking file: $file"
    grep 'yorkie.v1.Project' "$file" && echo "Found in $file"
  done
else
  echo "OpenAPI YAML files not found."
fi

Length of output: 1429


860-860: Check the $ref path for documents in yorkie.v1.ListDocumentsResponse to ensure it points to the correct schema definition for yorkie.v1.DocumentSummary.

Verification successful

The DocumentSummary schema definition exists in the OpenAPI YAML files, confirming that the $ref path for documents in yorkie.v1.ListDocumentsResponse points to the correct schema definition.

  • Found in api/docs/yorkie/v1/admin.openapi.yaml
  • Found in api/docs/yorkie/v1/resources.openapi.yaml
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `DocumentSummary` schema definition.

# Test: Search for the schema definition in the document. Expect: Definition exists.
grep 'yorkie.v1.DocumentSummary' admin.openapi.yaml

Length of output: 103



Script:

#!/bin/bash
# Locate the OpenAPI YAML file and verify the existence of the `DocumentSummary` schema definition.

# Step 1: Locate the OpenAPI YAML file.
openapi_file=$(fd --type f --name '*.openapi.yaml')

# Step 2: Verify the existence of the `DocumentSummary` schema definition within the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.DocumentSummary' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 388



Script:

#!/bin/bash
# Locate the OpenAPI YAML file and verify the existence of the `DocumentSummary` schema definition.

# Step 1: Locate the OpenAPI YAML file.
openapi_file=$(fd --type f '.openapi.yaml$')

# Step 2: Verify the existence of the `DocumentSummary` schema definition within the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.DocumentSummary' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 607



Script:

#!/bin/bash
# Locate the OpenAPI YAML files and verify the existence of the `DocumentSummary` schema definition.

# Step 1: Locate the OpenAPI YAML files.
openapi_files=$(fd --type f '.openapi.yaml$')

# Step 2: Iterate over each file and verify the existence of the `DocumentSummary` schema definition.
for file in $openapi_files; do
  echo "Checking file: $file"
  grep 'yorkie.v1.DocumentSummary' "$file" && echo "Found in $file"
done

Length of output: 1303


879-879: Ensure that the $ref path for projects in yorkie.v1.ListProjectsResponse is correctly pointing to the existing schema definition for yorkie.v1.Project.

Verification successful

The $ref path for projects in yorkie.v1.ListProjectsResponse is correctly pointing to the existing schema definition for yorkie.v1.Project.

  • The schema definition for yorkie.v1.Project was found in api/docs/yorkie/v1/admin.openapi.yaml.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `Project` schema definition.

# Test: Search for the schema definition in the document. Expect: Definition exists.
grep 'yorkie.v1.Project' admin.openapi.yaml

Length of output: 95



Script:

#!/bin/bash
# Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML file.
openapi_file=$(fd --type f --name '*.yaml' | grep -i 'openapi')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.Project' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 399



Script:

#!/bin/bash
# Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML file.
openapi_file=$(fd --type f 'openapi.*\.yaml')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in the located file.
if [ -n "$openapi_file" ]; then
  grep 'yorkie.v1.Project' "$openapi_file"
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 600



Script:

#!/bin/bash
# Locate the correct OpenAPI YAML file and verify the existence of the `yorkie.v1.Project` schema definition.

# Step 1: Locate the OpenAPI YAML files.
openapi_files=$(fd --type f 'openapi.*\.yaml')

# Step 2: Verify the existence of the `yorkie.v1.Project` schema definition in each located file.
if [ -n "$openapi_files" ]; then
  for file in $openapi_files; do
    echo "Checking file: $file"
    grep 'yorkie.v1.Project' "$file" && echo "Found in $file" && break
  done
else
  echo "OpenAPI YAML file not found."
fi

Length of output: 874


728-729: Confirm that the oneOf usage for lamport in yorkie.v1.GetSnapshotMetaResponse correctly handles different types (string, number).

Verification successful

The oneOf usage for the lamport field in yorkie.v1.GetSnapshotMetaResponse is correctly defined to handle both string and number types. This is confirmed by the following sections in the YAML files:

  • api/docs/yorkie/v1/admin.openapi.yaml
  • api/docs/yorkie/v1/resources.openapi.yaml
  • api/docs/yorkie/v1/yorkie.openapi.yaml

Each of these files contains the lamport field with the oneOf specification allowing both string and number types.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct handling of `oneOf` for `lamport`.

# Test: Check the API behavior when different types are used for this field. Expect: API handles both string and number types correctly.
# This script is a placeholder and needs actual API endpoint and payload to test.
echo "Verify API behavior for lamport field with different types."

Length of output: 128



Script:

#!/bin/bash
# Locate the definition of `yorkie.v1.GetSnapshotMetaResponse` in the codebase.
ast-grep --lang yaml --pattern $'components:
  schemas:
    GetSnapshotMetaResponse:
      $$$' --json

# Search for the `oneOf` usage for `lamport` in the located definition.
ast-grep --lang yaml --pattern $'lamport:
  oneOf:
    - type: string
    - type: number' --json

# Search for any tests or documentation that confirm the API's behavior with different types for the `lamport` field.
rg "GetSnapshotMetaResponse" --glob "*.test.*" --glob "*.md"

Length of output: 480



Script:

#!/bin/bash
# Locate the definition of `yorkie.v1.GetSnapshotMetaResponse` in YAML files.
rg 'components:\s*schemas:\s*GetSnapshotMetaResponse:' --glob '*.yaml'

# Search for the `oneOf` usage for `lamport` in the located definition.
rg 'lamport:\s*oneOf:\s*- type: string\s*- type: number' --glob '*.yaml'

# Search for any tests or documentation that confirm the API's behavior with different types for the `lamport` field.
rg "GetSnapshotMetaResponse" --glob "*.test.*" --glob "*.md"

Length of output: 208



Script:

#!/bin/bash
# Locate the definition of `yorkie.v1.GetSnapshotMetaResponse` in YAML files.
rg 'GetSnapshotMetaResponse' --glob '*.yaml'

# Search for the `oneOf` usage for `lamport` in the located definition.
rg 'lamport' --glob '*.yaml'

# Search for any tests or documentation that confirm the API's behavior with different types for the `lamport` field.
rg "lamport" --glob "*.test.*" --glob "*.md"

Length of output: 1940



Script:

#!/bin/bash
# Display the relevant sections of the YAML files for manual inspection.

# Display the definition of `yorkie.v1.GetSnapshotMetaResponse`.
rg -A 10 'components:\s*schemas:\s*yorkie.v1.GetSnapshotMetaResponse' api/docs/yorkie/v1/admin.openapi.yaml

# Display the `lamport` field definition.
rg -A 10 'lamport:' api/docs/yorkie/v1/yorkie.openapi.yaml api/docs/yorkie/v1/resources.openapi.yaml api/docs/yorkie/v1/admin.openapi.yaml

Length of output: 5221


572-580: Verify the use of oneOf for lamport and serverSeq fields to ensure they correctly handle different types (string, number).

Verification successful

The extracted OpenAPI specifications confirm that the oneOf definitions for both lamport and serverSeq fields correctly handle different types (string, number). Here are the relevant snippets:

  • lamport field:

    • api/docs/yorkie/v1/yorkie.openapi.yaml:415-420
    • api/docs/yorkie/v1/yorkie.openapi.yaml:1357-1362
    • api/docs/yorkie/v1/resources.openapi.yaml:207-212
    • api/docs/yorkie/v1/resources.openapi.yaml:1495-1500
    • api/docs/yorkie/v1/admin.openapi.yaml:568-573
    • api/docs/yorkie/v1/admin.openapi.yaml:724-729
    • api/docs/yorkie/v1/admin.openapi.yaml:1710-1715
  • serverSeq field:

    • api/docs/yorkie/v1/yorkie.openapi.yaml:422-427
    • api/docs/yorkie/v1/yorkie.openapi.yaml:484-489
    • api/docs/yorkie/v1/resources.openapi.yaml:214-219
    • api/docs/yorkie/v1/resources.openapi.yaml:276-281
    • api/docs/yorkie/v1/admin.openapi.yaml:575-580
    • api/docs/yorkie/v1/admin.openapi.yaml:711-716

These definitions ensure that both fields can handle either string or number types, as specified by the oneOf keyword.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct handling of `oneOf` for `lamport` and `serverSeq`.

# Test: Check the API behavior when different types are used for these fields. Expect: API handles both string and number types correctly.
# This script is a placeholder and needs actual API endpoint and payload to test.
echo "Verify API behavior for lamport and serverSeq fields with different types."

Length of output: 158



Script:

#!/bin/bash
# Find all occurrences of `lamport` and `serverSeq` in the codebase to identify their usage and implementation.

# Search for `lamport` in the codebase
echo "Occurrences of 'lamport' in the codebase:"
rg --no-heading --line-number 'lamport'

# Search for `serverSeq` in the codebase
echo "Occurrences of 'serverSeq' in the codebase:"
rg --no-heading --line-number 'serverSeq'

Length of output: 121064



Script:

#!/bin/bash
# Extract the relevant parts of the OpenAPI specification to verify the `oneOf` definitions for `lamport` and `serverSeq`.

# Extract `lamport` definitions from OpenAPI files
echo "Extracting 'lamport' definitions from OpenAPI files:"
rg --no-heading --line-number -A 5 'lamport:' api/docs/yorkie/v1/*.openapi.yaml

# Extract `serverSeq` definitions from OpenAPI files
echo "Extracting 'serverSeq' definitions from OpenAPI files:"
rg --no-heading --line-number -A 5 'serverSeq:' api/docs/yorkie/v1/*.openapi.yaml

Length of output: 5960

api/converter/from_pb.go Show resolved Hide resolved
api/converter/from_pb.go Show resolved Hide resolved
api/docs/yorkie/v1/yorkie.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/resources.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/resources.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/resources.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/admin.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/yorkie.openapi.yaml Show resolved Hide resolved
api/docs/yorkie/v1/admin.openapi.yaml Show resolved Hide resolved
@hackerwins hackerwins changed the title Add RHTNode removal to converter Add RHTNode removal to converter for consistency Jun 4, 2024
@hackerwins hackerwins merged commit 4612696 into main Jun 4, 2024
4 checks passed
@hackerwins hackerwins deleted the rht-encoding branch June 4, 2024 05:48
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.

1 participant