Remember commit selection, close stale diff tabs, and add ide browse#57
Remember commit selection, close stale diff tabs, and add ide browse#57GordonBeeming wants to merge 3 commits into
Conversation
Entering the commit view still selects every changed file, but leaving and coming back no longer wipes a manual selection. Re-entry only re-selects all when the remembered selection was empty or already the full set; a partial selection (say 14 of 15 after unchecking one) is preserved as-is. The all-or- none test is derived from the current set, so uncheck-then-recheck counts as 'all' again. After a successful commit, every open working-tree diff tab now closes. They all reflect the pre-commit tree, so they go stale the instant the commit lands and would otherwise linger showing 'N unchanged lines' with no content.
ide browse <path> opens a repo's web UI in the default browser instead of a
native window. If nothing is running yet it cold-starts the app headless (HTTP
server up, main window kept hidden) and gives the repo its own hidden session;
if an instance is already running it reuses it. Several repos can be browsed at
once, each on its own /{hash}/ URL, and closing a visible window leaves the
background sessions serving until the app is quit.
The launcher gains a browse subcommand that url-encodes the path and hands it to
a new loopback GET /browse?path= route, which ensures a (hidden) session exists
and 302-redirects to the repo's scoped SPA — so bash never has to reproduce the
Rust workspace hash. Window creation from the HTTP handler bridges to the main
thread via run_on_main_thread. open_launch_target_window gains a visible flag so
browse sessions build hidden and never steal focus.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds ChangesBackground repository browsing
Git commit state
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant HTTPServer
participant TauriApp
participant Workspace
CLI->>HTTPServer: Request encoded browse path
HTTPServer->>Workspace: Resolve workspace and hash
HTTPServer->>TauriApp: Create hidden session if absent
TauriApp->>Workspace: Register workspace window
HTTPServer-->>CLI: Redirect to workspace route
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Code Review
This pull request introduces an ide browse <path> command that allows users to open a repository in the default browser, running the app headless in the background if it is not already active. It also updates the frontend to remember partial file selections when re-entering commit mode and to close stale diff tabs after a successful commit. The review feedback highlights a critical security vulnerability in the new /browse endpoint, which lacks authentication and could allow arbitrary file reads via CSRF. Additionally, it identifies a React anti-pattern in src/App.tsx where a state setter is called inside another state updater, recommending the use of queueMicrotask to defer the nested update.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR enhances the commit workflow UX and adds a new “browse in browser” launch mode by reusing the existing HTTP+scoped-session architecture in the Tauri backend.
Changes:
- Preserve commit-file selection across leaving/re-entering commit mode; add tests for partial/empty remembered selection.
- Close all working-tree diff tabs after a successful commit (including pinned) and add a regression test.
- Add
ide browse <path>support: a/browse?path=loopback route that ensures a session exists (hidden window when needed) and redirects to the scoped/{hash}/SPA; update CLI installer, runner validation, and docs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/App.tsx | Remembers commit selection on re-entry and closes diff tabs post-commit. |
| src/App.test.tsx | Adds tests for selection memory and diff-tab cleanup after commit. |
| src-tauri/src/lib.rs | Adds browse-launch detection and supports hidden (non-visible) workspace windows. |
| src-tauri/src/http_server.rs | Adds /browse route to create/ensure sessions and redirect into scoped SPA. |
| scripts/validate-launch-runners.mjs | Extends launcher validation for the new browse branch. |
| scripts/install-cli-command.sh | Generates ide browse launcher logic and URL encoding utilities. |
| docs/development.md | Documents ide browse behavior and lifecycle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src-tauri/src/http_server.rs`:
- Around line 331-339: Protect the /browse handler by requiring a
launcher-issued, unguessable short-lived capability and reject missing or
invalid capabilities before invoking browse. Pass the capability through the
existing BrowseQuery or request state, validate it at the route boundary, and
ensure only ide browse can issue valid capabilities while preserving normal
behavior for authorized requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8fc7bcc4-ddbc-4be3-b030-09208169c463
📒 Files selected for processing (7)
docs/development.mdscripts/install-cli-command.shscripts/validate-launch-runners.mjssrc-tauri/src/http_server.rssrc-tauri/src/lib.rssrc/App.test.tsxsrc/App.tsx
Address reviewer comments: - Defer setActivePath out of the setOpenFiles updater (queueMicrotask) so the post-commit diff-tab cleanup stays pure (gemini) - Force byte-wise url_encode iteration (LC_ALL=C) and mask the signed-byte printf conversion (& 0xFF) so ide browse percent-encodes non-ASCII paths correctly under bash 3.2 (copilot)
|
@coderabbitai review |
✅ Action performedReview finished.
|
| setOpenFiles((current) => { | ||
| const kept = current.filter((file) => !file.diff); | ||
| if (kept.length === current.length) return current; | ||
| // Deferred so this updater stays pure — no nested setState calls during render. | ||
| queueMicrotask(() => { | ||
| setActivePath((currentActivePath) => | ||
| currentActivePath && kept.some((file) => file.path === currentActivePath) | ||
| ? currentActivePath | ||
| : kept.at(-1)?.path, | ||
| ); | ||
| }); | ||
| return kept; |
| /// Whether this cold start is `ide browse <path>` (`IDE_BROWSE_PATH` set, or a | ||
| /// leading `browse` argv token) — `run()` uses this to keep the auto-created `main` | ||
| /// window hidden. The browsed path itself doesn't need extracting here: | ||
| /// `resolve_explicit_launch_target`'s existing `IDE_OPEN_PATH`/argv scan already | ||
| /// finds the same path (the token after `browse` is just the first argv entry that | ||
| /// exists on disk) and roots `main`'s session in it, so hiding `main` is the only | ||
| /// extra work a browse cold start needs. `http_server.rs`'s `/browse` route handles | ||
| /// session creation for the warm (already-running) case. |
Summary
Three changes to the commit flow and how a repo can be opened:
ide browse <path>opens a repo in the browser instead of a native window. If nothing is running yet it cold-starts the app headless — HTTP server up, main window kept hidden — and gives the repo its own hidden session; if an instance is already running it reuses it. Several repos can be browsed at once, each on its own/{hash}/URL, and closing a visible window leaves the background sessions serving until the app is quit. A new loopbackGET /browse?path=route ensures the session exists and redirects to the scoped SPA, so the launcher never has to reproduce the Rust workspace hash.Implementation notes
refreshGitStatus— prune the remembered set to still-valid paths, then collapse to all only when it's empty or full. No new state.setOpenFilesfilter, minus the pinned exception — a post-commit diff is stale whether or not it's pinned./{hash}/routing, and single-instance forwarding.open_launch_target_windowgains avisibleflag so browse sessions build hidden and never steal focus; window creation from the HTTP handler bridges to the main thread viarun_on_main_thread.Test plan
npm test(410) andcargo test(235) pass;cargo build,npm run build, andnpm run launch:checkare clean.ide browsestarts headless with no visible window; a second repo is browsable alongside the first;/browse?path=redirects to the scoped/{hash}/and the repo lists once.Summary by CodeRabbit
ide browse <path>command to open a repository in the default browser.