Files
mnote/bugs/05-editor-mainline/done/5-21-page-body-save-rejects-invalid-editor-document-v1.md
T
lix-2026 cdff672aa5 feat: align local-first workspace direction
Document the VSCode-like local-first product shape, demote Convex to a control-plane role, and retire stale architecture drafts.

Add local workspace migration/export references plus smoke coverage for no-Convex managed workspace startup, local markdown title/body/options persistence, asset upload behavior, and Convex fixture export.

Verification: git diff --cached --check; node scripts/check-local-first-convex-guard.js --staged; node scripts/task444-convex-workspace-export-local-fixture-smoke.js; node scripts/task166-local-first-managed-workspace-no-convex-smoke.js; node scripts/task167-local-markdown-title-body-options-no-convex-smoke.js
2026-05-19 08:11:58 +08:00

1.4 KiB
Raw Blame History

5-21 [done] page.body.save 对非法 editorDocument 不能静默回退

级别

P1 / 05-editor-mainline 主线迁移缺陷。

现象

page.body.save 在保存时会同时携带 editorDocumenttiptapDocument 和 legacy content。 当 editorDocument 字段存在但结构非法时,原实现会静默回退到 tiptapDocumentcontent,把原生块快照损坏隐藏掉。

根因

normalize_save_editor_document(...) 之前只在 serde_json::from_value::<EditorBlockDocument> 成功时才使用 editorDocument,失败后会继续尝试 tiptapDocument,最后再回退 legacy content

修复

  • editorDocument 一旦存在就必须可解析。
  • editorDocument 无法反序列化时,直接返回 validation error,不再回退到 tiptapDocumentcontent
  • 现有“合法 editorDocument 优先于其他来源”语义保持不变。

验证

  • REDcargo test --manifest-path rust/Cargo.toml -p bridge-runtime documents_save_command_plan_rejects_unparseable_editor_document_instead_of_falling_back -- --nocapture
    • 旧实现失败,证明原先会静默回退。
  • GREENcargo test --manifest-path rust/Cargo.toml -p bridge-runtime documents_save_command_plan -- --nocapture
    • 12 passed。

剩余边界

这次修复只收紧非法 editorDocument 的失败语义,不改变合法 editorDocument / tiptapDocument 的既有优先级顺序。