Skip to content

fix(import): Import fails for gRPC request without URL in exported collection - #8367

Merged
vijayh-bruno merged 9 commits into
usebruno:mainfrom
sharan-bruno:fix/Import-fails-for-grpc-request-without-url
Jul 1, 2026
Merged

vijayh-bruno merged 9 commits into
usebruno:mainfrom
sharan-bruno:fix/Import-fails-for-grpc-request-without-url

Conversation

@sharan-bruno

@sharan-bruno sharan-bruno commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Jira: https://usebruno.atlassian.net/browse/BRU-2205

Description

Fix: import fails for requests without a URL

requestUrlSchema from .defined() to .optional() so collections containing gRPC/HTTP requests with an empty URL no longer fail import with items[0].request.url must be defined. Added an E2E regression test covering both request types.

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
    • Improved Bruno import behavior for HTTP, gRPC, and HTTP example requests/examples that omit a request URL.
    • Normalized empty/missing request URL values during import so collections and items are kept and handled correctly (including request examples).
  • Tests
    • Added Playwright coverage for “missing request URL” import scenarios across HTTP, gRPC, and HTTP example fixtures.
    • Verifies imported collections appear in the UI sidebar after import.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The Bruno importer now normalizes missing request URLs during request and example transformation. New HTTP and gRPC fixtures omit URLs, and a Playwright spec imports the cases and verifies the collections appear in the sidebar.

Changes

Missing-URL Bruno import flow

Layer / File(s) Summary
Request URL normalization
packages/bruno-app/src/utils/importers/common.js
transformItemsInCollection imports valueToString and applies it to request URLs for request items and request examples.
Import fixtures and spec
tests/import/bruno/fixtures/bruno-http-request-missing-url.json, tests/import/bruno/fixtures/bruno-grpc-request-missing-url.json, tests/import/bruno/fixtures/bruno-http-example-request-missing-url.json, tests/import/bruno/import-bruno-request-missing-url.spec.ts
The new HTTP, gRPC, and HTTP example fixtures omit request URLs, and the serial Playwright spec imports each case and asserts the collections appear in the sidebar.

Sequence Diagram(s)

sequenceDiagram
  participant Spec as Playwright spec
  participant Importer as importCollection
  participant Transformer as transformItemsInCollection
  participant Utility as valueToString
  participant Sidebar as buildCommonLocators
  Spec->>Importer: import HTTP, gRPC, or example fixture
  Importer->>Transformer: transform request items and examples
  Transformer->>Utility: normalize item.request.url
  Utility-->>Transformer: string value
  Transformer->>Utility: normalize example.request.url
  Utility-->>Transformer: string value
  Importer-->>Spec: imported collection
  Spec->>Sidebar: build collection selector
  Sidebar-->>Spec: sidebar locator
  Spec->>Sidebar: assert collection is visible
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

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

Poem

A URL drifted off the page,
But imports stayed neat on stage.
With valueToString in tow,
The sidebar said, “Hello!”
And tests kept time with gentle gauge.

