Skip to content

Conversation

@aditya-rajpurohit
Copy link
Contributor

@aditya-rajpurohit aditya-rajpurohit commented Jan 4, 2026

Which Issue(s) This PR Fixes

Fixes #5409

Brief Description

This PR converts the common Type enum from the Java version of RocketMQ to Rust.

  • Renamed TypeFilterType to avoid conflicts with Rust keywords and improve clarity.
  • Added variants corresponding to the original Java enum: Null, Operand, Operator, Parenthesis, Separator.
  • Integrated the enum into the filter module and exposed it in filter.rs.

This change is part of the RocketMQ Rust migration effort for the filter module.

How Did You Test This Change?

Verified compilation with cargo build

Summary by CodeRabbit

  • New Features
    • Enhanced filter system with a new type classification to improve parsing and processing of filters.

✏️ Tip: You can customize this high-level summary in your review settings.

@rocketmq-rust-bot
Copy link
Collaborator

🔊@aditya-rajpurohit 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Walkthrough

A new public filter_type module and a FilterType enum (variants: Null, Operand, Operator, Parenthesis, Separator) were added under rocketmq-common/src/common/filter/. No other code or control flow was modified.

Changes

Cohort / File(s) Summary
Filter module declaration
rocketmq-common/src/common/filter.rs
Added pub mod filter_type; to export the new module.
Filter type definition
rocketmq-common/src/common/filter/filter_type.rs
New public FilterType enum with variants Null, Operand, Operator, Parenthesis, Separator; derives Debug, Clone, Copy, PartialEq, Eq.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped in code to add a name,
Five little tokens, each with a claim.
From Null to Separator, neat and spry,
I nibble bytes and let enums fly.
Cheers to parsing—hop, hop, hi!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates the PR converts the Type enum from Java to Rust (FilterType), which directly matches the changeset.
Linked Issues check ✅ Passed All code requirements from issue #5409 are met: FilterType enum created with correct variants (Null, Operand, Operator, Parenthesis, Separator) and integrated into the filter module.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the FilterType enum as specified in issue #5409; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23be374 and 2e8e5b1.

📒 Files selected for processing (1)
  • rocketmq-common/src/common/filter.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • rocketmq-common/src/common/filter.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check (fmt + clippy)
  • GitHub Check: auto-approve

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

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
rocketmq-common/src/common/filter/filter_type.rs (1)

15-22: Clean enum implementation; consider optional enhancements.

The FilterType enum is well-structured with appropriate derives for a simple categorical type.

Optional improvements to consider:

  • Add Hash derive if this enum will be used as a key in HashMap or HashSet collections (it already has Eq).
  • Add documentation comments explaining the purpose of each variant (e.g., what constitutes an "Operand" vs "Operator" in the filter context).
Example with Hash and docs
+/// Represents the category of a token in filter expression parsing.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub enum FilterType {
+    /// Null or empty token
     Null,
+    /// Operand in an expression (e.g., variable or value)
     Operand,
+    /// Operator in an expression (e.g., comparison or logical operator)
     Operator,
+    /// Parenthesis for grouping
     Parenthesis,
+    /// Separator between tokens
     Separator,
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b12f7a6 and 23be374.

📒 Files selected for processing (2)
  • rocketmq-common/src/common/filter.rs
  • rocketmq-common/src/common/filter/filter_type.rs
🧰 Additional context used
🪛 GitHub Actions: RocketMQ Rust CI
rocketmq-common/src/common/filter.rs

[error] 15-15: cargo fmt --all -- --check failed: formatting differences detected in rocketmq-common/src/common/filter.rs. Please run 'cargo fmt' to format the code.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: auto-approve

@rocketmq-rust-bot rocketmq-rust-bot requested a review from mxsm January 4, 2026 11:57
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.83%. Comparing base (b12f7a6) to head (2e8e5b1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5444   +/-   ##
=======================================
  Coverage   37.83%   37.83%           
=======================================
  Files         811      811           
  Lines      109905   109905           
=======================================
  Hits        41582    41582           
  Misses      68323    68323           

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

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

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

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

LGTM - All CI checks passed ✅

Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

LGTM

@mxsm mxsm merged commit 5628094 into mxsm:main Jan 4, 2026
10 of 13 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge Difficulty level/Easy Easy ISSUE feature🚀 Suggest an idea for this project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature🚀] Convert the common Type enum from Java version to Rust

4 participants