refactor: remove dead selection bridge helpers

This commit is contained in:
lix-2026
2026-05-25 05:48:26 +08:00
parent ec27e08e8b
commit 7c6392becd
3 changed files with 9 additions and 115 deletions
@@ -198,3 +198,12 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- 修改:`rust/spikes/leptos-tiptap-spike/src/editor_runtime/dom_selection.rs``rust/spikes/leptos-tiptap-spike/src/lib.rs` - 修改:`rust/spikes/leptos-tiptap-spike/src/editor_runtime/dom_selection.rs``rust/spikes/leptos-tiptap-spike/src/lib.rs`
- 已验证:`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``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js` - 已验证:`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``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`
- 未迁/未删:`send_selection_state_to_target`、selection event dispatch、`send_selection_state``selection_event_payload``runtime_state_payload``runtime_status_payload` 等未使用 bridge/helper 函数;死代码清理后续单独切片处理。 - 未迁/未删:`send_selection_state_to_target`、selection event dispatch、`send_selection_state``selection_event_payload``runtime_state_payload``runtime_status_payload` 等未使用 bridge/helper 函数;死代码清理后续单独切片处理。
- 2026-05-25Batch W 只派发 1 个只读 Reasonix worker 审计 selection / bridge 死代码清理边界,使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-w-worker-a-5-29-selection-deadcode-readonly`run id `reasonix-2026-05-24T21-36-28-065Z-75d6e2e8`,并显式使用 `--no-memory-recall`
- Codex 已读取 Hindsight recall、`process-handoff.md/json``result.json`,并核对 worktree `git status --short` / `git diff --stat` 为空;Reasonix 未修改源码。
- 同批补派 Worker B/C/D 三个独立实现 worktree,合计 4 个 worker,未超过当前 goal 上限;三个实现 run 均只有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,没有 `final.md``result.json``process-handoff.md/json`,且 worktree diff 为空,按采纳规则全部拒收。
- 审计结论经 Codex 复核后采纳:删除无调用方私有函数 `send_selection_state``selection_event_payload``dispatch_bridge_event``current_runtime_block_info``current_runtime_block_info_from_hovered``runtime_state_payload``runtime_status_payload`
- 保留:`send_selection_state_to_target``dispatch_selection_event_to_target``current_block_info_from_index``state_payload``status_payload`,原因是仍有真实调用方或作为当前替代链路使用。
- Codex 随后在独立 worktree `/mnt/Data1T/mnote-worktrees/0525-w-worker-b-5-29-selection-deadcode-impl` 基于 W 审计结论产出候选 patch,验证后再选择性合入主工作区;没有在主工作区直接试改实现。
- 修改:`rust/spikes/leptos-tiptap-spike/src/lib.rs`、generated island wasm。
- 当前执行约束同步修正:`3-20` / `5-29` checklist 均保持“当前 goal 下每批最多 4 个 worker”。
- 已验证:`git diff --check``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``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js``MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3001 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js``codegraph sync .``codegraph status .`
-115
View File
@@ -3529,34 +3529,6 @@ fn runtime_event_target() -> Option<EventTarget> {
.map(|body| body.into()) .map(|body| body.into())
} }
fn current_runtime_block_info() -> CurrentBlockInfo {
hovered_block_from_selection()
.and_then(|block| {
Some(CurrentBlockInfo {
index: Some(block.index),
block_id: runtime_block_id_from_index(block.index),
})
})
.unwrap_or(CurrentBlockInfo {
index: None,
block_id: None,
})
}
fn current_runtime_block_info_from_hovered(
hovered_block: Option<HoveredBlockState>,
) -> CurrentBlockInfo {
hovered_block
.map(|block| CurrentBlockInfo {
index: Some(block.index),
block_id: runtime_block_id_from_index(block.index),
})
.unwrap_or(CurrentBlockInfo {
index: None,
block_id: None,
})
}
fn editor_block_by_id(block_id: &str) -> Option<Element> { fn editor_block_by_id(block_id: &str) -> Option<Element> {
find_mnote_block_anchor(block_id) find_mnote_block_anchor(block_id)
} }
@@ -4826,81 +4798,6 @@ fn current_workspace_id() -> Option<String> {
current_query_param("workspaceId") current_query_param("workspaceId")
} }
fn selection_event_payload(
selection: &TiptapSelectionState,
editor_focused: bool,
hovered_block: Option<HoveredBlockState>,
) -> SelectionPayload {
SelectionPayload {
selection: selection.clone(),
summary: selection_summary(selection),
editor_focused,
current_block_index: hovered_block.as_ref().map(|block| block.index),
current_block_id: hovered_block.and_then(|block| runtime_block_id_from_index(block.index)),
}
}
fn runtime_state_payload(
document_id: Option<String>,
workspace_id: Option<String>,
title: String,
dirty_count: u32,
hovered_block: Option<HoveredBlockState>,
editor_focused: bool,
slash_open: bool,
turn_into_open: bool,
color_menu_open: bool,
more_menu_open: bool,
read_only: bool,
) -> StatePayload {
StatePayload {
document_id,
workspace_id,
title,
dirty_count,
selected_block_index: hovered_block.map(|block| block.index),
editor_focused,
slash_open,
toolbar_open: toolbar_overlay_locked(turn_into_open, color_menu_open, more_menu_open),
read_only,
}
}
fn runtime_status_payload(
document_id: Option<String>,
workspace_id: Option<String>,
title: String,
dirty_count: u32,
hovered_block: Option<HoveredBlockState>,
editor_focused: bool,
slash_open: bool,
turn_into_open: bool,
color_menu_open: bool,
more_menu_open: bool,
read_only: bool,
) -> HostStatusPayload {
let current_block_index = hovered_block.as_ref().map(|block| block.index);
HostStatusPayload {
document_id,
workspace_id,
title,
dirty_count,
selected_block_index: current_block_index,
current_block_id: current_block_index.and_then(runtime_block_id_from_index),
editor_focused,
read_only,
slash_open,
toolbar_open: toolbar_overlay_locked(turn_into_open, color_menu_open, more_menu_open),
}
}
fn dispatch_bridge_event<T>(event_name: &'static str, payload: &T)
where
T: Serialize,
{
dispatch_runtime_event(event_name, payload);
}
pub(crate) fn editor_root_element() -> Option<Element> { pub(crate) fn editor_root_element() -> Option<Element> {
window() window()
.and_then(|win| win.document()) .and_then(|win| win.document())
@@ -5952,18 +5849,6 @@ fn dispatch_runtime_state_to_target(
); );
} }
fn send_selection_state(
selection: &TiptapSelectionState,
editor_focused: bool,
current_block_index: Option<usize>,
) {
dispatch_selection_event(&selection_payload(
selection,
editor_focused,
current_block_index,
));
}
fn send_selection_state_to_target( fn send_selection_state_to_target(
target: &EventTarget, target: &EventTarget,
selection: &TiptapSelectionState, selection: &TiptapSelectionState,