2026-05-20 20:48:18 +08:00
|
|
|
|
# 4-42 FileTree Open Target RootUri Contract Checklist v1
|
|
|
|
|
|
|
2026-05-21 09:04:13 +08:00
|
|
|
|
> 状态:done
|
|
|
|
|
|
>
|
|
|
|
|
|
> 归档说明(2026-05-21):FileTree open target `rootUri` 合同已完成,缺失 `rootUri` 的旧 payload 兼容仍保留。
|
2026-05-20 20:48:18 +08:00
|
|
|
|
>
|
|
|
|
|
|
> 日期:2026-05-20
|
|
|
|
|
|
>
|
|
|
|
|
|
> Owner:FileTree 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
|
|
|
|
|
|
|
|
|
|
|
|
- [x] `FileTreeRuntimeEnvironment` 携带可选 `rootUri`。
|
|
|
|
|
|
- [x] `resolve_open_target` 对 `LocalFile` / `Directory` 使用环境中的 `rootUri`。
|
|
|
|
|
|
- [x] tree shell SSR app state / runtime reduce 请求填入 local folder `rootUri`。
|
|
|
|
|
|
- [x] runtime API 反序列化对缺失 `rootUri` 保持兼容。
|
|
|
|
|
|
- [x] Rust 单测覆盖 local file / directory open target 输出真实 `rootUri`。
|
|
|
|
|
|
|
|
|
|
|
|
## 5. 验收
|
|
|
|
|
|
|
|
|
|
|
|
- [x] `cargo test -p mnote-web filetree_runtime -- --test-threads=1`
|
|
|
|
|
|
- [x] `cargo test -p mnote-web runtime_api -- --test-threads=1`
|
|
|
|
|
|
- [x] `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 同步。
|