Frun1na opened a new pull request, #4759:
URL: https://github.com/apache/rocketmq-dashboard/pull/4759
### Which Issue(s) This PR Fixes
### Brief Description
The studio client decoded the response payload with `json.Unmarshal` into
the caller's `out any`
(`internal/studio/client.go`). For the passthrough output paths — `table`,
`json` and `yaml` — that
target is an `any`, so `encoding/json` represented every number as `float64`
and silently corrupted
int64 values beyond 2^53:
```
server returns "msgOffset": 9007199254740993
rmqctl prints "msgOffset": 9007199254740992
```
`types.DecodeMutationOutput` re-encodes the same decoded value to inspect
it, so the mutation
summary inherited the corrupted number too. Nothing in `rmqctl` used
`json.Number`.
This decodes the studio payload with `json.Decoder.UseNumber()`:
`json.Number` keeps the literal and
re-marshals to the original digits, so table/json/yaml output and the
mutation summary now round-trip
exactly. Decoding into typed struct fields is unaffected — `UseNumber` only
changes how numbers land
in `interface{}` targets.
### How Did You Test This Change?
New test `internal/studio/client_test.go` feeds an `httptest` studio
response containing
`"msgOffset":9007199254740993` and asserts the marshaled passthrough payload
still contains the
literal:
```
$ go test ./internal/studio/ -run TestRequestPreservesLargeIntegers -v
=== RUN TestRequestPreservesLargeIntegersInPassthroughPayload
--- PASS: TestRequestPreservesLargeIntegersInPassthroughPayload (0.00s)
PASS
$ make ci
ok .../internal/config (go test -race)
ok .../internal/output
ok .../internal/studio
catalog generator -check (clean)
go vet ./... (clean)
gofmt (clean)
6x cross-platform build (ok)
```
The test fails on the unfixed code with exactly the reported symptom:
`payload lost integer precision: {"items":[{"msgOffset":9007199254740992}]}`.
### 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]