dsh-brain/docs/plans/DEPARTMENT_REVERIFY.md

80 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 复验单 · 部门接线 D1+D2 FAIL 修复(给 GPT)
日期:2026-11-24
仓库:C:\Users\qyh15\dsh-brain(main,已推送)
角色:独立复验者。只检查、不修改源码、不 commit/push/tag。
前情:首轮验收(基线 accc1c3)FAIL 三项:C7 片段超预算、C8 项目部门未按工作区隔离、A5 混树。
DeepSeek 已修复,规划侧预检全绿。本次是**复验**,不是全量重验。
## 0. 基线与范围
- 复验基线:`45f1ca9`(fix(departments): count ellipsis inside the 600-char recall budget)。
- 三个修复 commit(v0.10.1 之后、本轮审查对象):
| commit | 内容 |
| --- | --- |
| cae5c08 | fix(skill-sync): bind conflict resolution to the confirmed preview snapshot |
| 22b2497 | fix(departments): bind caller workspace around every department operation |
| 45f1ca9 | fix(departments): count ellipsis inside the 600-char recall budget |
- 注意:HEAD 可能已前进(UI 规划文档 commit 89e67d0/5fef328/9fe5e49 等,纯 docs/plans)。
审查 diff 用 `git diff accc1c3..45f1ca9`;若 HEAD 更新,确认新增仅 docs/plans 或 UI 施工
(src-client/ 等),UI 施工不在本次复验范围。
- 环境:npm/node 不在 PATH 时用 bundled node + pnpm 等价命令,记 PASS(等价):
node: C:/Users/qyh15/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/node/bin/node.exe
或 C:/Users/qyh15/AppData/Local/Programs/DeepSeek Harness/resources/runtime/primary-runtime/dependencies/node/bin/node.exe
pnpm: C:/Users/qyh15/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/pnpm/bin/pnpm.mjs
## 1. 门禁(亲自重跑)
git status --porcelain # A5:必须干净(UI 施工在途则记录并区分归属)
pnpm run typecheck # B1
pnpm run build # B2:build 后 git status 仍干净(lib 已入库)
node verify-departments.mjs # B3:21 项全 PASS
node scripts/verify-all.mjs # B4:39 脚本全绿(1 环境跳过),exit 0
node verify-departments-wiring.mjs # 25 项全 PASS(原 18 + 新 7),0 SKIP
node verify-skill-sync-conflict-round5.mjs # cae5c08 配套:19 项全 PASS
## 2. C8 复验(工作区隔离)——独立探针,不复用实施者测试
写临时探针(系统 temp,import 仓库 lib/),至少断言:
1. 同一进程、两个 mkdtemp 工作区 A/B:
withWorkspace(A) 内 create({name:'X',scope:'project'}) → created=true, idA;
withWorkspace(B) 内同名 create → **created=true, idB ≠ idA**(首轮 FAIL 点:B 曾拿到 A 的 id)。
2. A 内 remember 私有内容,B 内 recall 同 query → 0 命中。
3. 工具面:createDepartmentTools(deps) 的 department_create.execute(args, {workspace:B})
→ 注册表落 B 的 .dsh/brain/departments/registry.json(检查磁盘路径)。
4. HTTP 面:起真实 server 挂 createCoreRoutes(kernel.routeDeps()),
POST /departments/create?workspace=A 与 body workspace=B 分别建同名部门 → 两个 id。
5. 六操作全覆盖抽查:list/remember/recall/checkpoint/resume 在 withWorkspace(B) 下
不读不写 A 的目录(recall 已有 workspace 参数,其余靠包裹)。
代码核对点:src/memory/departments-tools.ts 的 inDepartmentWorkspace 助手是否包裹全部六个
execute;src/settings-ui/departments-routes.ts 各分支 withWorkspace(9 处);
kernel.departmentToolDeps() 是否暴露 memory 访问器。库层 src/local-memory/departments/ 必须零改动
(git diff accc1c3..45f1ca9 -- src/local-memory/departments/ 为空)。
## 3. C7 复验(600 字符预算)
1. 构造 700 字符记忆 → department_recall 工具返回 content.length **≤600**(省略号计入)。
2. HTTP GET /departments/recall → hits[].contentSnippet.length ≤600;content 全文字段允许存在
(管理页消费,裁定口径见 DEPARTMENT_ACCEPTANCE.md §8)。
3. departmentSnippet 为共享导出(departments-tools.ts export,路由 import 同一函数),
实现 slice(0, limit-1)+'…'。
4. k=99 仍 clamp 到 5(回归确认)。
## 4. cae5c08 顺带核(技能冲突线,非部门验收范围)
对照"提交前修复任务"P1 的 5 条验收用例(verify-skill-sync-conflict-round5.mjs 已扩到 19 项):
1. 有效确认 keep_local/take_cloud 跑通,断言实际远端调用/磁盘/回执;
2. 确认后远端变化 → 条件写入拒绝,expected_revision 仍是预览值;
3. 下载包完整但 revision/manifest 不同 → 过期,本地不动;
4. 确认后本地变化 → 不上传不覆盖;
5. 批量混合有效+过期 → 只有有效条目写入。
读 diff 确认 previews Map 快照机制方向正确(绑定用户确认的预览,而非新鲜列表)。
此项结论单列,不影响部门复验裁决。
## 5. 裁决与回报
- 全 PASS → "复验通过,D1+D2 最小可用闭环成立",建议用户打 tag(如 v0.10.2-dept.1,用户定)。
- 有 FAIL → 编号/证据(输出或 文件:行号)/影响/修复方向(不实施)。
- 回报末尾附亲自跑过的命令清单 + exit code。
- 首轮已 PASS 的 A1–A4/B5/C1–C6/C9–C12/D1–D7/E1–E2 不重跑,除非修复 diff 触及对应文件。