fix(staged): support missing commands in web dispatch - #848
Conversation
In web mode the browser reaches the backend by POSTing to /api/invoke/{command}, which web_server::dispatch() routes through a hand-maintained match mirroring the Tauri generate_handler! list. Eight commands the web frontend actually invokes had no arm and fell through to the "Unknown command" catch-all (HTTP 400):
- build_note_followup_message
- count_assistant_messages_after
- refresh_branch_git_state
- list_parent_branch_commits
- pull_branch_ff_only
- reset_branch_to_remote
- get_worktree_changes_preview
- discard_worktree_changes
Add a dispatch arm for each. Rather than copy-pasting the command bodies (which invites drift, as with the existing ensure_repo_badges arm), extract the synchronous body of each Tauri command into a shared `_impl` helper that both the #[tauri::command] wrapper and the new arm call inside spawn_blocking. refresh_branch_git_state_impl also takes &AppHandle for its git-state-updated event; reset_branch_to_remote_impl already existed and is just made pub(crate).
start_or_queue_branch_session (listed in the plan) already had an arm, so this closes the remaining 8 Tier-1 gaps. The paths are latent today since web mode is stubbed, but this restores parity for when web mode is switched back on.
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5eb98c00a7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let _ = app.emit( | ||
| "git-state-updated", |
There was a problem hiding this comment.
Use web broadcast for git refresh events
When refresh_branch_git_state is invoked through the new web dispatch arm, the HTTP response is just null and the frontend relies on the git-state-updated event to merge the refreshed state. This helper still calls app.emit, which only reaches the Tauri event bus; Axum WebSocket clients are fed from web_server::emit_to_all's broadcast channel, so browser clients never receive the update and can leave the git state/spinner stale after a web refresh.
Useful? React with 👍 / 👎.
Summary
Testing