chore(tauri-commands): remove the last 18 unreachable registrations - #1179
Merged
Conversation
Chloe-JY
force-pushed
the
chore/dead-command-registrations
branch
from
September 1, 2026 06:33
65cd4e2 to
3078289
Compare
Of the 145 registered Tauri commands with no frontend caller, 18 must not be deleted outright. 15 are invoked as plain Rust functions — the 9 `internal_browser_*` calls plus `list_internal_browser_targets` and `get_active_internal_browser_state` that make up the agent's browser-control tool, plus `cli_agent_run`, `get_webview_cookies`, `get_watch_status`, and `convert_patch_to_unified`. Deleting them would break agent web control and CLI session startup. Their registration and `#[tauri::command]` attribute are dropped; the functions stay. None takes `tauri::State`, so the attribute is signature-neutral. 3 are reached only by their own tests — `get_git_repo_info`, `calculate_ahead_behind`, `compute_diff_with_hunks`. Those are deleted with their 11 tests, which orphaned `diff_patch/structured.rs` (305 lines, one consumer), the `bundle.rs` helpers `has_uncommitted_changes`, `get_current_branch`, `get_head_sha` and `count_commits`, and the `GitRepoInfo` / `AheadBehindStatus` DTOs they returned. Invariant: an entry in handler_list.inc means the frontend can call it.
Chloe-JY
force-pushed
the
chore/dead-command-registrations
branch
from
September 1, 2026 08:02
3078289 to
8c2358c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A sweep of the 1,019 entries in
src-tauri/src/commands/handler_list.incfound145 commands with no caller in
src/,tests/, orsrc-tauri/capabilities/.Most are simply dead and are removed elsewhere. 18 are not, and each needs a
different fix than deletion:
15 have no frontend caller but are called from Rust. Registering them is
what is dead, not the code:
internal_browser_get_state/_click/_input/_select/_scroll/_show_mask/_hide_mask/_clean_up/_is_ready(9)agent-coretools/impls/web/control_internal_browser.rslist_internal_browser_targetsresolve_ready_target/execute_listget_active_internal_browser_statelist_internal_browser_targetscli_agent_runagent_sessions::cli::agent_core_bridgeget_webview_cookiesget_watch_statusgit::watch::commands::watch_reposconvert_patch_to_unifiedes_convert_patch_to_diff,extract_apply_patchDeleting these would break the agent's browser-control tool and CLI session
startup — a real hazard, because they look exactly like the dead ones from the
frontend's point of view. What is actually wrong is that each carries a
#[tauri::command]attribute and a registry entry that expose an IPC endpointnothing invokes.
3 are reached only by their own tests:
get_git_repo_infoandcalculate_ahead_behind(crates/git/src/bundle.rs) andcompute_diff_with_hunks(crates/perf-utils). Registered, never called byproduction code in either language, and green in CI forever because the only
thing exercising them is the test written alongside them.
Solution
For the 15: drop the
handler_list.incentry and the#[tauri::command]attribute; keep the function. Each takes ordinary parameters (
AppHandle,String, request structs) — none takestauri::State, so removing theattribute is signature-neutral and the existing Rust callers are unaffected.
convert_patch_to_unifiedused the#[command]short form; the now-unuseduse tauri::commandimport goes with it.For the 3: delete the function, its registration, and the tests that were
its only caller — 4 tests in
crates/git/src/tests/bundle_tests.rsand 7 incrates/perf-utils/src/tests/diff_patch_tests.rs.bundle_tests.rskeeps itsgit_commitregression test, which covers live code.Removing
compute_diff_with_hunksorphaned the wholecrates/perf-utils/src/diff_patch/structured.rsmodule (305 lines:compute_structured_diff_internal,group_into_hunks,generate_split_rows) —it had exactly one consumer. In
crates/git/src/bundle.rs, deletingget_git_repo_infoandcalculate_ahead_behindlefthas_uncommitted_changes,get_current_branch,get_head_shaandcount_commitswith no callers, andthe
GitRepoInfo/AheadBehindStatusDTOs they returned with no referents.All are removed. The live
compute_structured_diffentry point indiff_patch/mod.rsandbundle.rs'sgit_commitare untouched.Resulting invariant: an entry in
handler_list.incmeans the frontend can callit. Rust-internal helpers are plain functions, and code whose only voter is its
own test is gone rather than pretending to be covered.
Potential risks
change at runtime. Their bodies, signatures, and callers are identical; only
the attribute and the registry line are gone. The failure mode to watch for is
a frontend caller this sweep did not see — but that is the same evidence that
put them in this bucket, and the agent-side callers are Rust, not IPC.
internal_browser_*command turns out to be invoked from the webview afterall, the agent's web tool would start failing at runtime with "command not
found". Verified against every
.ts/.tsxfile in the repository plustests/e2e/andsrc-tauri/capabilities/default.json, and the repository'sonly two indirect
invoke()sites both pass literal constants.deleted in the same commit. This lowers the test count without lowering
coverage of live code — but it does mean
crates/perf-utilsloses itshunk-grouping tests along with the hunk-grouping code.
structured.rsis a real algorithm, not scaffolding. It implements hunkgrouping and split-row generation over
similar. It is deleted because itssingle consumer is gone, not because it was wrong. If a future diff view wants
hunks, this commit is where to recover it.
public API is touched.
Verification
cargo check --workspace --all-targets— clean, zero warnings. Run with aprivate
CARGO_TARGET_DIR: two ORGII worktrees resolve this package to thesame build-script
OUT_DIR, so a shared target dir verifies the wrongworktree's
handler_list.inc.cargo clippy --workspace --all-targets -- -D warnings— exit 0.cargo test -p browser -p git -p perf_utils -p org2— 1,324 passed, 0failed, 5 ignored (exit 0), re-run after the final rebase.
developas refactor(search): remove the semantic search stack #1172, build(dev-server): add rspack dev server, default on macos #1174, feat(appearance): add light/dark skins with per-variant accent #1176, chore(tauri-commands): remove 114 registered commands with no caller #1177, chore(unused-exports): harvest the dirs the check silently excluded #1178, fix(database): serialize the tests that race on the global pool #1180 andfix(agent-core): lock ORGII_HOME while the workspace test reads it #1181 landed underneath it.
handler_list.incandbundle.rswere bothre-derived from the new
developby re-running the removal scripts ratherthan hand-merged, so the diff is exactly the 18 registration lines plus the
intended function removals. The unrelated
db_browser/tempfilelockfiledrift each rebase pulled in was dropped every time, so
Cargo.lockisuntouched.
bundle.rscascade only appeared once chore(tauri-commands): remove 114 registered commands with no caller #1177 merged. With both PRs'removals in the same tree,
get_current_branch/get_head_sha/count_commitslost their last callers and clippy failed on-D warnings. They are removed here, and the eight bundle DTOs that chore(tauri-commands): remove 114 registered commands with no caller #1177alone orphaned (
GitBundleResult,BundleProgress,ApplyBundleResult,PushBundleResult,CloudMergeResult,GetRepoBranchesResult,BranchName,LocalCommitInfo) are deliberately left — they are not this PR'sresponsibility and belong in a follow-up.
databasepool,agent_coreORGII_HOME) are fixed in fix(database): serialize the tests that race on the global pool #1180 and fix(agent-core): lock ORGII_HOME while the workspace test reads it #1181; neither is causedby this PR and neither is folded in here.
every Rust reference was located, definitions /
usestatements (includingmulti-line
use {...}blocks) / comments were discarded, each remaining sitewas resolved to its enclosing
fn, and the result was iterated to a fixpointso a command whose only caller is another dead command counts as dead. The 15
in this PR are the ones with a caller that survives that fixpoint; the 3 are
the ones whose only surviving caller is a test.
for
tauri::Stateparameters, which only resolve inside a command. None hasone, so the attribute is removable without touching call sites.
cargo checksurfacedcompute_structured_diff_internal,group_into_hunks,generate_split_rows,and
has_uncommitted_changesas newly unused; each was confirmed againstorigin/developto be reachable only from a function deleted here beforebeing removed. Re-checked to zero warnings afterwards.
pnpm typecheck/vitest/ Playwrightwere not run. No UI change, so no screenshots.
git worktree, where.husky/_/husky.shis gitignored and therefore never created bygit worktree add, andnode_modulesis not installed. That trailer isstructurally always missing in a worktree and carries no signal here; the
check it would have run for a Rust diff is
cargo clippy, run manually above.