Skip to content

feat(description): file binary description implementation - #8434

Merged
sid-bruno merged 12 commits into
usebruno:mainfrom
sid-bruno:feat/file-binary-description
Jul 9, 2026
Merged

sid-bruno merged 12 commits into
usebruno:mainfrom
sid-bruno:feat/file-binary-description

Conversation

@sid-bruno

@sid-bruno sid-bruno commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Additional file/binary form descriptions which aren't a part of Opencollection schema right now, keeping it seperate
to not block the feature implementation

Additionally fixes a bug in the file selector which was using the wrong event prop

Opencollection PR: opencollection-dev/opencollection#59

Stacked on: #8269

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
    • Added per-file Description support to request Body: file tables, including multiline editing and saving.
    • Descriptions now persist and round-trip across YAML/BRU and OpenCollection conversions and are included in copy/export flows.
  • Bug Fixes
    • Improved editable table column resizing for more consistent behavior.
    • Updated selection handling so editing a non-selected file’s description no longer steals selection.
  • Tests
    • Added/expanded Playwright and conversion tests to verify description persistence and round-tripping.

@coderabbitai

coderabbitai Bot commented Jun 30, 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

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: c42d9dde-0bc7-493d-a568-1e98ccdc8b84

📥 Commits

Reviewing files that changed from the base of the PR and between 03765d6 and deb887f.

📒 Files selected for processing (2)
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
  • packages/bruno-filestore/src/formats/yml/common/body.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/bruno-filestore/src/formats/yml/common/body.spec.ts
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js

Walkthrough

Adds file-entry description support across schema, converters, Redux state, UI editors, and persistence tests. It also changes environment-variable table resizing to use the adjacent column directly.

Changes

File description support

Layer / File(s) Summary
Schema and converter contracts
packages/bruno-schema-types/src/common/file.ts, packages/bruno-schema/src/collections/index.js, packages/bruno-converters/src/opencollection/common/body.ts, packages/bruno-filestore/src/formats/yml/common/body.ts, packages/bruno-converters/package.json, packages/bruno-filestore/package.json
FileEntry and file-body schemas now include description, and Bruno/OpenCollection file-body conversion paths now read and write it; both converter packages also bump @opencollection/types.
State and UI editing
packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js, packages/bruno-app/src/utils/collections/index.js, packages/bruno-app/src/components/RequestPane/FileBody/index.js, packages/bruno-app/src/components/RequestPane/FileBody/StyledWrapper.js, packages/bruno-app/src/components/EditableTable/descriptionColumn.js, packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleFileBody/index.js
Redux file rows initialize and preserve description, FileBody renders and saves a Description cell with MultiLineEditor, ResponseExampleFileBody adds the description column, and related table widths and placeholder behavior are updated.
Fixtures and persistence tests
packages/bruno-converters/tests/opencollection/description.spec.js, packages/bruno-filestore/src/formats/yml/common/body.spec.ts, tests/request/description/fixtures/collection/file-with-descriptions.bru, tests/request/description/write-request-body-file-description.spec.ts, tests/request/description-yml/fixtures/collection/file-with-descriptions.yml, tests/request/description-yml/write-request-body-file-description.spec.ts
New fixtures and tests cover multiline description entry and round-trip persistence through BRU, YAML, and OpenCollection file-body conversions.

Binary file selection switch

Layer / File(s) Summary
Selection switch test
tests/request/binary-file/binary-file-selection-switch.spec.ts
A Playwright test creates two binary files, switches the selected row, and checks the request preview updates to the active file’s SHA-256.

Environment variable column resize

Layer / File(s) Summary
Next-column lookup
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js
handleResizeStart now resolves the next resizable column from the adjacent array entry and exits when none exists.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FileBody
  participant ReduxStore
  participant Converter
  participant OpenCollection

  User->>FileBody: edit Description in MultiLineEditor
  FileBody->>ReduxStore: handleParamChange(type=description)
  ReduxStore->>Converter: persist file entry
  Converter->>OpenCollection: toOpenCollectionBody(file)
  OpenCollection->>Converter: fromOpenCollectionBody(file)
  Converter-->>ReduxStore: restore description on reload
