Skip to content

[FIX] Success Screen fixes - #32

Merged
Avni2000 merged 5 commits into
mainfrom
ui-fixes
Feb 4, 2026
Merged

Avni2000 merged 5 commits into
mainfrom
ui-fixes

Conversation

@Avni2000

@Avni2000 Avni2000 commented Feb 4, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Optional automatic renumbering of execution counts during notebook conflict resolution (toggleable).
    • Real-time resolution status with pending/success/error states, messages and a retry action.
    • Dedicated success and error UI states after resolution.
    • Live refresh of file decorations and status indicators when conflicts are resolved.
  • Chores

    • Optimized build logic in test scripts for faster, conditional compilation.

@coderabbitai

coderabbitai Bot commented Feb 4, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds an event-driven resolution flow and a user-controlled renumbering option: emits onDidResolveConflict when resolutions save, updates extension decorations/status reactively, extends the web UI and websocket protocol to show resolution status (pending/success/error), and adds a renumber-execution-counts toggle in the resolver UI.

Changes

Cohort / File(s) Summary
Extension & decoration wiring
src/extension.ts
Replaces direct decoration reloads with a decorationChangeEmitter, subscribes to onDidResolveConflict, updates status bar logic and file-watcher refresh to use the emitter.
Resolver events & renumber plumbing
src/resolver.ts
Exports onDidResolveConflict EventEmitter; threads a shouldRenumber/renumberExecutionCounts flag into resolution APIs; fires event after saving resolved notebooks; replaces some blocking prompts with non-blocking notifications.
Web panel & server messages
src/web/WebConflictPanel.ts, src/web/webTypes.ts
Adds renumberExecutionCounts to unified resolution payloads; sends resolution-success / resolution-error messages and waits briefly to ensure delivery.
Web client UI & behavior
src/web/client/App.tsx, src/web/client/ConflictResolver.tsx
Adds renumberExecutionCounts checkbox in ConflictResolver; updates onResolve signature; App renders success/error states and includes the flag in resolve requests.
WebSocket hook & types
src/web/client/useWebSocket.ts, src/web/client/types.ts
Adds resolutionStatus and resolutionMessage to hook return; handles new resolution-success/resolution-error messages; sendMessage marks resolve commands as pending.
UI styling
src/web/client/styles.ts
Adds CSS for success/error blocks and a retry button (scaleIn animation); duplicated insertion blocks present.
Tests / scripts
test/simulate_merge_uu.sh
Makes compilation conditional based on timestamps/availability; adds graceful VS Code process termination on teardown.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly Related PRs

Poem

🐰 I hopped in with a checkbox bright and neat,
Fired an event when conflicts met defeat,
The web blinked success, or gently showed error,
Decorations refreshed — tidy as a burrow! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[FIX] Success Screen fixes' refers to success screen UI improvements visible in the changes (new success/error states in App.tsx and styles.ts), but does not fully capture the main scope of work, which includes substantial backend changes to conflict resolution logic, renumbering execution counts, and event-driven decoration refresh.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ui-fixes

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 since git ls-files -z already 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
+    done
src/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 from styles.ts. Consider adding a reusable .header-checkbox-label class 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">

Comment thread src/resolver.ts Resolved
Comment thread src/web/client/useWebSocket.ts Resolved
Comment thread test/simulate_merge_uu.sh Resolved
Avni2000 and others added 3 commits February 3, 2026 23:04
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant