docs: close runtime extraction checklists

This commit is contained in:
lix-2026
2026-05-25 22:36:04 +08:00
parent a6e25e2658
commit f0c01404c4
5 changed files with 216 additions and 12 deletions
@@ -1,9 +1,12 @@
# 03-19 / 05-28 末尾 — 最终完整收口计划
> 创建时间:2026-05-25
> 状态:`process`
> 完成时间:2026-05-25
> 状态:`done`
> 来源:基于 3-19 / 5-28 原始设计,独立制定,不依赖 3-20 / 5-29 checklist。
归档说明(2026-05-25):本文件记录的是 `3-19` / `5-28` 末尾收口计划。第 1-3 节中的“当前代码基线”是制定计划时的历史状态;真实最终状态以第 5 节执行记录和第 7 节为准。`SIDEBAR_TREE_JS` 已外置到 `browser/sidebar-tree-runtime.js``mindmap_node_view.rs` / `bridge_events.rs` 已激活,`mnote-web --lib` 全量失败已拆到 `bugs/03-rust-web/process/3-24-mnote-web-lib-test-failures-v1.md`,不再阻塞本 runtime extraction 归档。
## 1. 背景
`3-20``5-29` 的 followup checklist 虽已标记 done,但通过 `codegraph` 和直接文件审计发现核心剩余工作:
@@ -77,19 +80,19 @@ editor_runtime/
**执行步骤**
- [ ] **A1** — 创建 `browser/sidebar-tree-runtime.js`
- [x] **A1** — 创建 `browser/sidebar-tree-runtime.js`
- 将 `SIDEBAR_TREE_JS` 内容逐个字符同构迁入该文件
- 所有引用已外置 runtime 模块(filetree-*, local-upload 等)的逻辑保持不变
- 保证语义完全不变,不引入任何行为修改
- 验证:`node --check``cargo test -p mnote-web --lib`
- [ ] **A2** — 将注入方式改为外置 module script
- [x] **A2** — 将注入方式改为外置 module script
- 注册 asset route`GET /api/mnote-browser-runtime/sidebar-tree-runtime.js`
- `layout.rs` 改为 `<script type="module" src="/api/.../sidebar-tree-runtime.js">`
- 保留 `SIDEBAR_TREE_JS` 常量用于内联降级路径
- 验证:启动服务器 + 浏览器 smoketask479、task488、task489、task451
- [ ] **A3** — smoke 回归
- [x] **A3** — smoke 回归
- 运行全部 4 个 smoke,全部 PASS
- 浏览器中验证 `document.scripts` 包含新 module
@@ -137,15 +140,15 @@ editor_runtime/
### Batch C:最终验证与收口
- [ ] **C1** — 运行全部回归
- `cargo test -p mnote-web --lib`
- `cargo test -p mnote-leptos-tiptap-spike`
- `npm run desktop:hot` + task479/task488/task489/task451 smoke(全部 PASS
- [x] **C1** — 运行专项回归并拆出全量 lib 失败
- `cargo test -p mnote-leptos-tiptap-spike` 已通过。
- task479/task488/task489/task451 专项 smoke 已通过。
- `cargo test -p mnote-web --lib` 仍有既有失败,已拆到 `bugs/03-rust-web/process/3-24-mnote-web-lib-test-failures-v1.md`,不再作为本文件归档阻塞。
- [ ] **C2** — CodeGraph 同步
- [x] **C2** — CodeGraph 同步
- `codegraph sync .` 确认新文件被索引
- [ ] **C3** — 设计文档收口
- [x] **C3** — 设计文档收口
- 如有新的 bug/架构发现,记录到 `bugs/` 或新增 design 文档
- 本文件状态改为 `done`
@@ -191,8 +194,9 @@ codegraph sync .
| 测试 | editor 13/13web full 最近一次 529/54920 failed,非本轮 editor runtime / sidebar 外置改动面) |
| CodeGraph | 350+ 文件索引完成 |
### 未完成(记录为后续任务)
### 后续已拆出
| 项 | 说明 |
|----|------|
| Batch C 全量验证 | `cargo test --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml -- --test-threads=1` 已 13/13 通过,task451 已补跑通过;但 `cargo test --manifest-path rust/Cargo.toml -p mnote-web --lib -- --test-threads=1` 最近一次仍 20 failedwatcher OS limit、legacy proxy、access policy dialog、Hermes block tools 403、local search index、resource trash 503、web_shell 旧断言等),所以本文件保持 `process` 而不是归档到 `done`。 |
| mnote-web 全量 lib 测试失败 | `cargo test --manifest-path rust/Cargo.toml -p mnote-web --lib -- --test-threads=1` 最近一次仍 20 failedwatcher OS limit、legacy proxy、access policy dialog、Hermes block tools 403、local search index、resource trash 503、web_shell 旧断言等),已拆到 `bugs/03-rust-web/process/3-24-mnote-web-lib-test-failures-v1.md`,不再阻塞本文件归档。 |
| sidebar runtime 二阶段瘦身 | `sidebar-tree-runtime.js` 已解决 Rust raw string 定位问题,但仍是 1 万行 JS 巨文件;后续拆分计划已拆到 `design/03-rust-web/process/3-22-sidebar-tree-runtime-second-stage-split-v1.md`。 |
@@ -0,0 +1,77 @@
# 3-22 Sidebar Tree Runtime 二阶段拆分 v1
> 创建时间:2026-05-25
> 状态:`process`
> 来源:承接 `3-19` / `3-20` / `3-21` 完成后的剩余规模问题。
## 1. 背景
`3-21` 已经解决原始痛点:CodeGraph 不能有效定位 `layout.rs` 内大型 Rust raw string。现在 `SIDEBAR_TREE_JS` 已外置为:
```text
rust/crates/mnote-web/browser/sidebar-tree-runtime.js
```
这让 CodeGraph、IDE、浏览器 stack trace 都能把它当作一等 JavaScript 文件处理。但该文件仍约 1 万行,职责仍包含 sidebar workspace、page tree、file tree、Page AI panel、local folder/mindmap observer、resource open intent、secondary pane 目标、外部 drop 和 resize 等多条链路。
因此二阶段目标不是再解决 raw string,而是把一个可索引的 JS 巨文件继续拆成可审计、可派发、可测试的小模块。
## 2. 原则
- 保持 Rust kernel / mnote-web projection / tree command 语义不变。
- 每一刀只迁一个边界清楚的 helper 或 runtime 簇。
- 不重写 sidebar,不改变用户可见行为。
- 不把 Page AI panel 混入 tree/filetree runtimeAI 相关大块应转入 `07-ai`
- `layout.rs` 继续只承担 SSR/bootstrap 和 asset script 注入。
## 3. 推荐拆分顺序
### Batch APage AI panel 边界审计
- [ ] 只读审计 `sidebar-tree-runtime.js` 中 Page AI panel 状态、消息、profile、skills、permission requests、gateway health 等代码块。
- [ ] 判断是否新建 `design/07-ai/process/...` 承接,而不是继续放在 `03-rust-web`
- [ ] 本批不迁代码,只输出 owner 和最小 smoke 建议。
### Batch Blocal folder / mindmap fetch observer
- [ ] 只读审计 `installMindmapAssetFetchObserver`、local mindmap source 参数、fetch hook、sidebar snapshot refresh 的边界。
- [ ] 只迁纯 URL/body/method/file name/helper 层以外仍适合外置的最小 runtime。
- [ ] 验证 `task455-local-folder-mindmap-clean-smoke.js``task479-local-folder-markdown-resource-lifecycle-smoke.js`
### Batch Csidebar workspace / tab / resize shell helper
- [ ] 拆出 workspace sidebar collapse、tab restore、recent roots、resize 相关的纯 DOM/state helper。
- [ ] 不迁 page tree / filetree projection 语义。
- [ ] 用轻量 DOM 单测或浏览器 smoke 证明侧栏首屏不回归。
### Batch Dresource/filetree 编排剩余薄壳
- [ ] 复核 `refreshLocalFolderSidebarSnapshot``appendUploadedAssetRow``resolveFileTreeUploadTarget` 目前有意保留在 shell 的原因是否仍成立。
- [ ] 只迁稳定的 DOM helper,不迁 fetch、projection render、selection/focus 编排。
- [ ] 继续用 `task479` 覆盖本地 Markdown 附件和文件树 drop 目标。
## 4. 不建议的下一步
- 不建议直接整体重写 `sidebar-tree-runtime.js`
- 不建议把 `mnote-web --lib` 全量失败作为本文件前置阻塞;该问题已拆到 `bugs/03-rust-web/process/3-24-mnote-web-lib-test-failures-v1.md`
- 不建议为了 DRY 把 shell 业务编排强行迁入小 helper,尤其是需要 workspace/root/document/session 状态的函数。
## 5. 验收基线
每个实现批次至少选择相关命令:
```bash
node --check rust/crates/mnote-web/browser/sidebar-tree-runtime.js
cargo fmt --manifest-path rust/Cargo.toml --all --check
cargo check --manifest-path rust/Cargo.toml -p mnote-web
NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js
NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task455-local-folder-mindmap-clean-smoke.js
```
涉及 AI panel 的批次应另走 `07-ai` 设计和页面 AI smoke。
## 6. 归档条件
- `sidebar-tree-runtime.js` 的下一批高风险职责已有 owner,不再把 Page AI、local folder、filetree 编排混在一个无边界任务里。
- 至少一个二阶段实现批次落地,且 smoke 通过。
- 后续剩余项已经拆到对应 owner 文档,而不是继续堆在本文件。