Skip to content

Conversation

@predic8
Copy link
Member

@predic8 predic8 commented Jan 5, 2026

Summary by CodeRabbit

  • Chores

    • Added a compile-time annotation library dependency to improve compatibility.
  • Refactor

    • Core startup now eagerly initializes key components for more predictable behavior and reduced on-demand creation.
  • Documentation

    • Updated roadmap with planned enhancements to initialization patterns and scripting capabilities.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

Eagerly initialize and cache FlowController and RuleManager in DefaultMainComponents, change ResolverMap visibility to private final, add jakarta.annotation-api (v2.1.1) to core/pom.xml, and update docs/ROADMAP.md with two roadmap entries.

Changes

Cohort / File(s) Summary
Dependency Management
core/pom.xml
Added compile-scope dependency jakarta.annotation:jakarta.annotation-api version 2.1.1.
Component Initialization Refactoring
core/src/main/java/com/predic8/membrane/core/router/DefaultMainComponents.java
Made resolverMap private final; added eager construction and wiring of flowController and ruleManager in the constructor; removed lazy bean registration in init(); getRuleManager() and getFlowController() return the pre-initialized fields.
Documentation
docs/ROADMAP.md
Added roadmap entries: BalancerHealthMonitor lifecycle migration to @PostConstruct and exposing beanRegistry for scripting.

Sequence Diagram(s)

(omitted — changes are refactoring/dependency/docs only)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • rrayst
  • russelmrcl

Poem

🐰
Eager hops at startup's start,
I stitch the parts and do my part.
Rules and flows now snug and keen,
Quiet wiring, tidy scene.
A carrot snack — the code is clean!

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Router sync registry fix' is vague and doesn't clearly convey the main changes, which involve refactoring dependency initialization, adding a new Jakarta annotation dependency, and updating roadmap items. Consider a more descriptive title that captures the primary change, such as 'Eagerly initialize FlowController and RuleManager in DefaultMainComponents' or 'Refactor DefaultMainComponents to initialize dependencies eagerly'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dea549f and d5dea0e.

📒 Files selected for processing (2)
  • core/pom.xml
  • docs/ROADMAP.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/ROADMAP.md
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-12-19T09:01:49.730Z
Learnt from: rrayst
Repo: membrane/api-gateway PR: 2441
File: annot/pom.xml:0-0
Timestamp: 2025-12-19T09:01:49.730Z
Learning: In the annot module (annot/pom.xml), log4j dependencies (log4j-slf4j2-impl and log4j-core) should have <scope>test</scope>, while in the distribution module they should be normal compile-scope dependencies.

Applied to files:

  • core/pom.xml
📚 Learning: 2025-09-22T19:49:29.473Z
Learnt from: predic8
Repo: membrane/api-gateway PR: 2156
File: pom.xml:0-0
Timestamp: 2025-09-22T19:49:29.473Z
Learning: In the Membrane API Gateway project, jackson-annotations is pinned to version "2.20" instead of using ${jackson.version} (2.20.0) because version 2.20.0 is not available in Maven repository yet for jackson-annotations, while it is available for jackson-core and jackson-databind. This version inconsistency is intentional and necessary due to different release schedules between Jackson modules.

Applied to files:

  • core/pom.xml
📚 Learning: 2025-08-22T13:18:09.463Z
Learnt from: predic8
Repo: membrane/api-gateway PR: 2068
File: core/src/test/java/com/predic8/membrane/core/interceptor/balancer/ClusterBalancerTest.java:73-90
Timestamp: 2025-08-22T13:18:09.463Z
Learning: The Membrane API Gateway project has mixed Java version configurations in different modules, but the team uses Java 21 in practice. Modern Java 21 features like List.getFirst() are appropriate and should be used instead of older alternatives like List.get(0).

Applied to files:

  • core/pom.xml
⏰ 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: Analyze (java)
🔇 Additional comments (1)
core/pom.xml (1)

400-405: Correctly implemented Jakarta annotations dependency.

The addition of jakarta.annotation-api:2.1.1 with compile scope is appropriate for Spring Framework 6.2.15 and Java 21. This provides the necessary Jakarta namespace annotations (like @PostConstruct, @PreDestroy) required by the initialization changes in DefaultMainComponents.


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

Fix all issues with AI Agents 🤖
In @core/pom.xml:
- Around line 400-405: Replace the javax.annotation dependency with the Jakarta
equivalent: remove the dependency entry for groupId "javax.annotation"
artifactId "javax.annotation-api" version "1.3.2" and add the dependency for
groupId "jakarta.annotation" artifactId "jakarta.annotation-api" version "2.1.1"
so the project uses the Jakarta namespace required by Spring Framework 6.2.15
and Java 21.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/src/main/java/com/predic8/membrane/core/router/DefaultMainComponents.java (1)

94-108: setRuleManager() is now broken with the final field.

The ruleManager field is final and initialized in the constructor, but setRuleManager() still exists and registers a different instance to the registry. Since getRuleManager() now returns the field directly (line 95), any RuleManager passed to the setter will be ignored—creating a silent inconsistency between the registry and what's actually used.

Either:

  1. Remove setRuleManager() if it's no longer needed with eager initialization
  2. Make ruleManager non-final and update the field in the setter
  3. Throw an exception in setRuleManager() if called after construction
Option 1: Remove the setter if no longer needed
-    public void setRuleManager(RuleManager ruleManager) {
-        log.debug("Setting ruleManager.");
-        ruleManager.setRouter(router);
-        getRegistry().register("ruleManager", ruleManager);
-    }
Option 2: Make field non-final and update in setter
-    private final RuleManager ruleManager;
+    private RuleManager ruleManager;
     public void setRuleManager(RuleManager ruleManager) {
         log.debug("Setting ruleManager.");
         ruleManager.setRouter(router);
+        this.ruleManager = ruleManager;
         getRegistry().register("ruleManager", ruleManager);
     }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd7d741 and dea549f.

📒 Files selected for processing (3)
  • core/pom.xml
  • core/src/main/java/com/predic8/membrane/core/router/DefaultMainComponents.java
  • docs/ROADMAP.md
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-19T09:01:49.730Z
Learnt from: rrayst
Repo: membrane/api-gateway PR: 2441
File: annot/pom.xml:0-0
Timestamp: 2025-12-19T09:01:49.730Z
Learning: In the annot module (annot/pom.xml), log4j dependencies (log4j-slf4j2-impl and log4j-core) should have <scope>test</scope>, while in the distribution module they should be normal compile-scope dependencies.

Applied to files:

  • core/pom.xml
⏰ 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: Automated tests
  • GitHub Check: Analyze (java)
🔇 Additional comments (3)
docs/ROADMAP.md (1)

25-27: LGTM!

The roadmap entries for @PostConstruct lifecycle management and beanRegistry exposure are consistent with the dependency and component wiring changes in this PR.

core/src/main/java/com/predic8/membrane/core/router/DefaultMainComponents.java (2)

50-66: LGTM on eager initialization approach.

The shift to eagerly initializing flowController and ruleManager in the constructor with proper router wiring improves consistency and thread-safety. This addresses the registry sync issue by ensuring these components exist before any registry lookups.


169-171: LGTM!

Returning the pre-initialized flowController is consistent with the new eager initialization pattern, and there's no setter to create a mismatch.

@membrane-ci-server
Copy link

This pull request needs "/ok-to-test" from an authorized committer.

@christiangoerdes christiangoerdes merged commit 6d7a164 into master Jan 6, 2026
4 of 5 checks passed
@christiangoerdes christiangoerdes deleted the router-sync-registry-fix branch January 6, 2026 07: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.

3 participants