Skip to content

fix(kanban): harden board integrity and development - #243

Open
AIR-Xie wants to merge 1 commit into
mainfrom
fix/kanban-integrity
Open

AIR-Xie wants to merge 1 commit into
mainfrom
fix/kanban-integrity

Conversation

@AIR-Xie

@AIR-Xie AIR-Xie commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep board storage distinct for project paths that sanitize to the same name and recover appends after a partial JSONL tail
  • make cancellation dependency-safe, with optional dependent and child cascades exposed in the desktop UI and tool schema
  • keep delivered-file links usable after the author session is deleted by resolving them through the board project
  • stabilize Windows development by excluding Bun build artifacts from Vite watching and rejecting duplicate dev-server launches before sidecars start

Why

A follow-up audit of #242 found persistence, cancellation, file-link lifetime, and Windows development issues that could make a board lose isolation or become inconsistent.

Part of #241. Follow-up to #242.

Testing

  • bun test --randomize --seed=1 src/server/__tests__/kanban-api.test.ts src/server/__tests__/kanban-model.test.ts src/server/__tests__/kanban-service.test.ts src/tools/KanbanListTool/kanbanTools.test.ts (90 passed)
  • cd desktop && bun run lint
  • affected desktop Vitest suites (111 passed)
  • manual Windows audit: colliding project names, truncated JSONL restart, default and cascading cancellation, file access after session deletion, sidecar rebuild while Vite is running, and duplicate dev launch

Local full-suite notes: the root suite reached 2,597 passed and 26 skipped, with five Windows symlink/worktree cases blocked by EPERM; the desktop full run had two load-sensitive timeouts, and both files passed in isolation (35 tests).

@GoDiao

GoDiao commented Nov 10, 2026

Copy link
Copy Markdown
Owner

感谢跟进 #242!半行修复、交付文件改由看板读取这两项方向都对,新测试在 main 上也确实会失败。下面是 review 意见。

需要改

1. 连带取消:保留,但确认时要列出全部受影响的卡

取消时一并决定依赖和子任务怎么处理,修掉了原规则的一个漏洞:取消的一方什么都不做时,依赖它的卡会一直等一张已取消的卡。这个方向我们同意。需要补三点:

  • 列出全部卡号。 现在确认框只写「从 feat: 网站建设与文档完善 #2 开始的依赖任务链」,会话那边的确认卡片也只有「cancel open dependent cards transitively」,人看不到最终会取消哪些卡。人在看板上取消、会话取消弹出的确认卡片,都要列出这次会被取消的全部卡号,包括间接牵连的,以及会被删掉依赖的卡,由人看过再确认。
  • 列表和执行要用同一份计算。 会话那边的确认发生在 server 执行之前,所以列表要由 server 算出来,比如通过 kanban_query 查询,和 cancellationEvents 用同一段计算。这样确认时看到的就是实际会执行的。
  • 通知负责人。 依赖被自动删掉的卡,要通知它的负责人:前置卡被取消了,依赖已经删掉,这张卡现在可以开工。现在的 dependency_removed 不发任何通知。

另外,现在的默认行为会把已完成卡上的依赖也删掉,测试里 finished 的 dependsOn 被清空了。已完成卡的记录应该保持不变,只需要删未完成卡上的依赖。

2. 去掉项目路径冲突的处理

只有只差标点的两个路径(比如 repo.one 和 repo-one)才会撞名。会话目录用的也是同一个 sanitizePath,设计上就是有意保持一致的。项目还没发版,我们不为这种情况加保护。看板功能也还在 [Unreleased],用户磁盘上没有旧格式的数据,所以 projectBoardKey、findBoardKey 的旧 key 兼容分支和对应的两个测试可以一起删掉,看板 key 保持 sanitizePath(root)。

3. 判断越界的逻辑不要再写一份

kanbanService.readFile 里的 error.message.includes('outside workspace'),和 api/sessions.ts 里的 isOutsideWorkspaceError 是同一段逻辑。请挪到 workspaceService 里,两边共用。

4. CHANGELOG

看板还没发版,修的是未发布的功能。请把看板相关的内容并进 [Unreleased] 里已有的「Project board」那一条,不要单独写一条 Fixed。Windows 开发环境的修复和用户无关,不需要写进 CHANGELOG。

5. 复选框抽成组件

useReasonPrompt.tsx 里两段复选框 JSX 只差变量,可以抽成一个小组件。

6. 同步设计文档

按上面的结论更新文档:

  • docs/features/kanban/prd.zh.md:R40 改成新的取消规则。
  • docs/features/kanban/tech-design.zh.md:
    • 第 21、36 行:取消的结果和确认内容;
    • 第 287 行:半行之后追加新事件时先补换行;
    • 第 255、373 行:文件链接改由看板读取,读取范围是项目根目录。

Windows 开发环境部分

这部分放在这个 PR 里没问题,只有两个疑问:

  • desktop/.bun-cache/ 是哪一步生成的?仓库里的脚本都不会写这个目录。如果是你本机的环境变量生成的,.gitignore 和 Vite 忽略规则里的这一项就可以删掉。
  • 启动前已经用 assertDevServerAvailable 确认端口没被占用,Vite 又开了 strictPort,waitForDevServer 拿到响应后再固定等 500 毫秒检查一次,看起来是多余的。如果确实遇到过 Vite 先响应、再退出的情况,请说明一下场景;没有的话建议去掉。

小建议

中文文案里的「递归取消」「依赖任务链」偏技术用语,可以改成「连同……一起取消」这类说法。

This branch has not been deployed

No deployments
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