The GitHub Actions job "CI" on 
rocketmq-dashboard.git/fix/ai-draft-account-scope has failed.
Run started by GitHub user unbridled-41 (triggered by unbridled-41).

Head commit for run:
afef62d5cac92c23628a7bdb6e767b7d3e7c7595 / unbridled-41 
<[email protected]>
fix(ai): scope the composer draft to the signed-in account

The AI composer keeps unsent text in sessionStorage under one global key
(`rocketmq-studio-ai-composer-draft`). sessionStorage is per tab and survives a
client-side logout in that tab: logout only clears localStorage
(authStorage.clearAuthSession removes the token and user keys from 
localStorage),
and nothing removes the draft key except an explicit send or clear. So the next
operator who signs in on the same tab opens /ai with the previous operator's
unsent prompt already in the composer - cluster addresses, topic and group 
names,
whatever the first operator was mid-question about - and can send it as their 
own.

The sibling client-side preferences already carry the account in their key for
this reason (the custom prompt templates and the trace-topic preference are 
being
scoped to the signed-in account in the same series), and the hook's own design 
note
explains the per-tab lifetime without ever addressing whose draft it is.

Derive the storage key from the account (user id when the session has one, the
username otherwise) and keep the anonymous case working.

Tests (web/): npx vitest run src/pages/ai/hooks/useComposerDraft.test.ts
- new case "does not hand an unsent draft to the next account signed in on the
  same tab" fails before this change (`expected 'check the backlog on rmq-prod'
  to be ''`) and passes after it.
- "restores the draft of the account that typed it" keeps the intended 
behaviour.
- AiPage.test.tsx (15 tests) passes; npx eslint reports no errors; npx tsc -b 
passes.

Report URL: 
https://github.com/apache/rocketmq-dashboard/actions/runs/37969755096

With regards,
GitHub Actions via GitBox

Reply via email to