refactor: extract dnd target and sidebar helpers

This commit is contained in:
lix-2026
2026-05-25 04:16:35 +08:00
parent 32adfb38a1
commit 1e097a9597
9 changed files with 201 additions and 57 deletions
@@ -154,3 +154,12 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- Worker C`filetree-runtime.js` 新增并导出 `readProjection``readSidebarDataset``readDatasetProjection``projectionItems``hasProjectionItems``nodeIdOf``rowIdOf``parentIdOf``titleOf``fileWorkspaceRelativePath``groupRowsByParent``layout.rs` 对应 inline fallback 优先委托 `fileTreeRuntimeFunction(...)`,未迁 `refreshLocalFolderSidebarSnapshot` / `startLocalFolderSidebarWatch` / fetch / post-render shell 副作用 / HTML renderer。
- Worker D`task435-local-folder-watch-no-reload-smoke.js` 新增 `waitForLocalFolderWatchProjectionApplied`,每个外部文件变化步骤前清理旧标记,步骤内显式等待 `data-mnote-local-folder-watch-applied="projection"`,未放宽 no-reload 断言;Codex 同步把初始 `Stable Page` 等待修正为当前 file tree 标题 `stable`
- 已验证:`node --check rust/crates/mnote-web/browser/filetree-runtime.js``node --check scripts/task435-local-folder-watch-no-reload-smoke.js``cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/Cargo.toml -p mnote-web``cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime_contains_row_accessor_helpers -- --test-threads=1``cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_filetree_runtime_helpers_are_externalized_with_inline_fallback -- --test-threads=1``cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_tree_runtime_polls_local_folder_without_browser_reload -- --test-threads=1``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task435-local-folder-watch-no-reload-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`
- 2026-05-25Batch O Worker C 使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-o-worker-c-3-20-replace-sidebar-helper`Codex 已读取 subagent handoff、worktree diff 和验证证据,并选择性移植。
- 修改:`filetree-runtime.js` 新增并导出 `replaceSidebarTreeFromDocument(nextDocument, rootId)``layout.rs` 的 inline fallback 优先委托 `fileTreeRuntimeFunction('replaceSidebarTreeFromDocument')`,仍保留 `innerHTML` 和 attribute copy fallback。
- 未迁:`refreshLocalFolderSidebarSnapshot`、fetch URL 构造、watcher、副作用和 HTML renderer。
- Worker 验证:`node --check rust/crates/mnote-web/browser/filetree-runtime.js``cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/Cargo.toml -p mnote-web``cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime -- --test-threads=1` 通过。
- Codex 主控验证:`node --check rust/crates/mnote-web/browser/filetree-runtime.js``cargo check --manifest-path rust/Cargo.toml -p mnote-web``cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime -- --test-threads=1``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task435-local-folder-watch-no-reload-smoke.js`
- 2026-05-25Batch O Worker D 使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-o-worker-d-3-20-live-smoke-assertions`Codex 已读取 subagent handoff、worktree diff 和验证证据,并选择性移植。
- 修改:`task487-local-folder-tree-live-consumer-smoke.js` 保持 RED smoke 退出 0 语义,增加 staged DOM 状态、PageTree/FileTree 外部创建/删除后的目标节点证据、navigation evidence 和更多截图路径。
- Worker 验证:`node --check scripts/task487-local-folder-tree-live-consumer-smoke.js`、限定 `git diff --check` 通过;因当时 3000 未启动,未运行真实浏览器 smoke。
- Codex 主控验证:`node --check scripts/task487-local-folder-tree-live-consumer-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task487-local-folder-tree-live-consumer-smoke.js`。结果仍为 RED`transport=local-folder-events`、PageTree/FileTree 外部变更阶段 `navigationEvents=0`,但 `treeLiveApplied` 仍为空,说明 live consumer 证据仍未收敛到 snapshot/resync。