Files
mnote/design/04-tree-domain/process/4-42-filetree-open-target-rooturi-contract-v1.md
T

1.8 KiB
Raw Blame History

4-42 FileTree Open Target RootUri Contract Checklist v1

状态:process

日期:2026-05-20

OwnerFileTree runtime open target / filetree_runtime.rs

1. 目标

补齐 P0-4 的剩余合同问题:FileTreeOpenTarget::LocalFile / Directory 已存在,但 rootUri 仍为空字符串占位。需要让 runtime 环境携带本地 root,并让 open target 输出真实 rootUri

2. 允许修改范围

  • rust/crates/mnote-web/src/tree_shell/filetree_runtime.rs
  • rust/crates/mnote-web/src/tree_shell/runtime_api.rs
  • rust/crates/mnote-web/src/routes/tree.rs
  • 相关 Rust 单测

3. 禁止事项

  • 不改变 File Tree row 的长期资源真相。
  • 不改前端打开行为。
  • 不删除旧 Asset JSON 兼容字段。

4. Checklist

  • FileTreeRuntimeEnvironment 携带可选 rootUri
  • resolve_open_targetLocalFile / Directory 使用环境中的 rootUri
  • tree shell SSR app state / runtime reduce 请求填入 local folder rootUri
  • runtime API 反序列化对缺失 rootUri 保持兼容。
  • Rust 单测覆盖 local file / directory open target 输出真实 rootUri

5. 验收

  • cargo test -p mnote-web filetree_runtime -- --test-threads=1
  • cargo test -p mnote-web runtime_api -- --test-threads=1
  • cargo test -p mnote-web tree_shell_filetree_mode_embeds_asset_state -- --test-threads=1

5.1 本轮执行记录

  • 已合入:FileTreeRuntimeEnvironment.rootUri,并在 filetree runtime open target 中用于 local file / directory。
  • 已补充:tree shell 前端 runtime 环境构造会在 local folder 模式传入 rootUri
  • 已验证:缺失 rootUri 的旧 runtime API JSON 仍可反序列化。

6. 非目标

  • 不处理 resource lifecycle。
  • 不处理 tab URL 同步。