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

   ### Which Issue(s) This PR Fixes
   
   None — this is the small follow-up lizhimins asked for in the review on 
#4637 ("a much smaller PR that
   only teaches `decodeMCPMessage` to reject a response frame with an explicit 
message instead of
   'missing method' would be easy to review and is welcome on its own"), so it 
reuses that review as its
   context instead of opening a duplicate issue.
   
   ### Brief Description
   
   `decodeMCPMessage` classified stdin frames three ways — request (`method` + 
`id`), notification
   (`method`), and everything else. A JSON-RPC **response** (`id` + 
`result`/`error`, no `method`) fell
   into the last bucket and failed with `invalid MCP JSON-RPC message: missing 
method`, which tells the
   caller nothing about what was actually wrong.
   
   A frame with an `id` but no `method` is now named explicitly:
   
   ```
   invalid MCP JSON-RPC message: response frame (id without method); this 
transport only forwards
   client-originated requests and notifications
   ```
   
   Request and notification decoding is unchanged. (The larger #4637 forwarding 
change stays closed —
   this is only the error-message half the review welcomed.)
   
   ### How Did You Test This Change?
   
   ```
   $ go test ./internal/studio/ -run TestDecodeMCPMessageRejectsResponse -v
   === RUN   TestDecodeMCPMessageRejectsResponseFrameWithExplicitError
   --- PASS: TestDecodeMCPMessageRejectsResponseFrameWithExplicitError (0.00s)
   PASS
   
   $ make -C rmqctl ci
   ok  .../internal/catalog  ok  .../internal/config  ok  .../internal/output
   ok  .../internal/studio  ...  (gofmt, catalog-verify, go vet, go test -race, 
6x build — all green)
   ```
   
   The new test fails on the unfixed code (`got: invalid MCP JSON-RPC message: 
missing method`), asserts
   the explicit message for both a `result` and an `error` frame, asserts the 
misleading text is gone,
   and re-checks that request and notification frames still decode.
   
   ### 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, test methods named 
`...Test`
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


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