refactor(desktop): remove 11 unused Tauri commands with no consumer - #2536
refactor(desktop): remove 11 unused Tauri commands with no consumer#2536zvzuola wants to merge 2 commits into
Conversation
limityan
left a comment
There was a problem hiding this comment.
复审当前 head f5b18c395a569051318f76cfaaec69d9a328db09 后,这两个问题仍需修复:
-
PR 与
1.0.0-explore当前远端 tip5d012cbddb3acfac009f21f11fa3f026c04edaec存在冲突。三方合并确认冲突路径为docs/interactive-capabilities/README.md,GitHub 也仍标记为CONFLICTING / DIRTY。该文件是生成物,请 rebase 到最新目标分支后重新运行交互能力目录生成器,确保命令数和 UI 交互统计都来自合并后的源码状态。 -
删除
initialize_snapshot和record_file_change后,SnapshotInitRequest(src/apps/desktop/src/api/snapshot_service.rs:57)、RecordFileChangeRequest(:66)和begin_snapshot_record_mutation(:440)均已没有消费者。cargo check -p bitfun-desktop成功,但明确报告begin_snapshot_record_mutation为 dead code。请一并删除这些失效 DTO、辅助函数以及随之失效的 import,完成本 PR 的孤立命令清理。
完成 rebase 和清理后,请基于新的 exact head 重新运行能力目录检查、Desktop check 和 PR CI。
f5b18c3 to
f771bb2
Compare
limityan
left a comment
There was a problem hiding this comment.
复审当前 head f771bb2a77613f040d347228f053a0e1c01fc1a8 后,上轮的 snapshot 死代码问题已经修复;当前仍有两个合并阻塞:
-
PR 与
1.0.0-explore当前远端 tipf2910919dd65dbd07b4ac4dcb32d88b7a1a4a56a存在冲突。git merge-tree确认唯一冲突路径为docs/interactive-capabilities/README.md,GitHub 当前也标记为CONFLICTING / DIRTY。请再次 rebase 并运行交互能力目录生成器。合并后的统计应保留本 PR 的 640 个 Tauri commands,同时采用最新目标分支的 365 个交互源码文件和 4423 个交互候选。 -
本 PR 从 merge-base 计算只有 11 个文件、9 行新增和 619 行删除,共 628 行,但当前包含 3 个 commits。仓库约束要求小于 3k 行的变更不得超过 2 个 commits;其中
71e72d1ac仅清理 2 行 runtime contract,f771bb2a7仅刷新生成统计,请在 rebase 时将提交压缩到不超过 2 个。
完成标准:PR 对最新目标分支无冲突,生成器检查与相关测试基于新 exact head 通过,commit 数量符合仓库约束,并重新获得最新集成 CI 结果。
Remove 11 orphaned Desktop commands together with their registrations, remote-workspace policies, implementation-only capability entries, dead snapshot DTOs/helpers, and runtime contract references. Regenerate the Tauri command map for the resulting 640-command surface.
Regenerate the interaction inventory after rebasing onto the latest target branch. The merged source now audits 640 Tauri commands and 4,393 interaction candidates across 364 UI source files.
f771bb2 to
9d8038b
Compare
Summary
移除 11 个已确认没有实际消费方的 Desktop Tauri Commands:
sync_config_to_globalinitialize_snapshotrecord_file_changeget_storage_pathsget_project_storage_pathscleanup_storagecleanup_storage_with_policyget_storage_statisticsinitialize_project_storagereload_global_configsubscribe_config_updates这些命令未被 Web UI 通过
api.invoke调用,也未作为交互能力证据或其他 Agent Tool / Core 路径的实现入口。本 PR 同步完成以下清理:
generate_handler!中移除对应命令注册。REMOTE_WORKSPACE_COMMAND_POLICIES和LEGACY_UNAUDITED_BASELINE中移除对应条目。storage_commands.rs模块。commands.rs、config_api.rs和snapshot_service.rs中的孤立命令实现。另外保留了 18 个虽然没有前端直接调用、但仍作为真实能力实现证据的命令,例如由 Agent Tool 或 Core Function 提供实际能力的命令。
Type and Areas
Type:
Refactor / maintenance
Areas:
Desktop/Tauri, remote workspace policy, interactive capabilities catalog and generated documentation
Motivation / Impact
这些命令已经没有产品入口或运行时消费方,但仍扩大 Desktop IPC API 面,并增加命令注册、远程工作区策略和能力审计的维护负担。
删除这些孤立命令可以:
No direct user-facing change. 本 PR 不修改持久化数据格式,也不需要数据迁移。
Verification
node scripts/generate-interactive-capabilities.mjs --checknode --test scripts/interactive-capabilities.test.mjsRegistration/policy consistency audit:
generate_handler!command count: 640.LEGACY_UNAUDITED_BASELINEmatches the actualLegacyUnauditedset: 278.Repository-wide reference audit:
cargo check -p bitfun-desktopsherpa-onnx-sysdependency download failed due to network access. This failure is unrelated to the changes in this PR.Remote scenarios:
RemoteCommandproduct route.Reviewer Notes
The main review point is the distinction between truly orphaned commands and commands that merely lack a direct frontend invocation.
Only commands with no frontend consumer, capability evidence, Agent Tool path, or Core Function consumer were removed. Commands that still provide implementation evidence for active capabilities were intentionally retained.
This PR was AI-assisted. Verification was focused on command registration, remote-workspace policy consistency, generated capability artifacts, and dangling-reference detection.
Checklist