You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Wang1rrr (via GitHub)" <gi...@apache.org> on 2026/09/22 03:30:05 UTC

[PR] fix(apache): report a Node.js client language instead of dropping it [rocketmq-dashboard]

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

   <!-- Make sure the base branch is `master`: that is the RocketMQ Studio trunk. -->
   
   ### Which Issue(s) This PR Fixes
   
   - Fixes #4845
   
   ### Brief Description
   
   `RocketMQClientProvider.mapLanguage` (`provider/apache/RocketMQClientProvider.java:439`) is the only mapping from the broker's `LanguageCode` to Studio's `ClientLanguage`, and it covers seven of the eight `ClientLanguage` members. `LanguageCode.NODE_JS` - present in rocketmq-remoting 5.5.0 - has no case, so it hits `default: return null` and every Node.js client is published with `"language": null`.
   
   The rest of the stack already expects that member:
   
   | layer | state before this PR |
   | --- | --- |
   | `ClientLanguage` (`:21`) | declares `Java, Go, Python, Rust, Cpp, CSharp, NodeJS, PHP` |
   | `languageConfig` (`web/src/pages/cluster/clients.tsx:101`) | has `NodeJS: { color: 'lime', label: 'Node.js' }` |
   | Language column filter (`clients.tsx:473`, `:478`) | offers a Node.js option that can never match `null` |
   | Distribution panel (`clients.tsx:302`, `:806`) | buckets the connection under the literal language `null` |
   | CSV export (`clients.tsx:113`) | writes an empty `Language` cell |
   | Client diagnostics (`clientConnectionDiagnostics.ts:107`, `:315`) | `KNOWN_LANGUAGES` contains `NodeJS`, `normalizeText(null)` is `unknown`, so every Node.js connection raises `UNKNOWN_LANGUAGE` (客户端语言未知) |
   | `docs/api-spec.md:1597` | documents the field as `Java` / `Go` / `Python` / `Rust` / `C++` / `C#` / `Node.js` / `PHP` |
   
   So a healthy Node.js SDK client was rendered as an empty tag, was unfilterable, was charted as `null`, and was reported to the operator as a fleet defect - the diagnostic even suggests 补充语言展示映射, which is exactly what the provider was missing.
   
   **The change** adds the missing case and records why the remaining `LanguageCode` values stay unmapped:
   
   ```java
   case NODE_JS:
       return ClientLanguage.NodeJS;
   default:
       // LanguageCode values with no ClientLanguage counterpart (RUBY, HTTP, OMS, OTHER,
       // DELPHI, ERLANG) stay unmapped; the client diagnostics report them as unknown.
       return null;
   ```
   
   Keeping `null` for `RUBY` / `HTTP` / `OMS` / `OTHER` / `DELPHI` / `ERLANG` is deliberate: `ClientLanguage` has no member for them, and for those the `UNKNOWN_LANGUAGE` diagnostic is honest rather than a false alarm.
   
   Deliberately out of scope: `clients.tsx:302` interpolates a nullable field into the distribution label, so any still-unmapped language shows up as the literal `null` in that chart. That guard belongs in the web layer and is a separate change.
   
   ### How Did You Test This Change?
   
   ```
   cd server
   mvn -o -B test -Dtest=RocketMQClientProviderTest,ClientServiceTest
    Tests run: 37, Failures: 0, Errors: 0, Skipped: 0
    BUILD SUCCESS
   ```
   
   Checkstyle runs in the `validate` phase of this build (`failsOnError=true`, `includeTestSourceDirectory=true`), so the run also proves the new code and test pass `style/rmq_checkstyle.xml`.
   
   One new test in `RocketMQClientProviderTest` (30 -> 31), `connectionScanShouldReportEveryStudioClientLanguageTest`: it feeds a producer table holding one connection per `LanguageCode` that Studio has a name for (`JAVA`, `GO`, `PYTHON`, `RUST`, `CPP`, `DOTNET`, `PHP`, `NODE_JS`) through `findConnectionsAt(..., "Producer")` and asserts the resulting languages are `containsExactlyInAnyOrder(ClientLanguage.values())`.
   
   That assertion is the invariant that was broken, not just the reported symptom: it fails if any `ClientLanguage` member cannot be produced by the scan, so adding a ninth member without a mapping case breaks the build instead of silently nulling a fleet.
   
   Mutation-checked: deleting only the new `case NODE_JS:` makes `mvn -o -B test -Dtest=RocketMQClientProviderTest` report `Tests run: 31, Failures: 1` - the new test - and leaves the other 30 green, including `connectionVersionShouldBeResolvedFromMQVersionCodeTest`, which exercises the same scan path.
   
   ### 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 new UI text; `clients.tsx` already renders `NodeJS`)
   - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit checks)
   - [x] New source files carry the ASF license header (no new source files)
   - [x] Documentation touched where behaviour changed (README / `docs/` / in-app help) - none needed; `docs/api-spec.md:1597` already documents `Node.js` as a client language, and this change is what makes the provider honour it
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(apache): report a Node.js client language instead of dropping it [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4846:
URL: https://github.com/apache/rocketmq-dashboard/pull/4846


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org