iloveeyjafjalla opened a new pull request, #6833:
URL: https://github.com/apache/rocketmq-dashboard/pull/6833
## Which Issue(s) This PR Fixes
Fixes #6832
## Problem / Evidence
`GET /api/clusters` serialized two always-null keys on every cluster that
the endpoint's contract does not have:
```json
{"id": "DefaultCluster", "gmtCreate": null, "gmtModified": null, "name":
"DefaultCluster", "nsClusterName": null, "type": "V4_DIRECT", ...}
```
`docs/api-spec.md` defines the response as `ClusterInfo[]` with fourteen
fields (`id`, `name`, `nsClusterName`, `type`, `endpoint`, `status`, `version`,
`brokers`, `proxies`, `nameServers`, `config`, `topicCount`, `groupCount`,
`tpsHistory`); `gmtCreate` / `gmtModified` are not among them, and the console
does not read them (`grep -rn "gmtCreate\|gmtModified"
web/src/pages/cluster/index.tsx` is empty).
Cause: `cluster/broker/ClusterVO` declares the two bookkeeping columns
itself, and **nothing fills them** — a cluster in this list is discovered from
the NameServer rather than read from a registry row, and no builder call,
setter call or entity copy assigns either field (grep for `ClusterVO` plus
`setGmt`/`.gmtCreate(` is empty).
## Fix
Ignore the two columns for this view only; the class keeps its fields for
internal use:
```java
@JsonIgnoreProperties({"gmtCreate", "gmtModified"})
public class ClusterVO {
```
## Tests
New `ClusterWireContractTest` serializes the view and asserts the key set is
exactly the documented fourteen. Before the change it fails on the leaked key:
```
expected: [... "brokers", "config", "endpoint", "groupCount", "id", "name",
"nameServers", "nsClusterName", "proxies", "status", "topicCount",
"tpsHistory", "type", "version"]
but was: [... "brokers", "config", ... "gmtCreate", ...
```
After the change (JDK 21, offline Maven):
```
Tests run: 35, Failures: 0, Errors: 0, Skipped: 0
(ClusterWireContractTest 1, ClusterControllerTest 34) BUILD SUCCESS
```
One annotation plus a test; the cluster service, the probes and the cluster
page are untouched. This is the same shape as #6760 on the audit feed — a
different endpoint, so it keeps its own PR. Verified against the running stack
at `a92c2314`; the change was prepared with AI assistance and reviewed, tested
and verified by me.
--
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]