Skip to content

[ISSUE #8088]♻️Enforce unified subscriber bootstrap ownership#8089

Merged
mxsm merged 1 commit into
mainfrom
mxsm/subscriber-bootstrap-architecture-guard
Jul 6, 2026
Merged

[ISSUE #8088]♻️Enforce unified subscriber bootstrap ownership#8089
mxsm merged 1 commit into
mainfrom
mxsm/subscriber-bootstrap-architecture-guard

Conversation

@mxsm

@mxsm mxsm commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

This PR strengthens the observability architecture guard that protects global tracing subscriber ownership.

Changes include:

  • Route subscriber installation checks through a dedicated detector.
  • Continue detecting direct tracing_subscriber::fmt(), tracing_subscriber::registry(), and set_global_default usage.
  • Detect imported SubscriberInitExt call chains that invoke .init() or .try_init().
  • Add detector tests for direct initialization, imported initialization, and unrelated business init() calls.
  • Clarify allowlist comments for the unified bootstrap owner and remaining compatibility paths.

How Did You Test This Change?

  • cargo test -p rocketmq-observability --test architecture_guards passed.
  • cargo fmt --all passed.
  • cargo test -p rocketmq-observability --test architecture_guards --all-features passed.
  • cargo clippy --workspace --no-deps --all-targets --all-features -- -D warnings passed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of tracing subscriber setup in automated checks, reducing the chance of missing valid installation patterns.
    • Expanded test coverage for common initialization styles and unrelated init calls, making validation more reliable.

@mxsm mxsm merged commit 85640dc into main Jul 6, 2026
5 of 7 checks passed
@mxsm mxsm deleted the mxsm/subscriber-bootstrap-architecture-guard branch July 6, 2026 17:12
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 057f9ff5-b511-4222-a9c1-64eae0b47bcd

📥 Commits

Reviewing files that changed from the base of the PR and between e51705b and d53e817.

📒 Files selected for processing (1)
  • rocketmq-observability/tests/architecture_guards.rs

Walkthrough

Modifies rocketmq-observability's architecture guard test to use a new has_subscriber_installation detector, replacing a fixed pattern-list scan. Adds subscriber_init_statement_installs_global_subscriber helper to detect statement-level .init()/.try_init() chains tied to tracing_subscriber, plus new unit tests and allowlist comments.

Changes

Subscriber Installation Detector Update

Layer / File(s) Summary
Detection helper functions
rocketmq-observability/tests/architecture_guards.rs
Adds has_subscriber_installation combining direct pattern matching, set_global_default(...) detection, and statement-level analysis via subscriber_init_statement_installs_global_subscriber for .init(/.try_init( chains tied to tracing_subscriber, fmt(), registry(), or SubscriberInitExt.
Guard test wiring and allowlist comments
rocketmq-observability/tests/architecture_guards.rs
Changes subscriber_installation_sites_are_tracked to delegate to has_subscriber_installation(source) instead of scanning SUBSCRIBER_INSTALL_PATTERNS directly; adds inline comments to SUBSCRIBER_INSTALL_ALLOWLIST entries.
Detector unit tests
rocketmq-observability/tests/architecture_guards.rs
Adds tests covering direct tracing_subscriber::fmt().init(), imported SubscriberInitExt-based try_init(), and confirming unrelated init calls (e.g. store init) are not flagged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Poem

A rabbit sniffs through code with glee,
hunting .init() where'er it be,
no fmt() or registry() can hide,
nor try_init() on the sneaky side.
Allowlist notes now clear and neat—
hop hop, another guard complete! 🐇

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mxsm/subscriber-bootstrap-architecture-guard

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.

@rocketmq-rust-bot

Copy link
Copy Markdown
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💥.

@rocketmq-rust-bot rocketmq-rust-bot added AI review first Ai review pr first auto merge ready to review waiting-review waiting review this PR approved PR has approved and removed ready to review waiting-review waiting review this PR labels Jul 6, 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♻️] Enforce unified subscriber bootstrap ownership

3 participants