Skip to content

fix(traffic): keep the grouped table within the default window - #110

Merged
fylorn merged 1 commit into
devfrom
fix/traffic-grouped-width
Sep 22, 2026
Merged

fylorn merged 1 commit into
devfrom
fix/traffic-grouped-width

Conversation

@fylorn

@fylorn fylorn commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

With Group by session on, the group headers widened the traffic table past the default window. At 1100×720 with the sidebar expanded the table has 864px. The flat table fits exactly, but grouped with two sessions expanded it was 977px (zh) / 1005px (en), so the cost column, the one the upstream-cell comment in RequestTable.tsx says must never be pushed out of view, was partly off-screen. In English it overflowed even with every session collapsed (896px).

What drove the width

Emptying each group-header cell on its own (zh, two sessions expanded, Chromium and system WKWebView agree to within 1px):

Group-header cell Width Width once emptied (set by the request rows) Extra
Cost, $0.233 +1 轮无法计价 151 68 83
Model, joined list capped at 192px 192 123 69
Status, 64 轮 1 失败 112 87 25
Upstream, joined list capped at 128px 128 113 15

No single cell was enough (895 / 908 / 952 / 962px); only all four together fit.

Change

Group headers stay on one line and move the detail into tooltips (the option chosen after comparing it with wrapping onto a second line):

  • Failure count: a red dot and a number, the same red dot as a failed request. The tooltip and screen-reader text say 此会话中 N 轮失败 / N turns in this session failed.
  • Session cost: one figure. When turns are missing from the total (no price, no usage) it is written as a lower bound, ≥$0.233, and the tooltip lists which turns are missing and why. The rule lives in a pure costCell() with tests.
  • Model and upstream lists: only the first entry sets the column width. The rest uses whatever the column has left and ends in an ellipsis (claude-sonnet-5、cl…). The whole list is in the tooltip.

Rebased onto #113, which removed the subscription state, so the cost cell has no subscription case.

Measurements after the change

1100×720, sidebar expanded, table has 864px. On dev at 475ed66 (#108, #113, #114). Identical in Chromium and WKWebView; every group header is one line.

Collapsed 1 session expanded 2 expanded All 4 expanded
zh 864 ✅ 864 ✅ 864 ✅ (was 977) 864 ✅
en 864 ✅ (was 896) 864 ✅ 864 ✅ (was 1005) 882

English with every session expanded is still 18px too wide: the English request rows alone are 871px there (the English flat table is 851px, and indenting the expanded rows adds 20px), so no header design fits that state. It needs narrower English request rows (the latency column, e.g. 1473→53117ms, is the widest), which is a separate change.

At the minimum window (820px, out of scope) the grouped table with two sessions expanded is 820px against the flat table's 808px, previously about 977px.

Test plan

  • pnpm typecheck, pnpm test (220 passed, including the new costCell cases), pnpm build
  • Measured in the isolated preview (shots.html?page=requests) at 1100×720 in zh and en, collapsed / one / two / all sessions expanded, in Chromium and in an offscreen system WKWebView
  • Real hover on the ≥$0.233 amount and a model list opens the expected tooltip; the failure dot and its number are hit-tested inside the tooltip trigger and open 此会话中 N 轮失败

🤖 Generated with Claude Code

With requests grouped by session, the group headers widened the table
from 864px to 977px at the default window size (1100x720, sidebar
expanded), so the cost column, the last and most important one, was
partly pushed out of view. In English it was 1005px, and 896px even with
every session collapsed.

Four header cells drove it. Emptying each one on its own, with two
sessions expanded (zh): cost -83px ("$0.233 +1 轮无法计价"), model -69px
(the joined model list, capped at 192px), failure count -25px ("1 失败"),
upstream -15px. No single cell was enough.

Group headers now stay on one line and move the detail into tooltips:

- The failure count is a red dot and a number, the same red dot as a
  failed request; "N turns in this session failed" is in the tooltip
  and in screen-reader text.
- The session cost is one figure. When turns are missing from the total
  (no price, no usage) it is written as a lower bound, "≥$0.233", and
  the tooltip lists which turns are missing and why.
- In the model and upstream lists only the first entry sets the column
  width; the rest uses whatever the column has left and ends in an
  ellipsis, and the whole list is in the tooltip.

The cost rule lives in a pure function with tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the fix/traffic-grouped-width branch from 8cc2a9e to 49dda0e Compare September 22, 2026 14:05
@fylorn
fylorn merged commit d96bf91 into dev Sep 22, 2026
2 checks passed
@fylorn
fylorn deleted the fix/traffic-grouped-width branch September 22, 2026 14:10
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