Skip to content

[PR] web: Rotate the "Compressed Structure" tree view of large sessions to vertical full size, no longer shrunk to sub-pixel | web: 大会话「压缩结构」树图旋转为竖向全尺寸,不再缩成亚像素 (#4173) - #4174

Merged
ranxianglei merged 18 commits into
masterfrom
2026-10-21_web-graph-rotate
Oct 23, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4173

现象(有实测数字)

180 块会话(dsh 主会话,01a152ba…)的「压缩结构」树图:平铺布局 21558px × 204px,fit-to-card 缩放 0.052 —— 每个 118×36 方块渲染成 ~6px 像素点,文字 0.6px。块数一多整棵树退化成色带。

修法

blockGraphSvg 之前一律 fit=min(1,1120/W)。现在:平铺宽度溢出卡片、且转置后的长边更短时改用 blockGraphLayoutVertical(深度走 x 轴、兄弟堆叠走 y 轴),方块保持自然尺寸,在 .tree-graph 既有的 70vh 滚动区内滚动;提示语按朝向切换(新键 det.tree_graph_hint_lr)。同一会话实测:414px 宽 × 8356px 高,180 节点 + 104 边一个不少。窄树/小树走原路径,渲染逐字节不变(只在 flat 宽 > GRAPH_FIT_W 时才考虑转置)。

验证

  • tests/web-blocks-tree.test.ts:新增功能测试——从 WEB_CLIENT bundle 里抽出真实布局代码跑 fixture(30-root 平铺树必转置且节点数不丢、窄链不转置、空树保持 {html:""} 契约)+ bundle 正则钉 + i18n 双语文键对齐。9/9 绿。
  • web-* 全套 139 跑 134 过,5 红 = 给deepseek定制一个跳转到状态的链接 #1590×2/dsh web端和桌面端点击bili设置显示未启动 #1809×3,与干净 master 基线同集(本机环境性红)。
  • tsc 0 错;gen-config-docs 零 diff;check-unused-exports clean;npm run build rc=0(commit=c7e8af4d 无 dirty)。
  • 用真实会话数据(blockDetails 直喂)复算:flat fit=0.052 → rotated W=414/H=8356,选择 VERTICAL ✓。

@ranxianglei ranxianglei changed the title web: 大会话「压缩结构」树图旋转为竖向全尺寸,不再缩成亚像素 (#4173) [PR] web: Rotate the "Compressed Structure" tree view of large sessions to vertical full size, no longer shrunk to sub-pixel | web: 大会话「压缩结构」树图旋转为竖向全尺寸,不再缩成亚像素 (#4173) Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-21_web-graph-rotate (f9ca15c)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.5136-pr.4174.c29248b

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4174.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Progress on this branch: live tree thumbnail committed (b2ac0217).

The session detail page now carries an always-visible minimap of the compression tree in the top-right of the page head, refreshing itself every 5s while the view is open — compressions landing in a live session are watchable without opening the tab:

  • GET /__bili/sessions/<id>/tree — compact edge feed only (buildSessionTree(), ids/tiers/activity/fold edges, no summaries or refs): ~6KB for a 180-block session. Same first-parent-wins inversion as the detail payload.
  • Client shares one orientation rule (graphLayouts) and one bezier helper (graphEdgePath) between the full graph and the new rect-only chip, so both always agree and wide trees rotate inside the chip too.
  • The chip rides the existing 5s poller on the detail view only and is a decorative lane: fetch failures keep the last good frame and never touch the error strip or the 管理页面全量加载历史会话时触发堆 OOM:需要有界分页、摘要统计与详情懒加载 #1937 backoff ladder. Clicking it opens the Compression-Structure tab, switches to Tree-Graph mode and scrolls there.
  • Tests: server feed pin (edges wired, summaries never leave the wire, unknown id → null), thumb invariants (no <text>, width cap ≤168, rotation shared), i18n pair, bundle wiring regexes. All green locally (tsc 0, gates clean, web battery green modulo the known 给deepseek定制一个跳转到状态的链接 #1590/dsh web端和桌面端点击bili设置显示未启动 #1809 environment reds identical to master baseline).

@ranxianglei

Copy link
Copy Markdown
Owner Author

da60fe3 — in-pane live tree panorama (replaces the page-head chip)

The fixed ~170×56 corner chip could not render pathological trees: this session's rotated graph is 386×8356, which the CSS-capped box scaled down to a few pixels of content — effectively blank. Reworked per review:

  • The 压缩结构 pane now opens with a live panorama card: the same full labeled drawing at natural node size (118×36 boxes, topic + size labels), inside a bounded viewport (min(44vh, 440px)).
  • Interaction is bound on the stable container by delegation (the 5s poller swaps its innerHTML): wheel = zoom-to-cursor (exp factor, clamped 0.02–8), drag = pan, "适配" button resets to the meet-scaled overview, plain click on a node = jump to that block's row in the list below (open + flash + scrollIntoView). Zoom/pan state survives refreshes via an element expando.
  • The poller keeps the existing /sessions/<id>/tree endpoint; it now re-renders only when the block population actually changed (signature compare) and restores the viewer transform on top of each rebuild. Failures still keep the last good frame and never touch the 管理页面全量加载历史会话时触发堆 OOM:需要有界分页、摘要统计与详情懒加载 #1937 backoff ladder.
  • buildGraphSvg(blocks, wrapped) gains one opt-in mode (no fixed size attrs, content wrapped in <g class="tm-g"> for the transform); the plain path is byte-compatible — pinned in tests alongside the new wrapped assertions. Page-head chip markup, CSS and i18n keys removed; three new det.tree_map_* keys added.

Verification: web-blocks-tree 10/10; battery 49 runs → only the 5 pre-existing environment reds (#1590×2, #1809×3) identical to clean master; tsc 0; gen-config-docs zero diff; unused-exports clean; npm run build OK.

@ranxianglei

Copy link
Copy Markdown
Owner Author

298e978 — natural-size scroll, instead of a second meeting-to-fit

The first cut still had the chip's disease one size up: with no transform set, the browser met-scaled the whole viewBox into the fixed viewport. For this session's rotated tree (386×8356 user units in a ~1500×440 box) that means scale ≈ 0.05 — the "overview" rendered as a ~20px sliver of lines. Uniform meet can never make a 21:1 aspect ratio legible in a 3.4:1 box; it was only ever a coincidence for near-square trees.

Now the pane renders at natural pixels (a block box is always 118×36, its labels readable) inside a natively scrollable viewport:

  • wide flat trees scroll horizontally, tall rotated trees vertically — always legible, no matter the aspect ratio;
  • wheel = zoom around the cursor, implemented by resizing the inner frame (.tm-inner), so the native scrollbars track the zoomed extent honestly and the browser scales the drawing uniformly;
  • drag pans via the native scroll position (clamped by the browser); trackpad/touch scrolling just works too;
  • 适配/Fit shrinks to the whole-tree overview on demand; double-click restores natural size; click-through to the list row, the 5s /tree refresh and zoom/scroll survival across rebuilds are unchanged.

buildGraphSvg(blocks, wrapped) now returns {html, vertical, width, height} and the wrapped svg carries its natural width/height attributes (the plain path stays byte-identical — pinned). Tests updated accordingly; battery 44/49 with exactly the 5 pre-existing environment reds (#1590×2, #1809×3), tsc 0, gates clean.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 检索了 open+closed 的 issue/PR(关键词:压缩结构、树图、亚像素、web tree graph、blockGraph、rotate),除 #4173 本体与本 PR 外无相似条目。

初审进行中,先报两个要点,完整八问结论随后补:

  1. 方向判断成立:根因确实是 buildGraphSvg 一律 fit=min(1,1120/W) 把宽树缩成色带;「平铺宽度溢出卡片且转置后长边更短才转竖向」的门控与 issue 期望一致,窄树走原路径。
  2. 两处待核:① 分支落后 master,而 master 同期合入了 feat: proxy-side idle prompt-cache keepalive (TTL refresh pings) | feat: 代理层空闲期提示缓存保活(prompt cache TTL 续命) #3376(keepalive web 面)等改动,触碰同一组热文件(src/web/client.ts、i18n.ts、sessions-data.ts)——需 rebase 后验证无语义冲突;② PR 描述只写了旋转修复,但分支实际有 5 个 commit:旋转核心之外还有「页内实时全景图」(替换页头缩略图)和 UI shell 加 cache-control: no-cache 两个增量,会逐项审并单独披露行为变更。

ework-agent and others added 6 commits October 22, 2026 01:32
…g them to smears (#4173)

大会话(如 dsh 主会话,180 个压缩块)的「压缩结构」树图实测平铺布局
21558px 宽 x 204px 高,fit-to-card 缩放系数 0.052 —— 每个 118x36 的方块
渲染为约 6px 的像素点,完全不可读。根因:blockGraphLayout 的宽度由叶子数
决定,而 buildGraphSvg 一律 fit = min(1, 1120/W)。

The tree now rotates when the flat width overflows the card AND the rotated
long dimension is shorter: depth becomes the x-axis, sibling stacks pile along
y at full box size inside the pane's existing 70vh scroll area. Same fixture:
414px wide x 8356px tall, all 180 nodes + 104 edges intact. Small/narrow trees
render byte-identically to before (rotation is only considered once flat width
exceeds GRAPH_FIT_W). New det.tree_graph_hint_lr names the left-to-right
reading direction; the hint switches per orientation.
A small always-visible minimap of the compression tree sits in the top-right
corner of the session detail page and refreshes itself while the session is
live — you can watch compressions land without opening the tab.

- GET /__bili/sessions/<id>/tree: compact edge feed only (id/tier/active/
  parent/fold edges, no summaries or refs) — a 180-block session ships ~6KB.
  Served by buildSessionTree() with the same first-parent-wins inversion the
  detail payload uses.
- client.ts shares ONE orientation rule (graphLayouts) between the full graph
  and the new rect-only thumbnail, plus one bezier helper (graphEdgePath), so
  both drawings always agree and wide trees rotate in the chip as well.
- the chip joins the existing 5s poller on the detail view only; it is a
  decorative lane: failures keep the last good frame and never touch the
  error strip or the #1937 backoff ladder. Clicking it jumps into the
  Compression-Structure tab, switches to Tree-Graph mode, and scrolls there.
- tests: server-side feed pin (edges wired, summaries never leave the wire,
  unknown session -> null), thumbnail invariants (no text nodes, width cap,
  rotation shared), i18n key pair, bundle wiring regexes.
)

The shell document inlines the entire client bundle and carried no cache
directive, so browsers applied HEURISTIC caching: after a proxy upgrade the
page kept serving an old client build until someone happened to hard-refresh
(witnessed live — the tree thumbnail deploy stayed invisible this way).
Cache-Control: no-cache forces revalidation; the document is stateless HTML
so always-refetch costs nothing but a few hundred KB of loopback traffic.
…4173)

The fixed-size corner chip rendered as a blank sliver for pathological trees (this session: rotated 386x8356 -> ~3px of content in a 170px box). The compression tree now opens its own pane section: full labeled drawing at natural node size inside a bounded viewport, wheel zoom to cursor, drag pan, fit button, click a block to jump to its list row. Same 5s /tree poller; re-renders only on population change and restores the viewer transform.
…shrink (#4173)

The default meet-scaled viewBox still smears pathological aspect ratios inside the fixed viewport (this session: a 386x8356 rotated tree met into a ~20px sliver). The pane now renders the drawing at natural pixels (block boxes stay 118x36, labels readable) in a natively scrollable box; wheel zooms around the cursor by resizing the inner frame so scroll ranges stay honest, drag pans via the native scroll position, Fit shrinks to the whole-tree overview, double-click restores natural size. Click-through to the list row and the 5s /tree refresh are unchanged.
The /tree poller's change signature covered blockId/tier/active, so an
absorption that only adds a fold edge (the child keeps its id, tier and
active flag) left the in-pane panorama stale until the next unrelated
population change. Edges are part of the drawing, so they belong in the
signature.
@ranxianglei
ranxianglei force-pushed the 2026-10-21_web-graph-rotate branch from 298e978 to 4b8e6b4 Compare October 21, 2026 17:43
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #4174 review 结论(结构化八问)

  1. 是什么问题:大会话(如 180 块的 dsh 主会话)在 Web 会话详情页的「压缩结构」树图里,平铺布局宽 21558px、高仅 204px,fit-to-card 缩到 0.052——每个块变成 ~6px 像素点、文字 0.6px,整棵树退化成色带,无法阅读。
  2. 什么原因导致的:blockGraphSvg 一律按 fit=min(1,1120/W) 横向压扁,不管树的形状——又宽又扁的树被水平压缩碾碎,没有朝向选择这一层。
  3. 影响范围与严重程度:仅 Web 管理面板、块数多到平铺宽度 >1120px 的会话详情页树图可见性受损;窄树/小树渲染逐字节不变(实测)。纯展示缺陷,无功能损坏。
  4. 怎么修复的:当「平铺宽度溢出卡片 且 转置后长边更短」时改用 blockGraphLayoutVertical(深度走 x 轴、兄弟堆叠走 y 轴),方块保持自然尺寸,在既有 70vh 滚动区内滚动;提示语按朝向切换。PR 另含两处同面增强:详情页顶部加实时全景图(自然尺寸 + 滚轮缩放/拖拽平移/一键总览/点节点定位列表行),HTML 外壳加 cache-control: no-cache。
  5. 是否有回归问题:逐项过——
    • 窄树路径:A/B 实测(从 master 与分支 bundle 各抽出真实布局代码跑同一组 fixture):链状、平衡树、922px 宽的 7-root 树输出逐字节一致;只有 1352px 宽时 master 缩到 1120、分支转置为 146×532——门控条件与描述完全吻合;
    • 空树 {html:""} 契约保留(测试钉住);buildGraphSvg 返回类型 string→对象仅同文件内部调用方,无外部 API 变化;da60fe3c4 用页内全景替换页头缩略图后无死代码残留(check-unused-exports clean);
    • 行为变更披露①:HTML 外壳响应头原先没有 cache-control(浏览器启发式缓存,升级后旧 UI 可能滞留)→ 现在 no-cache;原因:新增 i18n 键与布局需升级后立即生效。有意变更;
    • 行为变更披露②:新增端点 GET /__bili/sessions/<id>/tree(管理回环面、no-store、≤5000 块截断),全景图每 5s 拉取——成本与既有 /detail 轮询同级,可接受;
    • 行为变更披露③:会话详情页布局新增 ~44vh 全景区(块卡片变高、graph/list tab 下移);空会话不渲染该区;
    • 新 i18n 键:det.tree_graph_hint_lr / det.tree_map_title / det.tree_map_hint / det.tree_map_fit(zh/en 成对,parity 测试覆盖);未引入任何 env/config/CLI flag。
  6. 是否破坏缓存:不涉及模型上下文缓存/折叠状态/重试/增量游标;披露①的 no-cache 只是浏览器侧 UI 外壳缓存策略,与此无关。
  7. 是否改了设计方向:不涉及——纯 Web 展示面,kernel 与请求管道零改动。
  8. 是否引入了新的配置:不涉及。

review 附加动作(已完成并推送):

判定:可合并。 无阻塞项;上述三处行为变更均已披露且合理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)

交叉链接:#4211(10-22 开)覆盖了本 PR 与 #4173 的同一根因,scope 更小——只做「预计缩放系数低于 0.5 时转竖向自然尺寸」这一项修复(无全景图 / no-cache 增量),CI 全绿。两个 PR 改同一组函数(blockGraphLayout/buildGraphSvg + styles/i18n/tests),不能共存。

按「一个 issue 一个 scope」,建议:合并 #4211 关 #4173;关闭本 PR;若页内实时全景图功能仍想要,另立 issue 拆独立 PR。等 owner 拍板,未对任何一侧做处置。

…oom (#4173)

User reported two trees on the compression pane (standalone panorama card
above plus the 列表/树图 switch below) and asked for ONE: drop the
real-time card, give 树图 itself the natural-size live drawing with zoom.

- #tree-graph now renders the wrapped natural-size svg (treeMapInnerHtml):
  boxes stay 118x36 px, native two-axis scroll, wheel zoom at cursor, drag
  pan, 适配(Fit) overview, double-click resets, click a box jumps to its
  list row. The 5s /tree poller repaints this same container (sig-guarded,
  including awork's fold-edge signature fix).
- The hint line and Fit button move into the 列表/树图 row; Fit only shows
  while 树图 is active. Per-node click listeners dropped (delegated
  pointerup in bindTreeMap covers click-vs-drag).
- Removed: tm-wrap/tm-head card markup+CSS, det.tree_map_title (zh/en).

Re-applied on top of the rebuilt branch history (previous attempt was lost
when the branch was rebased onto master); gates green (tsc, web-blocks-tree
10/10, battery, gen-config-docs, unused-exports, build).
@ranxianglei

Copy link
Copy Markdown
Owner Author

Re-applied the merge on top of the rebuilt branch history (the earlier merge commit was dropped when the branch was rebased onto master). This sits cleanly on 4b8e6b4 and keeps the fold-edge signature fix — the poller now repaints #tree-graph itself.

Shape: one tree. 树图 renders the natural-size drawing (wheel zoom at cursor, drag/scroll pan, 适配 overview, double-click reset, click-to-jump, 5 s live refresh); the standalone panorama card is gone and its hint/Fit control live in the 列表/树图 row (Fit only shown while 树图 is active). Gates green: tsc 0, web-blocks-tree 10/10, battery 33/33 (+ dsh-settings-ui at the known 5 env-red baseline), gen-config-docs zero diff, unused-exports clean, build rc 0.

…ss live refreshes (#4173 review)

78a123f moved #tm-fit into the list/graph row starting hidden, but
setMode never unhides it - the advertised Fit overview was unreachable.
The 5s poller also replaced the whole #tree-graph innerHTML, wiping the
legend row that now lives inside the pane after the first refresh.

- setMode toggles fit.hidden with the graph mode (visible only while the
  tree view is active)
- refreshTreeMap swaps only the .tm-inner drawing frame so the pane's
  other children survive live refreshes
- pin both behaviors as bundle regexes in tests/web-blocks-tree.test.ts;
  correct the stale #tree-map comment to #tree-graph
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

第二轮 review(新 commit 78a123f09「one tree」+ 我的修复 7d2ba7b95)

  1. 是什么问题:上一版页面上有两棵同一数据的树(独立全景卡片 + 下方列表/树图 tab),冗余;本轮把全景合进「树图」本身——自然尺寸绘制、滚轮缩放、拖拽平移、适配总览、点块跳列表行,独立卡片删除。
  2. 什么原因导致的:纯 UX 收敛,无缺陷背景;方向同意——一棵树比两棵清楚。
  3. 影响范围与严重程度:仅 Web 会话详情页布局与交互;列表模式、其他页面、非 Web 面不受影响。
  4. 怎么修复的:#tree-graph 直接渲染 wrapped 自然尺寸 svg;hint/Fit 移入 列表/树图 行;删 tm-wrap/tm-head CSS 与 det.tree_map_title 键;5s poller 改重绘 #tree-graph。
  5. 是否有回归问题:逐项过——
    • 窄树逐字节契约不受影响(未触碰布局函数):A/B fixture 仍全过;
    • 发现两处真实缺陷,已直接修掉(commit 7d2ba7b95):
      a) #tm-fit 以 hidden 创建,但 setMode 从未把它显示出来——「适配/Fit」按钮永久不可达(commit message 声称 "Fit only shown while 树图 is active",实现缺了这半句)→ setMode 现在随模式切换 fit.hidden;
      b) poller 用整段 innerHTML 替换 #tree-graph,而图例行现在在 pane 内部——首次 live 刷新(~5s 后)就把图例冲掉了 → 现在只换 .tm-inner 画框(remove + insertAdjacentHTML),兄弟节点存活;
      两个行为都加了 bundle 正则钉;另修正测试里一处过时注释(#tree-map→#tree-graph);
    • 死引用扫描:src/tests 中 tree-map/tm-head/tm-wrap/tree_graph_hint*/tree_map_title 零残留;
    • 行为变更披露:朝向说明文案(det.tree_graph_hint/_lr 的「从上到下/从左到右」)随旧 hint 行删除——pane 内现在只有交互提示(缩放/平移/刷新)+ 图例。可接受的简化,明确报出;
    • i18n:zh/en 成对删 3 键,parity 测试同步更新;无新增键/env/config。
  6. 是否破坏缓存:不涉及(模型上下文缓存/折叠状态不变;HTML shell no-cache 维持上轮披露)。
  7. 是否改了设计方向:不涉及——向更简单的单树形态收敛。
  8. 是否引入了新的配置:不涉及。

关于「earlier merge commit was dropped」:我核了 git 证据——rebase 前的远端分支历史是线性的(c7e8af4d9→b2ac0217e→05e5df63b→da60fe3c4→298e9787b,每个都只有一个父提交),我的 rebase 没有从远端历史丢掉任何 merge commit;如果之前有未推送的本地尝试,现已由 78a123f09 干净地重新落上。

验证(head 7d2ba7b95):本地定向 web-blocks-tree 10/10、web-* 全套 124/124、tsc 0 错、build rc=0;远程 CI 发帖时快照:10 绿 + 13 skipped(门控 e2e)+ 1 运行中,零红——全绿后我补一条确认。

判定:CI 全绿即可合并(当前无红项;两处缺陷已在本分支闭环)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 终态确认(head 7d2ba7b95)

  • 代码 CI 全绿:全部 test 分片(ubuntu 22×3 / ubuntu 24 / windows 22×2)+ 各 guard/gate/build 共 31 通过、14 skipped(门控 e2e)、零失败。
  • 唯一红项是 PR Build Artifact 的 npm publish 步骤,属注册表侧故障,与代码无关:
    • 两次尝试均死在同一步:npm error 503 Service Unavailable - PUT https://registry.npmjs.org/billion-context(build 本身成功,tarball 已打出);
    • 对照同期其他分支的同一 workflow:02:20 起 2026-10-22_4245-4079-win-ci-*、2026-10-22_storage-wrapup-3、fix/compress-input-contract 也相继红,而 02:02–02:37 之间多次成功——E503 从 ~02:20 UTC 起间歇性打这个包的发布通道,不是本分支特有;
    • 我已通过 API 触发过一次 failed-job 重跑(attempt 2,版本自动带 -a2 后缀不会撞 E409),仍遇同一 503。
  • 影响面:该 lane 只产「可安装构建」便利物(rolling pr tag + artifact tarball + 📦 评论),不 gate 正确性也不 gate 合并。当前 pr tag 停在上一 head 78a123f0 的构建(差我这一个两行修复 commit)。
  • 处置建议:等注册表恢复后重跑该 job 即可(我这边随时可以再触发一次;或你在 Actions 页面点 Re-run jobs)。代码侧无需任何改动。

判定维持不变:可合并——功能与回归面已闭环(两处 review 缺陷已修并钉测试),唯一待办是环境性的 artifact 重发。

@ranxianglei

Copy link
Copy Markdown
Owner Author

Fixing the two regressions reported after the merge (#4173):

Click-to-jump was dead — bindTreeMap calls view.setPointerCapture() on pointerdown, which retargets pointerup at the #tree-graph container. The handler then did e.target.closest("[data-bid]") → always null → the jump never fired. Now it hit-tests with document.elementFromPoint(clientX, clientY) (falls back to e.target).

"All the block details were lost" — graph mode hid the whole .block-node list (list.hidden = g), so with the map visible there was nothing else on screen. Graph mode now stacks the live map above the full block list (the list is never hidden), and the pane now defaults to graph mode so the overview shows immediately under the tabs; list mode just hides the drawing. A node click no longer flips modes — it opens/flashes/scrolls to that block's row in place.

Gates: bundle parse check ✓, tsc 0 ✓, web-blocks-tree 10/10, web-sessions + embed-cors 37/37 combined ✓. New pins: elementFromPoint + list.hidden = false in the bundle regex suite.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

两处回归修复已独立核验(head 3044419c8)。查重:不适用——同分支同 PR 的回归闭环,无并行条目。

先澄清一点:PR #4174 尚未合并——两个回归都只存在于 PR 构建(npm pr tag),master 未受污染;修复 commit 3044419c8 落在分支 head,合并即带修。

代码核对(diff 逐行读过):

  • click-to-jump:setPointerCapture 把 pointerup 重定向到容器,e.target.closest("[data-bid]") 恒 null——诊断准确;改 document.elementFromPoint(clientX, clientY) 命中测试 + e.target 兜底(try/catch 包裹),是这类问题的标准解法;节点点击不再 lb.click() 翻模式,改为原地展开/闪烁/滚动到对应行。
  • 细节丢失:list.hidden = g(互斥)→ list.hidden = false(图叠列表上方,列表永不隐藏),pane 默认 setMode("graph")。逻辑自洽,与描述一致。
  • 布局函数(blockGraphLayout*/buildGraphSvg)本次零改动,窄树逐字节契约不受影响;新增两条 bundle 正则钉(elementFromPoint、list.hidden = false)。

本地定向验证(分支 head 实跑,kernel 先构建):web-blocks-tree + web-sessions + dsh-panel-embed-cors 共 37/37 绿,与报告一致。

远程 CI(head 3044419c8):31 success + 13 skipped(门控 e2e)、零红。全部 static gates/guards/docs/build-artifact 绿(上次 npm registry 503 已恢复,artifact lane 正常出包);test 六分片中五片绿,仅剩 windows-latest 22 shard 1 在跑(~26 min,Windows 分片常态慢速)——若它转红会再转发唤醒,届时单独处置。

八问:

  1. 是什么问题:树图两个交互回归——点块跳列表不触发;树图模式下块详情列表被整体隐藏,看起来「细节全丢」。
  2. 什么原因导致的:① pointer capture 重定向事件目标,命中检测取错了元素;② 图/列表被实现成互斥 tab 而非叠加。
  3. 影响范围与严重程度:仅 Web 会话详情页压缩结构 tab 的交互与可见性;数据/压缩/缓存功能零影响。跳转变不可用属明确缺陷,但可绕行(手动切列表模式),且未进 master。
  4. 怎么修复的:按坐标命中测试替代事件目标;图叠在列表上方、列表永不隐藏;默认进树图模式。
  5. 是否有回归问题:审过——布局函数未触碰(窄树契约安全);setMode("graph") 默认值变化是有意行为变更(旧默认列表 → 新默认树图);节点点击不再切模式是配套变更;均已在原评论披露,我复核无异议。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:修复成立、验证齐备,可合并——当前无任何红项,最后一个 Windows 分片正常收尾即可直接合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

Five review nits from @ranxianglei addressed (7fd3ebb3, 3779fa75):

  1. List rows start collapsed — a 200-block session no longer opens as a wall of expanded cards; openAttr is now always empty (tree-map clicks still open+flash the target row).
  2. Message spans back on the tree nodes — /tree now ships canonicalized startRef/endRef per node (same orderedRefPair normalization as the detail view); node line-2 renders mXXXX–mYYYY (tokens demoted to the hover tooltip). Server pin asserts non-monotonic spans are canonicalized ascending before leaving the box.
  3. Active vs inactive contrast — inactive nodes: muted fill (--bg-muted) + dashed stroke + 50% text opacity; active keeps the tier tint (blue/violet).
  4. Raw-view button toggles closed — second press collapses the fetched raw content (was one-way before). CDP-verified: open → close → reopen cycle works.

Gates: bundle check + tsc 0 + web-blocks-tree 10/10 + web-sessions/embed-cors 27/27. Deployed as 0.1.207-treemap.9 on 18824/18826; live probe on the 211-block session: rows open=0, 201/211 nodes show a message span.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

第二轮修复(5 条 review 意见,7fd3ebb3 + 3779fa75)已逐条核对;分支上还多一个 6098d026c(树图挪到列表上方),一并核过。

逐条核验

  1. 列表行默认折叠 — openAttr 恒为空串(原来 depth<2 || (active && depth<3) 会展开),大会话不再一打开就是一整墙卡片;点树图仍会 open+flash 目标行,该路径未动。✓
  2. 消息区间回到节点 — /tree feed 每节点带 startRef/endRef(仅当两者都存储时才发),用 kernel 的 orderedRefPair(kernel/src/refs.ts:48,按 ref 数值比较交换)规范化升序——和详情视图是同一个函数,没有另写一份。测试钉了非单调 span(存 ["m00010","m00005"] → 出 m00005–m00010)。summary 依旧不出服务端(原断言保留)。✓
  3. 激活/非激活对比 — 非激活:--bg-muted 填充 + 虚线描边 + 文字 50% 透明;激活保持层级色。纯 CSS 层改动。✓
  4. raw 按钮可收起 — 把切换逻辑走完了一遍:开→关→再开循环成立;不同视图之间按各自 data-view 取数,不串台。✓
  5. (额外 commit 6098d026c)树图移到列表上方 — 纯 DOM 顺序调整,两行移动,无逻辑变化。✓

本地验证:web-blocks-tree + web-sessions + dsh-panel-embed-cors 三套定向测试 37/37 绿(含新钉的 span 规范化断言;第一轮的两个 pin elementFromPoint / list.hidden=false 仍在且通过)。

CI(head 3779fa75):guards / build-artifact / static-gates(ubuntu) 等已绿,6 个 test shard + windows static-gates 在跑(约 6 分钟),目前零红。PR 状态 open、mergeable=true(base 已领先,无冲突,不影响合并)。


八问

  1. 是什么问题:合入前 owner 的五条 UX review 意见——列表行默认全展开成卡片墙、树节点缺消息区间、激活/非激活对比不足、raw 查看按钮只能开不能关。
  2. 什么原因导致的:首版实现的取舍问题(展开策略激进、feed 为省字节不带 ref、样式没区分激活态、按钮只写了「开」分支),不是机制缺陷。
  3. 影响范围与严重程度:仅 web 详情页「压缩结构」面板的展示面;压缩行为、存储、wire 均不涉及。体验级。
  4. 怎么修复的:默认折叠 + feed 补带规范化 span(复用 kernel 既有 orderedRefPair)+ CSS 区分激活态 + 按钮幂等切换;布局上树图置顶、列表常显。
  5. 是否有回归问题:树图渲染/布局代码只在声明的位置动了(节点第二行内容、非激活 CSS、DOM 顺序、openAttr、raw 按钮),其余逻辑未触碰;本地 37/37 绿。有意的行为变更(旧→新):① 列表行默认部分展开 → 默认全折叠(点开/点树图才展开);② 节点第二行显示 token 元信息 → 显示 mXXXX–mYYYY 区间(token 降为 hover tooltip;无 ref 的节点仍显示元信息);③ /tree feed 每节点最多多两个短 ref 字段(payload 略增,summary 仍不出服务端);④ raw 按钮单向打开 → 可开可关。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(仍是既有的「单树图 + 完整列表叠加」结构)。
  8. 是否引入新配置:不涉及。

判定:五条意见的实现与评论声明一致,本地定向验证通过,CI 暂无红——剩余 shard 跑完即可合并;如有红我会被唤醒跟进。

@ranxianglei

Copy link
Copy Markdown
Owner Author

In-page flow for the live tree map (follow-up to review feedback on 194542c):

Problem. The map lived in its own ~440px scroll box (.tree-graph max-height/overflow), so it occupied a fixed chunk of the pane and hid the block list behind a second scrollbar; and with full-size 118×36 nodes a 200+ block session became a very long column of big boxes.

Change (client-side only):

  1. The drawing is part of the document now. The map div dropped its box classes (no inner overflow:auto/max-height, no drag-pan cursor): natural-size svg at the top of the compression pane, page scrolls through it into the list below. One continuous document, no box-within-box.
  2. Tighter map nodes. Layout metrics are parameterized (FULL_METRICS vs MAP_METRICS = 92×30, gap 8, level 46); the two production call sites pass the compact metrics, every other call site stays byte-for-byte identical (plain regression pin unchanged in tests). Text baselines and edge beziers follow the metrics.
  3. Zoom follows the new flow. Plain wheel scrolls the page over the map (native). Ctrl/⌘-wheel / trackpad pinch still zooms around the cursor — anchored by measuring .tm-inner before/after resize and compensating with window.scrollBy. #tm-fit now shrinks the whole tree into roughly the current viewport and centers it there; double-click restores 1:1. Click-to-jump logic untouched (point hit-test, open+flash+scroll-to-top).
  4. i18n hints updated (zh/en), CSS .tm-view de-boxed, compact fonts scoped under .tm-svg.

Gates: bundle extract + node --check; tsc --noEmit clean; web-blocks-tree 10/10 (signature pins updated for the parameterized builders, new pins for the ctrl-wheel guard / MAP_METRICS / window.scrollBy); web-sessions + dsh-panel-embed-cors + issue3862-context-view + web-i18n all green; gen-config-docs zero drift; unused-exports clean.

awork added 2 commits October 22, 2026 23:16
Review nit found while verifying 06e280a: since the map flows with the
page, #tree-graph is no longer an inner scroll box, so capturing/restoring
its scrollLeft/scrollTop on every live refresh is a no-op. Remove the dead
lines and fix the stale 'zoom/pan' wording in the poller's doc comment
(pan no longer exists).
CI red found while verifying this PR: master merge aa198fe (#4177) added
tests/storage-durability.test.ts without registering it in the process-spawning
LIVE_FILES table, so the SPAWN_RE tripwire in scripts/run-ci-tests.mjs fails
every test shard on any PR whose checkout includes current master (and master
itself). Append at the end of the array: slot = index drives each file's zone
port band, so mid-list insertion would renumber every later band.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

本轮两个新 commit(194542ce + 06e280a3)已逐条核对,另在验证过程中发现并处理了一个 CI 红风暴(与本 PR 内容无关,根因在 master),详见下文。

逐条核验

  1. 摘要夹钳(194542ce)— sumLong(>64 字符)预过滤;折叠态 <details> 无布局,所以「是否真截断」在首次展开时用 scrollHeight <= clientHeight+2 实测一次:没截到就移除 clamp 类和按钮,截到了才绑「展开全部」切换。逻辑闭环正确,不会给短摘要挂无意义按钮。✓
  2. 跳转落点 — scrollIntoView center → start(行顶对齐)。✓
  3. 去盒化(06e280a3)— .tree-graph 类从 CSS 和 markup 同时移除,.tm-view 只剩 position:relative(无 overflow/max-height/grab 光标);全仓无残留引用。自然尺寸 svg 置顶、整页一滚到底进列表。✓
  4. 指标参数化 — blockGraphLayout/blockGraphLayoutVertical/graphLayouts/graphEdgePath/buildGraphSvg 全部默认 m || FULL_METRICS(=原 118×36/16/84 常量);生产调用点只有两处传 MAP_METRICS(初始渲染 client.ts:2111、轮询刷新 :3901)。其余调用点(含测试的 byte pin)走默认值,字节不变——已核对。文本基线随指标走(idY/m.h>=36?15:12 等)。✓
  5. zoom 语义 — if (!e.ctrlKey) return; 放在 preventDefault 之前:普通滚轮 = 原生页面滚动;Ctrl/⌘ 滚轮/捏合仍缩放到光标处,锚定靠 resize 前后测 .tm-inner rect + window.scrollBy(dx,dy) 补偿,推导正确。drag-pan 整体移除(pointerdown 只留点击命中,moved>3px 守卫保留);treeMapFit 改为视口基准且 k=Math.min(1,…) 封顶不放大、垂直居中视窗;双击恢复 1:1。click-to-jump(elementFromPoint 命中 + open+flash+scroll-to-top)未动。✓
  6. i18n zh/en hint 与实现语义一致;紧凑字号 scoped 在 .tm-svg 下不外溢。✓

本地门禁:web-blocks-tree / web-sessions / dsh-panel-embed-cors / issue3862-context-view / web-i18n 五套定向测试 53/53 绿;tsc --noEmit 干净。


验证过程中发现并处理的两个问题(均已提交到本分支)

  1. 死代码清理(commit 4b927aa2,+1/-4):去盒化后 refreshTreeMap 里的 keepSl/keepSt 保存-恢复变成 no-op(#tree-graph 不再可滚动),连同 poller 注释里过时的 "zoom/pan" 措辞一并清掉。修复后 bundle parse + web-blocks-tree 复验通过。
  2. CI 红风暴根因定位 + 止血(commit 133cdd24,1 行登记):本 PR 的 12 个 test shard 全红,错误签名完全一致——process-spawning test files missing from LIVE_FILES …: tests/storage-durability.test.ts。追查结论:不是本 PR 引入。master aa198fe61(合并 [PR] storage: durability trio — open-time quick_check + online VACUUM INTO backup + second-process lockfile (#4175) #4177 storage durability trio)新增该测试时漏登 scripts/live-files.mjs 的 LIVE_FILES 表,tripwire(tests/claude-native.test.ts linux live-E2E subtests fail/hang in shared multi-agent sandboxes #1248 并发假设门禁)对任何检出含当前 master 的 merge ref 直接 die——master 自身在该 commit 上也是红的。按「几行级小修随当前 PR」纪律已在分支补登记(追加表尾而非插中间:slot=index 驱动各文件的 zone port band,插位会重排后续端口段)。本地模拟 tripwire:修复后 unregistered spawners = none。CI 已证实生效:新 head 上 12 个 shard 全部回到绿/运行中,零 shard 失败。

同一症状的另一机制(mysql-contract lane 因 job 缺 kernel build 步骤解析不到 acp-kernel/dist,与本 PR 无关、需缓存/build 顺序层面决策)已按同症状同 issue 纪律合并记录:#4326(标签 bug / scope/ci / p2,含完整证据链与候选修法)。

当前 CI(head 133cdd24):28 绿 + 13 skip,剩 3 个 shard 在跑真实测试(~10min),唯一红是 #4326 跟踪的 mysql-contract。


八问

  1. 是什么问题:owner 对 194542ce 的后续反馈——图困在自己 ~440px 滚动盒里形成盒中盒、长会话是超长的大盒子列;外加长摘要文字墙与跳转落点两个小项。
  2. 什么原因导致的:首版用固定高度滚动容器 + 全尺寸节点承载地图,与「大会话」场景不匹配;属实现取舍问题,非机制缺陷。
  3. 影响范围与严重程度:仅 web 详情页「压缩结构」面板展示面;纯客户端渲染,压缩行为/存储/wire 不涉及。体验级。
  4. 怎么修复的:去盒化让图随文档流排布 + 指标参数化(紧凑指标只作用于两处生产调用点,其余默认值保持字节一致)+ 普通滚轮交还页面、Ctrl/捏合光标锚定缩放 + Fit 封顶 1:1 并按视口居中 + 长摘要实测夹钳 + 跳转顶对齐。
  5. 是否有回归问题:五个布局/渲染函数经 m || FULL_METRICS 默认值保持原签名与原输出,plain regression pin 未变且通过;本地 53/53 绿。有意的行为变更(旧→新):① 图的内嵌滚动盒(自身滚动条 + drag-pan)→ 随页面流动、单文档滚动;② 普通滚轮缩放图 → 普通滚轮原生滚页面,仅 Ctrl/⌘ 滚轮/捏合缩放(光标锚定);③ drag-pan 移除;④ Fit:适配容器盒(可放大超 1:1)→ 整树缩进当前视口、封顶 1:1、垂直居中;双击仍恢复 1:1;⑤ 页内地图节点 118×36(gap 16/level 84)→ 92×30(gap 8/level 46),字号 10/9px(scoped .tm-svg);⑥ 长摘要(>64 字符)展开即全文 → 首展夹 5 行 + 展开全文按钮(实际没截断则自动摘除按钮);⑦ 点节点跳转行中部对齐 → 行顶对齐。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(仍是既有「单树图 + 完整列表叠加」结构,仅把布局载体从内嵌滚动盒换成文档本身)。
  8. 是否引入新配置:不涉及。

判定:两 commit 实现与声明一致,本地定向全绿,CI 红风暴已止血(facet A 随本 PR 合入生效,facet B 独立跟踪 #4326)——剩余 3 个 shard 跑完即可合并,目前无新增红;如有红我会被唤醒跟进。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.739-master.9e2d217 (rolling master tag).

npm install -g billion-context@0.0.739-master.9e2d217  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

Projects

None yet

1 participant