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

   ### Which Issue(s) This PR Fixes
   
   Fixes #6018
   
   ### Brief Description
   
   A failed Proxy stack query was reduced to null, and the subsequent Broker 
`CONSUMER_NOT_ONLINE` response incorrectly became 404. Preserve running-info 
query availability: a failed Proxy lookup plus an absent Broker result is 502; 
a successful direct-consumer Broker fallback still succeeds. Explicit offline 
replies remain distinguishable from failed/empty RPC responses, and interrupted 
running-info/Broker queries preserve interruption.
   
   The consumer modal now displays a localized capture-error notice for failed 
requests, and a separate no-stack notice for successful empty results. It no 
longer claims all Proxy clients lack capture support.
   
   The existing connection-list Resolver APIs stay intact. #5958 changes the 
connection aggregation path; #5255 changes client startup; #5529 touches nearby 
consumer-modal translations and may need a small rebase.
   
   **Follow-up commit `86e21f2` — keep instance errors out of the 502 
rewrite.** The first version of this PR graded *any* `BusinessException` with 
code 404 into 502 whenever the Proxy leg was unavailable. That status code is 
not produced only by the stack lookup: `RuntimeAdminClientResolver` raises `404 
"Instance not found: <id>"` while it resolves the instance, before the admin 
client callback runs, so asking for the stack of an unknown or deleted instance 
came back as `502 "Unable to determine consumer stack availability: proxy query 
failed for <clientId>"` — a request-level error reported as a gateway failure, 
with a message pointing at the client instead of the instance.
   
   The rewrite now lives inside the stack-lookup callback, i.e. it applies only 
once an admin client has actually been handed out and the lookup itself 
answered "client missing". Instance resolution (`400 instanceId is required`, 
`404 Instance not found`), the vendor/credential and endpoint preconditions 
(`422`, `400`) and admin-client preparation (`502`, `503`) are raised outside 
that callback and keep their own status code and message; a query with a blank 
`instanceId` still takes the default NameServer path unchanged. Nothing is 
classified by matching exception message text, and no pre-resolution check was 
added — a pre-check would only prove the instance existed a moment earlier 
while the later resolution could fail the same way, and would cost an extra 
lookup.
   
   A genuine Proxy failure combined with the Broker's client-missing reply is 
still 502, and the direct-consumer Broker fallback is still preferred whenever 
it answers. `server/README.md` states the boundary.
   
   ### How Did You Test This Change?
   
   Base: `rocketmq-studio@7e7aa344`; Java 21 (Dragonwell/Temurin-equivalent 
local JDK 21.0.10), Node 22.19.0. Frontend dependencies use the identical 
committed lockfile. Maven runs offline against the pre-existing local 
dependency cache.
   
   For the original change:
   
   - Fail-before probe on that base: Proxy query failure + Broker offline 
produced 404 instead of expected 502.
   - `cd server && mvn -o -B -ntp -Dmaven.repo.local=<local-cache> 
-Dspring.profiles.active=dev 
-Dtest=ProxyConsumerResolverTest,RocketMQConsumerDiagnosticsProviderTest,ConsumerGroupControllerTest
 test`: Checkstyle **0 violations**. Covers discovery/query failure, explicit 
offline, missing response/body, success after another Proxy fails, direct 
fallback, interruption and HTTP 502 mapping.
   - `cd web && npm test -- 
src/pages/instance/__tests__/ConsumerPage.test.tsx`: **49 passed**. The two new 
zh/en failure cases both fail against the old page implementation.
   - `cd web && npm test -- src/i18n`: **11 passed**; `npm run license:test`: 
**4 passed**.
   - `npm run lint`: **0 errors / 10 warnings in unchanged code**. Prettier and 
`git diff --check` pass.
   
   For the follow-up commit `86e21f2` (no frontend change is involved in it):
   
   - Fail-before on the previous head `e2379175`, with only the new test added: 
