lizhimins opened a new pull request, #5305:
URL: https://github.com/apache/rocketmq-dashboard/pull/5305
### Which Issue(s) This PR Fixes
Trivial build fix, no issue. It unblocks `tsc -b` on the trunk, which #4888
left failing.
### Brief Description
`metricData` in `MetricsExplorer.test.tsx` had no type annotation, so
TypeScript inferred
`series[].labels` as the literal `{ cluster: string; node_id: string }`
rather than the
`Record<string, string>` that `MetricSeries` declares
(`web/src/api/metrics.ts:60`).
`createDeferred<typeof metricData>()` then pinned that narrow shape as the
deferred's payload
type, so the case added by #4888 — which resolves a custom-query series
labelled
`{ cluster: 'prod', query: 'custom' }` — fails the excess property check:
```
src/components/__tests__/MetricsExplorer.test.tsx(516,38): error TS2353:
Object literal may
only specify known properties, and 'query' does not exist in type '{
cluster: string; node_id: string; }'.
```
Because `npm run build` is `tsc -b && vite build && npm run license:check`,
this breaks the
frontend CI job (`ci.yml`, "Build frontend") and the image build
(`web/Dockerfile:26`).
`npm test` stays green — vitest transpiles through esbuild and never
type-checks — so the test
pipeline could not catch it. #4888 itself never got a CI run: it was opened
on 2026-09-22, when
`ci.yml` on this branch still listed only `master` under
`on.pull_request.branches`; #5007 added
`rocketmq-studio` a day later and does not apply retroactively to a branch
with no further push.
Annotating the fixture with the API contract type it stands in for restores
the open label map.
The change is type-only — no runtime behaviour is affected.
### How Did You Test This Change?
```
$ cd web && rm -f tsconfig*.tsbuildinfo && npx tsc -b ; echo $?
0 # was 1 with TS2353 before this change
$ npx vite build ; echo $?
✓ built in 13.40s
0
$ npx eslint src/components/__tests__/MetricsExplorer.test.tsx ; echo $?
0
$ npx prettier --check src/components/__tests__/MetricsExplorer.test.tsx
All matched files use Prettier code style!
$ npx vitest run src/components/__tests__/MetricsExplorer.test.tsx
Test Files 1 passed (1)
Tests 35 passed (35)
```
`npm run build` still fails after this change, but one step later and for an
unrelated reason:
`license:check` reports `build artifact verification failed:
assets/index-*.js`. That is the
entry-chunk checksum being taken from `item.code` inside `generateBundle`
(`web/scripts/licenses.mjs:196`) before Vite's `buildImportAnalysisPlugin`
prepends
`__vite__mapDeps` in its own `generateBundle`. #5019 and #5083 both fix it
and are still open;
this PR deliberately does not touch it.
### 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` — n/a, no test behaviour changes; the existing 35 cases are the
verification
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
— n/a
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks) — n/a, frontend only
- [x] New source files carry the ASF license header — n/a, no new files
- [x] Documentation touched where behaviour changed (README / `docs/` /
in-app help) — n/a, no behaviour change
--
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]