Skip to content

feat: web UI model-switch column for session tables (#1557) - #1561

Closed
ranxianglei wants to merge 1 commit into
2026-09-28_cache-attribution-combinedfrom
2026-09-28_cache-attribution-web-ui
Closed

ranxianglei wants to merge 1 commit into
2026-09-28_cache-attribution-combinedfrom
2026-09-28_cache-attribution-web-ui

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Completes the Web UI portion of #1557, split out of #1558 per the owner instruction in #1557 ("deliver it as its own PR branched off this branch's head").

What

The sessions table (Sessions page) and the overview's recent list gain a Model Switches column: switch count · tokens re-billed after the switch, with tooltip; honest dash when none. Data is read-only from the per-session ledger agg (agg.switches / agg.switchMissed) in summaryOf(); both JSON fields appear only when switches > 0.

Files: src/web/client.ts, src/web/i18n.ts, src/web/page.ts, src/web/sessions-data.ts, tests/web-sessions.test.ts (+230/−8).

Semantics unchanged from the web hunks of #1540 (deep-reviewed there); applied onto the combined-stack head 3dc1358f with zero drift (verified src/web/ + tests/web-sessions.test.ts identical between #1540's branch point and the combined head).

Notes

Verification (head 670ec8c0, on top of #1558 head)

  • typecheck ✓
  • web-sessions 7/7 (6 master-state + 1 new alignment/render test executing the real client IIFE against live endpoints: header/colgroup/cells all 13, switch cell populated, plain session unaffected)
  • full suite: 3066 tests — 3054 pass / 0 fail / 12 skip

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — the content is good, but this PR is a byte-identical duplicate of #1560. Closing this one; #1560 survives.

Duplicate finding (why I'm closing this PR)

Two daemon sessions picked up the same owner instruction in #1557 ("deliver it as its own PR branched off this branch's head") in parallel and produced two deliveries:

Verified: git diff cf810560 670ec8c0 is empty — the two heads are tree-identical (same 5 files, same +230/−8 delta, same base 3dc1358f, one linear commit each). Keeping the earlier-opened #1560; closing #1561 as the exact duplicate (tagged 重复).

Review verdict (applies identically to both, since they're identical)

① Direction — exactly what #1557 asked: the web hunks of #1540 restored onto #1558's head, referencing #1557. The zero-drift claim checks out: all 5 files are byte-identical between the pre-revert stacked head a30ee8d1 and the PR head.

② Existing-behavior inventory

  • /__bili/sessions JSON: two additive optional fields (modelSwitches, switchMissedTokens), emitted only when switches > 0; byte-identical output for never-switched sessions → no existing-consumer impact.
  • Web tables: 12→13 columns on both session tables; 72px colgroup slot inserted after Hit %; both empty-state colspans bumped 12→13. Grep confirms no stale colspan="12" remains (only the unrelated 8-col providers table).
  • i18n: 2 new keys × zh/en with parity preserved; the tooltip rides the existing data-i18n-title mechanism (src/web/client.ts:103).
  • No config-surface change, no wire/message-shape change, no version bump.

③ Code — summaryOf() reads agg.switches / agg.switchMissed read-only (same conditional-spread pattern as the adjacent missDrop* fields); switchTd() renders honest dash / count-only / count · tokens with an escaped tooltip; column order matches header ↔ row ↔ colgroup exactly.

④ Test validity — the new test is a real one, not a tautology: it pins the data path (fields omitted, not zero, for plain sessions), pins served-HTML alignment (13 headers == 13 colgroup cols on both tables, no stale colspan), and executes the actual WEB_CLIENT IIFE in node:vm against live endpoints, asserting every row renders exactly 13 cells with the switch cell showing 1 · 8.0K plus the attribution tooltip. A future column revert or misalignment would trip it.

⑤ Diff — one linear commit, exactly the 5 named files, +230/−8, nothing else. Clean.

Local verification (ran on head 670ec8c0) — typecheck ✓ · web-sessions 7/7 · full suite 3066 tests: 3054 pass / 0 fail / 12 skip (matches the PR's claims) · remote CI green on both heads (all 5 e2e checks success).

README coherence — confirmed: the combined branch's README already carries "gains a matching model-switch column" (line 898) and it's absent on master, so the doc sentence lands coherently with whichever of these PRs merges.

Actions taken: closed #1561 as the duplicate of #1560 (tagged 重复). Please review/merge via #1560 instead — and remember to re-target its base to master after #1558 lands.

中文摘要:审查通过——Web UI 模型切换列内容正确(5 文件 +230/−8、语义与已深审的 #1540 web hunks 逐字节一致、新测试为真测试、本地 typecheck + 全套 3054 项测试全绿、CI 全绿);但发现 #1560 与本 PR 的提交树完全相同(同一条 owner 指令被两个并行会话各交付了一次)。按重复合规处置:关闭本 PR #1561 并打「重复」标签,请改走先开的 #1560 合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant