Repository navigation
fix(sidebar): clear the delete state when a removal is refused - #15187
Conversation
Callers mark rows deleting up front for immediate sidebar feedback, but a refusal in beginHostQualifiedRemoval returns before removeWorktree's try/catch — the only other place that clears the flag. The failure toast auto-dismisses after 10s, so the workspace was left on a 'Deleting…' spinner indefinitely with no explanation still on screen. Also removes workspace-cleanup-removal-host-guard.ts: #14731 refused a colliding cleanup removal, #15013 replaced refusing with routing to the confirmed host, and nothing imports the module any more — not even its own tests.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughRemoved the workspace cleanup removal-host guard. Updated 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts (1)
81-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the new comments concise in both files.
Both comments include detailed operational context. Keep only the invariant and the test purpose.
As per coding guidelines, comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.
src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts#L81-L85: reduce the refusal rationale to one concise statement.src/renderer/src/store/slices/worktrees/teardown/host-qualified-removal-refusal.test.ts#L6-L14: reduce the test rationale to a concise statement about refusal cleanup.Source: Coding guidelines
src/renderer/src/store/slices/worktrees/teardown/host-qualified-removal-refusal.test.ts (1)
32-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the host-mismatch refusal branch.
This test covers only an unresolved route with no confirmed host. It does not exercise the branch at Line 95, where a resolved route differs from
requiredExecutionHostId. Add a case that asserts refusal andclearWorktreeDeleteState(WORKTREE_ID).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c432692-a417-47c3-a1ef-941e1ca94989
📒 Files selected for processing (3)
src/renderer/src/store/slices/workspace-cleanup-removal-host-guard.tssrc/renderer/src/store/slices/worktrees/teardown/host-qualified-removal-refusal.test.tssrc/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/store/slices/workspace-cleanup-removal-host-guard.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 6 remain after this review.
Review loop statusCI is green. The earlier The reachability question, answeredThis PR clears the delete state on two refusal early-returns. They are not equally real.
After #15013, The no-route leg is structurally reachable: It is not reproducible through the UI. Four staged attempts failed: unqualified row with Dead code removalSound and independent of the above. Not done, deliberatelyNo Electron screenshots. The refusal state is unstageable for the same reason the bug is Open decisionLand as cheap insurance on the unqualified leg with the description corrected to drop the |
…usal The existing case used an empty store, which proved the clear but not that a user can land there. Cover a stale folder-workspace id and a hostless row under an ambiguous legacy runtime — both resolve to no route from populated state.
Correction: the refusal IS reachable — my earlier comment was wrongMy previous comment said the no-route refusal was "reachable in principle, unproven in Tracing 1. Stale folder workspace
if (!findFolderWorkspaceOwner(state, folderWorkspaceId)) {
// Why: deleted/stale folder ids keep failing closed like unknown worktrees.
return { kind: 'missing' }
}A row whose folder record is gone refuses instead of routing. 2. Hostless row + ambiguous legacy runtime
Reaching it needs a row with no Why it mattersBoth returns precede Tests
Still true from beforeThe host-mismatch refusal remains unreachable for canonical host ids, so this PR is Follow-up, not in this PRThe missing |
…yai#15187) * fix(sidebar): clear the delete state when a removal is refused Callers mark rows deleting up front for immediate sidebar feedback, but a refusal in beginHostQualifiedRemoval returns before removeWorktree's try/catch — the only other place that clears the flag. The failure toast auto-dismisses after 10s, so the workspace was left on a 'Deleting…' spinner indefinitely with no explanation still on screen. Also removes workspace-cleanup-removal-host-guard.ts: stablyai#14731 refused a colliding cleanup removal, stablyai#15013 replaced refusing with routing to the confirmed host, and nothing imports the module any more — not even its own tests. * test(sidebar): pin the two states that actually reach the removal refusal The existing case used an empty store, which proved the clear but not that a user can land there. Cover a stale folder-workspace id and a hostless row under an ambiguous legacy runtime — both resolve to no route from populated state. --------- Co-authored-by: QA <qa@local>
…yai#15187) * fix(sidebar): clear the delete state when a removal is refused Callers mark rows deleting up front for immediate sidebar feedback, but a refusal in beginHostQualifiedRemoval returns before removeWorktree's try/catch — the only other place that clears the flag. The failure toast auto-dismisses after 10s, so the workspace was left on a 'Deleting…' spinner indefinitely with no explanation still on screen. Also removes workspace-cleanup-removal-host-guard.ts: stablyai#14731 refused a colliding cleanup removal, stablyai#15013 replaced refusing with routing to the confirmed host, and nothing imports the module any more — not even its own tests. * test(sidebar): pin the two states that actually reach the removal refusal The existing case used an empty store, which proved the clear but not that a user can land there. Cover a stale folder-workspace id and a hostless row under an ambiguous legacy runtime — both resolve to no route from populated state. --------- Co-authored-by: QA <qa@local>
…yai#15187) * fix(sidebar): clear the delete state when a removal is refused Callers mark rows deleting up front for immediate sidebar feedback, but a refusal in beginHostQualifiedRemoval returns before removeWorktree's try/catch — the only other place that clears the flag. The failure toast auto-dismisses after 10s, so the workspace was left on a 'Deleting…' spinner indefinitely with no explanation still on screen. Also removes workspace-cleanup-removal-host-guard.ts: stablyai#14731 refused a colliding cleanup removal, stablyai#15013 replaced refusing with routing to the confirmed host, and nothing imports the module any more — not even its own tests. * test(sidebar): pin the two states that actually reach the removal refusal The existing case used an empty store, which proved the clear but not that a user can land there. Cover a stale folder-workspace id and a hostless row under an ambiguous legacy runtime — both resolve to no route from populated state. --------- Co-authored-by: QA <qa@local>
Defensive hardening plus a dead-code removal. Read the reachability note before landing — I could not reproduce this in the running app.
What it changes
Callers mark rows deleting up front so the sidebar shows progress immediately (
worktree-delete-execution.ts). The two refusals inbeginHostQualifiedRemovalreturn beforeremoveWorktree's try/catch — the only other place that clears the flag — so on those paths nothing clears it and the row keeps a "Deleting…" spinner after the 10s failure toast has gone. This adds the clear on both.Reachability — honest limits
I originally observed the stuck row on pre-#15013 code and fixed it there. #15013 then re-keyed delete state by host identity and its catch clears on every throwing path, which appears to have already resolved the observed case.
Against post-#15013 code I tried four times to reproduce it and could not:
markWorktreesDeleting+removeWorktreesequence the executor usesSo the guarded returns are reached on the unqualified path — a caller naming no host with no resolvable owner — which I can exercise in a unit test but could not stage through the UI.
This is therefore correct, cheap, tested hardening, not a fix for a demonstrable user-facing bug today. No screenshots, because staging one would misrepresent that.
Dead code
Deletes
workspace-cleanup-removal-host-guard.ts. #14731 added it to refuse a colliding cleanup removal; #15013 replaced refusing with routing to the confirmed host, and nothing imports the module any more — not even its own tests, which pass unchanged without it. That part stands on its own merits.Verification
typecheck 0 · changed-code quality 0 findings · 524 files / 4,901 tests green across store slices and sidebar. The new test is mutation-tested: reverting the
clearWorktreeDeleteStatecalls turns it red.