Loading

Possibly related PRs

  • usebruno/bruno#6843: Shares the environment-variable column resize change in EnvironmentVariablesTable/index.js.
  • usebruno/bruno#8269: Shares the createDescriptionColumn and MultiLineEditor description-editing path.

Suggested reviewers: bijin-bruno, lohit-bruno, naman-bruno, utkarsh-bruno

Poem

A tiny note found room to grow,
from editor cell to saved-file flow.
Descriptions hum in rows and YAML seams,
while columns resize with cleaner schemes.
✨

🚥 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 clearly related to the PR’s main change: adding file/binary description support.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)
packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js

ast-grep timed out on this file


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.

@sid-bruno sid-bruno changed the title feat: file binary description implementation feat(description): file binary description implementation Jun 30, 2026
Covers the UI table, FileEntry schema, .bru and .yml file persistence,
OpenCollection converters, and end-to-end tests.
@sid-bruno
sid-bruno force-pushed the feat/file-binary-description branch from 8d6d6d0 to b489516 Compare July 7, 2026 16:35
@pull-request-size pull-request-size Bot added size/L and removed size/XL labels Jul 7, 2026
@sid-bruno
sid-bruno marked this pull request as ready for review July 9, 2026 08:46
Copilot AI review requested due to automatic review settings July 9, 2026 08:46

Copilot AI 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.

Pull request overview

Adds support for per-file descriptions in file request bodies, enabling round-tripping through Bruno’s schema, app state, YAML/.bru persistence, and OpenCollection conversions (kept separate from the OpenCollection schema where needed).

Changes:

  • Add description to file-body entry types/schema and propagate it through OpenCollection/YAML conversion layers.
  • Add UI support for editing file-body descriptions (request pane + response example), including column sizing updates.
  • Add Playwright and unit/integration tests plus fixture updates; bump @opencollection/types to 0.10.0.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/request/description/write-request-body-file-description.spec.ts Playwright coverage for editing file-body description and persisting to .bru.
tests/request/description/fixtures/collection/file-with-descriptions.bru New .bru fixture with file-body @description annotations.
tests/request/description-yml/write-request-body-file-description.spec.ts Playwright coverage for YAML variant persistence.
tests/request/description-yml/fixtures/collection/file-with-descriptions.yml New .yml fixture containing file-body description fields (including multiline).
packages/bruno-schema/src/collections/index.js Schema updated to allow description on file-body entries.
packages/bruno-schema-types/src/common/file.ts Adds `description?: string
packages/bruno-filestore/src/formats/yml/common/body.ts YAML <-> Bruno body conversion updated to read/write file-body descriptions.
packages/bruno-filestore/src/formats/yml/common/body.spec.ts Unit tests for file-body description conversion and round-tripping.
packages/bruno-filestore/package.json Bumps @opencollection/types to 0.10.0.
packages/bruno-converters/tests/opencollection/description.spec.js Converter round-trip tests extended to cover file-body descriptions.
packages/bruno-converters/src/opencollection/common/body.ts OpenCollection conversion updated to include file-body descriptions.
packages/bruno-converters/package.json Bumps @opencollection/types to 0.10.0.
packages/bruno-app/src/utils/collections/index.js Includes file-body entry description in export transform.
packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js Initializes and persists file-body description in Redux updates.
packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleFileBody/index.js Adds Description column support for response-example file body table.
packages/bruno-app/src/components/RequestPane/FileBody/StyledWrapper.js Adjusts table column widths to accommodate the new Description column.
packages/bruno-app/src/components/RequestPane/FileBody/index.js Adds Description column/editor and exposes data-testid for Playwright targeting.
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js Resizing logic tweak for adjacent-column selection.
packages/bruno-app/src/components/EditableTable/descriptionColumn.js Adds placeholder behavior for empty description cells.
package-lock.json Lockfile update for @opencollection/[email protected].

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

🧹 Nitpick comments (2)
packages/bruno-converters/src/opencollection/common/body.ts (1)

133-146: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove unnecessary fileWithDescription alias.

Line 140 creates const fileWithDescription = file; without any type cast. Unlike the bruno-filestore counterpart (which casts file as FileBodyVariant), this alias adds no type information — fileWithDescription has the exact same type as file. The description extraction can use file directly.

♻️ Proposed refactor
           file: (fileBody.data || []).map((file): BrunoFileEntry => {
             const entry: BrunoFileEntry = {
               uid: uuid(),
               filePath: file.filePath || '',
               contentType: file.contentType || '',
               selected: file.selected !== false
             };
-            const fileWithDescription = file;
-            const desc = typeof fileWithDescription.description === 'string'
-              ? fileWithDescription.description
-              : (fileWithDescription.description as { content?: string } | undefined)?.content;
+            const desc = typeof file.description === 'string'
+              ? file.description
+              : (file.description as { content?: string } | undefined)?.content;
             if (desc && desc.trim().length) entry.description = desc;
             return entry;
           })
🤖 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-converters/src/opencollection/common/body.ts` around lines 133
- 146, Remove the unnecessary fileWithDescription alias in the body mapping
logic and read description directly from file. In the map callback that builds
BrunoFileEntry, keep the existing description extraction behavior but replace
references to fileWithDescription with file since the alias adds no type
information; this refactor belongs in the file-body conversion block that uses
uuid() and creates the entry object.
tests/request/description-yml/write-request-body-file-description.spec.ts (1)

