- 统一 local-first MVP 后阶段架构口径,补充 process 执行总序和 Reasonix 协作记录 - 归档已完成的 design checklist,标注参考型 process,更新 AGENTS/REASONIX/架构文档 - 补充文件树/主编辑器下载与上下文菜单相关实现、bug 记录和 smoke 脚本 验证:git diff --check;codegraph sync .;cargo test -p mnote-web;node --check scripts/task476-filetree-editor-context-menu-download-smoke.js
57 lines
2.7 KiB
Markdown
57 lines
2.7 KiB
Markdown
# 4-39 FileTree Open Target 与 Resource Identity Checklist v1
|
||
|
||
> 状态:done
|
||
>
|
||
> 归档说明(2026-05-21):FileTree open target 与 resource identity 合同已完成;`rootUri` 收尾由 `4-42` 覆盖并已归档。
|
||
>
|
||
> 日期:2026-05-20
|
||
>
|
||
> Owner:File Tree runtime / open target 合同
|
||
|
||
## 1. 目标
|
||
|
||
补齐 P0-4:扩展 `FileTreeOpenTarget` 和 runtime API,使 File Tree 能稳定表达 local raw file、directory、asset folder、office/image/pdf/code/mindmap/table 等资源身份,而不是只靠 UI 侧字符串分流。
|
||
|
||
## 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/crates/mnote-web/src/routes/local_folder_source.rs`
|
||
- 相关 Rust 单测
|
||
|
||
## 3. 禁止事项
|
||
|
||
- 不改前端打开 UI 大流程;只输出更稳定的 open target / intent 合同。
|
||
- 不做 resource lifecycle delete/restore/purge cutover;该项由 4-40 处理。
|
||
- 不引入新的树真相层,Resource Tree / File Tree / Page Tree 口径保持不变。
|
||
|
||
## 4. Checklist
|
||
|
||
- [x] 扩展 `FileTreeOpenTarget` 或新增字段,能表达 `local_file`、`directory`、`asset_folder`、`office`、`image`、`pdf`、`code/text`、`mindmap`、`table`。
|
||
- [x] open target 包含 canonical resource identity、resource kind、relative path、document id / parent id(若有)。
|
||
- [x] `parse_open_target_from_row` 支持现有 row dataset,不破坏 document/index/asset-folder/asset。
|
||
- [x] runtime API 序列化保持 camelCase,旧字段兼容。
|
||
- [x] Rust 单测覆盖 local raw file、directory、office/image/pdf/code/mindmap/table open target。
|
||
|
||
## 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`
|
||
|
||
## 6. 本轮执行记录
|
||
|
||
- 已完成:
|
||
- `FileTreeOpenTarget::Asset` 已补可选 `resourceKind`,并新增 `LocalFile` / `Directory` variant。
|
||
- `resolve_open_target` 支持 `local-file` / `directory` / `office` / `image` / `pdf` / `code` / `text` / `mindmap` / `table` row kind。
|
||
- 新增序列化合同测试,覆盖 resource kind、local file 中文路径、directory。
|
||
- 未完成:
|
||
- 后续仍需把更多上游 row dataset 补齐真实 `rootUri`,当前 `LocalFile` / `Directory` variant 的 rootUri 仍为空字符串占位。
|
||
- 风险:`FileTreeOpenTarget` schema 已扩展,需保留旧 `Asset` JSON 兼容;当前 `resourceKind=None` 时不序列化。
|
||
|
||
## 7. 非目标
|
||
|
||
- 不改变资源实际打开方式。
|
||
- 不处理 OnlyOffice 回源。
|