feat(mcp): notes 档案分片双写 + backfill 自愈(可拆除性修复) #5

Merged
lanrtop merged 2 commits from feat/governance-feedback-loop into master 2026-09-11 21:26:21 +08:00
Owner

摘要

修复可拆除性唯一硬违规:project_notes(复盘笔记 + 使者回传,飞轮全部原料)只活在 SQLite。现 append_project_note 双写到各项目 .blueprint/notes-archive.jsonl(JSONL 可重放重建 DB = 重生配方),新增 MCP 工具 backfill_notes_archive 全量重建自愈。

设计决策

  • 归宿翻转(辩证声明):原卡「炼境仓库集中档案」→ 按项目分片。理由:安装态进程无法可靠定位炼境仓库;可拆除性按项目成立;子项目会话(含 DSH)文件直读自家档案;usage.json 先例本就 per-project。
  • 双写失败不回滚(DB 事实源),log_event warn + backfill 自愈。
  • 死登记(空/相对路径)跳过并报告,复用 validate_registered_pathproject_root 重构出 DI 版 project_root_with_conn

自验

  • cargo test 110 全绿,新增 3:双写行与 DB 匹配(含换行/中文转义)/回填幂等 + 死登记跳过(空路径不写 cwd,2026-07-15 同款场景回归)/8 线程并发追加无交错。
  • 契约检查:project-context.yaml 只指文件不抄清单,无需同步;工具清单以 tools_list_result 为准(已含新工具 + schema 断言测试覆盖)。

没验什么

  • MCP 实调待重建安装后终验:append 双写与 backfill 对存量 78+ 条真实笔记的落盘,需新二进制运行时执行(与 onboarding U1 批量模式同状态)。
  • WSL 项目分片路径(UNC 转换)仅复用既有 project_root 逻辑,未真机验 WSL 项目写入。
  • 各子项目收到 notes-archive.jsonl 后的 git 提交节奏未约定(沿 usage.json 惯例:出现在工作区由各项目会话 chore 收编)。

🤖 Generated with Claude Code

## 摘要 修复可拆除性唯一硬违规:`project_notes`(复盘笔记 + 使者回传,飞轮全部原料)只活在 SQLite。现 `append_project_note` 双写到**各项目** `.blueprint/notes-archive.jsonl`(JSONL 可重放重建 DB = 重生配方),新增 MCP 工具 `backfill_notes_archive` 全量重建自愈。 ## 设计决策 - **归宿翻转(辩证声明)**:原卡「炼境仓库集中档案」→ 按项目分片。理由:安装态进程无法可靠定位炼境仓库;可拆除性按项目成立;子项目会话(含 DSH)文件直读自家档案;usage.json 先例本就 per-project。 - 双写失败不回滚(DB 事实源),log_event warn + backfill 自愈。 - 死登记(空/相对路径)跳过并报告,复用 `validate_registered_path`;`project_root` 重构出 DI 版 `project_root_with_conn`。 ## 自验 - cargo test **110 全绿**,新增 3:双写行与 DB 匹配(含换行/中文转义)/回填幂等 + 死登记跳过(空路径不写 cwd,2026-07-15 同款场景回归)/8 线程并发追加无交错。 - 契约检查:project-context.yaml 只指文件不抄清单,无需同步;工具清单以 tools_list_result 为准(已含新工具 + schema 断言测试覆盖)。 ## 没验什么 - **MCP 实调待重建安装后终验**:append 双写与 backfill 对存量 78+ 条真实笔记的落盘,需新二进制运行时执行(与 onboarding U1 批量模式同状态)。 - WSL 项目分片路径(UNC 转换)仅复用既有 project_root 逻辑,未真机验 WSL 项目写入。 - 各子项目收到 notes-archive.jsonl 后的 git 提交节奏未约定(沿 usage.json 惯例:出现在工作区由各项目会话 chore 收编)。 🤖 Generated with [Claude Code](https://claude.com/claude-code)
lanrtop added 2 commits 2026-09-11 21:23:29 +08:00
project_notes 是全系统唯一不在 git 的原创资产(可拆除性唯一硬违规)。
append_project_note 现双写到项目 .blueprint/notes-archive.jsonl(JSONL 可重放
重建 DB=重生配方);双写失败不回滚仅记日志,backfill_notes_archive 全量重建自愈。
归宿按项目分片(辩证翻转集中式设计,理由见蓝图卡留痕)。
死登记路径复用 validate_registered_path 防护;project_root 重构出 DI 版。
cargo test 110 全绿(新增 3:双写匹配/回填幂等+死登记跳过/并发不交错)。

Feature-Confirmed: true
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
chore(blueprint): notes 档案卡收官——归宿翻转声明 + 验收留痕
All checks were successful
Push & PR Check / check (push) Successful in 1m10s
Push & PR Check / check (pull_request) Successful in 55s
e345cc6a90
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
lanrtop merged commit fb96865c11 into master 2026-09-11 21:26:21 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lanrtop/dev-manager-tauri#5
No description provided.