Skip to content

feat(request): warn when binary body file is missing on disk#8753

Open
sanish-bruno wants to merge 5 commits into
usebruno:mainfrom
sanish-bruno:feat/add-missing-file-warning-to-binary-file
Open

feat(request): warn when binary body file is missing on disk#8753
sanish-bruno wants to merge 5 commits into
usebruno:mainfrom
sanish-bruno:feat/add-missing-file-warning-to-binary-file

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

JIRA: BRU-3118
Extension of #8276

Screenshot 2026-07-23 at 8 00 45 PM

Description

Warn when a request's binary body points to a file that no longer exists on disk.

  • FilePickerEditor shows a warning icon and tooltip when the selected file is missing.
  • New useMissingFileCheck(paths, basePath) hook returns { status, missingPaths } and uses a sequence counter to discard superseded results.
  • Filename extraction switched to getBasename for correct handling of trailing separators, ./.., and mixed separators on Windows.
  • Inline warning SVG replaced with the existing IconAlertTriangleFilled component.
  • New Playwright spec: tests/request/binary-file/binary-file-missing-warning.spec.ts.

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.

Summary by CodeRabbit

  • New Features

    • File pickers now identify selected files that are missing from the collection directory.
    • Missing files display a warning icon and an explanatory tooltip.
  • Bug Fixes

    • Improved filename handling across different path formats.
  • Tests

    • Added coverage for missing binary payload file warnings.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The file picker now checks selected paths against the collection directory, displays warning styling and tooltip content for missing files, and adds an end-to-end test with a binary request fixture.

Changes

Missing file warning

Layer / File(s) Summary
Missing-file checking hook
packages/bruno-app/src/hooks/useMissingFileCheck/index.js
Adds asynchronous path existence checks with idle, checking, ready, and error states, plus stale-result suppression.
Warning presentation in file picker
packages/bruno-app/src/components/FilePickerEditor/index.js, packages/bruno-app/src/components/FilePickerEditor/StyledWrapper.js
Derives filenames, detects missing selections, and renders warning styling, an alert icon, and a tooltip. Theme-based border-radius values replace hardcoded values.
Missing-file warning validation
tests/request/binary-file/fixtures/binary-file-missing-warning.yml, tests/utils/page/locators.ts, tests/request/binary-file/binary-file-missing-warning.spec.ts
Adds a missing-binary fixture, tooltip locator, and Playwright assertions for the warning UI.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RequestUI
  participant FilePickerEditor
  participant useMissingFileCheck
  participant FilesystemHelpers
  RequestUI->>FilePickerEditor: load selected binary path
  FilePickerEditor->>useMissingFileCheck: check path against collection directory
  useMissingFileCheck->>FilesystemHelpers: test resolved file existence
  FilesystemHelpers-->>useMissingFileCheck: report missing path
  useMissingFileCheck-->>FilePickerEditor: return missingPaths
  FilePickerEditor-->>RequestUI: render warning icon and tooltip
Loading

Suggested reviewers: bijin-bruno

Poem

A file goes missing, a warning takes flight,
An alert icon glows in the picker’s light.
Paths are checked with care,
Tooltips bloom there,
Tests keep the behavior right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: warning when a binary body file is missing on disk.
✨ 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.

@sanish-bruno sanish-bruno changed the title Feat/add missing file warning to binary file feat(request): warn when binary body file is missing on disk Jul 23, 2026
@sanish-bruno
sanish-bruno marked this pull request as ready for review July 23, 2026 13:42

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

🤖 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 106-111: Update the warning icon rendering in FilePickerEditor so
the missing-file warning is discoverable without hover: wrap the icon in a
focusable semantic trigger or add equivalent accessible text/ARIA, while
preserving the existing warningTooltipId tooltip behavior. Apply the same
accessibility treatment to the related warning rendering at the additional
location.

In `@packages/bruno-app/src/hooks/useMissingFileCheck/index.js`:
- Around line 31-39: Update the early idle-return branch in the useEffect of
useMissingFileCheck to increment seqRef.current before returning when paths are
empty or basePath is falsy. Keep the existing idle state reset unchanged so any
in-flight check is invalidated and cannot overwrite it with stale results.

In `@tests/request/binary-file/binary-file-missing-warning.spec.ts`:
- Around line 42-54: The binary-file warning spec should stop using inline
page.locator selectors. Add selected, fileName, and warningIcon helpers under
locators.filePicker in the page locator module, then update the spec to use
those helpers while preserving the existing visibility, text, class, hover, and
tooltip assertions.
🪄 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 Plus

Run ID: 228e0025-7d16-4b77-9657-eb6da29e529e

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1170b and f078a29.

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

Comment on lines +106 to +111
{hasMissingFiles ? (
<IconAlertTriangleFilled
data-tooltip-id={warningTooltipId}
className="warning-icon"
size={16}
/>

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the warning discoverable without hover.

The warning is attached to a plain, non-focusable SVG with a mouse-triggered tooltip, so keyboard and screen-reader users cannot reliably discover why the file is highlighted. Use a focusable semantic trigger or provide equivalent accessible text/ARIA.

Also applies to: 128-138

🤖 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 106
- 111, Update the warning icon rendering in FilePickerEditor so the missing-file
warning is discoverable without hover: wrap the icon in a focusable semantic
trigger or add equivalent accessible text/ARIA, while preserving the existing
warningTooltipId tooltip behavior. Apply the same accessibility treatment to the
related warning rendering at the additional location.

Comment on lines +31 to +39
useEffect(() => {
const currentPaths = pathsRef.current;
if (!currentPaths.length || !basePath) {
setState({ status: 'idle', missingPaths: [] });
return;
}

const seq = ++seqRef.current;
setState({ status: 'checking', missingPaths: [] });

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Invalidate in-flight checks when entering idle.

When paths becomes empty or basePath becomes falsy, the effect sets idle without advancing seqRef. A prior Promise.all can then resolve with the same sequence and overwrite the idle state with stale ready/missingPaths, allowing an obsolete warning to reappear. Increment the sequence before the early return.

Proposed fix
 useEffect(() => {
+  const seq = ++seqRef.current;
   const currentPaths = pathsRef.current;
   if (!currentPaths.length || !basePath) {
     setState({ status: 'idle', missingPaths: [] });
     return;
   }

-  const seq = ++seqRef.current;
   setState({ status: 'checking', missingPaths: [] });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
const currentPaths = pathsRef.current;
if (!currentPaths.length || !basePath) {
setState({ status: 'idle', missingPaths: [] });
return;
}
const seq = ++seqRef.current;
setState({ status: 'checking', missingPaths: [] });
useEffect(() => {
const seq = ++seqRef.current;
const currentPaths = pathsRef.current;
if (!currentPaths.length || !basePath) {
setState({ status: 'idle', missingPaths: [] });
return;
}
setState({ status: 'checking', missingPaths: [] });
🤖 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/hooks/useMissingFileCheck/index.js` around lines 31 -
39, Update the early idle-return branch in the useEffect of useMissingFileCheck
to increment seqRef.current before returning when paths are empty or basePath is
falsy. Keep the existing idle state reset unchanged so any in-flight check is
invalidated and cannot overwrite it with stale results.

Comment on lines +42 to +54
const filePicker = page.locator('.file-picker-selected').first();
await expect(filePicker).toBeVisible({ timeout: 5000 });
await expect(filePicker.locator('.file-name')).toHaveText('missing-payload.bin');

// Warning: the missing-file styling, icon and tooltip must be present.
await expect(filePicker).toHaveClass(/has-warning/);
const warningIcon = filePicker.locator('.warning-icon');
await expect(warningIcon).toBeVisible();

await warningIcon.hover();
const tooltip = locators.filePicker.warningTooltip();
await expect(tooltip).toBeVisible();
await expect(tooltip).toContainText(MISSING_FILE_WARNING);

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Move these selectors into the page locator module.

This spec directly uses page.locator(...) for .file-picker-selected, .file-name, and .warning-icon. Add selected, fileName, and warningIcon helpers under locators.filePicker and consume them here.

As per path instructions, specs must not inline raw selectors; selectors belong in tests/utils/page/* page modules.

🤖 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/request/binary-file/binary-file-missing-warning.spec.ts` around lines
42 - 54, The binary-file warning spec should stop using inline page.locator
selectors. Add selected, fileName, and warningIcon helpers under
locators.filePicker in the page locator module, then update the spec to use
those helpers while preserving the existing visibility, text, class, hover, and
tooltip assertions.

Source: Path instructions

…ilenames and improve warning tooltip layout with icon integration. Adjust StyledWrapper to utilize theme-based border radius for consistency.
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