21-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer user-like interaction over direct CodeMirror API manipulation.

descCell.evaluate() calls cm.setValue() directly on the CodeMirror instance, bypassing user interaction. This tests implementation details rather than user-visible behavior and will break if the CodeMirror internal API changes. Consider clicking into the editor and using page.keyboard.type() instead, or extract a reusable CodeMirror helper in tests/utils/page/* if direct interaction proves unreliable.

Additionally, wrapping the Arrange / Act / Assert phases in test.step() would improve report readability, as recommended in the Playwright testing guide.

As per path instructions: "Promote the use of test.step as much as possible so the generated reports are easier to read" and "Tests must verify user-visible behavior, not implementation details."

♻️ Proposed refactor with test.step and user-like interaction
 test('writes a multiline description to a file body row and persists it to the .yml file', async ({
   pageWithUserData: page,
   collectionFixturePath
 }) => {
+  await test.step('Arrange: open request and locate description cell', async () => {
     await openRequest(page, COLLECTION, 'file-with-descriptions');
     await selectRequestPaneTab(page, 'Body');
 
     const fileTable = page.getByTestId('file-body-table');
     const plainRow = fileTable.locator('tbody tr').nth(2);
     const descCell = plainRow.getByTestId('column-description');
+  });
 
-  await descCell.evaluate((el) => {
-    const cmEl = el.querySelector('.CodeMirror');
-    if (!cmEl) throw new Error('No CodeMirror in plain-field description cell');
-    const cm = (cmEl as any).CodeMirror;
-    if (!cm) throw new Error('CodeMirror instance not found');
-    cm.setValue('File line one\nFile line two');
-  });
+  await test.step('Act: type multiline description into the editor', async () => {
+    await descCell.click();
+    await page.keyboard.type('File line one');
+    await page.keyboard.press('Enter');
+    await page.keyboard.type('File line two');
+  });
 
-  await expect(descCell.locator('.CodeMirror-line').nth(0)).toHaveText('File line one');
-  await expect(descCell.locator('.CodeMirror-line').nth(1)).toHaveText('File line two');
+  await test.step('Assert: verify editor content and persisted file', async () => {
+    await expect(descCell.locator('.CodeMirror-line').nth(0)).toHaveText('File line one');
+    await expect(descCell.locator('.CodeMirror-line').nth(1)).toHaveText('File line two');
 
-  await page.keyboard.press(saveShortcut);
-  await expect(page.getByText('Request saved successfully')).toBeVisible({ timeout: 5000 });
+    await page.keyboard.press(saveShortcut);
+    await expect(page.getByText('Request saved successfully')).toBeVisible({ timeout: 5000 });
 
-  const ymlPath = path.join(collectionFixturePath!, 'file-with-descriptions.yml');
-  const fileContent = fs.readFileSync(ymlPath, 'utf8');
+    const ymlPath = path.join(collectionFixturePath!, 'file-with-descriptions.yml');
+    const fileContent = fs.readFileSync(ymlPath, 'utf8');
 
-  expect(fileContent).toContain('description:');
-  expect(fileContent).toContain('File line one');
-  expect(fileContent).toContain('File line two');
+    expect(fileContent).toContain('description:');
+    expect(fileContent).toContain('File line one');
+    expect(fileContent).toContain('File line two');
+  });
 });

Note: If page.keyboard.type() does not reliably trigger CodeMirror's internal state updates, consider extracting a typeIntoCodeMirror(locator, text) helper into tests/utils/page/* that wraps the evaluate-based approach. This keeps the spec clean and centralizes the implementation-detail coupling in one place.

🤖 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/description-yml/write-request-body-file-description.spec.ts`
around lines 21 - 30, The test in write-request-body-file-description.spec.ts
should avoid calling descCell.evaluate() and cm.setValue() directly on the
CodeMirror instance, since that couples the spec to internal implementation
details. Update the scenario to interact like a user by focusing the editor
through descCell and typing the multiline text with page.keyboard.type(), or, if
that is unreliable, move the direct CodeMirror manipulation into a reusable
helper under tests/utils/page/* and call that helper from the spec. Wrap the
Arrange/Act/Assert sections in test.step() to make the report clearer, and keep
the final assertions on the visible .CodeMirror-line content.

Source: 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.

Nitpick comments:
In `@packages/bruno-converters/src/opencollection/common/body.ts`:
- Around line 133-146: Remove the unnecessary fileWithDescription alias in the
body mapping logic and read description directly from file. In the map callback
that builds BrunoFileEntry, keep the existing description extraction behavior
but replace references to fileWithDescription with file since the alias adds no
type information; this refactor belongs in the file-body conversion block that
uses uuid() and creates the entry object.

In `@tests/request/description-yml/write-request-body-file-description.spec.ts`:
- Around line 21-30: The test in write-request-body-file-description.spec.ts
should avoid calling descCell.evaluate() and cm.setValue() directly on the
CodeMirror instance, since that couples the spec to internal implementation
details. Update the scenario to interact like a user by focusing the editor
through descCell and typing the multiline text with page.keyboard.type(), or, if
that is unreliable, move the direct CodeMirror manipulation into a reusable
helper under tests/utils/page/* and call that helper from the spec. Wrap the
Arrange/Act/Assert sections in test.step() to make the report clearer, and keep
the final assertions on the visible .CodeMirror-line content.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e749790-5f8c-4525-ad1d-00622ef5e8c9

📥 Commits

Reviewing files that changed from the base of the PR and between ce7dde1 and f16c2cf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • packages/bruno-app/src/components/EditableTable/descriptionColumn.js
  • packages/bruno-app/src/components/EnvironmentVariablesTable/index.js
  • packages/bruno-app/src/components/RequestPane/FileBody/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/FileBody/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleFileBody/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
  • packages/bruno-app/src/utils/collections/index.js
  • packages/bruno-converters/package.json
  • packages/bruno-converters/src/opencollection/common/body.ts
  • packages/bruno-converters/tests/opencollection/description.spec.js
  • packages/bruno-filestore/package.json
  • packages/bruno-filestore/src/formats/yml/common/body.spec.ts
  • packages/bruno-filestore/src/formats/yml/common/body.ts
  • packages/bruno-schema-types/src/common/file.ts
  • packages/bruno-schema/src/collections/index.js
  • tests/request/description-yml/fixtures/collection/file-with-descriptions.yml
  • tests/request/description-yml/write-request-body-file-description.spec.ts
  • tests/request/description/fixtures/collection/file-with-descriptions.bru
  • tests/request/description/write-request-body-file-description.spec.ts

@pull-request-size pull-request-size Bot removed the size/L label Jul 9, 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.

🧹 Nitpick comments (5)
packages/bruno-app/src/components/RequestPane/FileBody/index.js (1)

147-167: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Description column duplicates logic already factored into createDescriptionColumn.

This inline MultiLineEditor wiring (value fallback, onSave/onRun/onChange plumbing, placeholder logic) mirrors createDescriptionColumn in packages/bruno-app/src/components/EditableTable/descriptionColumn.js, which was extended in this same PR. Since FileBody doesn't use the generic EditableTable, reuse isn't a drop-in swap, but consider extracting a small shared render helper to avoid the two implementations drifting (e.g. placeholder text, description fallback value) as the feature evolves.

🤖 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/RequestPane/FileBody/index.js` around lines
147 - 167, The Description column in FileBody duplicates the same
MultiLineEditor wiring already centralized in createDescriptionColumn, so factor
the shared value/placeholder/onChange/onSave/onRun setup into a reusable helper
or shared renderer instead of maintaining two separate implementations. Use the
existing createDescriptionColumn in
packages/bruno-app/src/components/EditableTable/descriptionColumn.js as the
reference for the shared behavior, and update FileBody to consume that helper so
the fallback value, placeholder text, and description-change plumbing stay
consistent as the feature evolves.
packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js (1)

1726-1741: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

isSelectionUpdate is always true for FileBody's calls — the real gate is param.selected's value, not edit type.

Since FileBody.handleParamChange always dispatches a cloneDeep of the full existing param (which always has a boolean selected from creation), typeof action.payload.param.selected === 'boolean' is true for every edit (filePath, contentType, description edits included), not just selection changes. The intended "only touch selection on selection edits" behavior currently works only because non-selected files keep selected: false unchanged in the clone — so the exclusivity remap on lines 1736-1741 harmlessly re-runs (no-op) whenever editing fields on the already-selected file. This is not a bug given current callers, but the flag name/comment could mislead a future reader into thinking it's gated on an explicit type: 'selected' signal from the UI layer.

Consider either renaming/commenting to clarify intent, or having FileBody only include selected in the payload when the edit type is 'selected', to make the reducer's guard meaningfully independent of caller cloning behavior.

🤖 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/providers/ReduxStore/slices/collections/index.js`
around lines 1726 - 1741, Clarify the selection-update guard in the collection
reducer: `isSelectionUpdate` in the `collections` slice is currently driven by
the presence of `param.selected`, but `FileBody.handleParamChange` always clones
and dispatches a full param object so that flag is effectively always present.
Update `FileBody.handleParamChange` and the reducer path that sets
`param.selected`/remaps `item.draft.request.body.file` so selection exclusivity
is only triggered for explicit selection edits, or rename/comment the guard to
reflect that it depends on the caller’s payload shape rather than an edit-type
signal.
tests/request/binary-file/binary-file-selection-switch.spec.ts (3)

35-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

test.describe.serial is unnecessary with a single test.

With only one test in this describe block, .serial has no effect. Consider using test.describe instead, or keep .serial if you plan to add more tests that share the beforeAll state.

🤖 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-selection-switch.spec.ts` at line 35,
The use of test.describe.serial in the "File / Binary body - switching selected
file" suite is unnecessary because there is only one test in that block. Update
the describe wrapper in binary-file-selection-switch.spec.ts to use
test.describe instead of test.describe.serial, unless you intend to add
additional tests that rely on shared beforeAll state.

17-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move inline raw selectors into page modules per path instructions.

The spec uses several inline raw CSS selectors (input[type="radio"], .dropdown-item, .file-picker-btn, .file-picker-selected, table tbody tr) on lines 19, 22, 76, 81, 82, 86, 87, and 90. The path instructions state: "Centralize locators and actions in page modules under tests/utils/page/*; never inline raw selectors in a spec." While the comment on line 16 justifies keeping the helper functions local, the locators themselves should be defined in page modules (e.g., via buildCommonLocators or a dedicated file-body page module) and consumed here.

♻️ Suggested refactor: extract locators to a page module

For example, add file-body locators to tests/utils/page/locators.ts or a dedicated tests/utils/page/fileBody.ts:

// In tests/utils/page/fileBody.ts
export const buildFileBodyLocators = (page: Page) => ({
  rows: () => page.locator('table tbody tr'),
  radioInRow: (index: number) => page.locator('table tbody tr').nth(index).locator('input[type="radio"]'),
  addFileButton: () => page.getByRole('button', { name: /Add File/i }),
  filePickerBtn: () => page.locator('.file-picker-btn'),
  filePickerSelected: () => page.locator('.file-picker-selected'),
  dropdownItem: (text: string) => page.locator('.dropdown-item').filter({ hasText: text }),
});

Then consume them in the spec instead of inlining raw selectors.

🤖 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-selection-switch.spec.ts` around lines
17 - 33, The binary file selection spec still inlines raw CSS selectors instead
of using page modules, so move those locators into a shared helper under
tests/utils/page and have the spec consume them via buildCommonLocators or a
dedicated file-body module. Update the local helpers selectRow and
sendAndAssertSha256 only to use the exported locator methods for the radio rows
and file/body UI, and replace every inline selector such as the radio, dropdown,
file picker, selected state, and table row lookups with named page-module
accessors.

Source: Path instructions


26-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider keeping assertions in the spec body rather than in helpers.

The path instructions note: "Put assertions in the spec: action helpers should synchronize (wait for UI readiness) but not assert pass/fail conditions." While sendAndAssertSha256 is a test-local helper rather than a page-module action, inlining the assertions in the test body (or splitting send vs. assert) would make failure diagnostics clearer in the report—each expect would map directly to a test.step line.

🤖 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-selection-switch.spec.ts` around lines
26 - 33, The helper sendAndAssertSha256 in the binary-file-selection-switch spec
mixes an action with assertions, which reduces failure clarity. Split it so the
helper only performs the request and waits for the UI to be ready, then move the
sha256 parsing and expect checks into the spec body or a separate assertion
helper used directly by the test. Keep the assertions near the test flow so each
expect is reported against the relevant test step and the failure diagnostics
stay explicit.

Source: 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.

Nitpick comments:
In `@packages/bruno-app/src/components/RequestPane/FileBody/index.js`:
- Around line 147-167: The Description column in FileBody duplicates the same
MultiLineEditor wiring already centralized in createDescriptionColumn, so factor
the shared value/placeholder/onChange/onSave/onRun setup into a reusable helper
or shared renderer instead of maintaining two separate implementations. Use the
existing createDescriptionColumn in
packages/bruno-app/src/components/EditableTable/descriptionColumn.js as the
reference for the shared behavior, and update FileBody to consume that helper so
the fallback value, placeholder text, and description-change plumbing stay
consistent as the feature evolves.

In `@packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js`:
- Around line 1726-1741: Clarify the selection-update guard in the collection
reducer: `isSelectionUpdate` in the `collections` slice is currently driven by
the presence of `param.selected`, but `FileBody.handleParamChange` always clones
and dispatches a full param object so that flag is effectively always present.
Update `FileBody.handleParamChange` and the reducer path that sets
`param.selected`/remaps `item.draft.request.body.file` so selection exclusivity
is only triggered for explicit selection edits, or rename/comment the guard to
reflect that it depends on the caller’s payload shape rather than an edit-type
signal.

In `@tests/request/binary-file/binary-file-selection-switch.spec.ts`:
- Line 35: The use of test.describe.serial in the "File / Binary body -
switching selected file" suite is unnecessary because there is only one test in
that block. Update the describe wrapper in binary-file-selection-switch.spec.ts
to use test.describe instead of test.describe.serial, unless you intend to add
additional tests that rely on shared beforeAll state.
- Around line 17-33: The binary file selection spec still inlines raw CSS
selectors instead of using page modules, so move those locators into a shared
helper under tests/utils/page and have the spec consume them via
buildCommonLocators or a dedicated file-body module. Update the local helpers
selectRow and sendAndAssertSha256 only to use the exported locator methods for
the radio rows and file/body UI, and replace every inline selector such as the
radio, dropdown, file picker, selected state, and table row lookups with named
page-module accessors.
- Around line 26-33: The helper sendAndAssertSha256 in the
binary-file-selection-switch spec mixes an action with assertions, which reduces
failure clarity. Split it so the helper only performs the request and waits for
the UI to be ready, then move the sha256 parsing and expect checks into the spec
body or a separate assertion helper used directly by the test. Keep the
assertions near the test flow so each expect is reported against the relevant
test step and the failure diagnostics stay explicit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a85e2c6d-7f8d-4fd4-ab4c-45f73946b045

📥 Commits

Reviewing files that changed from the base of the PR and between 65ed6ae and 759bfae.

📒 Files selected for processing (9)
  • packages/bruno-app/src/components/EditableTable/descriptionColumn.js
  • packages/bruno-app/src/components/RequestPane/FileBody/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleFileBody/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/index.spec.js
  • packages/bruno-converters/src/opencollection/common/body.ts
  • tests/request/binary-file/binary-file-selection-switch.spec.ts
  • tests/request/description-yml/write-request-body-file-description.spec.ts
  • tests/request/description/write-request-body-file-description.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/request/description-yml/write-request-body-file-description.spec.ts
  • packages/bruno-converters/src/opencollection/common/body.ts
  • tests/request/description/write-request-body-file-description.spec.ts
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleFileBody/index.js

@sid-bruno
sid-bruno merged commit ff2f2d0 into usebruno:main Jul 9, 2026
11 of 16 checks passed
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Aug 21, 2026
* fix: handle missing location header in redirect error response (usebruno#7725)

* fix(request-panel)/websocket and grpc tooltip overflow fixed in request panel (usebruno#8544)

* fix(request-panel)/websocket and grpx tooltip overflow fixed in request panel

* added test ids and updated the locators for request panel icons

* test(auth): fix modified-indicator inherit spec test (usebruno#8550)

* test(auth): fix modified-indicator inherit spec test

* fix(locators): updated locators for inherit

* feat(description): file binary description implementation (usebruno#8434)

* Add description support to file body entries

Covers the UI table, FileEntry schema, .bru and .yml file persistence,
OpenCollection converters, and end-to-end tests.

* chore: update @opencollection/types to version 0.10.0 and adjust related code

* fix: ensure placeholder is displayed correctly in description editor

* fix: improve column resizing logic in EnvironmentVariablesTable

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* fix: remove unused import of FileEntry in body.ts

* feat: enhance file handling and selection logic in various components

* test: refactor file description tests for improved readability and structure

* refactor: streamline test setup for binary file selection

* test: improve comments for clarity in file body description tests

* refactor: simplify selection update logic in collections slice

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* fix(mount): show requests that failed to load in the collection overview (usebruno#8545)

* fix(mount): show requests that failed to load in the collection overview

Partial/errored requests were being dropped or mis-rendered:

- collection-watcher (v1): the synchronous add path and the change path only
  logged parse errors and never emitted the item, so failed requests never
  reached the renderer. Both now send a partial item, matching the async
  worker path.
- mount v2: reconcile dropped `raw` for errored items; it is now forwarded so
  the item's size can be derived, and size is set for every item.
- RequestsNotLoaded: the relative pathname is computed separator-agnostically
  so it renders on Windows, and errored items are included.

* fix(mount): render v2 requests that failed to parse in the sidebar

An errored request had no parsed `request`, so tree-builder set
`request: undefined`. The main->renderer payload is JSON round-tripped, which
drops undefined keys, so the item reached the renderer without a `request`
property and `isItemARequest` (which requires it) excluded it from the sidebar.
Give errored items an empty `request` object so they survive serialization and
render.

Also render the "not loaded" table from the same filtered list used for the
empty-state check, so errored items are listed consistently.

* fix(mount): guard against NaN size and unstable keys for unloaded requests

* fix(mount): recover unloaded requests on valid re-parse without crashing the reducer

* feat(mount): moved the assignments in change reducer

---------

Co-authored-by: Chirag Chandrashekhar <[email protected]>

---------

Co-authored-by: Pragadesh-45 <[email protected]>
Co-authored-by: sachin-thakur-bruno <[email protected]>
Co-authored-by: Pooja <[email protected]>
Co-authored-by: Sid <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
Co-authored-by: Bijin A B <[email protected]>
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