Files
mnote/bugs/04-tree-domain/done/4-52-resource-lifecycle-retired-bridge-artifact-regression-v1.md
T
lix-2026 1882db7681 收口 MNote P0 P1 P2 审查尾项
- 归档 OnlyOffice live bridge、Page AI、mindmap、design governance 与相关 bug 条目
- 补齐 MinerU OCR 后端 runtime 合同与 smoke/test 基线
- 收口 ChatOnly/Doubao、ObjectIdentity、Page Aggregate compat 与 runtime owner 文档口径

验证:
- cargo test --manifest-path rust/Cargo.toml -p mnote-web local_ocr -- --test-threads=1
- cargo test --manifest-path rust/Cargo.toml -p mnote-web onlyoffice_bridge -- --test-threads=1
- git diff --check
- git diff --cached --check
- codegraph index . --force && codegraph status .
- codegraph sync . && codegraph status .
2026-06-01 09:29:12 +08:00

49 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 4-52 resource lifecycle 兼容路径在 Convex 退役后丢失 artifact / 拒绝 mindmap lifecycle
## 状态
- 状态:done
- Owner04-tree-domain / bridge-runtime / resource lifecycle command
- 发现时间:2026-06-01
- 修复时间:2026-06-01
## 现象
执行 `cargo test -p mnote-web mindmap -- --test-threads=1` 时,mindmap 相关宽测曾失败:
- `mindmap_put_derives_workspace_and_returns_tree_artifacts`
- `mindmap_command_apply_returns_object_artifacts_without_tree_resync`
- `mindmap_delete_restore_keeps_markdown_reference_out_of_lifecycle_command`
- `mindmap_trash_routes_delete_restore_purge_and_empty`
- `sidebar_runtime_routes_local_mindmap_and_office_assets`
前两个失败是 `execute_retired_command_plan_with_artifacts()` 在 Convex 退役后仍能执行 fixture mutation,但把 Rust artifact plan 置为 `None`,导致调用方拿不到 `commandLog` / `domainEvent`
后两个失败是 `tree.resource.archive/restore/purge/rename` 在 bridge-runtime 生成 resource-kind 专用函数名前,会先经过 `build_write_request()`;旧 `legacy_command_function_name()` 没有这些正式 tree resource command 名,导致 mindmap lifecycle 被 `retired_bridge_error()` 拒绝。
最后一个失败是 runtime 拆分后,OnlyOffice local open 逻辑已迁到 `sidebar-filetree-open-runtime.js`,但 Rust include 断言仍检查旧 `sidebar-tree-runtime.js` 字符串。
## 根因
- Convex 退役后,artifact 持久化不能再作为兼容路径成功条件;Rust artifact plan 应继续返回给调用方和 realtime consumer。
- resource lifecycle command 的正式命名已从表面 compat alias 收口到 `tree.resource.*`,但旧 Convex 兼容映射表未允许这些名称通过前置 request 构造。
- browser runtime 模块拆分后,测试断言没有同步到新的 canonical owner 文件。
## 修复
- `rust/crates/mnote-web/src/transport/convex.rs`
- `persist_runtime_command_artifacts()` 在 Convex 退役路径改为 no-op 成功。
- `execute_retired_command_plan_with_artifacts()` 重新构造并返回 `RuntimeCommandArtifactPlan`,不重新启用 Convex artifact 持久化。
- `rust/crates/bridge-runtime/src/lib.rs`
- `legacy_command_function_name()` 允许 `tree.resource.archive/restore/purge/rename` 通过前置 request 构造;最终函数名仍由 resource lifecycle plan 按资源类型分流。
- `rust/crates/mnote-web/src/ssr/pages/layout.rs`
- OnlyOffice local open 断言改查 `SIDEBAR_FILETREE_OPEN_RUNTIME_JS`
- `rust/crates/mnote-web/src/routes/resource_trash.rs`
- `delete_json()` test helper 在状态码失败时输出 body,便于后续定位真实错误码。
## 验证
- `cargo test -p mnote-web mindmap -- --test-threads=1`
结果:26 个 mindmap 相关测试全部通过。