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

[ECO-5188] MessageAction enum changes #1056

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SimonWoolf
Copy link
Member

@SimonWoolf SimonWoolf commented Jan 8, 2025

per ably/specification#263

Breaking change but this was agreed, as no clients are currently using the action yet.

Summary by CodeRabbit

  • Breaking Changes

    • Removed MESSAGE_UNSET, ANNOTATION_CREATE, and ANNOTATION_DELETE enum values
    • Adjusted ordinal values for MESSAGE_CREATE, MESSAGE_UPDATE, and MESSAGE_DELETE
    • Added new MESSAGE_SUMMARY enum value
  • Updates

    • Updated META_OCCUPANCY ordinal value
    • Modified message action serialization and deserialization tests to reflect new enum configuration

@SimonWoolf SimonWoolf requested a review from ttypic January 8, 2025 14:04
Copy link

coderabbitai bot commented Jan 8, 2025

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The pull request modifies the MessageAction enum in the Ably library, removing three enum values (MESSAGE_UNSET, ANNOTATION_CREATE, and ANNOTATION_DELETE) and introducing a new MESSAGE_SUMMARY value. The ordinals for existing enum values have been reorganized, with MESSAGE_CREATE, MESSAGE_UPDATE, and MESSAGE_DELETE now assigned sequential ordinals from 0 to 2. Corresponding test cases in MessageTest.java have been updated to reflect these changes in the enum's structure.

Changes

File Change Summary
lib/src/main/java/io/ably/lib/types/MessageAction.java - Removed enum values: MESSAGE_UNSET, ANNOTATION_CREATE, ANNOTATION_DELETE
- Added new enum value: MESSAGE_SUMMARY
- Reordered ordinals for MESSAGE_CREATE (0), MESSAGE_UPDATE (1), MESSAGE_DELETE (2), META_OCCUPANCY (3)
lib/src/test/java/io/ably/lib/types/MessageTest.java - Updated test assertions to match new enum ordinal values
- Modified expected "action" property from 1 to 0 in serialization/deserialization tests

Poem

🐰 Hop, hop, enum's new dance!
Ordinals shift with rabbit's glance
Unset values swept away
Message actions find their way
A summary joins the bright parade 🎉


📜 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 8c3d03c and 0684534.

📒 Files selected for processing (2)
  • lib/src/main/java/io/ably/lib/types/MessageAction.java (1 hunks)
  • lib/src/test/java/io/ably/lib/types/MessageTest.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/src/test/java/io/ably/lib/types/MessageTest.java
  • lib/src/main/java/io/ably/lib/types/MessageAction.java
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: check (29)
  • GitHub Check: check-rest-okhttp
  • GitHub Check: check (24)
  • GitHub Check: check (21)
  • GitHub Check: check-rest
  • GitHub Check: check (19)
  • GitHub Check: check-realtime-okhttp
  • GitHub Check: check-realtime
  • GitHub Check: check
  • GitHub Check: build

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@github-actions github-actions bot temporarily deployed to staging/pull/1056/features January 8, 2025 14:06 Inactive
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: 3

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2c0f111 and 8c3d03c.

📒 Files selected for processing (3)
  • lib/src/main/java/io/ably/lib/types/MessageAction.java (1 hunks)
  • lib/src/test/java/io/ably/lib/test/common/Setup.java (4 hunks)
  • lib/src/test/java/io/ably/lib/types/MessageTest.java (2 hunks)
🔇 Additional comments (2)
lib/src/main/java/io/ably/lib/types/MessageAction.java (1)

4-8: Verify impact of breaking changes

The removal of enum values and reordering of ordinals is a breaking change. While PR objectives indicate no clients use these actions, we should verify this claim.

Run this script to search for any usage of the removed enum values:

✅ Verification successful

Breaking changes verified - safe to proceed

The removal of enum values and reordering of ordinals is safe because:

  • No usage of the removed enum values found in the codebase
  • No direct ordinal value dependencies found
  • Ordinal changes are safely handled by tryFindByOrdinal which returns null for unknown values
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of removed enum values
echo "Searching for MESSAGE_UNSET usage..."
rg "MESSAGE_UNSET" -t java

echo "Searching for ANNOTATION_CREATE usage..."
rg "ANNOTATION_CREATE" -t java

echo "Searching for ANNOTATION_DELETE usage..."
rg "ANNOTATION_DELETE" -t java

# Search for direct ordinal usage which might break
echo "Searching for potential hardcoded ordinal values..."
rg "MessageAction.*\b[0-9]+\b" -t java

Length of output: 507


Script:

#!/bin/bash
# Search for all MessageAction usages
echo "Searching for MessageAction usage..."
rg "MessageAction" -t java -A 2 -B 2

# Search for serialization/deserialization patterns
echo "Searching for MessageAction in serialization context..."
rg "fromInt|toInt|valueOf|ordinal.*MessageAction" -t java

# Search specifically in test files
echo "Searching for MessageAction in test files..."
fd "Test.*\.java" --exec rg "MessageAction" {} \;

Length of output: 26358

lib/src/test/java/io/ably/lib/test/common/Setup.java (1)

163-164: Verify impact of configuration changes

The changes to default configurations might affect other tests in the suite.

Run this script to find tests that might be affected:

✅ Verification successful

Configuration changes are consistent with test suite patterns

The changes to tls and logLevel in Setup.java align with existing test patterns. Many tests already explicitly set tls = false, and Log.VERBOSE is commonly used across the test suite. Tests requiring different configurations are already overriding these values explicitly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for tests that might depend on TLS or specific ports
echo "Searching for TLS-dependent tests..."
rg "opts\.tls" -t java -A 5 "test.*\.java$"

echo "Searching for port-dependent tests..."
rg "opts\.port|opts\.tlsPort" -t java -A 5 "test.*\.java$"

echo "Searching for environment-dependent tests..."
rg "opts\.environment.*local" -t java -A 5 "test.*\.java$"

Length of output: 596


Script:

#!/bin/bash
# Search for tests that might depend on TLS or specific ports
echo "Searching for TLS-dependent tests..."
rg "opts\.tls" -t java lib/src/test/

echo "Searching for log level dependent tests..."
rg "opts\.logLevel" -t java lib/src/test/

echo "Searching for Setup class usage..."
rg "Setup\." -t java lib/src/test/

Length of output: 9004

lib/src/main/java/io/ably/lib/types/MessageAction.java Outdated Show resolved Hide resolved
@SimonWoolf SimonWoolf force-pushed the message-action-changes branch from 8c3d03c to 510185c Compare January 8, 2025 14:54
@github-actions github-actions bot temporarily deployed to staging/pull/1056/features January 8, 2025 14:55 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1056/javadoc January 8, 2025 14:56 Inactive
@SimonWoolf SimonWoolf force-pushed the message-action-changes branch from 510185c to 0684534 Compare January 8, 2025 20:29
@ably ably deleted a comment from coderabbitai bot Jan 8, 2025
@ably ably deleted a comment from coderabbitai bot Jan 8, 2025
@SimonWoolf
Copy link
Member Author

@coderabbitai ignore

Copy link

coderabbitai bot commented Jan 8, 2025

✅ Actions performed

Reviews paused.

@ttypic ttypic changed the title MessageAction enum changes [ECO-5188] MessageAction enum changes Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants