Skip to content

fix(app): preserve multipart file values when creating example from r… - #8129

Merged
sid-bruno merged 6 commits into
usebruno:mainfrom
pooja-bruno:fix/multipart-example-circular-files
May 29, 2026
Merged

sid-bruno merged 6 commits into
usebruno:mainfrom
pooja-bruno:fix/multipart-example-circular-files

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented May 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

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.
Screen.Recording.2026-05-28.at.3.44.11.PM.mov

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unintended data mutation when creating response examples for multipart requests.
  • Refactor

    • Reworked multipart file chip into a reusable entry with improved tooltip swapping, remove-button hover text/delay, and deferred overflow rendering until dropdowns are opened.
  • Tests

    • Added end-to-end tests for chip tooltip swapping and multipart "create example" behavior; added a test ensuring preserved filenames.
  • Chores

    • Added/initialized multipart test fixtures and user preference fixtures; updated a fixture field name and cleaned up test comments.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Refactors multipart file chip rendering into a FileEntry component, prevents requestBody mutation in example creation, and adds Playwright fixtures and tests validating tooltip swapping and saved multipart filenames.

Changes

Multipart File Handling

Layer / File(s) Summary
FileEntry Component Refactoring
packages/bruno-app/src/components/MultipartFileChipsCell/index.js
Extracts FileEntry to encapsulate ToolHint usage, dynamic tooltip text (swaps to "Remove file" on remove-button hover), variant-specific classes/dataTestId, remove-button event handling, and gates overflow rendering behind dropdown open state.
Response Example Mutation Prevention
packages/bruno-app/src/providers/ReduxStore/slices/collections/exampleReducers.js
Deep-clones requestBody in addResponseExample to avoid mutating the draft request body by reference.
Tooltip Swap Test Suite with Fixtures
tests/request/multipart-form/fixtures/collection/{bruno.json, chip-tooltip.bru}, tests/request/multipart-form/init-user-data/{collection-security.json, preferences.json}, tests/request/multipart-form/multipart-chip-tooltips.spec.ts
Adds fixtures and a Playwright suite that asserts tooltip text swaps between the file path and "Remove file" on hover and that only one tooltip is visible at a time.
Save-as-Example Test and Maintenance Updates
tests/response-examples/save-as-example-multipart.spec.ts, tests/response-examples/fixtures/collection/multipart-example.bru, tests/response-examples/multipart-form-chips.spec.ts
Adds test verifying save-as-example preserves real multipart filenames without "[Circular]", updates fixture field naming (multipartForm), and removes obsolete comments from an existing spec.

Sequence Diagram

sequenceDiagram
  participant Test
  participant UI as MultipartFileChipsCell
  participant FileEntry
  participant Tooltip
  Test->>UI: open collection and render files
  UI->>FileEntry: mount entry (variant, toolhintId, editMode)
  FileEntry->>Tooltip: show file path on entry hover
  FileEntry->>Tooltip: change to "Remove file" on remove-button hover
  FileEntry->>UI: call onRemove(filePath) when remove clicked
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • usebruno/bruno#7971: Introduces the initial multipart chip/overflow/remove behavior that this PR refactors into the FileEntry component with enhanced tooltip interactions.

Suggested reviewers

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

"A chip that whispers file names in light,
Hover a tiny cross and it switches to 'Remove file' bright,
Deep-cloned dreams keep drafts intact at night,
Tests stand guard so filenames show just right,
Tiny refactors, tidy UI — code sings in flight."

🚥 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 clearly identifies the main fix: preserving multipart file values when creating examples from requests, which aligns with the core changes in the PR (Redux state cloning and multipart UI refactoring).
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

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

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

sid-bruno
sid-bruno previously approved these changes May 28, 2026

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

🧹 Nitpick comments (1)
tests/response-examples/save-as-example-multipart.spec.ts (1)

29-29: ⚡ Quick win

Consider removing { force: true } to improve test reliability.

Forcing the click bypasses Playwright's actionability checks, which could hide real timing or visibility issues. Since you hover on line 28, the menu icon should become visible naturally. Try removing force: true and let Playwright's built-in checks ensure the element is truly clickable.

♻️ Suggested change
-      await requestRow.locator('.menu-icon').click({ force: true });
+      await requestRow.locator('.menu-icon').click();
🤖 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/response-examples/save-as-example-multipart.spec.ts` at line 29, The
test currently forces a click on the menu icon via
requestRow.locator('.menu-icon').click({ force: true }), which bypasses
Playwright actionability checks; remove the { force: true } option and rely on
the preceding hover (the call that makes the menu visible) and Playwright’s
built-in checks—optionally add an explicit await
expect(requestRow.locator('.menu-icon')).toBeVisible() or await
requestRow.locator('.menu-icon').waitFor() before calling .click() to ensure the
element is actually actionable.
🤖 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.

Nitpick comments:
In `@tests/response-examples/save-as-example-multipart.spec.ts`:
- Line 29: The test currently forces a click on the menu icon via
requestRow.locator('.menu-icon').click({ force: true }), which bypasses
Playwright actionability checks; remove the { force: true } option and rely on
the preceding hover (the call that makes the menu visible) and Playwright’s
built-in checks—optionally add an explicit await
expect(requestRow.locator('.menu-icon')).toBeVisible() or await
requestRow.locator('.menu-icon').waitFor() before calling .click() to ensure the
element is actually actionable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 53dcf677-a78a-44a3-af58-a2c7b80d73a3

📥 Commits

Reviewing files that changed from the base of the PR and between c9e8b04 and 0e71ed4.

📒 Files selected for processing (1)
  • tests/response-examples/save-as-example-multipart.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.

Actionable comments posted: 1

🤖 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 `@tests/request/multipart-form/multipart-chip-tooltips.spec.ts`:
- Around line 21-23: The branch currently checks DOM presence with
summary.count(), which can be true even when the element is hidden; replace that
presence check with a visibility check (e.g., await summary.isVisible() or await
summary.first().isVisible()) before calling summary.click(), and if multiple
summaries exist ensure you call click() on the visible/first locator
(summary.first() or the visible locator) so the click does not fail on hidden
elements.
🪄 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: 2ab5d6b8-025a-4f10-b253-0b71261b4924

📥 Commits

Reviewing files that changed from the base of the PR and between 9f88a93 and 22eadbf.

📒 Files selected for processing (1)
  • tests/request/multipart-form/multipart-chip-tooltips.spec.ts

@sid-bruno
sid-bruno merged commit 7413465 into usebruno:main May 29, 2026
16 of 20 checks passed
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