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

Head commit for run:
0b93666b8b9039c78406a5b988383c185f2021d9 / unbridled-41 
<[email protected]>
fix(metrics): scope the explorer query history to the signed-in account

The metrics explorer keeps its query history in localStorage under one global 
key
(`rocketmq-studio-metrics-query-history`), loaded once when the panel mounts and
cleared only by the explicit "clear history" button. The auth logout path
(`authStorage.clearAuthSession`) removes the token and user keys only, so on a
shared browser the next account to sign in sees the previous account's history:

- PromQL text, metric/profile names, instance ids, data-source keys and the 
queried
  windows are rendered in the history drawer (MetricsExplorer.tsx: the entry 
rows),
  and the entry can be re-run under the second account's session;
- `/ops/dashboard` has no admin gate, so any signed-in account reaches the 
panel.

The sibling client-side stores already carry the account in their keys for 
exactly
this reason (composer draft, prompt templates, trace-topic preference); the 
metrics
history was the last unscoped one.

Derive the key from the signed-in account (user id, else the username, else
`anonymous`) and export the key builder so the panel's tests seed and assert 
against
the current account's store instead of the legacy global key.

Tests (web/): npx vitest run src/utils/metricsExplorerDiagnostics.test.ts 
src/components/__tests__/MetricsExplorer.test.tsx
-> Tests 46 passed.
- new case "does not hand one account the query history of another" fails with 
an
  unscoped key (`expected [ { ... } ] to deeply equal []`) and passes with the
  scoped one.
- the six explorer cases that seeded the raw key now seed the current account's
  store via the exported builder; the malformed-payload case does the same.
- npx eslint reports no errors; npx tsc -b passes.

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

With regards,
GitHub Actions via GitBox

Reply via email to