Repository navigation
fix logical errors in conflict detection - #194
Conversation
- only create conflict when current != incoming AND (instead of OR) (cur differs from base AND inc differs from base)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTightens conflict-detection to record execution-count, outputs, and kernel/language_info conflicts only when both current and incoming values differ from base. Narrows markdown cell styling to exclude Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/conflictDetector.ts (1)
595-604:⚠️ Potential issue | 🟠 MajorHandle deleted
kernelspecvalues in this helper too.
applyAutoResolutions()now treats missing notebook metadata asnull, buthasKernelVersionConflict()still exits before the new 3-way predicate when either side deletesmetadata.kernelspec. That misses delete-vs-modify conflicts even though the main auto-resolution path will classify them correctly.As per coding guidelines, "Always parse raw JSON in .ipynb files; conflicts may be in cells[].source, cells[].outputs, or metadata—never assume they're only in code"💡 Suggested fix
export function hasKernelVersionConflict( current?: Notebook, incoming?: Notebook, base?: Notebook ): boolean { if (!current || !incoming) return false; const currentKernel = current.metadata?.kernelspec; const incomingKernel = incoming.metadata?.kernelspec; const baseKernel = base?.metadata?.kernelspec; - if (!currentKernel || !incomingKernel) return false; - - const currentStr = stableStringify(currentKernel); - const incomingStr = stableStringify(incomingKernel); - const baseStr = baseKernel ? stableStringify(baseKernel) : ''; + const currentStr = stableStringify(currentKernel ?? null); + const incomingStr = stableStringify(incomingKernel ?? null); + const baseStr = stableStringify(baseKernel ?? null); /** * Only consider it a conflict if current and incoming kernelspecs differ, and both differ from base */ return currentStr !== incomingStr && (currentStr !== baseStr && incomingStr !== baseStr); // both differ from base }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/conflictDetector.ts` around lines 595 - 604, The helper hasKernelVersionConflict currently returns early if either currentKernel or incomingKernel is missing, which skips delete-vs-modify cases; update hasKernelVersionConflict to allow null/missing kernelspecs by removing the early return and normalizing currentKernel/incomingKernel/baseKernel to explicit null (or a consistent placeholder) before calling stableStringify, then perform the same 3-way comparison (using stableStringify on currentKernel, incomingKernel, baseKernel) so delete (null) vs modify conflicts are detected; refer to the hasKernelVersionConflict function and the currentKernel/incomingKernel/baseKernel variables and use stableStringify for the comparisons.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/conflictDetector.ts`:
- Around line 595-604: The helper hasKernelVersionConflict currently returns
early if either currentKernel or incomingKernel is missing, which skips
delete-vs-modify cases; update hasKernelVersionConflict to allow null/missing
kernelspecs by removing the early return and normalizing
currentKernel/incomingKernel/baseKernel to explicit null (or a consistent
placeholder) before calling stableStringify, then perform the same 3-way
comparison (using stableStringify on currentKernel, incomingKernel, baseKernel)
so delete (null) vs modify conflicts are detected; refer to the
hasKernelVersionConflict function and the
currentKernel/incomingKernel/baseKernel variables and use stableStringify for
the comparisons.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 853c0519-a3f9-466a-bb69-b8091c0935c5
📒 Files selected for processing (2)
src/conflictDetector.tssrc/web/client/styles.ts
Summary by CodeRabbit
Bug Fixes
Style
Tests