Make the dashboard's two lists of unusual days agree

オープン
#291 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
nextjs, react, typescript
領域
frontend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
1
フォーク
1
平均マージ
6時間 56分
マージ済み PR(30日)
136

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eddiejaoude/StackDash のほかの issue

eddiejaoude/StackDash の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。