Skip to content

fix(tasks): 修复图展开、优化布局并提供独立自动折叠设置 - #1041

Merged
Menghuan1918 merged 2 commits into
devfrom
fix/tasks-folding-performance
Oct 23, 2026
Merged

Menghuan1918 merged 2 commits into
devfrom
fix/tasks-folding-performance

Conversation

@Menghuan1918

Copy link
Copy Markdown
Collaborator

变更

  • 修复背景平移后下一次聚合卡/Agent 卡点击被吞:每次有效 pointerdown 先重置上一手势的移动量。
  • 任务图卡片内容独立 memo;布局用索引、显式栈和单次调用内的列数复用,减少宽树/深链的重复工作,不新增全局缓存或轮询。
  • 仅在整条分支结束、目录已知且不含当前查看路径时自动聚合;聚合计数覆盖隐藏 Agent 后代。后代组的手动展开会保护祖先路径,显式手动收起仍优先。
  • 复用现有齿轮与 volatile 偏好存储,新增四个默认开启的独立开关:已结束叶子、整条已结束分支、空闲队友、后台任务抽屉自动收起。21 份词典、Config、指南和变更记录同步。
  • 保留原有空闲阈值/例外:普通同父级队友至少 3 个,workflow 内沿用原规则;抽屉阈值为总 Agent 数至少 8。没有新 UI 体系、路由或存储。

验证

  • pnpm test --maxWorkers=1:221 文件,2719 passed / 17 skipped,exit 0;没有跳过 watcher 或修改断言/超时。
  • pnpm build && pnpm pack、pnpm typecheck、pnpm lint、pnpm check:consumer-types、pnpm check:engines、git diff --check 均通过。
  • 精确宿主 DSH 0.2.1-rc.1 的真实挂载:13 passed / 4 skipped,含原生终端唯一性、xterm、页内重新注册、文件树、Git 与稳态门禁。
  • 独立 scratch profile 的 200/500 Agent 完整鼠标手势回归通过:平移 → 展开 → 再平移 → 详情 → Escape → 手动收回;无 pageerror/console error。
  • 同一测试换原始 0fab0af tarball:200 Agent 的背景平移后点击,60 秒仍只有 2 个节点(预期 201),确认回归测试能抓原问题。
  • Spec 独立审查发现的两项边界(真实 workflow 会话未知目录、后代展开被祖先自动覆盖)均先红后绿修复并复审;模型 54/54,任务页 63/63,布局 14/14。

性能口径

同 Node 进程、相同输入、预热后 11 个交错样本的纯布局中位,2001 节点(2000 个非根 Agent):平铺 14.549 → 0.590 ms(-95.95%),深链 174.334 → 0.770 ms(-99.56%)。

真浏览器单次无 pan 展开对照两版数量级相近(200 Agent:修复 26.0 / 基线 22.1 ms;500:65.9 / 62.2 ms,两版 Long Task 均为 0)。不把布局加速倍数外推为整页加速;测量模式不代替完整交互回归。

已知风险

默认并行 pnpm test 曾有唯一 fs-watch notice 超时(2718 passed / 1 failed / 17 skipped)。同测试在未改动的 0fab0af worktree 也复现:基线 12 轮 11 过/1 失败;工作树 18 轮 14 过/4 失败。本 PR 没改 watcher/测试,单 worker 全量已过,但不声称这个既有 flake 已修复。初次沙箱的 npm cache/home-relative 文件 EPERM、终端挂载失败在正常权限复跑后通过,记录保留。

详细口径、tarball SHA-256、复跑命令和完整证据见 验证记录。

仅发起面向 dev 的 PR,不直接合入、不发版,不修改 DSH 源码或用户 profile。

Reset per-gesture travel before node guards so a preceding background pan cannot suppress the next card click. Index and iteratively lay out graph topology, memoize agent card contents, and project complete settled branches under independent existing-settings preferences.

Keep unknown real workflow catalogs and explicitly opened descendant paths visible. Add regression coverage and real rc.1 browser/baseline validation evidence.
Background pans, the floating-window title drag and the anchored-popover drag committed on every pointermove, so a high-report-rate mouse re-rendered the tasks canvas at event cadence. Compose the latest position in a ref and commit it through the existing frame batcher; release and cancel flush synchronously. Click suppression still updates per event.

Regression: same-frame 100-move burst commits drop 98 -> 1; full suite 2720 passed.
@Menghuan1918

Copy link
Copy Markdown
Collaborator Author

补充提交 dc38513:任务页拖拽改为每帧一次更新。

  • 图模式背景平移、后台任务浮窗标题拖动、锚定弹层拖动此前每个 pointermove 都 setState,整块画布/浮窗按鼠标事件频率重绘;同仓库的侧栏分隔条、浮窗 resize、编辑器 gutter 早已用 createFrameBatcher,这三处是遗漏。
  • 现把最新位置写进 ref,经 createFrameBatcher 每帧最多提交一次;pointerup / pointercancel 调用 flushNow() 保证最终位置不丢;点击抑制的 travelRef 仍逐事件同步更新。
  • 真机探针(rc.1 预览):同一帧内 100 次 pointermove 的画布提交 98 → 1;真实鼠标拖拽前后均约 1 提交/事件(无头 Chromium 本就按帧派发),判别性证据取同帧突发。
  • 新增 jsdom 回归 coalesces background pans into one update per animation frame and flushes on release(先红后绿);pnpm test --maxWorkers=1:221 文件 / 2720 passed / 17 skipped;pnpm typecheck、pnpm lint 通过。
  • 未改滚轮缩放路径(按 wheel 事件提交,频率远低于拖拽),如需要可另开。

@Menghuan1918
Menghuan1918 merged commit 740d73a into dev Oct 23, 2026
5 of 6 checks passed
davidLi17 added a commit to davidLi17/DSH-better-sidebar that referenced this pull request Oct 24, 2026
Selectively backport upstream dev PR omdsh-dev#1044 (6f14792) and pointer fixes from PR omdsh-dev#1041 (dc38513), retaining LHG image attachments, draft bridge and compacted-history inheritance. Resolve delivered files against current scope cwd. Do not adopt new folding preferences.

Ship 0.28.1-lhg.3 with matching prebuilt assets. Verified 2747 tests passed / 17 skipped, typecheck, lint, build, pack, consumer types, scratch DSH startup and Git package consistency. Browser UI verification blocked by environment. Details: docs/plans/2026-10-24-lhg-selective-maintenance.md
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