chennaji9 opened a new pull request, #6662:
URL: https://github.com/apache/rocketmq-dashboard/pull/6662

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   `MessageService.pullMessageAtOffset` resolved the instance's provider 
through `Optional.map(...).orElseGet(fallback)`. For a registered provider, a 
**null** return (the provider's documented "no message at this offset" answer — 
`RocketMQMessageProvider` returns null whenever the pull status is not `FOUND` 
or the found list is empty) became an empty `Optional`, so the fallback issued 
a **second, identical pull**. If that second RPC failed, a query that had 
already succeeded once surfaced as a 502; when both succeeded, the queue was 
still queried twice.
   
   - The provider is now selected explicitly: a registered provider's result 
(including null) is returned as-is; the fallback runs only for instances 
without a registered provider.
   
   ### How Did You Test This Change?
   
   `cd server && mvn -B -ntp test -Dtest='MessageServiceTest' 
-DfailIfNoTests=false` → **Tests run: 37, Failures: 0, Errors: 0** (35 
pre-existing + 2 new).
   
   New tests:
   - `pullMessageAtOffsetKeepsTheRegisteredProviderNullResultTest` — a 
registered provider returning null yields null, the provider is called exactly 
once, and the fallback provider is **never** invoked. On the unfixed code this 
fails (the fallback is invoked by the second pull).
   - `pullMessageAtOffsetStillFallsBackWithoutAProviderTest` — an instance 
without a registered provider still uses the fallback provider.
   
   Red-green: both new tests were also run against the unfixed tree — the 
null-result test fails there (`verifyNoInteractions(fallback)`), the fallback 
test passes, pinning the regression boundary.
   
   Not run: the full `mvn test` suite (integration tests need MySQL 8); the 
change is confined to one method whose callers are covered above.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes (2 new red-green tests)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(n/a — no UI change)
   - [x] Architecture constraints stay green (same class, same package, no new 
dependency)
   - [x] New source files carry the ASF license header (n/a — no new source 
file)
   - [x] Documentation touched where behaviour changed (n/a — observable 
behaviour now matches the provider contract)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to