Repository navigation
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds an event-driven resolution flow and a user-controlled renumbering option: emits Changes
Sequence DiagramsequenceDiagram
participant Browser as Browser UI (App.tsx)
participant WS as WebSocket hook (useWebSocket)
participant Panel as Web Panel (WebConflictPanel)
participant Resolver as Resolver (resolver.ts)
participant Ext as Extension (extension.ts)
participant Deco as File Decorations
Browser->>WS: sendMessage({ command: "resolve", renumberExecutionCounts })
WS->>Panel: forward resolve message
Panel->>Resolver: processResolution(..., renumberExecutionCounts)
activate Resolver
Resolver->>Resolver: apply resolutions (optionally renumber)
Resolver->>Resolver: save resolved notebook
Resolver->>Resolver: onDidResolveConflict.fire(uri)
Resolver->>Panel: respond success/error
deactivate Resolver
Panel->>WS: send resolution-success/error
WS->>Browser: update resolutionStatus & resolutionMessage
Browser->>Browser: render success/error UI
Note right of Ext: subscribed to onDidResolveConflict
Resolver-->>Ext: event fired
Ext->>Ext: decorationChangeEmitter.fire(uri / undefined)
Ext->>Deco: refresh decorations
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/resolver.ts`:
- Around line 333-336: Replace the fragile filename extraction that uses
uri.fsPath.split('/') with a cross-platform approach: use
path.basename(uri.fsPath) when constructing the message passed to
vscode.window.showInformationMessage; ensure the Node 'path' module is imported
(e.g., add an import for path) and update the call in the resolver.ts code where
vscode.window.showInformationMessage is invoked so it uses
path.basename(uri.fsPath) to correctly handle Windows backslashes and POSIX
slashes.
In `@src/web/client/useWebSocket.ts`:
- Around line 81-88: sendMessage currently sets resolutionStatus('pending') for
every outbound message which can incorrectly leave the UI pending for
non-resolution commands; update sendMessage to only call
setResolutionStatus('pending') when the message is a resolution-related action
(e.g., inspect message.type or message.command for resolution actions like
"resolve" or similar), leaving other message types (e.g., "ready", "cancel")
unchanged. Locate the sendMessage function and add a conditional check on the
message payload before invoking setResolutionStatus so only resolution requests
expect a subsequent "resolution-success"/"resolution-error" response.
In `@test/simulate_merge_uu.sh`:
- Around line 72-84: The current process-grepping that populates _code_pids is
too broad and can match unrelated commands; change the selection logic that
builds _code_pids (the mapfile -t _code_pids < <(...) line) to only capture
processes whose executable name is exactly "code" (or "Code") and whose
arguments include "/tmp/"—for example by using ps -eo pid=,comm=,args= and
filtering where the comm column matches /^[Cc]ode$/ and args match
/\/tmp\//—then keep the subsequent kill loops (the for _pid in
"${_code_pids[@]}" ... kill -TERM/kill -KILL logic) as-is so only true VS Code
PIDs are terminated.
🧹 Nitpick comments (5)
test/simulate_merge_uu.sh (2)
47-51: Overly complex pipeline can be simplified.The
tr '\n' '\0' | xargs -0 -n1 printf '%s\0'portion is redundant sincegit ls-files -zalready outputs null-separated entries. This can be simplified:♻️ Suggested simplification
- while IFS= read -r -d '' f; do - [ -f "$f" ] || continue - m=$(stat -c %Y "$f" 2>/dev/null || stat -f %m "$f" 2>/dev/null || echo 0) - [ "$m" -gt "$newest_src" ] && newest_src=$m - done < <(git ls-files -z | tr '\n' '\0' | xargs -0 -n1 printf '%s\0' 2>/dev/null | grep -z -E -v '^dist/|^node_modules/' || true) + while IFS= read -r -d '' f; do + [ -f "$f" ] || continue + m=$(stat -c %Y "$f" 2>/dev/null || stat -f %m "$f" 2>/dev/null || echo 0) + [ "$m" -gt "$newest_src" ] && newest_src=$m + done < <(git ls-files -z 2>/dev/null | grep -z -E -v '^dist/|^node_modules/' || true)
78-78: Hardcoded sleep may be insufficient or excessive.The 2-second sleep before force-killing may not be enough for VS Code to gracefully shut down (especially with unsaved work or active extensions), or may be unnecessarily long if the process terminates quickly.
Consider polling for process termination with a timeout instead:
♻️ Suggested polling approach
- sleep 2 - for _pid in "${_code_pids[@]}"; do - if kill -0 "$_pid" 2>/dev/null; then - echo "Force killing VS Code pid $_pid" - kill -KILL "$_pid" 2>/dev/null || true - fi - done + # Wait up to 5 seconds for graceful termination + for _i in {1..10}; do + _any_alive=0 + for _pid in "${_code_pids[@]}"; do + kill -0 "$_pid" 2>/dev/null && _any_alive=1 + done + [ "$_any_alive" -eq 0 ] && break + sleep 0.5 + done + # Force kill any remaining + for _pid in "${_code_pids[@]}"; do + if kill -0 "$_pid" 2>/dev/null; then + echo "Force killing VS Code pid $_pid" + kill -KILL "$_pid" 2>/dev/null || true + fi + donesrc/web/WebConflictPanel.ts (1)
179-190: Consider extracting the delay constant.The 500ms delay ensures the success message is delivered before disposal. While functional, this hardcoded value could be extracted as a named constant for clarity.
📝 Proposed refinement
+// Time to wait for message delivery before disposing the panel +const MESSAGE_DELIVERY_DELAY_MS = 500; + // ... in _handleResolution method - // Wait to ensure message is delivered to browser - await new Promise(resolve => setTimeout(resolve, 500)); + // Wait to ensure message is delivered to browser + await new Promise(resolve => setTimeout(resolve, MESSAGE_DELIVERY_DELAY_MS));src/web/client/App.tsx (1)
58-76: Consider adding a visual indicator for the pending resolution state.While resolution is in progress (
resolutionStatus === 'pending'), the UI remains unchanged. Consider showing a loading overlay or disabling the "Apply Resolution" button to prevent double-submissions and provide feedback that the operation is in progress.src/web/client/ConflictResolver.tsx (1)
302-309: Consider using CSS classes instead of inline styles.The checkbox label uses inline styles (
style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 12 }}), which is inconsistent with the rest of the UI that uses CSS classes fromstyles.ts. Consider adding a reusable.header-checkbox-labelclass for consistency.♻️ Proposed CSS class addition in styles.ts
/* Header checkbox labels */ .header-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 12px; }Then update the JSX:
- <label style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 12 }}> + <label className="header-checkbox-label"> <input type="checkbox" checked={renumberExecutionCounts} onChange={e => setRenumberExecutionCounts(e.target.checked)} /> Renumber execution counts </label> - <label style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 12 }}> + <label className="header-checkbox-label">
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Chores