unbridled-41 commented on PR #5991: URL: https://github.com/apache/rocketmq-dashboard/pull/5991#issuecomment-6090954444
### Follow-up review of this fix: `thresholdUnit` was the one field still unbounded The PR body listed `duration/reminderInterval/thresholdUnit 32` among the columns now guarded, but `thresholdUnit` got no annotation: `rmq_alert_rule.threshold_unit` is `VARCHAR(32)` and an over-long unit still travelled to the database write, which is exactly the 500-instead-of-400 this PR is about. (The other columns the body names are all covered — `metric`, `brokerName`, `clusterName`, `instanceId`, `description`, `consumerGroup`, `topic`, `duration`, `reminderInterval`.) Commit `02c99caa` fixes that in this branch (first commit `5d1ed7af` untouched, no force-push): - added `@Size(max = 32, message = "thresholdUnit must not exceed 32 characters")` to `AlertRuleRequestDTO.thresholdUnit`; - the DTO test now sets a 33-character unit in `textFieldsShouldBeBoundedToTheirColumnsTest` and a 32-character unit in `textFieldsAtTheirColumnWidthAreAcceptedTest`. The PR description is corrected as well: it now says the bounds are on UTF-16 code units (`@Size` semantics) rather than "matching each column" exactly — the DTO is the stricter of the two for non-BMP input, which for these identifier/duration/unit fields only refuses values the column would have accepted — and it records that `thresholdUnit` arrived in the follow-up commit. Red/green, both observed locally: ``` # with the thresholdUnit annotation removed cd server && mvn -o -B -ntp test -Dtest='AlertRuleRequestDTOTest' Tests run: 6, Failures: 1, Errors: 0, Skipped: 0 <<< FAILURE! (BUILD FAILURE) # with 02c99caa cd server && mvn -o -B -ntp test -Dtest='org.apache.rocketmq.studio.ops.alert.**' Tests run: 328, Failures: 0, Errors: 0, Skipped: 0 BUILD SUCCESS ``` Branch `fix/alert-rule-text-bounds`, HEAD `02c99caa` (on top of `5d1ed7af`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