`mvn -o -B -ntp -Dmaven.repo.local=<local-cache> -Dspring.profiles.active=dev 
-Dtest=RocketMQConsumerDiagnosticsProviderTest test` → **18 tests, 1 failure**, 
`Expecting message to be "Instance not found: instance-a" but was "Unable to 
determine consumer stack availability: proxy query failed for client-1"`, 
thrown from `RocketMQConsumerDiagnosticsProvider.getConsumerStack`.
   - Same command after the fix: **18 tests, 0 failures/errors**. The two added 
cases pin that a `404 "Instance not found"` and the `422`/`400` instance 
preconditions survive unchanged with their original messages, and that no stack 
lookup is attempted once resolution fails; one `ConsumerGroupControllerTest` 
case pins the same 404 through the HTTP layer. The pre-existing 
`proxyFailureAndBrokerOfflineShouldRemainUnavailableTest` and 
`proxyFailureAndEmptyBrokerResultShouldRemainUnavailableTest` still assert 502 
for a Proxy failure plus a missing client, so the original grading was not 
traded away for the new assertions.
   - Targeted: `mvn -o -B -ntp -Dmaven.repo.local=<local-cache> 
-Dspring.profiles.active=dev 
-Dtest=ProxyConsumerResolverTest,RocketMQConsumerDiagnosticsProviderTest,ConsumerGroupControllerTest
 test`: **54 tests, 0 failures, 0 errors** (11 + 18 + 25), Checkstyle **0 
violations**.
   - Full backend: `cd server && mvn -o -B -ntp 
-Dmaven.repo.local=<local-cache> -Dspring.profiles.active=dev test`: **3408 
tests, 0 failures, 0 errors, 3 skipped**, Checkstyle **0 violations**, `BUILD 
SUCCESS`. The first full run on this tree reported one error, 
`ResourceOwnershipGuardTest.migrationConcurrentStartupIsIdempotentTest` 
(`ConcurrentModificationException` from H2 during concurrent migration); 
re-running that class alone reproduced it, and two further full-suite runs on 
the same unmodified tree were clean. The same single error is recorded in other 
working trees at this base that do not contain this commit. That test was not 
modified, disabled or skipped, and a rerunning suite is by itself not proof of 
unrelatedness — it is reported as an observation, not as a claim.
   - `git diff --check` passes; the commit touches only `server/README.md`, 
`RocketMQConsumerDiagnosticsProvider.java`, 
`RocketMQConsumerDiagnosticsProviderTest.java` and 
`ConsumerGroupControllerTest.java`.
   
   These runs were executed on the working tree before the commit was created; 
the published commit contains exactly that verified content (same four files, 
81 insertions / 16 deletions, byte-identical diff). Local results are not a 
substitute for the CI run on the current head.
   
   Not exercised: a real Broker/Proxy outage, ACL/TLS, the default MySQL 
integration suite, and concurrency against a live Broker. Network responses are 
simulated; this PR does not claim protocol-specific capture support. The 
instance-level `400`/`422` cases assert that the provider passes a precondition 
exception through unchanged — they do not test the credential system end to end.
   
   ### Checklist
   
   - [x] One coherent change; no unrelated refactor
   - [x] Conventional commit; new Java test methods end with `Test`
   - [x] Regression tests cover changed behavior
   - [x] New UI text has Chinese and English entries
   - [x] No new source files or dependencies
   - [x] Diagnostic behavior documented in `server/README.md`
   - [ ] CI green on the current head
   
   
   ### CI follow-up
   
   On head `e2379175` the backend test job passed while the backend build, 
frontend build, frontend Docker build and the `rmqctl` Go job failed. Those 
four also fail on this repository's own push run for `rocketmq-studio@7e7aa344` 
(https://github.com/apache/rocketmq-dashboard/actions/runs/37924783619), and 
the Go failure traces to `TestMessageQueryCompletenessWarningTest` on the yaml 
renderer, which this PR does not modify — so they are reported as pre-existing 
on the base rather than as something this branch introduced.
   
   Head `86e21f2` is a new commit; its checks are read from the checks tab of 
this pull request and are not assumed to match the previous head. This PR does 
not claim a fully green CI: the status of the current head is whatever its own 
checks report, and the trunk has since moved beyond `7e7aa344`.
   


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