Skip to content

Make it possible to permit empty endpoints in CD endpoint groups - #1319

Merged
minwoox merged 7 commits into
line:mainfrom
m50d:LINELINT-2137
Jun 29, 2026
Merged

Make it possible to permit empty endpoints in CD endpoint groups#1319
minwoox merged 7 commits into
line:mainfrom
m50d:LINELINT-2137

Conversation

@m50d

@m50d m50d commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

We have a use case where this is desirable for a testing-only endpoint group (which will be empty when there are no tests currently active, and will then be populated before testing starts - we'd like the server to start up successfully even if no tests are currently active).

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

CentralDogmaEndpointGroupBuilder gains an allowEmptyEndpoints boolean field and updated constructor. CentralDogmaEndpointGroup's constructor is extended to accept and forward this flag to DynamicEndpointGroup via super(strategy, allowEmptyEndpoints). All factory and builder paths pass false explicitly. Empty endpoint skip logic in registerWatcher() is now gated on allowsEmptyEndpoints().

Changes

allowEmptyEndpoints propagation through EndpointGroup construction

Layer / File(s) Summary
Builder field, constructor, and configuration
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java
CentralDogmaEndpointGroupBuilder adds an allowEmptyEndpoints field initialized in the package-private constructor, provides a new public setAllowEmptyEndpoints() fluent method, and passes the field to CentralDogmaEndpointGroup in build().
CentralDogmaEndpointGroup constructor and factory methods
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java
CentralDogmaEndpointGroup constructor is extended to accept boolean allowEmptyEndpoints and forwards it to DynamicEndpointGroup via super(strategy, allowEmptyEndpoints). The ofWatcher() factory explicitly sets allowEmptyEndpoints to false, and builder factory methods (both two-argument and new three-argument overload) route this parameter through the builder.
Empty endpoints update skip logic
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java
registerWatcher() now conditionally skips refresh for empty decoded endpoint lists only when empty endpoints are not allowed, using allowsEmptyEndpoints() to gate the skip behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A flag hops down the builder chain,
allowEmptyEndpoints is its name.
False by default, it travels far,
Through super() calls to where you are.
Guarding empty lists with care and grace! 🚫✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% 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
Title check ✅ Passed The title accurately and concisely describes the main change: adding support for permitting empty endpoints in Central Dogma endpoint groups.
Description check ✅ Passed The description clearly explains the use case and motivation: a testing-only endpoint group that needs to remain empty when no tests are active, allowing the server to start successfully.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java`:
- Around line 129-133: The `allowEmptyEndpoints` parameter is passed to the
parent DynamicEndpointGroup constructor but is not being honored in the refresh
logic. In the refresh method around line 143 where empty decoded updates are
dropped unconditionally, add a check for the `allowEmptyEndpoints` flag. Only
drop empty endpoint updates if `allowEmptyEndpoints` is false; when it is true,
allow the empty endpoint list to be processed and reflected in the endpoint
group. This ensures that transitions to empty endpoint states are properly
honored when explicitly enabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8be4af5e-979f-4d75-91d2-56ec0362ddbb

📥 Commits

Reviewing files that changed from the base of the PR and between 07b6fdb and 2801a82.

📒 Files selected for processing (2)
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java (1)

123-127: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add Javadoc for the allowEmptyEndpoints parameter.

The three-parameter builder overload introduces an allowEmptyEndpoints parameter but does not document it. Add an @param allowEmptyEndpoints tag explaining when and why a caller would set this to true.

📝 Suggested Javadoc addition
     /**
      * Returns a new {`@link` CentralDogmaEndpointGroupBuilder} with the {`@link` Watcher}
      * and {`@link` EndpointListDecoder}. You can create a {`@link` Watcher} using {`@link` CentralDogma}:
      *
      * <pre>{`@code`
      * CentralDogma centralDogma = ...
      * Query<T> query = ... // The query to the entry that contains the list of endpoints.
      * Watcher watcher = centralDogma.fileWatcher(projectName, repositoryName, query);
      * }</pre>
+     *
+     * `@param` allowEmptyEndpoints whether to allow the endpoint group to have an empty endpoint list.
+     *                            When {`@code` false}, transitions to an empty endpoint list are ignored
+     *                            and the group retains its previous endpoints. When {`@code` true}, the
+     *                            group will reflect an empty state when the watched entry contains no endpoints.
      */
     public static <T> CentralDogmaEndpointGroupBuilder<T> builder(Watcher<T> watcher,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java`
around lines 123 - 127, The static builder method in the
CentralDogmaEndpointGroupBuilder class is missing Javadoc documentation for the
allowEmptyEndpoints parameter. Add a Javadoc comment block above the builder
method that includes an `@param` tag for the allowEmptyEndpoints parameter,
explaining what this parameter controls and the conditions or reasons when a
caller would set it to true.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java`:
- Around line 123-127: The static builder method in the
CentralDogmaEndpointGroupBuilder class is missing Javadoc documentation for the
allowEmptyEndpoints parameter. Add a Javadoc comment block above the builder
method that includes an `@param` tag for the allowEmptyEndpoints parameter,
explaining what this parameter controls and the conditions or reasons when a
caller would set it to true.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac8753dc-5634-43b0-a8ba-db58ac7615b8

📥 Commits

Reviewing files that changed from the base of the PR and between 0fab123 and 2c0f916.

📒 Files selected for processing (1)
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java

@m50d

m50d commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Build error looks like an unrelated flake?

@minwoox minwoox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 👍

@minwoox minwoox added this to the 0.85.0 milestone Jun 23, 2026

@jrhee17 jrhee17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 👍

*/
public static <T> CentralDogmaEndpointGroupBuilder<T> builder(Watcher<T> watcher,
EndpointListDecoder<T> endpointListDecoder,
boolean allowEmptyEndpoints) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional) Given that we're already using a builder pattern and allowEmptyEndpoints's default value is reasonable, I wonder if it's a better idea to add a builder method instead of adding to the builder factory method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The use sites I've seen don't really use it as a builder, they all call the factory method and build() immediately, so this seemed more in line with existing use? But happy to follow the builder style if you prefer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My line of thought is just from an API management point - each param could possibly add 2^n overload variants.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Doing it that way.

@ikhoon ikhoon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM if @jrhee17 comments are addressed.

try {
final List<Endpoint> newEndpoints = endpointListDecoder.decode(instances);
if (newEndpoints.isEmpty()) {
if (newEndpoints.isEmpty() && !allowsEmptyEndpoints()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand this is the main change because empty endpoints are allowed in DynamicEndpointGroup by default.

@m50d m50d Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm I guess so. Didn't dig in far enough, just saw it would exception when trying to start if there were no endpoints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Checked the consequences of setting to false rather than true, seems to just be early exit from update methods that would otherwise set it to empty.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java (1)

67-69: 📐 Maintainability & Code Quality | 🔵 Trivial

Make setAllowEmptyEndpoints return CentralDogmaEndpointGroupBuilder<T> for a consistent fluent API.

The selectionStrategy() method (line 48) returns the builder for method chaining, but setAllowEmptyEndpoints() (line 67) returns void, breaking the fluent API pattern. Returning this would allow seamless chaining with other builder methods.

♻️ Proposed change
-    public void setAllowEmptyEndpoints(boolean allowEmptyEndpoints) {
+    public CentralDogmaEndpointGroupBuilder<T> setAllowEmptyEndpoints(boolean allowEmptyEndpoints) {
         this.allowEmptyEndpoints = allowEmptyEndpoints;
+        return this;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java`
around lines 67 - 69, The setAllowEmptyEndpoints method currently returns void,
which breaks the fluent API pattern used elsewhere in the
CentralDogmaEndpointGroupBuilder class. Change the return type of
setAllowEmptyEndpoints from void to CentralDogmaEndpointGroupBuilder<T> to match
the pattern used in selectionStrategy(), and add a return statement at the end
of the method that returns this to enable method chaining consistency with other
builder methods.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java`:
- Around line 67-69: The setAllowEmptyEndpoints method currently returns void,
which breaks the fluent API pattern used elsewhere in the
CentralDogmaEndpointGroupBuilder class. Change the return type of
setAllowEmptyEndpoints from void to CentralDogmaEndpointGroupBuilder<T> to match
the pattern used in selectionStrategy(), and add a return statement at the end
of the method that returns this to enable method chaining consistency with other
builder methods.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c406da3-2ed4-4062-9478-c9b7d3e0eee3

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5dd47 and 5100eda.

📒 Files selected for processing (2)
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroupBuilder.java
💤 Files with no reviewable changes (1)
  • client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java

@minwoox
minwoox merged commit 12bc1f0 into line:main Jun 29, 2026
13 of 14 checks passed
@m50d
m50d deleted the LINELINT-2137 branch June 29, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants