zjncs opened a new pull request, #5701:
URL: https://github.com/apache/rocketmq-dashboard/pull/5701
### What
`ThinkingBlock` — the reasoning disclosure of the AI transcript — had no
test. This adds `ThinkingBlock.test.tsx` with 8 tests pinning the two contracts
its own documentation calls load-bearing.
### Why
The component doc names two subtle behaviors nothing guarded:
1. **the label depends on `source`** — model reasoning (`思考过程`) and the
prompt-enhancement rewrite (`Prompt 增强改写`) must never share one label; the
component is the other half of the reducers' refusal to merge thinking blocks
of different sources. The block it replaced labelled both as the rewrite.
2. **the open state is derived, not effect-synced** — a manual toggle is
remembered only for as long as `autoOpen` keeps its value, so the transition
into or out of streaming always wins over a stale click. That is what makes
collapse-on-done unconditional without an effect fighting the user.
### What is pinned
- model reasoning and the enhance rewrite get different labels, and
`data-source` reflects the block's source;
- the character count of the reasoning travels in the summary;
- collapsed when nothing is streaming; an **earlier** block of a streaming
run stays closed; only the **last** thinking block of the streaming run
auto-opens;
- a manual toggle is respected while the streaming context is unchanged;
- a close-then-reopen mid-stream still collapses on done — a stale
double-click cannot defeat the collapse-on-done rule;
- the reasoning text renders in the body.
### Verification
- New tests on unmodified code: **8/8 green** (`npx vitest run`).
- Discriminating mutations on `ThinkingBlock`, vitest result verified red
each time:
1. the source-dependent label collapsed to a single label — the label test
reddens;
2. the auto-open condition dropped its `latest` conjunct so every thinking
block of the streaming run opens — the earlier-block test reddens;
3. the stored-click discard removed so a stale toggle survives the done
transition — the close-then-reopen test reddens.
- Restored: 8/8 green. Test-only change; no product code touched.
--
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]