Skip to content

[ISSUE #6496]♻️Refactor message filter usage to utilize ArcMessageFilter for improved type safety and clarity#6497

Merged
rocketmq-rust-bot merged 1 commit intomainfrom
refactor-6496
Feb 24, 2026
Merged

[ISSUE #6496]♻️Refactor message filter usage to utilize ArcMessageFilter for improved type safety and clarity#6497
rocketmq-rust-bot merged 1 commit intomainfrom
refactor-6496

Conversation

@mxsm
Copy link
Owner

@mxsm mxsm commented Feb 24, 2026

Which Issue(s) This PR Fixes(Closes)

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • Refactor
    • Unified message filtering type implementation across broker and storage modules for consistent type handling.

@rocketmq-rust-bot
Copy link
Collaborator

🔊@mxsm 🚀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 Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e3661b and a41cd99.

📒 Files selected for processing (11)
  • rocketmq-broker/src/coldctr/cold_data_pull_request_hold_service.rs
  • rocketmq-broker/src/long_polling/long_polling_service/pop_long_polling_service.rs
  • rocketmq-broker/src/long_polling/pop_request.rs
  • rocketmq-broker/src/long_polling/pull_request.rs
  • rocketmq-broker/src/processor/default_pull_message_result_handler.rs
  • rocketmq-broker/src/processor/pop_message_processor.rs
  • rocketmq-broker/src/processor/pull_message_processor.rs
  • rocketmq-broker/src/processor/pull_message_result_handler.rs
  • rocketmq-store/src/base/message_store.rs
  • rocketmq-store/src/filter.rs
  • rocketmq-store/src/message_store/local_file_message_store.rs

Walkthrough

The PR refactors message filter type usage across RocketMQ broker and store modules by introducing a new public type alias ArcMessageFilter = Arc<dyn MessageFilter> and replacing all instances of Arc<Box<dyn MessageFilter>> with this alias, removing unnecessary boxing indirection while maintaining trait object support.

Changes

Cohort / File(s) Summary
Type Alias Definition
rocketmq-store/src/filter.rs
Introduced new public type alias ArcMessageFilter = Arc<dyn MessageFilter> to simplify arc-wrapped trait object usage across the codebase.
Store Trait Interfaces
rocketmq-store/src/base/message_store.rs, rocketmq-store/src/message_store/local_file_message_store.rs
Updated MessageStore trait and implementation: get_message and get_message_with_size_limit methods now accept Option<ArcMessageFilter> instead of Option<Arc<Box<dyn MessageFilter>>>.
Cold Data & Pull Request Structures
rocketmq-broker/src/coldctr/cold_data_pull_request_hold_service.rs, rocketmq-broker/src/long_polling/pull_request.rs, rocketmq-broker/src/long_polling/pop_request.rs
Updated struct fields, constructors, and getter methods to use ArcMessageFilter, eliminating nested boxing from public APIs.
Long Polling Service
rocketmq-broker/src/long_polling/long_polling_service/pop_long_polling_service.rs
Updated PopLongPollingService::polling method signature to accept message_filter as Option<ArcMessageFilter> instead of the boxed variant.
Message Processors & Handlers
rocketmq-broker/src/processor/pull_message_processor.rs, rocketmq-broker/src/processor/pop_message_processor.rs, rocketmq-broker/src/processor/pull_message_result_handler.rs, rocketmq-broker/src/processor/default_pull_message_result_handler.rs
Updated method signatures and filter creation paths: removed Arc::new(Box::new(...)) wrapping in favor of direct ArcMessageFilter instantiation across message processors and result handlers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~13 minutes

Poem

🐰 A filter wrapped in Box, now has a cleaner name,
No nested Arcs to muddy up the game!
ArcMessageFilter shines so bright and clear,
Refactoring the filters we hold so dear! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring change: replacing Arc<Box> with ArcMessageFilter across multiple files for improved type safety.
Linked Issues check ✅ Passed The pull request successfully refactors message filter usage to use ArcMessageFilter instead of Arc<Box>, directly addressing issue #6496's objective to improve type safety and clarity.
Out of Scope Changes check ✅ Passed All changes are directly within scope, focusing exclusively on refactoring message filter types from Arc<Box> to ArcMessageFilter across broker and store modules.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-6496

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.

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.18%. Comparing base (cf24e7b) to head (a41cd99).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...etmq-broker/src/processor/pop_message_processor.rs 0.00% 4 Missing ⚠️
...tmq-broker/src/processor/pull_message_processor.rs 0.00% 4 Missing ⚠️
rocketmq-broker/src/long_polling/pop_request.rs 0.00% 2 Missing ⚠️
rocketmq-broker/src/long_polling/pull_request.rs 0.00% 2 Missing ⚠️
...tore/src/message_store/local_file_message_store.rs 0.00% 2 Missing ⚠️
...src/coldctr/cold_data_pull_request_hold_service.rs 0.00% 1 Missing ⚠️
...g/long_polling_service/pop_long_polling_service.rs 0.00% 1 Missing ⚠️
...c/processor/default_pull_message_result_handler.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6497      +/-   ##
==========================================
- Coverage   42.18%   42.18%   -0.01%     
==========================================
  Files         942      942              
  Lines      131786   131785       -1     
==========================================
- Hits        55598    55593       -5     
- Misses      76188    76192       +4     

☔ 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 ✅

@rocketmq-rust-bot rocketmq-rust-bot merged commit 51c7663 into main Feb 24, 2026
17 of 19 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 Feb 24, 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 refactor♻️ refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor♻️] Refactor message filter usage to utilize ArcMessageFilter for improved type safety and clarity

3 participants