yyqdbngt opened a new pull request, #4671: URL: https://github.com/apache/rocketmq-dashboard/pull/4671
<!-- Base branch: `rocketmq-studio`, the RocketMQ Studio trunk. --> ### Which Issue(s) This PR Fixes - No open issue; validation asymmetry found while auditing the offset-reset path (same defect class as #4260 / #4258, which hardened the neighbouring group read paths). ### Brief Description `MetadataService.resetOffset` and `MetadataService.previewResetOffset` forwarded `timestamp` straight to the broker, even though `ResetConsumerOffsetDTO` declares it `@Positive` and the same two methods already reject a blank group and topic name before provider resolution. The AI / rmqctl tool path (`GroupResetOffsetToolHandler`) only checks that the timestamp is non-null, so a `0` or negative value reached the broker's `resetOffsetByTimestamp` and moved the group to the earliest offset, while the API reported success. Both entrypoints now reject a non-positive timestamp with the same 400 the DTO promises. ### How Did You Test This Change? Two new `MetadataServiceTest` cases, one per entrypoint, assert the 400 and that no provider call was made. Red - on the unmodified base: ``` $ cd server && mvn -B -ntp test -Dtest=MetadataServiceTest [ERROR] Tests run: 54, Failures: 2, Errors: 0, Skipped: 0 [ERROR] MetadataServiceTest.resetOffsetShouldRejectNonPositiveTimestampBeforeProviderResolution:864 java.lang.AssertionError: Expecting code to raise a throwable. [ERROR] MetadataServiceTest.previewResetOffsetShouldRejectNonPositiveTimestampBeforeProviderResolution:876 java.lang.AssertionError: Expecting code to raise a throwable. [INFO] BUILD FAILURE ``` Green - after the fix, including the 52 pre-existing cases of the class and checkstyle: ``` $ cd server && mvn -B -ntp test -Dtest=MetadataServiceTest [INFO] You have 0 Checkstyle violations. [INFO] Tests run: 54, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS ``` ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / `refactor:` / `chore:` / `docs:` / `perf:`) - [x] Tests added or updated for non-trivial changes, test methods named `...Test` - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (no UI text is added) - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit checks) - [x] New source files carry the ASF license header (no new source file) - [x] Documentation touched where behaviour changed (no README / `docs/` page documents this guard) -- 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]
