chstercc opened a new pull request, #5782:
URL: https://github.com/apache/rocketmq-dashboard/pull/5782
<!-- Make sure the base branch is `rocketmq-studio`: that is the RocketMQ
Studio trunk. -->
### Which Issue(s) This PR Fixes
<!-- Link the issue with a keyword so it closes on merge. Trivial fixes need
no issue.
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
- Fixes #5777
### Brief Description
<!-- What changes and why. Keep it short — the diff already shows how. -->
Invalidate the current LLM runtime-load generation when `useLlmRuntime`
unmounts. Previously, a configuration response received after leaving the AI
page could overwrite a newer engine preference in the persisted store and start
an obsolete model-catalog request. Late failures could also invoke the old
page’s error callback.
Reuse the existing generation checks to suppress these late results. Add
regressions for configuration success/failure and model-catalog failure after
unmount, and verify that StrictMode still allows the active load to complete. A
routed AI-page test also verifies that both the in-memory and persisted engine
preference survive the old response.
Only the runtime hook and its hook/page tests change. AI assistance was used
for investigation, implementation, and validation.
### How Did You Test This Change?
<!-- Paste the commands you ran and what they printed. Typical verification:
backend `cd server && mvn -B -ntp test` (integration tests need
MySQL 8, see CONTRIBUTING.md)
frontend `cd web && npm test && npm run lint && npm run build`
A pull request with no verification will not be merged. -->
From `web`, using Linux Node.js 22.20.0:
```bash
node node_modules/vitest/vitest.mjs run
src/pages/ai/hooks/useLlmRuntime.test.ts src/pages/ai/__tests__/AiPage.test.tsx
```
Result: **2 test files passed, 23 tests passed**, including the existing
disabled-runtime and overlapping-reload cases.
```bash
npm run lint
node node_modules/prettier/bin/prettier.cjs --check
src/pages/ai/hooks/useLlmRuntime.ts src/pages/ai/hooks/useLlmRuntime.test.ts
src/pages/ai/__tests__/AiPage.test.tsx
```
Result: lint passed with zero errors and 10 warnings in unchanged files;
formatting passed.
```bash
npm run build
```
TypeScript compilation and Vite bundling passed. The final license check
failed with `build artifact verification failed: assets/index-*.js`. The
unchanged upstream baseline at `c99b9ad5` also fails at that gate with the same
toolchain. This existing issue is tracked by #5547 / PR #5019; no check was
bypassed.
At the repository root:
```bash
git diff --check
```
Result: passed.
Regression proof: before the fix, four of the five new cases fail. The
routed-page case shows the newer `qoder` preference being replaced by the old
response’s `http` engine. All five new cases pass with the cleanup.
The full frontend suite, browser/server integration, and backend tests were
not run.
### 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`
- [ ] 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)
No new UI text or source files are introduced. Backend code and the API
contract are unchanged; architecture tests were not run. No documentation
changes are included.
--
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]