Skip to content

feat(overview): add 30-day cost comparison / 总览页新增 30 天成本对比 - #676

Merged
edwingao28 merged 6 commits into
masterfrom
feat/overview-30-day-comparison
Aug 5, 2026
Merged

feat(overview): add 30-day cost comparison / 总览页新增 30 天成本对比#676
edwingao28 merged 6 commits into
masterfrom
feat/overview-30-day-comparison

Conversation

@edwingao28

@edwingao28 edwingao28 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a shareable 30-day change mode to /overview and /zh/overview.
  • Compare each platform with its latest validated result from 30–60 days earlier, matched by model, scenario, hardware, SLO, and engine scope.
  • Preserve tier, engine, locale, and comparison state in URLs; render finite changes as heat-map percentages, missing baselines as , and missing/stale current results as .

Unofficial overlays: N/A — Overview is a server-rendered summary and has no ?unofficialrun= path.

Validation

  • typecheck, lint, fmt, production build
  • Unit: 3,628 passed
  • Cypress component: 195 passed
  • Cypress integration (Chrome): 585 passed
  • Overview E2E (Firefox): 20 passed

中文说明

  • /overview/zh/overview 新增可分享的「30 天变化」模式。
  • 按模型、场景、硬件、SLO 与引擎范围匹配各平台,并与 30–60 天前最近一次有效结果对比。
  • 在 URL 中保留档位、引擎、语言与对比状态;可比结果显示热力百分比,缺少历史基线显示 ,当前无结果或没有更新结果显示

非官方运行叠加不适用:Overview 是服务端渲染的摘要页,不存在 ?unofficialrun= 数据路径。

验证

  • typechecklintfmt、production build
  • 单元测试:3,628 项通过
  • Cypress 组件测试:195 项通过
  • Cypress 集成测试(Chrome):585 项通过
  • Overview E2E(Firefox):20 项通过

Note

Medium Risk
Introduces a second benchmark fetch and historical matching rules that drive published cost deltas; incorrect window or pairing logic would misstate trends, though changes are display-only with broad test coverage.

Overview
Adds a 30-day change comparison mode on the inference cost overview (?compare=30d), alongside the existing vs B200 view.

Users switch via a new comparison control; tier, engine scope, locale, and comparison mode stay in sync through canonical URLs. In history mode the matrix drops the B200 “Reference” column treatment and shows per-platform cost deltas versus each platform’s latest validated result from 30–60 days earlier (same model, scenario, hardware, SLO, and engine scope). Comparable cells keep heat-map percentages; missing baselines or stale current evidence show cost only (no misleading in history).

Backend: resolves comparison mode from compare, derives a snapshot date from current overview-visible rows, loads an as-of benchmark snapshot for the baseline window, and merges via assembleOverviewHistoricalPageData (with cached getCachedBenchmarksAsOf). Fixtures and unit/E2E coverage exercise the new path; E2E date assertions ignore .sr-only text so screen-reader baseline dates don’t fail “no visible dates” checks.

Reviewed by Cursor Bugbot for commit 9dabdea. Bugbot is set up for automated code reviews on this repo. Configure here.

中文:为总览页新增可分享的历史对比 URL 模式,并在档位与引擎切换时保留该状态。
中文:基于数据库最新证据日加载 30–60 天历史快照,并按平台服务包络线计算变化。
Add the bilingual comparison control, historical heat-map states, bounded fixture coverage, and responsive cross-browser assertions.\n\n中文:新增双语对比控件、历史变化热力状态、限定时间窗口的测试数据,以及跨浏览器响应式断言。
Filter snapshot candidates through the curated overview scenario layout and document every em-dash state in both locales.\n\n中文:让历史窗口与可见场景保持一致,并完整说明缺失结果状态。
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview Aug 5, 2026 8:53pm

Request Review

@edwingao28
edwingao28 marked this pull request as ready for review August 5, 2026 19:14
@edwingao28
edwingao28 requested a review from adibarra as a code owner August 5, 2026 19:14
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @edwingao28's task in 7m 57s —— View job


PR Review: 30-day cost comparison on /overview

  • Read changed files & analyze diff
  • Check CI status
  • Runtime verification (localhost + Playwright)
  • Post review findings

🟢 LGTM — no blocking code issues found.

I verified the change at runtime against the read-only DB (/overview, /overview?compare=30d, and /zh/overview?tier=75&engine=all&compare=30d). The feature works as intended.

Runtime verification ✅

  • 30-day mode renders finite deltas as a heat-map (−9%, −45%, +14%, …), for a missing 30–60-day baseline, and for stale/no-newer current results — matching the spec and the legend copy.
  • The Compare switcher toggles between vs B200 and 30-day change; the default (vs B200) mode is unregressed.
  • URL state is preserved across switchers: the "vs B200" link keeps ?tier=75&engine=all, the engine switcher keeps ?tier=75&compare=30d, aria-current tracks the active mode. zh strings render (对比 B200, 30 天变化, legend).
  • 0 console errors on all three routes.

Correctness spot-checks ✅

  • getCachedBenchmarksAsOf blob cache key is benchmarks-as-of:<keys>:<date> — the as-of date is part of the key, so different target dates don't collide with each other or with the absolute-latest benchmarks slot (benchmark-data.server.ts:25).
  • The costPerMtok === null early-return in displayedComparison is unreachable from CellValue (guarded by the member.costPerMtok === null check at overview-scorecard.tsx:392), so the vs-B200 badge behavior is unchanged — no regression.
  • assembleOverviewHistoricalPageData matches by model|scenario|hardware and applies engineScope to both current and baseline assemblies; the no_newer_result / no_baseline branches are exhaustive.

Tests ✅ — 86 overview unit tests pass locally; new E2E (overview.cy.ts) and fixtures added for both modes.

ℹ️ Note on the red Tests (Unit) check (not caused by this PR): the only failure is src/etl/trace-replay-ingest.test.ts > streams a file-backed trace… timing out at 5000ms — an ETL trace-replay test untouched by this PR (a known flaky timeout). The PR's own unit suites (overview-data, overview-data.server, overview-links) all pass. Recommend a re-run of the unit job to get it green before merge.
· feat/overview-30-day-comparison

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b6ff87f. Configure here.

Comment thread packages/app/src/components/overview/overview-scorecard.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6ff87fd42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/app/src/lib/overview-data.server.ts Outdated
Comment thread packages/app/src/lib/overview-data.ts Outdated
Scope snapshots to visible engines, gate deltas on tier evidence dates, restore screen-reader text, and relax the flaky trace stream test timeout.

中文:按可见引擎限定历史快照,以档位证据日期判断变化,恢复读屏文本,并放宽易波动的 trace 流式测试超时。
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @edwingao28's task in 2m 4s —— View job


Re-review: 30-day cost comparison on /overview

  • Review new commit 61eda29 (post-dates prior review at b6ff87f)
  • Verify Cursor Bugbot a11y finding (sr-only on cost delta badge)
  • Verify Codex P2: history window from scoped rows
  • Verify Codex P2: gate historical changes on tier evidence date
  • Runtime verification (localhost + Playwright)
  • Post review findings

🟢 Re-review: LGTM — commit 61eda29 resolves all three outstanding findings; no new blocking issues.

Since the prior review (b6ff87f), commit 61eda29 "align historical evidence and accessibility" cleanly addresses every open comment. I verified each fix statically and at runtime against the read-only DB.

Cursor Bugbot — cost-delta badge screen-reader text ✅ Fixed
CostDeltaBadge now renders a <span className="sr-only">{aria}</span> sibling and drops the unreliable aria-label on the role-less span, matching the working CellMissing pattern (overview-scorecard.tsx:366-369). Confirmed in the live DOM: visible text -38% is aria-hidden, the sr-only span reads "38% cheaper than this platform's Jul 1 result", and no aria-label remains on the wrapper.

Codex P2 — history window built from unscoped rows ✅ Fixed
overviewSnapshotDate now takes engineScope and derives the snapshot date from overviewEngineRows(rows, engineScope) instead of the raw fetch (overview-data.ts:166-184); the server passes the active scope through (overview-data.server.ts:48). A newer out-of-scope ATOM/TRTLLM row can no longer push the 30-day target forward for the community matrix.

