Skip to content

fix(converters): deduplicate Postman folder/request names case-insensitively#7900

Open
BradPerbs wants to merge 1 commit intousebruno:mainfrom
BradPerbs:bugfix/postman-import-case-colliding-names
Open

fix(converters): deduplicate Postman folder/request names case-insensitively#7900
BradPerbs wants to merge 1 commit intousebruno:mainfrom
BradPerbs:bugfix/postman-import-case-colliding-names

Conversation

@BradPerbs
Copy link
Copy Markdown

@BradPerbs BradPerbs commented May 1, 2026

Summary

Fixes a piece of issue #7821 — Postman/Insomnia import silently corrupts folders with case-colliding sibling names.

The Postman v2 importer in bruno-converters already deduplicates sibling folder and request names against an in-memory map, but the map lookup is case-sensitive. A Postman collection with two sibling folders named e.g. OAuth2 and oAuth2 therefore produces two Bruno items with their original names, and on a case-insensitive filesystem (default on Windows and macOS APFS) the writer collapses them into the same directory and silently overwrites the first folder's contents.

This PR lowercases the key used for the collision lookup (and for recording entries), so case-only variants are renamed at the converter stage:

  • OAuth2 (kept)
  • oAuth2oAuth2_1

Same fix applied symmetrically to the request-name path. Display names keep their original casing — only the dedup map's key is normalized.

Scope

This PR addresses the converter-level deduplication gap. The two follow-ups mentioned in #7821 — sibling-level dedup in the filesystem writer and the missing recursive: true on mkdirSync — are intentionally out of scope to keep this PR small and focused, per contributing.md.

Tests

Added two unit tests in packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js:

  • should deduplicate sibling folder names case-insensitivelyOAuth2 + oAuth2OAuth2, oAuth2_1
  • should deduplicate sibling request names case-insensitivelyGetUser + getuserGetUser, getuser_1

Both tests fail on main and pass with this change. The full bruno-converters test suite has the same pre-existing failure count (161) before and after this change; the only delta is +2 passing tests in postman-to-bruno.spec.js.

Before:  Tests: 161 failed, 22 skipped, 737 passed, 920 total
After:   Tests: 161 failed, 22 skipped, 739 passed, 922 total

The pre-existing failures are all in unrelated postman-translations / bruno-to-postman-translations test files and are not touched by this change.

Test instructions

nvm use
HUSKY=0 npm install --legacy-peer-deps --ignore-scripts
npm run build --workspace=packages/bruno-common
cd packages/bruno-converters
NODE_OPTIONS=--experimental-vm-modules node ../../node_modules/jest/bin/jest.js tests/postman/postman-to-bruno/postman-to-bruno.spec.js

Expected: Tests: 32 passed, 32 total (including the two new cases).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Postman to Bruno conversion to handle folder and request names with different casing as duplicates. Names differing only by case (e.g., "Test" and "test") will now be properly deduplicated with a numeric suffix.
  • Tests

    • Added test cases for case-insensitive deduplication of sibling folders and requests.

…itively

The Postman v2 collection importer already deduplicates sibling folder
and request names against an in-memory map, but the lookup is
case-sensitive. As a result a Postman collection that contains two
sibling folders named, for example, OAuth2 and oAuth2 produces two
Bruno items with their original names. On case-insensitive filesystems
(default on Windows and macOS APFS) the writer collapses them into the
same directory and silently overwrites the first folder's contents.

Lowercase the lookup key when checking for and recording a collision so
case-only variants are renamed (oAuth2 -> oAuth2_1) before they reach
the filesystem layer. The same fix is applied to the request-name path.

Adds two unit tests covering the folder and request cases. The wider
filesystem-writer dedup gap mentioned in usebruno#7821 is not addressed here.

Refs usebruno#7821
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b2bcf0e4-4838-4b61-aa16-80e28843b1b1

📥 Commits

Reviewing files that changed from the base of the PR and between 118ba80 and 106f9d9.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js

Walkthrough

The Postman-to-Bruno converter now performs case-insensitive name deduplication for both folders and requests. Map keys are lowercased during uniqueness checks and storage, preventing collisions between names differing only in casing.

Changes

Cohort / File(s) Summary
Implementation
packages/bruno-converters/src/postman/postman-to-bruno.js
Updated deduplication logic for folder and request names to use lowercase key comparisons, ensuring names differing only by casing are treated as duplicates.
Tests
packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js
Added two new test cases validating case-insensitive deduplication behavior for both sibling folders and requests, confirming numeric suffix application on collisions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

size/XS

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

Case doesn't matter, we've laid down the law,
Duplicate names now follow the same draw,
Whether FOLDER or Folder, they're just one and the same,
A numeric suffix settles any name shame,
Deduplication's now blind to the case of it all! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: case-insensitive deduplication of Postman folder and request names, which directly addresses the bug fix in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown

@THANSHEER THANSHEER left a comment

Choose a reason for hiding this comment

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

changes looks proper for merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants