Skip to content

[ENHANCEMENT] Adds take all current/incoming/base - #43

Merged
Avni2000 merged 1 commit into
mainfrom
all-base
Feb 6, 2026
Merged

Avni2000 merged 1 commit into
mainfrom
all-base

Conversation

@Avni2000

@Avni2000 Avni2000 commented Feb 6, 2026 •

Copy link
Copy Markdown
Owner

Looks good at first glance, this'll be properly tested in the coming PR

Summary by CodeRabbit

  • New Features
    • Added three bulk conflict resolution buttons (All Base, All Current, All Incoming) in the conflict resolver header to apply a chosen side to all conflict rows at once.
    • When the chosen side lacks content for a row, that row will be cleared (treated as deletion); otherwise its content is taken from the chosen side.

@coderabbitai

coderabbitai Bot commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • ✅ Full review completed - (🔄 Check again to review again)
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch all-base

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.

❤️ Share

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

@Avni2000 Avni2000 changed the title [WIP] [ENHANCEMENT] Adds take all current/incoming/base [ENHANCEMENT] Adds take all current/incoming/base Feb 6, 2026
@Avni2000
Avni2000 marked this pull request as ready for review February 6, 2026 02:30

@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: 1

🤖 Fix all issues with AI agents
In `@src/web/client/ConflictResolver.tsx`:
- Around line 272-298: handleAcceptAll currently overwrites any existing
per-conflict resolutions; change it to skip already-resolved rows by checking
the incoming prev Map inside setChoices and not touching entries where
prev.has(conflictIdx) is true (use the existing conflictIdx derived from each
conflictRow and the choices Map passed into the updater). Specifically, in the
setChoices updater for handleAcceptAll, before computing effectiveChoice/content
for a row, if prev.has(conflictIdx) continue so you only fill unresolved
conflicts; alternatively, if you prefer confirmation UX, perform a pre-check
using choices.size > 0 (or the current choices Map) and show a confirmation
dialog before calling setChoices — reference handleAcceptAll, choices (prev),
conflictRows and conflictIndex when making the change.
🧹 Nitpick comments (1)
src/web/client/ConflictResolver.tsx (1)

461-504: Extract shared inline styles to reduce duplication.

The three buttons share identical fontSize, padding, and color declarations. Consider extracting the common style to a constant:

♻️ Suggested refactor
+const acceptAllBtnStyle: React.CSSProperties = {
+    color: 'var(--text-primary)',
+    fontSize: 11,
+    padding: '4px 8px',
+};
+
 // Then in JSX:
-    style={{
-        background: 'var(--base-bg)',
-        border: '1px solid var(--base-border)',
-        color: 'var(--text-primary)',
-        fontSize: 11,
-        padding: '4px 8px'
-    }}
+    style={{
+        ...acceptAllBtnStyle,
+        background: 'var(--base-bg)',
+        border: '1px solid var(--base-border)',
+    }}

Same pattern for the "Current" and "Incoming" buttons. Alternatively, a CSS class (e.g., .btn-accept-all) would be cleaner and consistent with the existing btn/btn-primary/btn-secondary class-based approach.

Comment thread src/web/client/ConflictResolver.tsx Resolved
@Avni2000

Avni2000 commented Feb 6, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Yep, can you commit option 2 -

     conflictRows.forEach(row => {
         const conflictIdx = row.conflictIndex ?? -1;
         if (conflictIdx < 0) return;
  •        // Skip rows already resolved by the user
    
  •        if (next.has(conflictIdx)) return;
    
           let cell: NotebookCell | undefined;
    

That was an oversight!

@coderabbitai

coderabbitai Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@Avni2000: I'll help you add that check to skip already-resolved rows. Let me first locate the exact file and context where this change needs to be applied.


🏁 Script executed:

#!/bin/bash
# Search for the conflictRows.forEach pattern with conflictIndex check
rg -n -A5 -B2 "conflictRows\.forEach.*row.*=>" --type ts

Length of output: 649


@Avni2000: Perfect! I found the code in src/web/client/ConflictResolver.tsx. I'll add the check to skip already-resolved rows.

Task: Add check to skip already-resolved rows in bulk conflict resolution

  • Add guard clause after the conflictIdx < 0 check to skip rows that are already resolved by the user
  • This prevents bulk actions from overwriting manual conflict resolutions

🧠 Learnings used
Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to src/conflictDetector.ts : Implement `analyzeNotebookConflicts` function for detection and `resolveAllConflicts` function for resolution

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to src/conflictDetector.ts : Implement cell-level diffing—show side-by-side or inline diffs for conflicting cells, not raw JSON lines

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Treat merge conflicts in Jupyter notebooks at the cell level rather than as flat JSON lines to provide a rich, notebook-aware conflict resolution experience

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:45:32.680Z
Learning: Applies to src/**/resolver.ts : Use the `merge-nb.findConflicts` command as the single unified entry point to find notebooks with merge conflicts (both textual and semantic) and bring up the conflict resolution panel

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to **/*.ts : Always parse raw JSON in conflict detection—conflicts may be in `cells[].source`, `cells[].outputs`, or `metadata`, never assume they're only in code

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to src/cellMatcher.ts : Implement content-based cell matching algorithm for 3-way merge

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:45:32.680Z
Learning: Applies to src/webview/**/*.{ts,tsx} : Provide a unified conflict resolution UI in `ConflictResolverPanel` webview supporting both textual and semantic conflict resolution with 3-way diff view

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Use VSCode Extension API for implementing the notebook merge conflict resolver extension

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to src/web/**/*.ts : Implement web-based conflict resolution UI using React and communicate via HTTP/WebSocket server

Learnt from: CR
Repo: Avni2000/MergeNB PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-03T02:39:45.034Z
Learning: Applies to src/{conflictDetector,resolver}.ts : Handle execution counts—Git nullifies `execution_count`; optionally restore or renumber after resolution

💡 Use @coderabbitai plan to create a plan for code changes

@Avni2000
Avni2000 merged commit fce06eb into main Feb 6, 2026
1 check passed
@Avni2000
Avni2000 deleted the all-base branch March 1, 2026 01:39
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