Codex P2 — delta gated on frontier latestDate instead of tier evidence ✅ Fixed
New overviewTierEvidenceDate(read) returns read.evidenceDate?.to ?? read.config?.latestDate and is now used for the no_newer_result cutoff and both baseline labels (overview-data.ts:345-346, 689-720). Since these branches only run when costPerMtok !== null (an in-range interpolated read), evidenceDate.to is always populated — the SLO-specific tier date now drives the decision, so a stale tier read is no longer mistaken for a newer result.

Runtime verification ✅ (/overview?compare=30d)

  • Heat-map renders finite deltas (−9%, −45%, −13%, +14%, −12%, −21%, +3%), for missing 30–60-day baselines, for no-newer/stale current results — matching the legend copy.
  • 0 console errors.

CI ✅ — all checks green on the latest commit (Typecheck & unit, Lint/format, Component, E2E Chrome ×4 + Firefox, CodeQL, Cursor Bugbot). The previously-flagged flaky trace-replay-ingest timeout was relaxed in this commit and the unit job is now green. New unit coverage (overview-data.test.ts +27) and E2E (overview.cy.ts) exercise the scoped-window and tier-evidence paths.

Overlay path is correctly N/A — Overview is server-rendered with no ?unofficialrun= branch.
· feat/overview-30-day-comparison

Move comparison mode into the primary centered tab row and show only current cost when a valid 30-day comparison is unavailable.

中文:将对比方式提升为居中的主视图标签;缺少有效 30 天对比时仅显示当前成本。
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @edwingao28's task in 2m 39s —— View job


Re-review: 30-day cost comparison on /overview

  • Check for new commits since prior review (61eda29)
  • Review new commit 9dabdea "promote comparison tabs"
  • Check CI status
  • Runtime verification (localhost + Playwright)
  • Post findings

🟢 Re-review: LGTM — commit 9dabdea is a clean presentation + simplification change; no blocking issues.

Only one new commit since the prior LGTM (61eda29). It does two things, both verified statically and at runtime:

1. Compare switcher promoted to a centered tab row
The OverviewComparisonSwitcher moved out of the card header into a primary <nav> tab row (overview-page.tsx:99-105), restyled as underline tabs. URL state is preserved: on /overview?tier=75&engine=all&compare=30d the vs B200 link resolves to /overview?tier=75&engine=all and aria-current tracks the active mode. Confirmed the nav is a direct child of [data-testid="overview-page"] with justify-center, matching the updated E2E assertions.

2. History mode: current-cost-only when no valid 30-day comparison
displayedComparison now returns a badge only for status === 'comparable' && costDeltaPct !== null (overview-scorecard.tsx:246-252); no_baseline / no_newer_result fall through to null, so those cells render just the cost with no badge and an untinted background. The DisplayedComparison['status'] type is correctly narrowed via Exclude<…, 'no_newer_result'>, and the now-dead / history branches, aria strings, and legend copy were removed consistently (EN + zh).

Runtime verification ✅

  • /overview?compare=30d: comparable cells render heat-map deltas (-38%, -67%, -9%, -45%, +14%, +3%, +12%, -21%), platforms without a baseline (e.g. DeepSeek V4 8K/1K B300/GB200/GB300) show cost only — no , no badge. Legend reads "Platforms without a valid 30-day comparison show current cost only."
  • /overview (default vs-B200): unregressed — B200 stays the reference column (0 deltas), other cells show ±%, and still correctly appears for genuinely-missing B200 baselines (the doc comment was rescoped to "Missing B200 evidence" to match).
  • Genuinely-empty cells still render via the separate CellMissing path (no data for this scenario / no exact @50 result) — unaffected.
  • 0 console errors on all routes.

CITests (Unit) ✅ and Lint & Format ✅ green on the latest commit; Tests (E2E) in progress. The E2E spec (overview.cy.ts) was updated in this same commit to assert the new no-badge/transparent-cell behavior and the centered switcher, so the new code path is covered.

Overlay path remains correctly N/A — Overview is server-rendered with no ?unofficialrun= branch.
· feat/overview-30-day-comparison

@edwingao28
edwingao28 merged commit bc86e2a into master Aug 5, 2026
24 checks passed
@edwingao28
edwingao28 deleted the feat/overview-30-day-comparison branch August 5, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant