fix: checkout switches apply visibly and worktrees no longer trip the parent-repo gate - #177
Merged
Merged
Conversation
…e parent-repo gate Three linked fixes for a switch that looked like it did nothing: - A stopped thread's checkout switch now applies immediately: the stale session-scoped effectiveCwd stops shadowing the new worktree the moment thread.meta-updated lands with no live session. Running sessions keep the queued-switch behavior and chip. - Refused source-control actions say why. The parent-repository safety gate now toasts its reason from switch/create/merge handlers instead of silently returning, a failed thread.meta.update dispatch reports itself in the panel and the composer branch control, and the changes empty state explains when the gate is what emptied it. - repositoryRootRelation only reads "ancestor" for a genuine parent directory. Plain string comparison used to raise the confirmation gate for healthy checkouts whenever git's resolved root differed from the configured cwd by symlinks, casing, or separators.
…dings Reworks the previous commit after independent review: - The stale-effectiveCwd clearing moves from a special case in one projector fold into the decider, which now emits a real thread.effective-cwd-set(null) alongside thread.meta-updated when a stopped thread's worktree changes. Every projection (in-memory fold, SQLite pipeline, web store) already folds that event, so snapshots, live streams, and restarts all agree. - The same rule applies when a session stops with a queued switch: thread.session.set(stopped) in a checkout that differs from the thread's configured one also emits the clear. A session stopping in its own checkout keeps its cwd-follow effectiveCwd. - resolveRepositoryRootRelation resolves symlinks before comparing and treats any residual divergence as "ancestor": a false gate is a visible banner, a false "same" would silently expose parent-repository actions (e.g. a cwd symlinked into a subdirectory of a larger repo). - Failed thread.meta.update dispatches now roll back the optimistic branch/worktree update instead of leaving the UI lying, and a missing environment connection reports itself instead of silently skipping the dispatch.
Follow-up to the second review pass: - The decider only emits the effective-cwd clear when the worktree path actually changes; branch-only updates carry the unchanged path and must not wipe a valid cwd-follow value. - Rolling back a failed checkout dispatch now restores the full snapshot through a new store restoreThreadCheckout action, including the session the optimistic setThreadBranch cleared. - Rollbacks are keyed to their dispatch: a stale rejection can no longer overwrite state a newer dispatch already replaced.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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
Switching a stopped thread from a worktree back to the project root looked like it did nothing: the thread's worktree setting updated, but the stale session-scoped effectiveCwd kept shadowing it in every panel until the next session started. Separately, several switch actions returned silently when blocked, and the parent-repository safety gate could false-fire on healthy checkouts whenever git's resolved root differed from the configured cwd by symlinks, casing, or separators.
Fix
Three review rounds (two independent); server 1944 / web 2285 / browser 484 tests green.