Files
mnote/.codex/reasonix-tasks/2026-05-25-batch-e-worker-b-3-20-conflict-diff-dom.md
T

74 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.
# Reasonix Batch E / Worker B3-20 document conflict diff DOM helper 候选
Project root`/mnt/Data1T/mnote-worktrees/0525-e-worker-b-3-20-conflict-diff-dom`
## 目标
在独立 worktree 中产出候选 patch,把 document conflict panel 中 diff / merge 区域的纯 DOM 构建和按钮 wiring 从 `web_shell.rs` inline script 外置到 `document-conflict-panel-runtime.js``web_shell.rs` 仍负责读取磁盘版本、计算 plain text、状态切换和持久化业务逻辑。
优先新增 runtime helper
- `populateSessionConflictDiffPanel(panel, context, deps)` 或等价命名
其中 `context` 至少包含:
- `currentText`
- `diskText`
- 可选 empty 文案
`deps` 注入:
- `onUseCurrent`
- `onUseDisk`
- `onSaveMerge`
## 允许修改
- `rust/crates/mnote-web/browser/document-conflict-panel-runtime.js`
- `rust/crates/mnote-web/src/routes/web_shell.rs`
必要时只更新同文件内字符串断言测试。
## 禁止事项
- 不修改 `rust/crates/mnote-web/browser/local-upload-runtime.js``layout.rs`,避免和当前 3-20 local upload 候选冲突。
- 不修改 editor island / leptos-tiptap 代码。
- 不迁 `acceptDiskVersion``keepCurrentEditorVersion``writeMergedConflictResult``fetchLatestSessionAggregate``fetchLatestResourceSnapshot` 等业务逻辑。
- 不改变按钮 data-testid、面板结构语义、错误处理和 fallback 行为。
- 不修改 AGENTS、design、bugs 或 git 状态。
- 不提交 git。
## 实现要求
- `openConflictDiffPanel(session, panel)` 仍负责:
- 显示 loading。
- fetch 最新 session/resource snapshot。
- 计算 `latestText``sessionPlainText(session)`
- 捕获错误并显示错误。
- runtime helper 只负责在已有 `diffPanel` 中创建 current/disk/merge DOM,并绑定 use current / use disk / save merge 回调。
- runtime 不可直接访问 session fetch / persist / status 业务函数。
- inline fallback 必须完整保留;runtime 不存在时当前行为不变。
## 验收命令
```bash
node --check rust/crates/mnote-web/browser/document-conflict-panel-runtime.js
cargo fmt --manifest-path rust/Cargo.toml --all --check
cargo check --manifest-path rust/Cargo.toml -p mnote-web
cargo test --manifest-path rust/Cargo.toml -p mnote-web document_conflict_panel_runtime_contains_dom_helpers -- --test-threads=1
cargo test --manifest-path rust/Cargo.toml -p mnote-web mnote_browser_runtime_assets_are_explicitly_mounted -- --test-threads=1
```
如果能定位现有 secondary pane conflict smoke,可额外运行;不要新增大范围浏览器用例。
## 输出要求
handoff 必须列出:
- 修改文件。
- 外置 DOM helper 的职责和 deps 清单。
- fallback 是否保留。
- 验收命令和结果。
- 未覆盖风险。
- `git diff --stat`