Phase A — EditorRuntimeActor 内存缓存层 - 新增 editor_actor.rs: EditorBlockDocument 内存态 + apply_command + load_or_init - block.rs 四个写工具(replace/insert/delete/move)接入 actor 路径 - editor_actor feature flag(MNOTE_WEB_ENABLE_EDITOR_ACTOR=true 默认开启) - bridge-runtime 三个核心函数公开化 - rust-toolchain: 1.89 → stable(修复 spike WASM 编译阻塞) Phase B — 编辑器增量 delta channel - BlockDelta/DeltaOperation 类型 + actor.build_block_delta() - leptos-tiptap spike: mnote:editor:block-delta CustomEvent 监听 + JSON patch - DocumentAiAgentPanel: 拦截 blockDelta → window dispatchEvent - 工具响应含 blockDelta 字段供前端消费 Phase C — 事件 stream delta - broadcast channel 在 AppState/actor/SSE 三层贯通 - tree_events SSE 端点发 block.delta 事件 - 旧客户端降级兼容 环境修复 - rustc recursion_limit = 1024(修复 Leptos SSR 类型深度溢出) - run-convex-deploy.js(封装 Convex function 部署到本地后端 3210) ref: design/07-ai/process/7-13-page-block-editor-runtime-actor-v1.md
75 lines
2.8 KiB
Markdown
75 lines
2.8 KiB
Markdown
# 4-41 [done][bug] tree.node.purge commandProtocol 泄漏到 Convex validator v1
|
||
|
||
> 更新时间:2026-05-16
|
||
>
|
||
> 分类归属:
|
||
> - `04-tree-domain/done`
|
||
>
|
||
> 关联文档:
|
||
> - `/mnt/Data1T/mnote/design/10-review/process/08-kernel-architecture-next-priority-review-and-checklist.md`
|
||
> - `/mnt/Data1T/mnote/design/03-rust-web/process/3-3-rust-web-tree-realtime-event-stream-v1.md`
|
||
|
||
## 1. 问题定义
|
||
|
||
`tree.node.purge` / `documents.purge` 的 Rust execution plan 会携带 `commandProtocol` 审计字段,用于标记正式 tree command 与 compat alias 的关系。但发往 Convex legacy mutation `documents:purge` 时,这个字段不应进入 mutation args。
|
||
|
||
实际运行中,`task432-filetree-trash-page-dual-browser-no-refresh-smoke.js` 在 purge 阶段触发 Convex validator 502:
|
||
|
||
```text
|
||
ArgumentValidationError: Object contains extra field `commandProtocol` that is not in the validator.
|
||
Object: {commandProtocol: {...}, id: "..."}
|
||
Validator: v.object({id: v.string()})
|
||
```
|
||
|
||
这会阻断双浏览器 File Tree / Trash no-refresh 验收中的彻底删除阶段。
|
||
|
||
## 2. 根因
|
||
|
||
`rust/crates/bridge-runtime/src/lib.rs` 的 `documents.purge | tree.node.purge` plan 会生成:
|
||
|
||
```json
|
||
{
|
||
"id": "...",
|
||
"commandProtocol": {
|
||
"family": "tree",
|
||
"owner": "rust-runtime-kernel",
|
||
"preferredCommandName": "tree.node.purge",
|
||
"compatCommandName": "documents.purge"
|
||
}
|
||
}
|
||
```
|
||
|
||
但 `rust/crates/mnote-web/src/transport/convex.rs` 的 `convex_command_args_for_plan` 只对 create / rename / archive / restore / move 等命令调用 `strip_tree_artifact_fields`,漏掉了 `tree.node.purge` 与 `documents.purge`。
|
||
|
||
## 3. 修复
|
||
|
||
`rust/crates/mnote-web/src/transport/convex.rs` 已将以下命令加入 legacy mutation artifact 剥离名单:
|
||
|
||
- `tree.node.purge`
|
||
- `documents.purge`
|
||
|
||
新增回归测试:
|
||
|
||
- `convex_command_args_strips_tree_purge_artifacts_for_legacy_mutation`
|
||
|
||
## 4. 验证
|
||
|
||
已通过:
|
||
|
||
```bash
|
||
cargo test --manifest-path rust/Cargo.toml -p mnote-web convex_command_args_strips_tree_purge_artifacts_for_legacy_mutation -- --nocapture
|
||
cargo test --manifest-path rust/Cargo.toml -p mnote-web convex_command_args_strips_tree_archive_artifacts_for_legacy_mutation -- --nocapture
|
||
MNOTE_UI_BASE_URL=http://127.0.0.1:3000 MNOTE_AUTH_BASE_URL=http://127.0.0.1:3000 node scripts/task432-filetree-trash-page-dual-browser-no-refresh-smoke.js
|
||
```
|
||
|
||
真实 smoke 证据:
|
||
|
||
- 修复前失败:`tmp/task432-filetree-trash-page-dual-browser-no-refresh-smoke/result.json` 曾记录 `documents:purge` 因 `commandProtocol` 额外字段返回 502。
|
||
- 修复后通过:`tmp/tree-live-cache-smoke/20260516-task432/result.json`,`ok=true`,覆盖 create / archive / restore / purge / empty trash 在 B 端 File Tree 与 Trash 无刷新同步。
|
||
|
||
## 5. 状态
|
||
|
||
当前状态:`done`
|
||
|
||
该缺陷已在真实代码中修复,并通过单测与真实 3000 双浏览器 smoke 验证。
|