Files
mnote/.codex/reasonix-tasks/2026-05-21-batch-g-worker-a-local-folder-tree-live-backend.md
T

2.6 KiB
Raw Blame History

Reasonix Worker ALocal Folder Tree Live 后端事件流

Project root/mnt/Data1T/mnote

你不是唯一 worker。不要回滚、覆盖或清理他人的改动;只修改本任务 ownership 范围内的文件。不要提交 git。

背景

design/01-tree-first-graph-kernel/process/1-8-mvp-post-process-execution-order-v1.md 仍未整体完成,当前阻塞在 3-3local_folder 默认路径的 Sidebar / FileTree 仍通过 startLocalFolderSidebarWatch() 轮询 /api/tree/local-folder-watch 后补拉 projection,没有进入统一 tree live consumer。

新 checklistdesign/03-rust-web/process/3-18-local-folder-tree-live-consumer-convergence-checklist-v1.md

Ownership

允许修改:

  • rust/crates/mnote-web/src/routes/local_folder_events.rs
  • rust/crates/mnote-web/src/routes/stream_support.rs
  • rust/crates/mnote-web/src/routes/mod.rs
  • 同文件测试

只读参考:

  • rust/crates/mnote-web/src/local_folder_watcher_registry.rs
  • rust/crates/mnote-web/src/routes/local_folder_source.rs
  • rust/crates/mnote-web/src/routes/kernel.rs

禁止修改:

  • rust/crates/mnote-web/src/ssr/pages/layout.rs
  • scripts/*.js
  • 其他 design 文档

目标

  1. 给 local_folder 提供 tree live 事件形状,至少支持 snapshot / resync。
  2. payload 中必须携带:
    • kind: "snapshot"kind: "resync"
    • stream: "workspace"
    • projection: "sidebar_tree"
    • sourceKind: "local_folder"
    • rootUri
    • workspaceId
    • revision
    • data.dataset.kernel_sidebar_projection
    • data.dataset.kernel_file_tree_projection
  3. 复用 LocalFolderWatcherRegistry,不要新增第二套 watcher。
  4. 如果不能可靠生成细粒度 delta,本阶段允许 watcher change 后发 resync snapshot。
  5. 不把 local_folder 变化写回 Convex command log。

建议实现

  • 可以扩展 /api/local-folder/events,让它在 query 中带 treeLive=1scope=tree 时输出 snapshot / resync 事件;保留原有 ready / change 给 web_shell 编辑器外部变更使用。
  • snapshot 可复用 load_local_folder_page_tree_snapshot(rootUri)load_local_folder_file_tree_snapshot(rootUri) 组装 dataset。
  • 事件 id 可继续使用 revision。

验收命令

cargo test --manifest-path rust/Cargo.toml -p mnote-web local_folder_events -- --test-threads=1
cargo test --manifest-path rust/Cargo.toml -p mnote-web stream_support -- --test-threads=1
git diff --check

最终回复格式

  • 修改文件列表
  • 新增/变更的 API 行为
  • 运行过的命令和结果
  • 未完成项或风险