Skip to content

fix(desktop): chart this session's completed requests in Stats - #1453

Merged
jonathan308 merged 1 commit into
codex/desktop-mac-preview-20261012from
fix/desktop-stats-completed-history
Oct 15, 2026
Merged

jonathan308 merged 1 commit into
codex/desktop-mac-preview-20261012from
fix/desktop-stats-completed-history

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On a serving Mac, My Macs → Stats → Performance never showed the traffic chart.

  • The native desktop API returns this session's local request history with completed_at only (provider-swift/Sources/darkbloom/Desktop/DesktopRequestHistory.swift, localRequestHistory).
  • recordedTraffic bucketed records by settled_at ?? started_at!. For local records that is undefined, so every bucket key was NaN and the function returned [].
  • Because history existed, MacPerformance didn't fall back to observed samples, and points.length > 0 hid the chart.

The Activity table already handled this through requestTime() (settled_at ?? completed_at ?? started_at), so the two views disagreed about the same records.

Reproduction: render MacPerformance with a history of { completed_at, outcome: 'completed' } records, the shape the Swift API emits while serving. Before: no traffic chart, and recordedTraffic returns []. After: 30-minute buckets, with empty intervals between records kept as explicit zero-request intervals as before, and the chart labeled Completed requests · 30-minute intervals. Ledger history (settled_at) keeps Settled requests.

Found during a desktop UI audit. Base: codex/desktop-mac-preview-20261012 (unmerged desktop stack: #1354 plus the signed preview packaging commits). The diff contains only this fix.

Before / After

flowchart LR
  subgraph Before["Before"]
    direction TB
    B1(["Serving Mac opens Stats"]):::user --> B2["GET request history<br/>records: completed_at only"]:::code
    B2 --> B3["recordedTraffic:<br/>settled_at ?? started_at → undefined"]:::bad
    B3 --> B4["NaN buckets → points = []"]:::bad
    B4 --> B5(["Traffic chart hidden"]):::bad
  end
  subgraph After["After"]
    direction TB
    A1(["Serving Mac opens Stats"]):::user --> A2["GET request history<br/>records: completed_at only"]:::code
    A2 --> A3["recordedTraffic:<br/>requestTime(record)"]:::fix
    A3 --> A4["30-minute buckets"]:::fix
    A4 --> A5(["Chart: Completed requests ·<br/>30-minute intervals"]):::good
  end
  classDef user fill:#1f2937,stroke:#93c5fd,color:#f9fafb
  classDef code fill:#312e81,stroke:#a5b4fc,color:#eef2ff
  classDef bad fill:#7f1d1d,stroke:#fca5a5,color:#fef2f2
  classDef fix fill:#065f46,stroke:#6ee7b7,color:#ecfdf5
  classDef good fill:#14532d,stroke:#86efac,color:#f0fdf4
Loading

Legend: blue = user action, indigo = unchanged code path, red = defect, green = changed code / fixed outcome.

Changes

  • features/stats/data.ts: recordedTraffic buckets by requestTime(), the helper the Activity table already uses.
  • features/stats/Performance.tsx: the scope label says Completed requests unless every record is settled.
  • tests/macStats.test.tsx: unit and render regressions using the Swift local-history shape. Both fail on the base branch.
  • CHANGELOG.md: Unreleased entry.

Validation

cd desktop-app
npx vitest run tests/macStats.test.tsx          # 2 new tests fail on base; 7/7 pass here
npx vitest run tests/stats.test.tsx tests/requestActivity.test.tsx tests/macStats.test.tsx   # 22 passed
npx tsc --noEmit
npx prettier --check src tests
make docs-impact-check BASE=origin/codex/desktop-mac-preview-20261012

Limitations

  • Fixture and jsdom coverage only. It wasn't checked against a live serving session, because the Mac's GPU was in use during the audit.
  • The Performance history still loads once per mount (no revision key). That's a separate, lower-severity refresh issue and isn't changed here.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The native desktop API reports this session's local request history
with completed_at only (DesktopRequestHistory.swift). recordedTraffic
bucketed by settled_at ?? started_at, so every local record produced a
NaN bucket and an empty series. Because history existed, Performance did
not fall back to observed samples and hid the traffic chart entirely on
a serving Mac.

Bucket with the shared requestTime helper (settled, completed, started)
and label local history as completed rather than settled requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference Ready Ready Preview Oct 13, 2026 10:25pm UTC
d-inference-console-ui-dev Ready Ready Preview Oct 13, 2026 10:25pm UTC
d-inference-landing Ready Ready Preview Oct 13, 2026 10:25pm UTC
darkbloom-status Ready Ready Preview Oct 13, 2026 10:25pm UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 13, 2026 10:25pm UTC

Request Review

This branch was successfully deployed

5 active deployments
Preview – d-inference — 57800568 Deployed Oct 13, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 57800568 Deployed Oct 13, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 57800568 Deployed Oct 13, 2026 by vercel[bot]
Preview – d-inference-landing — 57800568 Deployed Oct 13, 2026 by vercel[bot]
Preview – darkbloom-status — 57800568 Deployed Oct 13, 2026 by vercel[bot]
benchmarks — 57800568 Deployed Oct 13, 2026 by jonathan308 via E2E Benchmarks #2605
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