Skip to content

fix: opencollection export as bruno json#6444

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:bugfix/bruno-export
Dec 18, 2025
Merged

fix: opencollection export as bruno json#6444
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:bugfix/bruno-export

Conversation

@naman-bruno
Copy link
Collaborator

@naman-bruno naman-bruno commented Dec 18, 2025

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Bug Fixes

    • Fixed file extension handling when exporting request items to ensure consistent naming conventions across collections.
  • Improvements

    • Enhanced collection export functionality to standardize file naming for request items during export operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Walkthrough

Adds a filename normalization helper that converts YAML file extensions (.yml/.yaml) to .bru format. During collection export, filenames for request items are normalized while other items retain their original filenames.

Changes

Cohort / File(s) Summary
Filename Normalization for Export
packages/bruno-app/src/utils/collections/index.js
Introduces normalizeFilenameToBru() helper to convert YAML extensions to .bru. Modifies transformCollectionToSaveToExportAsFile() to conditionally apply normalization to request items only during export.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the regex/string replacement logic handles all extension cases (uppercase, lowercase, mixed)
  • Confirm conditional logic correctly identifies request vs. non-request items
  • Check for any edge cases with malformed or missing filenames

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

YAML transforms to BRU so fine, ✨
Export logic in perfect line,
Requests get their new attire,
Collection export climbs higher! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing the export functionality for Bruno collections to properly output as Bruno JSON format, which aligns with the code change that normalizes YAML filenames to .bru format during export.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/bruno-app/src/utils/collections/index.js (1)

283-286: Consider adding JSDoc for clarity.

The implementation looks correct. However, adding a JSDoc comment would help explain why filenames are normalized during export (e.g., to ensure exported collections use the canonical .bru format).

🔎 Suggested JSDoc
+  /**
+   * Normalizes YAML-based filenames to use the .bru extension
+   * @param {string} filename - The filename to normalize
+   * @returns {string} The filename with .yml/.yaml replaced by .bru
+   */
   const normalizeFilenameToBru = (filename) => {
     if (!filename) return filename;
     return filename.replace(/\.(yml|yaml)$/i, '.bru');
   };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78ee99e and 0b59229.

📒 Files selected for processing (1)
  • packages/bruno-app/src/utils/collections/index.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/utils/collections/index.js
🧠 Learnings (2)
📚 Learning: 2025-12-16T07:16:08.934Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:08.934Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-app/src/utils/collections/index.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-app/src/utils/collections/index.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - Windows
🔇 Additional comments (1)
packages/bruno-app/src/utils/collections/index.js (1)

300-300: Request verification for roundtrip export/import with .yml/.yaml files.

The filename normalization applies only during JSON export transformation and converts .yml/.yaml extensions to .bru for request items. The import system doesn't depend on filename extensions for format detection—it uses the data structure instead. While the codebase supports .bru, .yml, and .yaml extensions equally in functions like generateUniqueRequestName, there is no explicit test in the test suite validating that collections exported with normalized .bru filenames can be re-imported and function correctly. This verification gap should be addressed to ensure the roundtrip workflow is stable, particularly for users exporting and re-importing collections.

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