🚥 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 is specific and accurately reflects the main import fix for missing URLs, though it mentions gRPC while the PR also covers HTTP.
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.
✨ 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

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

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-schema/src/collections/index.js`:
- Line 132: The shared request URL schema was made optional in a way that
affects all consumers, not just the intended import paths. Revert the broad
change on requestUrlSchema in collections/index.js, keep the shared schema
strict, and apply .optional() only inside the specific HTTP/gRPC request schema
builders that need URL-less imports, such as the request-type-specific schema
definitions.

In `@tests/import/bruno/import-bruno-request-missing-url.spec.ts`:
- Around line 5-30: The Bruno import tests are split across two tests that
depend on shared state and `test.describe.serial`, which makes them
non-parallel-safe. Update the `cases` loop in
`import-bruno-request-missing-url.spec.ts` so each scenario does the import and
the sidebar visibility assertion in the same `test` callback, using
`importCollection` and `buildCommonLocators` together. After inlining the
assertion, remove the serial-only dependency so each case is self-contained and
follows the Arrange-Act-Assert-Cleanup pattern.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d84c31c0-4d79-40fb-b055-64174744439b

📥 Commits

Reviewing files that changed from the base of the PR and between 7765320 and ce69193.

📒 Files selected for processing (4)
  • packages/bruno-schema/src/collections/index.js
  • tests/import/bruno/fixtures/bruno-grpc-request-missing-url.json
  • tests/import/bruno/fixtures/bruno-http-request-missing-url.json
  • tests/import/bruno/import-bruno-request-missing-url.spec.ts

@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.

♻️ Duplicate comments (1)
tests/import/bruno/import-bruno-request-missing-url.spec.ts (1)

5-29: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make each fixture case self-contained.

Line 26 relies on state created by Line 17, so these cases only pass because the suite is serialised. That breaks parallel-safety and makes the regression flaky. Import and sidebar assertion should live in the same test callback for each case, then test.describe.serial can go away.

Minimal rewrite
-test.describe.serial('Import Bruno Collection - request with missing URL', () => {
+test.describe('Import Bruno Collection - request with missing URL', () => {
@@
   for (const { fixture, collectionName, type } of cases) {
     test(`imports a ${type} request without a URL`, async ({ page, createTmpDir }) => {
       const brunoFile = path.resolve(__dirname, 'fixtures', fixture);
       const location = await createTmpDir(collectionName);

       await importCollection(page, brunoFile, location, {
         expectedCollectionName: collectionName
       });
-    });
-
-    test(`${type} collection appears in the sidebar after import`, async ({ page }) => {
+
       const locators = buildCommonLocators(page);
       await expect(locators.sidebar.collection(collectionName)).toBeVisible();
     });
   }
 });
#!/bin/bash
set -euo pipefail

file='tests/import/bruno/import-bruno-request-missing-url.spec.ts'

printf '\n== Suite structure ==\n'
sed -n '1,80p' "$file"

printf '\n== Shared-state indicators ==\n'
rg -n 'describe\.serial|test\(`imports a .* without a URL`|collection appears in the sidebar after import' "$file"

As per coding guidelines, “E2E tests must be parallel-safe” and “Every E2E test should follow the Arrange-Act-Assert-Cleanup shape.” As per path instructions, “Follow best practices for Playwright code and e2e automation.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/import/bruno/import-bruno-request-missing-url.spec.ts` around lines 5 -
29, The Bruno import cases are split across two tests, so the sidebar assertion
depends on shared state from the import test and only works because the suite is
serial. Move the import and visibility check into the same test callback inside
the `cases` loop in `import-bruno-request-missing-url.spec.ts`, using
`importCollection` and `buildCommonLocators` together for each
`fixture`/`collectionName`/`type`, and then remove the `test.describe.serial`
wrapper so each case is self-contained and parallel-safe.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@tests/import/bruno/import-bruno-request-missing-url.spec.ts`:
- Around line 5-29: The Bruno import cases are split across two tests, so the
sidebar assertion depends on shared state from the import test and only works
because the suite is serial. Move the import and visibility check into the same
test callback inside the `cases` loop in
`import-bruno-request-missing-url.spec.ts`, using `importCollection` and
`buildCommonLocators` together for each `fixture`/`collectionName`/`type`, and
then remove the `test.describe.serial` wrapper so each case is self-contained
and parallel-safe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0c91250b-ae6a-407a-84da-b29f41d3170e

📥 Commits

Reviewing files that changed from the base of the PR and between 6be3386 and be07e02.

📒 Files selected for processing (2)
  • tests/import/bruno/fixtures/bruno-http-example-request-missing-url.json
  • tests/import/bruno/import-bruno-request-missing-url.spec.ts

@sharan-bruno
sharan-bruno force-pushed the fix/Import-fails-for-grpc-request-without-url branch from be07e02 to 677a956 Compare June 30, 2026 11:09
@vijayh-bruno
vijayh-bruno merged commit 4f31e9b into usebruno:main Jul 1, 2026
18 of 20 checks passed
naman-bruno pushed a commit to naman-bruno/bruno that referenced this pull request Jul 1, 2026
…llection (usebruno#8367)

* fix(import): Import fails for gRPC request without URL in exported collection

* changed the approach for import request with missing url

* addressed review comment

* added a fixture for http example request

* added an assertion to check whether the request is being imported or not

* added an assertion to check whether the request is being imported or not

* refactored test scripts
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.

3 participants