fix: unify OpenAPI comparison logic, improve OpenAPI Sync tab banner consistency and error handling#7483
Conversation
… feedback - Removed unused props and improved error handling in OpenAPISyncTab components. - Updated messaging in CollectionStatusSection and OverviewSection for clarity. - Enhanced the SpecDiffModal to provide better visual feedback on changes. - Refactored sync flow logic to ensure accurate endpoint categorization and improved performance. - Added new utility functions for better handling of spec changes and endpoint comparisons.
WalkthroughThis PR significantly refactors the OpenAPI sync feature, introducing version delta display across multiple UI components, refining three-way merge categorization to exclude local-only updates from spec-driven endpoints, and replacing MD5-based comparison with field-by-field request analysis in the Electron backend. The changes span from UI banner logic through sync hooks to core IPC processing, with signature modifications to key components. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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 unit tests (beta)
📝 Coding Plan
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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/OpenAPISyncTab/SpecStatusSection/index.js (1)
50-59:⚠️ Potential issue | 🟠 MajorTreat metadata-only spec drift as a pending update.
This branch only considers added/modified/removed endpoints. If the remote spec changes just
info.version,info.title, orinfo.description, the IPC layer still returnshasChanges: true, but this component falls through to the “No updates from the spec” path and gives the user no way to refresh the stored spec file. The same condition should drive the other overview/pending surfaces too, otherwise the UI will drift again.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/OpenAPISyncTab/SpecStatusSection/index.js` around lines 50 - 59, Update the pending-update detection in SpecStatusSection by expanding the hasEndpointUpdates check (the const hasEndpointUpdates and its branch) to also treat metadata-only changes as a pending update: include specDrift.hasChanges (or explicitly check differing metadata like specDrift.storedVersion !== specDrift.newVersion and/or specDrift.info?.version/title/description differences) so the branch returns the warning variant and actions when only metadata changed, not just when added/modified/removed endpoint arrays are non-empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/OpenAPISyncTab/hooks/useSyncFlow.js`:
- Around line 17-25: The confirm modal is showing updates from raw
remoteDrift.modified while the actual sync payload filters add/remove to
spec-driven endpoints, causing a mismatch; in performSync, derive the update
list using the same filtered source used by confirmGroups (e.g., use
specUpdates, resolvedConflicts or a filteredRemoteModified variable) instead of
raw remoteDrift.modified so the confirmation dialog only promises changes that
will be applied; update any references in performSync and the confirm modal
construction to use that filtered set (and ensure newToCollection, specUpdates,
resolvedConflicts, localChangesToReset are used consistently).
In `@packages/bruno-electron/src/ipc/openapi-sync.js`:
- Around line 540-546: The header comparison in compareRequestFields() currently
maps header names directly, causing case-sensitive mismatches; normalize header
names (e.g., convert to lower-case and trim) when building specHeaderNames and
actualHeaderNames before sorting and JSON-stringifying so that headers like
"Content-Type" and "content-type" are treated as equal; update the logic that
produces specHeaderNames and actualHeaderNames (and any other header-name
comparisons) to use the normalized names for the diff check.
---
Outside diff comments:
In `@packages/bruno-app/src/components/OpenAPISyncTab/SpecStatusSection/index.js`:
- Around line 50-59: Update the pending-update detection in SpecStatusSection by
expanding the hasEndpointUpdates check (the const hasEndpointUpdates and its
branch) to also treat metadata-only changes as a pending update: include
specDrift.hasChanges (or explicitly check differing metadata like
specDrift.storedVersion !== specDrift.newVersion and/or
specDrift.info?.version/title/description differences) so the branch returns the
warning variant and actions when only metadata changed, not just when
added/modified/removed endpoint arrays are non-empty.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4c4208ca-25fa-4532-b64f-d1d797d8e4f0
📒 Files selected for processing (9)
packages/bruno-app/src/components/OpenAPISyncTab/CollectionStatusSection/index.jspackages/bruno-app/src/components/OpenAPISyncTab/OverviewSection/index.jspackages/bruno-app/src/components/OpenAPISyncTab/SpecDiffModal/index.jspackages/bruno-app/src/components/OpenAPISyncTab/SpecStatusSection/index.jspackages/bruno-app/src/components/OpenAPISyncTab/SyncReviewPage/index.jspackages/bruno-app/src/components/OpenAPISyncTab/hooks/useOpenAPISync.jspackages/bruno-app/src/components/OpenAPISyncTab/hooks/useSyncFlow.jspackages/bruno-app/src/components/OpenAPISyncTab/index.jspackages/bruno-electron/src/ipc/openapi-sync.js
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/OpenAPISyncTab/index.js
|
Ok 01
…On Fri, 13 Mar 2026 at 20:45, Bijin A B ***@***.***> wrote:
Merged #7483 <#7483> into main.
—
Reply to this email directly, view it on GitHub
<#7483 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BC2ZHPWPIBWAAUHD3FXT55D4QRQOHAVCNFSM6AAAAACWRL3IICVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRTGU2TQMBVGY2TOMY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
… feedback (usebruno#7483) - Removed unused props and improved error handling in OpenAPISyncTab components. - Updated messaging in CollectionStatusSection and OverviewSection for clarity. - Enhanced the SpecDiffModal to provide better visual feedback on changes. - Refactored sync flow logic to ensure accurate endpoint categorization and improved performance. - Added new utility functions for better handling of spec changes and endpoint comparisons.
Description
JIRA
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Improvements