[ISSUE #11087] Validate lite.bind.topic for LiteTopic groups - #11088
Conversation
yx9o
commented
Sep 9, 2026
- Fixes [Enhancement] Validate lite.bind.topic with standard topic validation #11087 .
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #11088 +/- ##
=============================================
+ Coverage 48.94% 49.35% +0.41%
- Complexity 13845 14221 +376
=============================================
Files 1382 1390 +8
Lines 101597 103130 +1533
Branches 13212 13485 +273
=============================================
+ Hits 49724 50898 +1174
- Misses 45845 46051 +206
- Partials 6028 6181 +153 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR strengthens validation for lite.bind.topic in LiteTopic consumer groups by:
- Replacing
!= nullchecks withStringUtils.isNotBlank()inLiteMetadataUtil— catches empty-string values that previously passed through. - Introducing
TopicNameAttribute(extendingStringAttribute) to validate topic names at the attribute level viaTopicValidator.validateTopic(). - Adding comprehensive tests for empty/blank
lite.bind.topicin both single and batch delete scenarios, plus attribute-level validation.
The defense-in-depth approach (attribute-level validation + runtime isNotBlank checks) is solid. Tests are thorough and cover edge cases well. LGTM.
Automated review by github-manager
|
Reviewed the change — the validation itself is correct. One design suggestion on the attribute abstraction: All existing public class StringAttribute extends Attribute {
private final Consumer<String> validator;
public StringAttribute(String name, boolean changeable) {
this(name, changeable, null);
}
public StringAttribute(String name, boolean changeable, Consumer<String> validator) {
super(name, changeable);
this.validator = validator;
}
@Override
public void verify(String value) {
checkNotNull(value);
if (validator != null) {
validator.accept(value);
}
}
}and wire it at the declaration site: public static final StringAttribute LITE_BIND_TOPIC_ATTRIBUTE = new StringAttribute(
"lite.bind.topic", true, value -> {
TopicValidator.ValidateResult result = TopicValidator.validateTopic(value);
if (!result.isValid()) {
throw new RuntimeException(result.getRemark());
}
});The two-arg constructor remains unchanged, so existing attributes like |
|
Updated according to your suggestion. Could you please review it again? Thanks @f1amingo |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR adds validation for lite.bind.topic in subscription groups to prevent empty/blank topic names from being used. The changes are well-structured:
- Replaces null checks with
StringUtils.isNotBlank()for robust validation - Adds attribute-level validation in
StringAttributewith a configurable validator - Includes comprehensive test coverage for edge cases (empty strings, blank strings)
- Properly handles deletion scenarios to avoid cleaning offsets for invalid lite groups
The implementation correctly addresses issue #11087 and follows good defensive programming practices.
Automated review by github-manager-bot
|
LGTM |