Loyal-Young opened a new pull request, #5181:
URL: https://github.com/apache/rocketmq-dashboard/pull/5181

   ## What changed
   
   - Scope AI composer drafts in `sessionStorage` to the authenticated user ID, 
falling back to the username when no ID is available. The unauthenticated mode 
has its own key.
   - Discard the old unowned key instead of assigning its contents to whichever 
account opens the AI page next.
   - Keep the current draft hidden when the account changes while the page 
remains mounted, while retaining each account's own draft for a later return to 
the same tab.
   
   Fixes #5180. This is separate from #5164, which scopes custom prompt 
templates; the composer uses a different storage key and hook.
   
   ## Verification
   
   - Reproduced the cross-account disclosure with a failing hook test on the 
old implementation.
   - `npx vitest run src/pages/ai/hooks/useComposerDraft.test.ts` — 3 passed.
   - `npx vitest run src/pages/ai/hooks/useComposerDraft.test.ts 
src/pages/ai/__tests__/AiPage.test.tsx` — 17 passed before the final additional 
username-fallback test.
   - `npx tsc -b` — passed.
   - `npx eslint src/pages/ai/hooks/useComposerDraft.ts 
src/pages/ai/hooks/useComposerDraft.test.ts` — passed.
   - `git diff --check` — passed.
   
   The existing hook source already fails the repository's Prettier check on 
unmodified `master`; the newly added test file passes it.
   
   ## AI assistance
   
   An AI assistant helped trace the draft storage lifecycle, draft the 
account-scoped change, and write tests for account switching and legacy data. 
The failure was reproduced before the fix, and the checks above were run on the 
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]

Reply via email to