Skip to content

chore(tauri-commands): remove the last 18 unreachable registrations - #1179

Merged
sudomaggie merged 1 commit into
developfrom
chore/dead-command-registrations
Sep 1, 2026
Merged

chore(tauri-commands): remove the last 18 unreachable registrations#1179
sudomaggie merged 1 commit into
developfrom
chore/dead-command-registrations

Conversation

@Chloe-JY

@Chloe-JY Chloe-JY commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

A sweep of the 1,019 entries in src-tauri/src/commands/handler_list.inc found
145 commands with no caller in src/, tests/, or src-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:

Command Called from
internal_browser_get_state / _click / _input / _select / _scroll / _show_mask / _hide_mask / _clean_up / _is_ready (9) agent-core tools/impls/web/control_internal_browser.rs
list_internal_browser_targets same, resolve_ready_target / execute_list
get_active_internal_browser_state list_internal_browser_targets
cli_agent_run agent_sessions::cli::agent_core_bridge
get_webview_cookies Cursor session-token capture
get_watch_status git::watch::commands::watch_repos
convert_patch_to_unified es_convert_patch_to_diff, extract_apply_patch

Deleting 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 endpoint
nothing invokes.

3 are reached only by their own tests: get_git_repo_info and
calculate_ahead_behind (crates/git/src/bundle.rs) and
compute_diff_with_hunks (crates/perf-utils). Registered, never called by
production 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.inc entry and the #[tauri::command]
attribute; keep the function. Each takes ordinary parameters (AppHandle,
String, request structs) — none takes tauri::State, so removing the
attribute is signature-neutral and the existing Rust callers are unaffected.
convert_patch_to_unified used the #[command] short form; the now-unused
use tauri::command import 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.rs and 7 in
crates/perf-utils/src/tests/diff_patch_tests.rs. bundle_tests.rs keeps its
git_commit regression test, which covers live code.

Removing compute_diff_with_hunks orphaned the whole
crates/perf-utils/src/diff_patch/structured.rs module (305 lines:
compute_structured_diff_internal, group_into_hunks, generate_split_rows) —
it had exactly one consumer. In crates/git/src/bundle.rs, deleting
get_git_repo_info and calculate_ahead_behind left has_uncommitted_changes,
get_current_branch, get_head_sha and count_commits with no callers, and
the GitRepoInfo / AheadBehindStatus DTOs they returned with no referents.
All are removed. The live compute_structured_diff entry point in
diff_patch/mod.rs and bundle.rs's git_commit are untouched.

Resulting invariant: an entry in handler_list.inc means the frontend can call
it. 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

  • The 15 are the risky half of this change, and nothing about them should
    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.
  • Agent browser control is the blast radius if that evidence is wrong. If any
    internal_browser_* command turns out to be invoked from the webview after
    all, the agent's web tool would start failing at runtime with "command not
    found". Verified against every .ts/.tsx file in the repository plus
    tests/e2e/ and src-tauri/capabilities/default.json, and the repository's
    only two indirect invoke() sites both pass literal constants.
  • Deleted tests were not covering anything else. All 11 exercise functions
    deleted in the same commit. This lowers the test count without lowering
    coverage of live code — but it does mean crates/perf-utils loses its
    hunk-grouping tests along with the hunk-grouping code.
  • structured.rs is a real algorithm, not scaffolding. It implements hunk
    grouping and split-row generation over similar. It is deleted because its
    single consumer is gone, not because it was wrong. If a future diff view wants
    hunks, this commit is where to recover it.
  • Rollback: revert this commit. No schema, migration, persisted format, or
    public API is touched.

Verification

@Chloe-JY
Chloe-JY force-pushed the chore/dead-command-registrations branch from 65cd4e2 to 3078289 Compare September 1, 2026 06:33
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
Chloe-JY force-pushed the chore/dead-command-registrations branch from 3078289 to 8c2358c Compare September 1, 2026 08:02
@Harry19081 Harry19081 changed the title chore(tauri-commands): unregister the 18 that are not simply dead chore(tauri-commands): remove the last 18 unreachable registrations Sep 1, 2026
@Harry19081 Harry19081 added maintenance Maintenance, CI, build, release, cleanup, or tooling work dev-tooling Developer tooling, build, CI, tests, diagnostics, or release labels Sep 1, 2026
@sudomaggie
sudomaggie merged commit f1c4a32 into develop Sep 1, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-tooling Developer tooling, build, CI, tests, diagnostics, or release maintenance Maintenance, CI, build, release, cleanup, or tooling work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants