zjncs commented on PR #5612:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/5612#issuecomment-6076592647

   Hi @lizhimins, thanks for the thorough review! I've reworked the PR 
accordingly, rebased onto `rocketmq-studio` (c99b9ad5) and retargeted the base 
branch. Point by point:
   
   - **Reuse the existing constant**: The second constant is gone. The 
textarea's `maxLength` now uses `MAX_COMPOSER_DRAFT_CHARS` imported from 
`web/src/pages/ai/hooks/useComposerDraft.ts`, and `chatDraft.ts` is back to its 
untouched state. I did not mean to change the documented intent — "text being 
typed is left alone and the server stays the authority on the send path" still 
holds; the only addition is clamping typed text at the same budget a restored 
draft is already clamped to.
   - **The unhandled throw**: I took your first option and dropped the guard 
entirely. `buildMessageRequest` no longer throws, so neither call site 
(`ai/index.tsx` nor `hooks/useDraftHandoff.ts`) can hit an unhandled rejection; 
the only client-side clamp is the textarea `maxLength`, which covers both entry 
points since `home/index.tsx` reuses the same `Composer`.
   - **The test**: It now imports the real constant instead of redeclaring it, 
pins it to the backend 8192-char budget (`AiMessageDTO`'s `@Size(max = 8192)`), 
and asserts the textarea carries it. Since the throw guard is gone, the 
coverage moved into the existing `Composer.test.tsx` rather than a standalone 
contract file.
   - **Trailing newlines**: Restored on all touched files.
   
   Verification: the `src/pages/ai` + `src/pages/home` suites are green (220 
tests) and `tsc -b` is clean.
   


-- 
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]

Reply via email to