Skip to content

fix/request - Binary body type - show warning on file not exists in system - #8276

Closed
rajashreehj-bruno wants to merge 3 commits into
usebruno:mainfrom
rajashreehj-bruno:fix/import---binary-file-path-not-exists-warning
Closed

rajashreehj-bruno wants to merge 3 commits into
usebruno:mainfrom
rajashreehj-bruno:fix/import---binary-file-path-not-exists-warning

Conversation

@rajashreehj-bruno

@rajashreehj-bruno rajashreehj-bruno commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Jira link: https://usebruno.atlassian.net/browse/BRU-3118

Description

When a request has binary/file body type and if the file doesn't exist in the system, then it shows a warning message to the user.

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

  • New Features
    • The file picker now checks whether selected file paths exist locally and flags missing selections.
    • When files are missing, it displays a warning indicator (including a warning icon) and shows a hover tooltip explaining which files can’t be found.
  • Tests
    • Added an end-to-end UI test and fixture to verify the “missing binary file” warning in the request pane.
  • Style/UI
    • Improved warning-state styling for the file picker button, including warning icon spacing and tooltip presentation.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: afc8e92b-2b9c-4a4e-8157-33cc8ead1b31

📥 Commits

Reviewing files that changed from the base of the PR and between 133700b and 0fd9e5c.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js
✅ Files skipped from review due to trivial changes (1)
  • packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js

Walkthrough

FilePickerEditor now checks selected file paths against the filesystem using existsSync, tracks missing files in state, and renders a warning icon and Tooltip when any selected file is absent. A has-warning CSS class is added via StyledWrapper. A Playwright test and YAML fixture verify the warning UI end-to-end.

Changes

Missing file warning in FilePickerEditor

Layer / File(s) Summary
Warning state CSS
packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js
Adds &.has-warning, .warning-icon, and .warning-tooltip CSS selectors with background color, border radius, spacing, and font-weight rules.
Missing-file detection and warning rendering
packages/bruno-app/src/components/FilePickerEditor/index.js
Imports useEffect, useId, useState, and filesystem/path utilities; adds a hasMissingFiles state and an existsSync-based effect; applies has-warning CSS class; swaps the file icon for a warning SVG; and conditionally renders a bottom-end warning Tooltip.
E2E test and fixture
tests/request/binary-file/binary-file-missing-warning.spec.ts, tests/request/binary-file/fixtures/binary-file-missing-warning.yml
YAML fixture defines a POST request with a binary body pointing to ./missing-payload.bin; Playwright spec imports the collection, navigates to the body tab, and asserts has-warning class, icon visibility, and tooltip text on hover.

Sequence Diagram

sequenceDiagram
  participant FilePickerEditor
  participant existsSync
  participant StyledWrapper
  participant Tooltip

  FilePickerEditor->>existsSync: check each resolved filePath
  existsSync-->>FilePickerEditor: true / false per path
  FilePickerEditor->>FilePickerEditor: setHasMissingFiles(true/false)
  FilePickerEditor->>StyledWrapper: apply has-warning class
  FilePickerEditor->>StyledWrapper: render warning SVG icon
  FilePickerEditor->>Tooltip: render warning tooltip (warningTooltipId)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • usebruno/bruno#6614: Refactors FilePickerEditor and StyledWrapper components; this PR further extends those same components with missing-file validation and warning UI.

Suggested labels

size/M

Suggested reviewers

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

Poem

A file goes missing, the binary's gone astray,
But Bruno now sees it and brightens the gray,
A warning icon glows where the file should be,
Hover the tooltip — "not found," plain to see.
existsSync stands guard so nothing slips away! 🚨📂

🚥 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 describes the main feature: adding a warning when binary/file body references missing files on the system.
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 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

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/FilePickerEditor/index.js (1)

145-183: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add data-testid to the warning UI elements and use them in tests.

The warning icon/tooltip are directly test-targeted UI, but they currently rely on CSS class selectors. Please add stable data-testid attributes for the selected row warning state, warning icon, and warning tooltip anchor/content.

As per coding guidelines, “Add data-testid to testable elements for Playwright in React components.”

🤖 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 `@packages/bruno-app/src/components/FilePickerEditor/index.js` around lines 145
- 183, Add stable data-testid attributes to the warning UI elements for test
targeting. Add data-testid to the warning icon SVG element (currently rendered
when hasMissingFiles is true), and add data-testid to the Tooltip component that
displays the warning message. These attributes will enable reliable Playwright
test targeting instead of relying on CSS class selectors, making the tests more
maintainable and aligned with the coding guidelines.

Source: Coding guidelines

🤖 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-app/src/components/FilePickerEditor/index.js`:
- Around line 39-42: The filename extraction logic in the filenames mapping uses
OS-specific separator detection which fails when paths contain mixed separators
(such as relative paths on Windows that include forward slashes). Instead of
splitting only on the OS-determined separator, modify the split operation to
handle both forward slashes and backslashes as valid path separators, or use a
cross-platform basename utility function that naturally handles both separator
types. This ensures the extracted filename is correct regardless of the
separator used in the input path.

In `@packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js`:
- Around line 79-97: Replace the hardcoded hex color values in the has-warning,
warning-icon, and warning-tooltip style blocks with theme tokens from
props.theme. The background color (`#BB931B1A`) for has-warning and
warning-tooltip, the icon color (`#BB931B`) for warning-icon, and the text color
(`#856404`) for warning-tooltip should all be mapped to appropriate theme color
tokens using the props.theme object to ensure the styles respect the
application's theme system and remain consistent across different themes.

---

Outside diff comments:
In `@packages/bruno-app/src/components/FilePickerEditor/index.js`:
- Around line 145-183: Add stable data-testid attributes to the warning UI
elements for test targeting. Add data-testid to the warning icon SVG element
(currently rendered when hasMissingFiles is true), and add data-testid to the
Tooltip component that displays the warning message. These attributes will
enable reliable Playwright test targeting instead of relying on CSS class
selectors, making the tests more maintainable and aligned with the coding
guidelines.
🪄 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: 7eaa6344-af97-43f9-8fd4-3ef2ddd5ecef

📥 Commits

Reviewing files that changed from the base of the PR and between 07c7348 and be77465.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js
  • packages/bruno-app/src/components/FilePickerEditor/index.js
  • tests/request/binary-file/binary-file-missing-warning.spec.ts
  • tests/request/binary-file/fixtures/binary-file-missing-warning.yml

@rajashreehj-bruno
rajashreehj-bruno force-pushed the fix/import---binary-file-path-not-exists-warning branch from e65f0ec to 133700b Compare June 17, 2026 06:52
@sanish-bruno

Copy link
Copy Markdown
Collaborator

Worked upon #8753

@rajashreehj-bruno
rajashreehj-bruno deleted the fix/import---binary-file-path-not-exists-warning branch August 12, 2026 09:56
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