Make the dashboard's two lists of unusual days agree

Aperta
#291 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
nextjs, react, typescript
Ambito
frontend

Direzione di ricerca

Read the two sources side by side: src/lib/dashboard/what-changed.ts (recentAnomalies, re-detected under filter and mutes) and src/lib/data/anomalies.ts:101-123 (getRecentAnomalies, stored events for the whole workspace), then the rendering at src/components/dashboard/alerts-summary.tsx:83-117. Nothing can start until Eddie picks one of the four options on this issue and #289 has merged, so the first step is a comment asking for the decision, not code. Done means one list of unusual days on the dashboard, with e2e/anomaly-detection.spec.ts and e2e/dashboard.spec.ts updated, including an axe scan.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: dashboard enhancement impact: low priority: P3 size: S

Summary

Once #289 merges, the dashboard shows unusual spend and usage in two places from two sources, and they can disagree with no explanation on screen. Decide which one the dashboard keeps, and make the other agree or step aside.

Found in the Fable review of #289 (round 1, at 0e39408), review comment.

Evidence

  • "What changed" at the top (#270, src/lib/dashboard/what-changed.ts, recentAnomalies): anomalies found again with findAnomalies from the trend rows the page reads, under the dashboard filter, with today's mutes and the daily summary job's connections (revoked ones left out).
  • "Unusual spend and usage" inside the alerts summary (src/components/dashboard/alerts-summary.tsx:83-117, UnusualDays): the stored devmacro.anomaly_detected events from getRecentAnomalies (src/lib/data/anomalies.ts:101-123), for the whole workspace, as written on the day.
  • They disagree when: a metric is muted after its event was written (the top drops it, the alerts list keeps it); the dashboard is filtered (the top follows the filter, the alerts list does not); the rows lack 14 days of history but an event exists (the top shows nothing, as e2e/anomaly-detection.spec.ts seeds). A reader who sees "1 unusual spend or usage event" below and nothing at the top, or the reverse, cannot tell why.

Options

Option Pros Cons Effort Impact
Leave both as they are (status quo) No work. Each list is correct for its own source. The two lists disagree in the cases above with no words saying why. XS Any dashboard reader after a mute or with a filter on sees two different answers to "what was unusual"; no data is at risk and it lasts as long as the mute or filter.
Alerts summary keeps its count and timeline link, drops its list (UnusualDays loses the newest items) One list on the page, the top one. The count still points at the stored events on the timeline. The count can still differ from the number of sentences at the top. getRecentAnomalies keeps its count read and drops its list read. S Readers get one list; the count's wording would need to say it is the stored events for the whole workspace.
Alerts summary reads the same re-detected set as "What changed" Both agree by construction. The alerts box then follows the dashboard filter, unlike the rest of AlertsSummary, which is workspace wide (getUnacknowledgedSummary). S Readers get the same answer twice; the alerts box changes meaning under a filter.
Remove the unusual list from the alerts summary entirely Simplest page. Loses the stored events' count on the dashboard; the timeline link moves elsewhere or goes. XS Readers who used the alerts box for unusual days lose that path.

Files each option touches:

Option Files
Status quo none
Count and link only src/components/dashboard/alerts-summary.tsx, src/lib/data/anomalies.ts, e2e/anomaly-detection.spec.ts
Same re-detected set src/components/dashboard/alerts-summary.tsx, src/app/w/[workspace]/dashboard/page.tsx, src/lib/data/anomalies.ts, e2e/anomaly-detection.spec.ts
Remove the list src/components/dashboard/alerts-summary.tsx, src/lib/data/anomalies.ts, e2e/anomaly-detection.spec.ts

Recommendation: count and link only. The deciding argument is that the top already lists the days in words, so a second list adds disagreement and nothing else, while the count keeps the way to the stored events. Second choice: the status quo with a sentence under the alerts count saying it covers the whole workspace as recorded.

Acceptance criteria

  • Eddie has picked an option on this issue.
  • The dashboard no longer shows two lists of unusual days that can disagree without words saying why.
  • e2e/anomaly-detection.spec.ts and e2e/dashboard.spec.ts cover the chosen behavior, with an axe scan.

Decisions needed

Which option above. Blocked on #289 merging first.

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

Lingua principale
TypeScript
Stelle
1
Fork
1
Merge medio
6h 56m
PR unite (30g)
136

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eddiejaoude/StackDash

Tutte le issue di eddiejaoude/StackDash

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.