Skip to content

feat(todo): 展开后的 TodoDock 列出全部清单并在 dock 内滚动(#1319 方案 A) - #1391

Merged
vastsa merged 4 commits into
vastsa:mainfrom
HanawaBanana:feat/todo-dock-full-list
Oct 5, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
HanawaBanana:feat/todo-dock-full-list

Conversation

@HanawaBanana

Copy link
Copy Markdown
Contributor

摘要

实现 #1319 的方案 A:展开后的 TodoDock 列出全部条目,列表在 dock 内按上限滚动,不再截断成一行静态的「还有 N 项」。同时按维护者在 #1336 里指出的要求,补齐这个行为所需的三处契约更新(ADR 0312、component spec §11.3a、E2E-CHAT-session-todo-checklist 场景及其 Electron 探针)。

关于 #1336(@yexisu):那条 PR 提的是同一方案,改动方向与本 PR 一致;维护者按临时外部 PR 类型政策关闭了它(不是质量原因),并指出该行为若要推进需要一次被授权的契约更新。本 PR 由维护者授权的定向贡献者提交,除同样的行为改动外,还包含那份契约更新与探针更新,并保留了 #1336 里那条「去掉静态溢出行」的判断。

分支 feat/todo-dock-full-list,rebase 到 origin/main 675c4aa28(pnpm check:pr-base 通过),1 个提交。

refs #1319(该 issue 是请维护者确认方案的请求;方案 A 落地后是否关闭由你们决定)

改动

组件 / 样式

  • TodoDock.tsx:去掉 VISIBLE_LIMIT 与 slice,展开时渲染全部条目;删除「还有 N 项」行;列表在展开时成为滚动容器,且只有展开时可被键盘聚焦(tabindex 展开 0 / 收起 -1,收起时内容仍是 aria-hidden)。
  • composer.css:展开列表 max-height: min(280px, 30dvh) + overflow-y: auto + overscroll-behavior: contain(滚到底不会带动背后的对话),删除 .todo-dock-more,并给滚动容器加了内缩 2px 的 :focus-visible 焦点环(外扩会被承载折叠动画的 clip 层裁掉)。
  • 收起态、头部文案与进度、状态样式、动画时长、「收起只占标题行高度」这些既有约束全部不变。

i18n

  • 9 种语言删除已无引用的 chat.todo.more。

测试 / 探针

  • todo-dock-rendering.test.mjs:断言 12 条全部渲染、无 more items 文案、收起时列表 tabindex="-1";新增 CSS 契约断言(滚动上限、overflow-y: auto、overscroll-behavior: contain、焦点环),并断言 .todo-dock-more 样式已删除。
  • scripts/e2e/todo-checklist.tsx:展开后断言 10 条全部渲染、列表是滚动容器、scrollHeight > clientHeight、高度有界(≤280)、overscroll-behavior 为 contain、可键盘聚焦、无溢出行、dock 整体高度有界。

文档

  • ADR 0312:决策段与验证段改为「完整清单 + dock 内滚动」。
  • component spec §11.3a(中英):展开列出全部条目、滚动上限与 overscroll 约束、仅在展开时可键盘聚焦。
  • E2E 计划(中英):步骤补「展开一个超过上限的清单,确认全部渲染且列表在 dock 内滚动」,预期补「以自身为滚动容器」,自动化说明补「全量渲染 + dock 内滚动」。

取舍(如与你们预期不同,我按你们说的改)

  1. 「还有 N 项」行按方案 A 的前提删除(issue 正文里也是这个前提)。
  2. 滚动上限取 min(280px, 30dvh):与仓库既有的 min(212px, 30dvh) 写法一致,矮窗口下更矮,避免挤压输入框。
  3. 展开时让滚动容器可键盘聚焦:不加 tabindex 的话键盘用户无法滚动这个区域;收起时设为 -1,避免 aria-hidden 内存在可聚焦元素。这是随「列表变成滚动区」而来的行为新增,不接受可以去掉。

验证

候选基于 origin/main 675c4aa28(已 rebase,pnpm check:pr-base 通过):

  • pnpm build:js、pnpm lint(biome + 样式令牌)、pnpm -r --if-present typecheck、pnpm docs:check(555 页)
  • pnpm --filter @pi-desktop/desktop test — 3489 通过
  • pnpm --filter @pi-desktop/i18n test — 29 通过
  • pnpm test:e2e:todos — 真实 Host/SQLite + 生产渲染器 + 生产 Agent 的 ToolSearch/TodoWrite 路径,仅替换外部模型流;新增断言随该探针一起通过:
TODO_CHECKLIST {"ok":true,"checks":["collapsed-dock-reserves-no-blank-height",
"agent-prompt-tool-discovery-host-write-event-dock-expand-full-scrolling-list",
"agent-501-unicode-truncation-warning-single-active","session-switch-isolation",
"complete-cancel-clear-stale-event","sqlite-host-restart-cached-snapshot-recovery",
"initial-read-failure-ready-recovery"],"normalization":{"unicodeScalars":500,
"activeItems":1,"truncationWarning":true,"demotionWarning":true},"host":"real-stdio-sqlite",
"agent":"production-runtime-tool-search-todo-write","renderer":"production-todo-dock-api-store"}

另外我用同一个探针在真实 Electron 窗口里截了两张图核对观感(展开态顶部 / 滚到底部,1000×688,两张内容不同说明滚动确实生效);需要的话我贴到这条 PR 里。

已知问题

  1. 本机 cargo clippy 不可用;本次未改 Rust,cargo test -p host-core 由 CI 覆盖。
  2. 滚动上限的数值(280px / 30dvh)是按现有惯例取的,不是设计稿给定的数字。

AI 辅助说明

本 PR 的实现、文档与验证由 AI 编码代理协助完成:模型 deepseek-v4.1-flash,思考程度 max。上面的命令与探针结果都在本地实际执行过。

The expanded dock truncated to the first eight rows behind a static,
non-clickable "N more" line, so every item past the eighth was unreadable
anywhere but the raw JSON tool card (issue vastsa#1319, proposal A). The expanded
dock now renders every ordered row and scrolls inside its own box, which
keeps the Composer's footprint and stops a wheel gesture at the end of the
list from scrolling the transcript behind it. The scrollport is keyboard
reachable only while the disclosure is open, and the now-unused
`chat.todo.more` key is dropped from all nine locales.

This amends the contracts that capped the dock at eight rows: ADR 0312,
component spec §11.3a (en + zh), and the E2E-CHAT-session-todo-checklist
scenario (en + zh) with its Electron probe, which now asserts full-list
rendering, the internal scroll bound, and the absence of the overflow line.

refs vastsa#1319
@HanawaBanana
HanawaBanana force-pushed the feat/todo-dock-full-list branch from 7557b09 to d3b68df Compare October 4, 2026 09:42
vastsa added 3 commits October 5, 2026 08:00
The TodoDock contract update left a repeated phrase in the component spec.\nRemove the duplicate so the revised behavior reads cleanly in the landing diff.
@vastsa
vastsa merged commit 10e824e into vastsa:main Oct 5, 2026
4 checks passed
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.

2 participants