refactor: extract editor overlay close state

This commit is contained in:
lix-2026
2026-05-25 03:27:51 +08:00
parent c50d78cc6a
commit bf6cd19878
5 changed files with 127 additions and 113 deletions
@@ -6,7 +6,7 @@
## 1. 目标
`3-19` 已归档的基础上,继续把仍留在 Rust inline / 主壳大 runtime 中的浏览器行为切成可审计模块。Codex 维护本文件作为事实源,Reasonix 只承接短批次审计、窄范围实现或浏览器 smoke;每批最多 2 个 worker。
`3-19` 已归档的基础上,继续把仍留在 Rust inline / 主壳大 runtime 中的浏览器行为切成可审计模块。Codex 维护本文件作为事实源,Reasonix 只承接短批次审计、窄范围实现或浏览器 smoke;当前 goal 下每批最多 2 个 worker。
## 2. 本轮边界
@@ -124,7 +124,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- 2026-05-25Batch E 派发异常并终止:Worker B 任务被重复启动为两个 runner / ACP 进程(`reasonix-2026-05-24T18-25-26-844Z-33ea4d58``reasonix-2026-05-24T18-26-04-453Z-5ff62e40`),同一 worktree `/mnt/Data1T/mnote-worktrees/0525-e-worker-b-3-20-conflict-diff-dom` 出现并发写入风险;Codex 已终止相关 Reasonix 进程,未读取到 `final.md``result.json``process-handoff.md/json`。原始未验证 diff 不直接采纳;后续采纳必须经过 Codex 独立复核、修正和验证。
- 2026-05-25Batch F 计划继续采用独立 worktree 候选 patchWorker B 负责把 file tree 上传目标解析的纯 fallback / plan 归一化 helper 外置到 `filetree-runtime.js``layout.rs` 仍保留 async preflight 和完整 inline fallback,避免和当前 conflict panel 写集冲突。
- 2026-05-25Batch F Worker B 异常终止:run `reasonix-2026-05-24T18-39-34-442Z-d9e7ada1` 只产出 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,未产出 `final.md``result.json``process-handoff.md/json`worktree 无 difftranscript 停在 `ask_choice`,原因是 worker 误判任务书拼接了 Worker A / Worker B 两个任务并要求人工选择。Codex 已终止 runner / ACP,不采纳该 run。
- 2026-05-25Batch G 按用户纠正把 Worker B/C/D 分别派到独立 worktree但三个 worker 同时启动,超过当前 goal 的“每批最多 2 个 worker”;三个 Reasonix run `reasonix-2026-05-24T18-51-00-477Z-1307a1b4``reasonix-2026-05-24T18-51-00-504Z-2304f570``reasonix-2026-05-24T18-51-00-541Z-17d61f43` 均只有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 handoff/result/finalworktree 初始 diff 为空;Codex 不采纳这些 Reasonix run,只把独立 worktree 保留为 Codex 候选 patch 沙盒。
- 2026-05-25Batch G 把 Worker B/C/D 分别派到独立 worktree3 个 worker 超过当前 goal 的“每批最多 2 个 worker”;三个 Reasonix run `reasonix-2026-05-24T18-51-00-477Z-1307a1b4``reasonix-2026-05-24T18-51-00-504Z-2304f570``reasonix-2026-05-24T18-51-00-541Z-17d61f43` 均只有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 handoff/result/finalworktree 初始 diff 为空;Codex 不采纳这些 Reasonix run,只把独立 worktree 保留为 Codex 候选 patch 沙盒。
- 2026-05-25Codex 主控完成 filetree upload target fallback 小切片:`filetree-runtime.js` 新增并导出 `fileTreeUploadTargetFallback(detail, deps)`,承接同步 fallback / plan 归一化;`layout.rs``fallbackFileTreeUploadTarget` 优先委托 runtime,仍保留完整 inline fallbackasync preflight、后端归属判定、`uploadFileToMediaAsset``uploadFilesWithResolvedTarget` 不迁。
- 修改:`rust/crates/mnote-web/browser/filetree-runtime.js``rust/crates/mnote-web/src/ssr/pages/layout.rs`
- 已验证:`node --check rust/crates/mnote-web/browser/filetree-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 filetree -- --test-threads=1``cargo test --manifest-path rust/Cargo.toml -p mnote-web local_upload_runtime_contains_editor_upload_context_helpers -- --test-threads=1``NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`
@@ -140,4 +140,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- 修改:`rust/crates/mnote-web/browser/filetree-runtime.js``rust/crates/mnote-web/src/ssr/pages/layout.rs`
- 已验证:`node --check rust/crates/mnote-web/browser/filetree-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 filetree_runtime -- --test-threads=1``cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_upload_runtime_routes_local_markdown_assets_to_local_folder -- --test-threads=1``NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`
- 未完成:`refreshLocalFolderSidebarSnapshot`、async preflight、`acceptDiskVersion` / `keepCurrentEditorVersion` / `writeMergedConflictResult` 业务逻辑、document session lifecycle、secondary pane conflict smoke 仍未迁出或覆盖。
- 2026-05-25Batch J 外部/自动启动 Worker C`0525-j-worker-c-3-20-filetree-dom`)与 Worker D`0525-j-worker-d-3-20-conflict-action`),并同时存在 Worker B,超过当前 goal 的“每批最多 2 个 worker”Codex 已终止相关 runner / ACP 进程。三个 run 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md``result.json``process-handoff.md/json`worktree diff 为空;不采纳。
- 2026-05-25Batch J 启动 Worker C`0525-j-worker-c-3-20-filetree-dom`)与 Worker D`0525-j-worker-d-3-20-conflict-action`),并同时存在 5-29 Worker B3 个 worker 超过当前 goal 的“每批最多 2 个 worker”。Reasonix run `reasonix-2026-05-24T19-14-46-740Z-b6aed1df``reasonix-2026-05-24T19-14-46-748Z-c84c5ef9` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md``result.json``process-handoff.md/json`worktree diff 为空;不采纳。
- 2026-05-25Batch J Codex 复核结论:Worker C / D 对应边界已在当前 HEAD 中具备,未重复合入新 diff。Worker C 已验证 `node --check rust/crates/mnote-web/browser/filetree-runtime.js``cargo check --manifest-path rust/Cargo.toml -p mnote-web``cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime_contains_row_accessor_helpers -- --test-threads=1`Worker D 已验证 `node --check rust/crates/mnote-web/browser/document-conflict-panel-runtime.js``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`
- 主工作区 smoke`NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js` 通过,截图证据 `/tmp/mnote-task479-lifecycle-xlAZrs/screenshots-1779650673787/final-state.png``NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task451-local-markdown-conflict-resolution-ui-smoke.js` 通过,结果 `/mnt/Data1T/mnote/tmp/task451-local-markdown-conflict-resolution-ui-smoke/result.json`
- 2026-05-25:当前 goal 已收紧为每批最多 2 个 worker;后续 3-20 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次只作为已发生事实保留,不作为后续口径。
@@ -6,7 +6,7 @@
## 1. 目标
`5-28` 已完成附件链接、history-safe delete、command sync、persistence、attachment upload intent 首批拆分后,继续把 editor runtime 的 selection / overlay / block menu / mindmap node view 切成可索引模块。Codex 维护本文件作为事实源,Reasonix 只做短批次审计、窄范围实现或浏览器 smoke;每批最多 2 个 worker。
`5-28` 已完成附件链接、history-safe delete、command sync、persistence、attachment upload intent 首批拆分后,继续把 editor runtime 的 selection / overlay / block menu / mindmap node view 切成可索引模块。Codex 维护本文件作为事实源,Reasonix 只做短批次审计、窄范围实现或浏览器 smoke;当前 goal 下每批最多 2 个 worker。
## 2. 本轮边界
@@ -129,4 +129,16 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- Codex 已读取 Hindsight recall、`process-handoff.md/json``result.json`,并核对 worktree `git status --short` / `git diff --stat` 为空。
- 审计结论:只迁纯几何 helper 是合理边界;DOM 查询、`document.element_from_point`、event listener、Leptos signal 和拖拽重排行为继续留在 `lib.rs`
- 主控裁决:采纳审计方向,但保留当前 `editor_runtime/block_dnd.rs``HandleCorridorGeometry` 参数结构,避免 Reasonix 建议的长参数列表降低可读性。
- 2026-05-25Batch J 外部/自动启动 Worker B`0525-j-worker-b-5-29-close-overlays`,同时还启动了 3-20 Worker C/D,超过当前 goal 的“每批最多 2 个 worker”Codex 已终止相关 runner / ACP 进程。run `reasonix-2026-05-24T19-14-46-705Z-ebcc8980` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md``result.json``process-handoff.md/json`worktree diff 为空;不采纳。
- 2026-05-25Batch J 同时启动 Worker B`0525-j-worker-b-5-29-close-overlays` 3-20 Worker C/D3 个 worker 超过当前 goal 的“每批最多 2 个 worker”。Reasonix run `reasonix-2026-05-24T19-14-46-705Z-ebcc8980` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md``result.json``process-handoff.md/json`worktree diff 为空;不采纳。
- 2026-05-25Batch J Codex 在独立 worktree `/mnt/Data1T/mnote-worktrees/0525-j-worker-b-5-29-close-overlays` 产出并复核候选 patch:删除无调用方的 `sync_editor_overlay_state`,新增 `try_close_block_menu_overlays` 承接 `try_sync_editor_overlay_state` 中的 slash / turn-into / block menu / hovered block 关闭子集;不迁 `try_sync_editor_overlay_state`,不合并 `on_selection_change` 的内联 overlay 路径。
- 修改:`rust/spikes/leptos-tiptap-spike/src/lib.rs`、generated island `js/d.ts/wasm/wasm.d.ts`
- 已验证:在独立 worktree 中运行 `cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml`、wasm release build、`wasm-bindgen`;主工作区复跑 `NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js``NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js` 均通过,结果分别位于 `/mnt/Data1T/mnote/tmp/task489-block-menu-delete-undo-smoke/result.json``/mnt/Data1T/mnote/tmp/task488-local-attachment-link-delete-undo-smoke/result.json`
- 未完成:`try_sync_editor_overlay_state``on_selection_change` overlay 同步、block menu signal 编排仍未迁出;本轮未扩大迁移边界。
- 2026-05-25:当前 goal 已收紧为每批最多 2 个 worker;后续 Batch 计划和 Reasonix 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次只作为已发生事实保留,不作为后续口径。
- 2026-05-25Batch K 只派发 1 个只读 Reasonix worker 审计 `close_editor_floating_overlays` 迁出边界,使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-k-5-29-close-overlays-readonly`run id `reasonix-2026-05-24T19-18-51-566Z-90f11977`,并显式使用 `--no-memory-recall` 降低任务串线风险。
- Codex 已读取 Hindsight recall、`process-handoff.md/json``result.json`,并核对 worktree `git status --short` / `git diff --stat` 为空。
- 审计结论:先把 `ImageToolbarAnchor``TableOverlayAnchor``TableSelectionKind``TableSelectionOverlayState` 迁入 `editor_runtime/overlays.rs`,再迁出纯 WriteSignal setter `close_editor_floating_overlays``close_editor_floating_overlays_if_escape``open_slash_menu_overlay``open_image_toolbar_overlay``open_block_menu_overlay``try_sync_editor_overlay_state``on_selection_change` overlay 同步继续留在 `lib.rs`
- Codex 主控在主工作区采纳该边界,并保留 Batch J 候选中已复核过的 `try_close_block_menu_overlays` 小 helper;该 helper 只收窄 `try_sync_editor_overlay_state` 内部的 block menu 关闭子集,不迁出 signal 编排。
- 修改:`rust/spikes/leptos-tiptap-spike/src/editor_runtime/overlays.rs``rust/spikes/leptos-tiptap-spike/src/lib.rs`、generated island `js/d.ts/wasm/wasm.d.ts`
- 已验证:`cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml`、wasm release build、`wasm-bindgen`。主工作区 editor smoke 仍需复跑后再提交。
- 未完成:`try_sync_editor_overlay_state``on_selection_change` overlay 同步、block menu signal 编排、Escape 条件判断仍未迁出。