Repository navigation
feat(code-mirror-search): add replace and replace-all with search position, debouncing and tests - #8715
Conversation
…ition, debouncing and tests
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe CodeMirror search/replace implementation is modularized with caching, viewport marking, replacement utilities, imperative controls, shared keyboard bindings, read-only support, refreshed styling, and unit and Playwright coverage. ChangesSearch and Replace Workflow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CodeEditor
participant CodeMirrorSearch
participant CodeMirror
User->>CodeEditor: Press Cmd/Ctrl+F
CodeEditor->>CodeMirrorSearch: Open or focus search
CodeMirrorSearch->>CodeMirror: Find and mark matches
User->>CodeMirrorSearch: Navigate or replace
CodeMirrorSearch->>CodeMirror: Update document
CodeMirror-->>CodeMirrorSearch: Emit change event
CodeMirrorSearch->>CodeMirrorSearch: Refresh match state
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (2)
tests/code-editor/search-replace.spec.ts (1)
37-304: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider
test.stepfor readability of reports.None of the tests use
test.step, even though most have multiple logical phases (open bar → act → assert → close). As per path instructions, "Promote the use oftest.stepas much as possible so the generated reports are easier to read."🤖 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/code-editor/search-replace.spec.ts` around lines 37 - 304, Improve Playwright report readability by grouping the logical phases of the tests in the `CodeEditor Search/Replace` suite into descriptive `test.step` blocks, especially the repeated open/search or replace, action, assertion, and close flows. Apply this consistently across the test cases without changing their behavior or assertions.Source: Path instructions
tests/utils/page/code-editor-search.ts (1)
44-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHardcoded 50ms sleep after
setValue.Per path instructions, hardcoded
page.waitForTimeout()should be avoided "unless absolutely necessary and the locator cannot be found using existingexpect()playwright calls." SincesetValueis synchronous insideevaluate(), this timeout is likely papering over an async re-render or debounced search-index rebuild. Consider polling a concrete signal (e.g.,cm.getValue()matchingcontent, or waiting for the search result count to settle) instead of a flat delay.🤖 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/utils/page/code-editor-search.ts` around lines 44 - 51, Remove the hardcoded page.waitForTimeout call from setCodeEditorContent and replace it with an explicit Playwright wait for the editor’s value to match content, or another concrete readiness signal for the dependent search index. Keep the synchronous CodeMirror setValue operation and ensure the helper waits only until the required state is observable.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.
Inline comments:
In `@packages/bruno-app/src/components/CodeEditor/index.js`:
- Around line 106-111: Update the CodeEditor lifecycle handling around
buildSearchKeyBindings and the readOnly prop synchronization so replace
shortcuts always use the current readOnly value. Rebuild or update the editor
extraKeys whenever readOnly changes, while preserving the existing
setOption('readOnly', ...) behavior and other key bindings.
In `@packages/bruno-app/src/components/CodeMirrorSearch/index.js`:
- Around line 317-327: Update the dependency array of handleReplaceAll to
include regex, caseSensitive, and wholeWord, matching the values read by
findSearchMatches and the dependency pattern used by handleReplace. Preserve the
existing replacement and focus behavior.
In `@packages/bruno-app/src/components/CodeMirrorSearch/searchKeyBindings.js`:
- Line 1: Update buildSearchKeyBindings to accept an isReadOnly accessor and
invoke it inside openReplace each time a replace shortcut runs, rather than
capturing a readOnly boolean during construction. Update both CodeEditor call
sites to pass isReadOnly: () => this.props.readOnly, preserving live read-only
behavior for all replace shortcuts.
- Around line 13-33: Update buildSearchKeyBindings to accept a live isReadOnly
accessor instead of the captured readOnly boolean, and evaluate it inside the
replace-key handler on each keypress so the handler returns false while the
editor is read-only and opens replace otherwise. Update all callers to pass
functions such as this.props.readOnly accessors, preserving the existing
behavior for search and writable editors.
In `@packages/bruno-app/src/components/FileEditor/CodeEditor/index.js`:
- Around line 76-81: Update the CodeEditor initialization around
buildSearchKeyBindings so changes to this.props.readOnly are propagated to the
live editor after mount, rather than relying on the initially captured value.
Add the necessary component update handling for this CodeEditor variant and
ensure replace shortcuts reflect the current readOnly state.
In `@tests/code-editor/search-replace.spec.ts`:
- Around line 94-99: Centralize all CodeMirror interactions currently
implemented through inline evaluate calls in the affected tests by adding
exported helpers to code-editor-search.ts for selection, cursor placement, and
scrolling, alongside the existing setCodeEditorContent helper. Update the spec
to call these page-module helpers for every affected location, preserving the
current editor IDs and interaction arguments.
---
Nitpick comments:
In `@tests/code-editor/search-replace.spec.ts`:
- Around line 37-304: Improve Playwright report readability by grouping the
logical phases of the tests in the `CodeEditor Search/Replace` suite into
descriptive `test.step` blocks, especially the repeated open/search or replace,
action, assertion, and close flows. Apply this consistently across the test
cases without changing their behavior or assertions.
In `@tests/utils/page/code-editor-search.ts`:
- Around line 44-51: Remove the hardcoded page.waitForTimeout call from
setCodeEditorContent and replace it with an explicit Playwright wait for the
editor’s value to match content, or another concrete readiness signal for the
dependent search index. Keep the synchronous CodeMirror setValue operation and
ensure the helper waits only until the required state is observable.
🪄 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: acbe114b-dd15-44a1-a1a3-af7e4a3cb50f
📒 Files selected for processing (16)
packages/bruno-app/src/components/CodeEditor/index.jspackages/bruno-app/src/components/CodeMirrorSearch/CodeMirrorSearch.spec.jsxpackages/bruno-app/src/components/CodeMirrorSearch/StyledWrapper.jspackages/bruno-app/src/components/CodeMirrorSearch/index.jspackages/bruno-app/src/components/CodeMirrorSearch/markingUtils.jspackages/bruno-app/src/components/CodeMirrorSearch/replaceUtils.jspackages/bruno-app/src/components/CodeMirrorSearch/replaceUtils.spec.jspackages/bruno-app/src/components/CodeMirrorSearch/searchKeyBindings.jspackages/bruno-app/src/components/CodeMirrorSearch/searchUtils.jspackages/bruno-app/src/components/CodeMirrorSearch/searchUtils.spec.jspackages/bruno-app/src/components/Documentation/index.jspackages/bruno-app/src/components/FileEditor/CodeEditor/index.jstests/code-editor/search-replace.spec.tstests/utils/page/code-editor-search.tstests/utils/page/index.tstests/utils/page/locators.ts
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/utils/page/code-editor-search.ts (1)
44-51: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winReplace the fixed timeout with deterministic synchronization.
The helper uses
page.waitForTimeout()after setting the editor value. Wait for an observable editor/application state instead; fixed sleeps can make the suite slower and still leave race conditions unresolved.As per path instructions, avoid hardcoded sleeps unless no locator- or state-based wait is possible.
🤖 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/utils/page/code-editor-search.ts` around lines 44 - 51, Replace the fixed page.waitForTimeout call in setCodeEditorContent with deterministic synchronization based on an observable CodeMirror or application state after setValue completes. Wait for the editor content or relevant rendered state to reflect the new value, while preserving the existing visibility wait and content-setting behavior.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.
Inline comments:
In `@tests/utils/page/code-editor-search.ts`:
- Around line 118-134: Update the CodeMirror helpers around setCodeEditorCursor
and the related operations to wait for el.CodeMirror to become available or
throw an explicit error when it is not initialized; remove silent no-op
behavior, including the getCodeEditorScrollTop fallback of 0, so editor failures
surface before assertions continue.
---
Outside diff comments:
In `@tests/utils/page/code-editor-search.ts`:
- Around line 44-51: Replace the fixed page.waitForTimeout call in
setCodeEditorContent with deterministic synchronization based on an observable
CodeMirror or application state after setValue completes. Wait for the editor
content or relevant rendered state to reflect the new value, while preserving
the existing visibility wait and content-setting behavior.
🪄 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: 2cccb3b7-8654-4748-8885-f41aa07722b2
📒 Files selected for processing (6)
packages/bruno-app/src/components/CodeEditor/index.jspackages/bruno-app/src/components/CodeMirrorSearch/index.jspackages/bruno-app/src/components/CodeMirrorSearch/searchKeyBindings.jspackages/bruno-app/src/components/FileEditor/CodeEditor/index.jstests/code-editor/search-replace.spec.tstests/utils/page/code-editor-search.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- packages/bruno-app/src/components/CodeMirrorSearch/searchKeyBindings.js
- packages/bruno-app/src/components/FileEditor/CodeEditor/index.js
- packages/bruno-app/src/components/CodeEditor/index.js
- tests/code-editor/search-replace.spec.ts
- packages/bruno-app/src/components/CodeMirrorSearch/index.js
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/bruno-app/src/components/CodeMirrorSearch/index.js (2)
289-330: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReplace-all keyboard shortcut isn't blocked when
readOnly.The replace row's rendering is gated with
replaceVisible && !readOnly(Line 346), butisReplaceDisabled(Line 290) and the search-input's Cmd/Ctrl+Enter handler (Lines 321-324) only checkreplaceVisible && !isReplaceDisabled— neither includesreadOnly. SinceuseSearchBarHandle'sopenReplace()setsreplaceVisible = truewithout checkingreadOnly, and the main search input stays rendered/interactive in read-only mode, a Cmd/Ctrl+Enter in the search box could invokehandleReplaceAll()and attempt to mutate a read-only document.🐛 Proposed fix
- const isReplaceDisabled = isDebouncing || !searchText.trim() || matchCount === 0; + const isReplaceDisabled = readOnly || isDebouncing || !searchText.trim() || matchCount === 0;This single change also protects the Replace/Replace All buttons and the replace-input's own Enter handler for free.
🤖 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/CodeMirrorSearch/index.js` around lines 289 - 330, Update isReplaceDisabled in the CodeMirror search component to include readOnly, so the Cmd/Ctrl+Enter path in the search input cannot invoke handleReplaceAll and the existing replace controls and handlers are disabled consistently.
61-76: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winCache hit skips cursor-anchoring (
preferLine) resolution.The
preferLine/newIndexresolution block is nested insideif (!isCacheHit), so it only runs when matches are freshly computed. If the user retypes text that hits the cache (samedocVersion/text/flags — e.g., backspace then retype),newIndexstays0regardless ofpreferLine, and the search always jumps to the first match instead of the nearest match to the cursor. This directly undermines the "search-position handling" feature this PR introduces.🐛 Proposed fix
let matches = searchMatches.current; if (!isCacheHit) { matches = findSearchMatches(editor, text, regex, caseSensitive, wholeWord); searchMatches.current = matches; searchCacheKey.current = newCacheKey; setMatchCount(matches.length); - - if (preferLine !== null && newIndex === 0) { - const nearestIdx = matches.findIndex((m) => m.from.line >= preferLine); - newIndex = nearestIdx >= 0 ? nearestIdx : 0; - } } + + if (preferLine !== null && newIndex === 0) { + const nearestIdx = matches.findIndex((m) => m.from.line >= preferLine); + newIndex = nearestIdx >= 0 ? nearestIdx : 0; + }🤖 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/CodeMirrorSearch/index.js` around lines 61 - 76, Move the preferLine/newIndex cursor-anchoring logic out of the !isCacheHit block so it runs for both cached and freshly computed matches. Keep cache updates and match-count updates limited to cache misses, while resolving the nearest match from the reused matches whenever preferLine is set and newIndex is zero.
🤖 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/CodeMirrorSearch/useSearchBarHandle.js`:
- Around line 64-88: Update focusAtCursor to reuse searchMatches.current only
when searchCacheKey.current matches createCacheKey(docVersion.current,
searchText, regex, caseSensitive, wholeWord), mirroring doSearch’s cache
validation. Otherwise recompute matches with findSearchMatches, and only update
searchCacheKey.current after obtaining matches for the current search state.
---
Outside diff comments:
In `@packages/bruno-app/src/components/CodeMirrorSearch/index.js`:
- Around line 289-330: Update isReplaceDisabled in the CodeMirror search
component to include readOnly, so the Cmd/Ctrl+Enter path in the search input
cannot invoke handleReplaceAll and the existing replace controls and handlers
are disabled consistently.
- Around line 61-76: Move the preferLine/newIndex cursor-anchoring logic out of
the !isCacheHit block so it runs for both cached and freshly computed matches.
Keep cache updates and match-count updates limited to cache misses, while
resolving the nearest match from the reused matches whenever preferLine is set
and newIndex is zero.
🪄 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: 9262e82e-2c7f-46be-8104-930703d61574
📒 Files selected for processing (2)
packages/bruno-app/src/components/CodeMirrorSearch/index.jspackages/bruno-app/src/components/CodeMirrorSearch/useSearchBarHandle.js
There was a problem hiding this comment.
🧹 Nitpick comments (3)
packages/bruno-app/src/components/CodeMirrorSearch/CodeMirrorSearch.spec.jsx (3)
363-368: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssertion doesn't verify "advances to next match".
Title claims the replace also advances to the next match, but the test only checks
editor.replaceRangecall count. Add an assertion on the result-count/active-match state after the replace to actually cover the claimed behavior.✅ Suggested additional assertion
fireEvent.keyDown(screen.getByTestId('codemirror-search-replace-input'), { key: 'Enter' }); expect(editor.replaceRange).toHaveBeenCalledTimes(1); + // Verify the active match actually advanced after the replace + expect(screen.getByTestId('codemirror-search-result-count')).not.toHaveTextContent('1 / 3'); });As per coding guidelines, "Ensure failures identify the broken behavior clearly."
🤖 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/CodeMirrorSearch/CodeMirrorSearch.spec.jsx` around lines 363 - 368, Update the test “Enter in replace input triggers replace single and advances to next match” to assert the result-count or active-match state after pressing Enter, confirming it advances from the initial match to the next one. Keep the existing replaceRange assertion and make the new assertion clearly identify a failure to advance.Source: Coding guidelines
218-234: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTest titles promise "select" but only focus is asserted.
Both tests here are named around auto-focus and selection ("auto-focuses and selects the replace input", "focuses and selects the search input"), but the assertions only check
document.activeElement. A regression that drops the.select()call (e.g., input value stays unselected) would not be caught.✅ Suggested additional assertions
act(() => { jest.runAllTimers(); }); - expect(document.activeElement).toBe(screen.getByTestId('codemirror-search-replace-input')); + const replaceInput = screen.getByTestId('codemirror-search-replace-input'); + expect(document.activeElement).toBe(replaceInput); + expect(replaceInput.selectionStart).toBe(0); + expect(replaceInput.selectionEnd).toBe(replaceInput.value.length); });Apply the analogous change to the
focusAtCursor()search-input test.As per coding guidelines, "Assert required behavior rather than incidental details so tests do not overfit current implementation."
🤖 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/CodeMirrorSearch/CodeMirrorSearch.spec.jsx` around lines 218 - 234, Add assertions to the `openReplace()` and `focusAtCursor()` tests verifying that the respective replace and search inputs have their text selected, not just focused. Use the input elements obtained from their existing test IDs and assert the required selection behavior after the timers run.Source: Coding guidelines
370-384: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winOnly Mac modifier (
metaKey) is covered for Replace All shortcut.Bruno targets Windows/Linux/macOS, and the PR objective describes
Cmd/Ctrl+H-style bindings. Both "Replace All" tests only firemetaKey: true; there's no coverage forctrlKey: true(Windows/Linux), so a regression that only checkse.metaKeyin the handler would slip through untested.🤖 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/CodeMirrorSearch/CodeMirrorSearch.spec.jsx` around lines 370 - 384, Extend the Replace All shortcut tests in the Cmd+Enter cases to also dispatch Enter with ctrlKey: true, covering Windows/Linux behavior for both the replace input and search input when replace is open. Keep the existing editor.operation assertion for each modifier path.
🤖 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/CodeMirrorSearch/CodeMirrorSearch.spec.jsx`:
- Around line 363-368: Update the test “Enter in replace input triggers replace
single and advances to next match” to assert the result-count or active-match
state after pressing Enter, confirming it advances from the initial match to the
next one. Keep the existing replaceRange assertion and make the new assertion
clearly identify a failure to advance.
- Around line 218-234: Add assertions to the `openReplace()` and
`focusAtCursor()` tests verifying that the respective replace and search inputs
have their text selected, not just focused. Use the input elements obtained from
their existing test IDs and assert the required selection behavior after the
timers run.
- Around line 370-384: Extend the Replace All shortcut tests in the Cmd+Enter
cases to also dispatch Enter with ctrlKey: true, covering Windows/Linux behavior
for both the replace input and search input when replace is open. Keep the
existing editor.operation assertion for each modifier path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: aff127d3-ac0c-4d69-b3ef-11c5e7ade9c7
📒 Files selected for processing (1)
packages/bruno-app/src/components/CodeMirrorSearch/CodeMirrorSearch.spec.jsx
* fix(ws): keep body-mode dropdown above collapsed sticky headers (#8622) * fix(ws): keep body-mode dropdown above collapsed sticky headers * fix * add: test * rm: only * improvement * fix(app): point generated docs to api-docs CDN path (#8633) * test(sidebar): move sidebar locators to a dedicated file (#8634) Co-authored-by: Bijin A B <[email protected]> * fix(ai): align AI buttons to primary color and refine copy (#8627) * fix(ai): align AI buttons to primary color and refine copy * fix: test --------- Co-authored-by: naman-bruno <[email protected]> * improve: test file arrangement * fix(new-app): prevented validation error on blur and dialog layout shift (#8624) * add: unit test * feat(proxy-settings): show "last refreshed" timestamp on System Proxy panel (#8640) * refactor: improve Wysiwyg editor toolbar interactions, add delete table option * refactor: update documentation code block background theme colors * reconciled autocomplete suggestions against typed prefix to stop dupes + invalid res (#8621) * fix(ai): scope autocomplete API hints by scriptType so pre-request never suggests res * fix(ai): de-duplicated typed token in autocomplete + unify suggestion sanitization * resolved the coderabit review. * fix(ai): reconciled autocomplete suggestions against typed prefix to stop dupes + invalid res * fix(ws): keep selection on current message when deleting another (#8643) * Generate documentation modal text and style changes (#8644) * fix(ui): visual improvements for tables in FileBody and EnvironmentVarsTable (#8632) * fix(StyledWrapper): improve table header styling and add ellipsis for overflow text * fix(FileBody): add truncation to 'Selected' column for better overflow handling * fix: ui improvements for descriptions and tables * fix(EnvironmentVariablesTable): improve formatting and overflow handling in EnvVarValueCell * fix(EnvironmentVariablesTable): add testId to SecretEyeButton for better testing support * chore(claude): add .claude config into the repo (#8648) * fix(app): resolve collection level variables in bru.ctx and add app logs to console (#8650) * fix(app): resolve collection level variables in bru.ctx.variables * fix(app): log bru.ctx.log output into app console * refactor(app): integrate Portal component and enhance form submission (#8645) * chore(mount): route request entries through buildRequestNode in buildTree (#8658) * Update CODEOWNERS (#8666) * refactor: replace DocsLinkModal with contextual DocsLinkPopover and update toolbar link handling * test(environments): env tab eye icon (#8655) * fix(interpolation): add interpolation for akamai-auth (#8631) * fix: show correct New Request shortcut in response placeholder (#8116) * refactor: redesign documentation editor table styles, update mode switch UI * fix(ai): respected the redact-secret-variables toggle for name-pattern variables (#8657) * fix(app): chevron positioning and selector width (#8669) * refactor: extract richtext editor test utility and modularize test suites * fix(ai): improve script types and clarify res restrictions in pre scripts (#8678) * Update beta features section in preferences (#8642) * Refine bug report issue template UI * Rename config.yaml to config.yml * Update FeatureRequest.yaml * chore(ui-component)/added radio group component with storybook and updated the preset component * added storybook docs * added tests for radio group * fix(environments): keep secret values on the secret row when a variable shares its name (#8679) * fix(environments): keep secret values on the secret row when a variable shares its name * rm: comment * fix * fix(mount): redact large text blocks so big .bru files parse fast (#8660) Large .bru files (>=512KB) were fed whole to the ohm parser on mount, which is slow and memory-heavy. Add a redaction pass that splits the flat text blocks (bodies, scripts, tests, docs) out of the file, parses the small remaining skeleton, and re-attaches the extracted content. - redactLargeBruTextBlocks: replaces each top-level text block's content with a content-hash token, returning a skeleton + the extracted values - restoreRedactedBlocks: re-attaches values wherever the tokens land in the parsed object - parse-file uses this for request, collection and folder .bru above the size threshold - values are extracted to be byte-identical to a normal parse (leading blank lines, CRLF terminator and 2-space outdent all handled), proven by round-trip tests that deep-equal against a normal parse * added stories for ui components * feat(mount): follow symlinks when walking collections (#8649) * feat(mount): follow symlinks when walking collections Resolve symbolic-link entries during the mountv2 walk so symlinked request files and directories are classified and listed like their real counterparts. Broken links are skipped. Adds an e2e spec covering symlinked file and directory entries across both formats and with the file cache off and on. * test(mount): use waitForReadyPage and closeElectronApp helpers in symlink spec * fix(mount): guard against directory-symlink cycles when walking A directory symlink that resolves to an ancestor (or itself) previously re-entered the same subtree until the walk exhausted the stack. Track canonical directory paths and skip any directory already visited, so a cyclic link is walked at most once. Extends the symlink e2e spec with an ancestor-pointing link, asserting the mounted tree stays bounded (file-cache path). * removed preset component * fix(size/S):Minor bug fix in the version edit popup for the new version input box (#8672) * Minor bug fix for the version edit popup * Fix unit test case failing issue * added segment group component with stories and tests * revert presets to not use segment group * added theme selector * added readme for storybook * feat(ai): implement immediate security settings save (#8685) * feat(ai): implement immediate security settings save * Update packages/bruno-app/src/components/Preferences/AI/index.js * refactor: migrate editor components to RichTextEditor, and adjust ModeSwitch UI styles * refactor: rename Docs-prefixed editor extensions to Editor * refactor: rename Wysiwyg references to Rich Text * enabled code in storybook and updated Radio and Segmented control API to accept list * refactor: remove code-block test file * removed box shadow * refactor: rename docs CSS classes to editor prefix for consistency * fix(snapshot): environment loss of some workspaces (#8686) * fix: draft attempt 1 * fix(snapshot): enhance active workspace collection handling in SnapshotManager * fix(snapshot): refactor collection lookup assignments for improved readability * fix(snapshot): simplify collection lookup assignments for clarity and maintainability * fix(snapshot): improve handling of workspace-scoped collection lookups and ensure distinct entries based on active workspace preferences * fix: coderabbit comments * added a box shadow on active item * updated shadow to lighter version * improved readme file * added test and stories for toggle switch * added post css loader so Storybook can compile the app's Tailwind CSS * added dropdown stories and test * feat(ai): enhance app handling in AiChatSidebar (#8697) * fix: size of cancel button (#8692) Co-authored-by: shubh-bruno <[email protected]> * task (migration) : hiding migration options and the respective test (#8690) * fix(ui): SensitiveFieldWarning tooltip position (#8698) * feat(ai): add request handling to ai chatbar (#8700) * feat(ai): add request handling to ai chatbar * fix: test * Added changelog for v4 (#8677) * Added changelog for v4 * updated images to use s3 links * Updated url for images * Added version for docs urls * Reverted version change Co-authored-by: Bijin A B <[email protected]> * Updated the YAML migration text --------- Co-authored-by: Bijin A B <[email protected]> * fix(keybindings): new request in active tab based on active collection (#8703) * Added beta flag for AI (#8706) * chore(coderabbit)/adds coderabbit instructions for adding new file as ts/tsx in bruno app (#8717) * fix(devtools): prevent console panel from bleeding over modals (#8716) * feat(web-buidler): remote artifact builder plugin (#8718) * basic plugin * Apply suggestion from @sid-bruno * fix(settings): Enable App toggle for GQL requests (#8723) * fix(converters): add missing auth mappings on postman export, add additional parameters mapping on postman import (#8494) * fix(import): add Oauth fallback for grant authorization code, parse additional parameters. * feat(import): support NTLM auth import from postman. #BRU-3114 * feat(export): support collection level auth. support awsv4, digest, ntlm, oauth1 and oauth2 auth types. fix bearer type return structure. * test(import): add NTLM, Additional parameters tests. * fix(export): add 'in' key for 'apiKey' auth type * test(export): add test cases for bruno to postman Auth flow. * fix (export): add folder level auth in export and use ensureString for string attributes * fix(import): add missing placement default and remove grant-type redundant logic * fix: revert missed grantType variable * test(export): add auth undefined assertion (code rabbit review) * fix: use common string util method for fallback * added stories and tests for Help component * fix(mountv2): give duplicate-named env variables distinct uids (#8730) * refactor(tests): update data type assertions to use data-selected-type attribute for consistency (#8731) * added stories and tests for accordian * fix(secrets): environment table (#8733) * fix(secrets): environment table * fix: removed useeffect * added introduction md file * test(converters): add round trip tests for Postman <-> Bruno converters (#8534) * test(export): add round trip tests for Postman <-> Bruno converter * fix(export): add unique key for paths to handle duplicates, fix postman collections to handle more code coverage * fix(conveters): add diff enum for reusability * fix: add enum for auth types * fix: CJS to ESM imports * fix: update readme info for round trip * added outlined version for segmented control * updated icons * removed dropdown * chore(eslint): adds eslint config warnings for unused-vars, debuggers, duplicate-imports (#8505) * feat(tests): enhance Playwright configuration for sharded CI runs (#8742) * refactor(ui): extract richtext editor utilities to utils folder * refactor(ui): move useLinkHandlers to utils folder * refactor(ui): extract richtext editor components to components folder * refactor(ui): refactor RichTextEditor toolbar state into custom hooks * test(e2e): fix richtext editor locators and handle new button components * fix(tests-macos): update branch filters for workflow triggers to support release branches (#8752) * fix: encode url for url without protocol (#8756) * fix(cookies): toggle raw mode state in ModifyCookieModal (#8755) * refactor: reorganize RichTextEditor hooks * feat(ai): add focus for prompt input after AI response completion (#8747) * fix(security): overflow on chip list styling (#8748) * feat(converters): add support for script execution flow in yml configuration (#8745) * chore: remove accidentally added non-bruno-app files * feat(collections): open multiple collections from a monorepo (#8724) * feat(collections): open multiple collections at once * refactor(collections): rename open-collection IPC channels * test(collections): e2e coverage for open collection picker and selection modal * refactor(collections): 'no collections found' toast message * fix(collections): import hydrateCollectionWithUiStateSnapshot in workspaces actions * fix(collections): default to no selection and surface open failures * feat(collections): prevent duplicate open collection toasts * fix(collections): update auto close condition for selection modal * test(collections): open collection selection selectors moved to page module * test(collections): match open collection rows by exact title * Merge branch 'main' into feat/open-multiple-collections * fix(workspaces): switch to default workspace on close so header shows correct name (#8425) * fix(workspaces): switch to default workspace on close so header shows correct name * Added the test spec related review. * added e2e test for closing workspace returns to default * added e2e test for closing workspace returns to default * added e2e test for closing workspace returns to default * test(workspaces): used stable test ids for workspace switcher and actions in close-workspace e2e * refactor(ai): update API key handling in openai comp providers (#8749) * refactor(ai): update API key handling in openai comp providers * fix * refactor: simplify rich text editor link management with unified ToolHint components and improved URL validation logic * chore(pr-decription)/updated pr description (#8786) * removed unused stories * removed radio group * chore(eslint)/disable autofix for const (#8760) * chore(eslint)/disable autofix for const * added a config * Apply suggestion from @sid-bruno Co-authored-by: Sid <[email protected]> * Apply suggestion from @sid-bruno Co-authored-by: Sid <[email protected]> * Apply suggestion from @sid-bruno Co-authored-by: Sid <[email protected]> * Apply suggestion from @sid-bruno Co-authored-by: Sid <[email protected]> * lint fix * added inline check * removed comment --------- Co-authored-by: Sid <[email protected]> * updated segment control design * fix: decouple task lists from mixed-content lists and improve markdown serialization for block elements * Fix: binary body lost on importing from postman (#8729) * fix/3118 - Postman Import: Binary Body Type Silently Lost * fix/3118 - Postman Import: Binary Body Type Silently Lost * fix/3118 - Postman Import: Binary Body Type Silently Lost * fix/Added indentation * Import binary body mode * handling else if * Handling example with binary body * file body mode * Add tests for importing Postman binary body requests * Enhance Postman binary body import by inferring content type from file extensions and adding tests for various file types * Add mime-types as an external dependency and implement test for .bin file content type resolution in Postman to Bruno conversion * fix: import statements * fix: e2e tests * refactor: improve test structure and assertions for Postman binary body import --------- Co-authored-by: rajashreehj-bruno <[email protected]> * style: update documentation edit toggle button size to sm * updated outlined styles * style: update inline code and block styling with transparent backgrounds, borders, and light-mode adjustments * fix(timeout): allow inherit request timeout for yaml requests (#8746) * fix(timeout): allow inherit request timeout for yaml requests * fix: add test.step for timeout * fix(timeout): normalize resolveTimeoutSetting to reject non-finite/negative timeouts * style: update code and block border radius to use base theme radius * fix(environment): auto save on env table removing some characters (#8732) * fix(environment)/auto save on env table * moved autosave tests * added locators * added test for multi line * updated name * feat(code-mirror-search): add replace and replace-all with search position, debouncing and tests (#8715) * feat(environment): add default env to presets (#8612) * fix: Folder Sequencing When we try to move any folder at the bottom of the folders list (#8722) * fix: Folder Sequencing When we try to move any folder at the bottom of the folders list * fix(bruno-app): use path-segment ancestry for folder drop checks to avoid sibling-prefix false positives * fix(bruno-app): allow folder to be reordered to bottom via dropType edge zones (BRU-1112) * ci: re-run benchmark check (flaky perf gate) * docs(bruno-app): updated stale dropType comments to above/below terminology * Added the fix for bru.runner.stopExecution() while running collection run from tests (#8720) * Added the fix for bru.runner.stopExecution() while running collection run from tests * resolved the code review for coderabbit * fix * feat(collections): add description text to open collection selection modal (#8793) * fix(ws): remove auto-reconnect in websockets (#8605) * feat: add preserve scripts option for Postman import/export (#8726) * feat(import): add preserve scripts option for Postman import/export * test(import): add postman preserve scripts coverage * fix(import): align preserve scripts option place and color * fix(import): address coderabbit comments * test(import): assert export scripts and centralize import locators * fix(export): validate empty filename, dismiss dialogs between tests * refactor(import): use options object for convertCollection config params * refactor(import): remove redundant check from importPostmanV2CollectionItem * Added the ignore for the collection nested folders (#8725) * Added the ignore for the collection nested folders * Removed the unignored functionality for Collection folder for now * require path boundary in folder ignore matching to prevent prefix and empty-pattern over-matching * fix(collection): deep-cloned bruno config before transform so ignore/update never mutated the object returned to redux * resolved the coderebbit review comments * fix:env configure remains visible (#8530) Co-authored-by: Adwait Aayush <[email protected]> * fix:url truncates in docs (#8468) * fix:url truncates in docs * refactor:added unit testcases made functions modular * Keep the default selected as none in the environments (#8785) * feat(request): warn when binary body file is missing on disk (#8753) * fix/request - Binary body type - show warning on file not exists in system * Made filename extraction OS-agnostic. * Use theme tokens for warning colors in this styled-component block. * Refactor FilePickerEditor to use useMissingFileCheck hook for file existence validation and improve warning display. Introduced new hook for checking missing files and updated tests to reflect changes in file picker behavior. * Enhance FilePickerEditor: Update title handling for single/multiple filenames and improve warning tooltip layout with icon integration. Adjust StyledWrapper to utilize theme-based border radius for consistency. --------- Co-authored-by: rajashreehj-bruno <[email protected]> * updated test ids * added dev tag so stories shows in docs only * added disabled * fix: failing test case fix (#8801) * feat(db): sqlite as a re-usable SDK for secondary queries (#8533) * chore: PR checklist update (#8806) * fix: avoid network probe in PAC myIpAddress (#8588) * fix * Fix/collection runner loader issue (#8783) * fix(runner): Collection Runner - Loader still keeps running even after Cancelling the execution * added a test id for the action buttons * removed onborading section * updated bg of segment control * added disabled color * fix(bruno-response): normalize response header name lookup to be case-insensitive (#8461) * fix(bruno-response): normalize header name lookup to be case-insensitive * fix(bruno-response): handle non-string header names in getHeader method * chore: resolve GitHub review conversations * fix(dev-tools): console and network filter dropdown position to top if no space (#8713) * fix(dev-tools): console and network filter dropdown scroll * fix(ws-replace)/add height for ws msgs to fix search overlap * fixed the accordion's isSearchOpen goes stale on collapse * fix(workspace): notify about collections that fail to open in Workspa… (#8719) * fix(workspace): notify about collections that fail to open in Workspace Home * Resolved the coderabbit comments * test(workspace): added e2e coverage for collections that fail to open * resolved the code rabit comments * refactor(ui): changed data-testid prop on StatusBadge for consistency * fix(workspace): exclude failed-to-open collections when reopening on config update * test(workspace): added the switch-time aggregated toast for unopenable collections * test(workspace): guard that config updates don't reopen failed-to-open collections * feat(snapshot):persisting sidebar state in the snapshot (#8328) * chore: new folder shortcut (#8805) * refactor(ai): moved AI Assist from floating overlay into request pane and collection/folder settings tab bars (#8693) * refactor(ai): moved AI Assist from floating overlay into request pane and collection/folder settings tab bars * test(ai): added e2e coverage for AI Assist tab-bar placement across request pane, collection and folder settings * test(ai): added e2e coverage for AI Assist tab-bar placement across request pane and settings * test(ai): extended AI Assist tab-bar placement coverage to graphql, grpc, websocket, app tab and default script sub-tab * scoped AI Assist placement assertions to the tab bar and added a settings tab bar test id * feat(auth-headers):handling authorization header leaks to third party servers on redirect (#8380) * feat: add forwardAuthorizationOnRedirect setting to allow stripping sensitive headers on cross-origin redirects * feat: add forwardAuthorizationOnRedirect to opencollection types * fix: restore missing forwardAuthorizationHeader config lines in runners and filestore * feat: apply secure forwardAuthorizationHeader default to Insomnia and OpenAPI imports * refactor: remove stale module augmentations for GraphQL and HTTP request settings * refactor: centralize default HTTP request settings and improve test step organization * chore: update @opencollection/types to version 0.10.0 across packages * fix: handle cross-origin redirect auth stripping, and optimize Redux settings initialization * refactor: fix formatting in collection schemas * chore: remove unused data-testid from Settings toggle * refactor: simplify forwardAuthorizationHeader serialization logic with nullish coalescing * refactor: migrate redirect auth strip E2E tests to use common locators utility * refactor: use toBool helper in bruToJson * feat: update forwardAuthorizationHeader to respect Postman protocol profile behavior * refactor: move DEFAULT_HTTP_ITEM_SETTINGS to bruno-common and update UI layout and redirection logic * refactor: introduce type conversion helpers to simplify HTTP request setting parsing * tests: support Postman protocolProfileBehavior for authorization header forwarding * feat: add test ID to forward auth toggle * feat: enable URL encoding by default in request settings * refactor: centralize isSameOrigin utility and simplify GraphQL settings conversion logic * refactor: replace manual type checks with toBool and toNumber helpers in collection converters * refactor: migrate request settings test locators to page object model * chore: set default encodeUrl to false and add line breaks for utils * test: add regression tests for encode URL setting default behavior * refactor: migrate encode-url-default-behaviour tests to use pageWithUserData fixture * updated discable dtext opacity * fix(node-vm): resolve npm modules from additionalContextRoots via native walk-up (#8538) * fix: resolve npm modules from additionalContextRoots node_modules in NodeVM When shared script folders configured via additionalContextRoots have their own node_modules, the NodeVM runtime now searches those directories for npm packages instead of only checking the collection and Bruno paths. * fix(node-vm): enhance npm module resolution security by restricting access to ancestor node_modules Added a new function to compare resolved npm module paths against allowed roots, ensuring that modules from ancestor directories outside the configured additionalContextRoots are not accessible. Updated the loadNpmModule function to utilize this security check during module resolution. Added tests to verify that ancestor node_modules cannot be accessed when not explicitly allowed. * feat(tests): add integration tests for additionalContextRoots npm module resolution Introduced a comprehensive set of integration tests to validate the resolution of npm modules from additionalContextRoots in the CLI. The tests ensure that shared libraries are correctly resolved, ancestor node_modules are inaccessible, and that collections can successfully utilize shared scripts. Additionally, created fixture files to support the testing environment, including workspace configurations and sample scripts for both collections A and B. * chore(tests): update .gitignore to track specific node_modules for e2e tests Modified .gitignore to include tracking for node_modules in test fixtures, ensuring that fake npm packages are available for end-to-end tests. Added new files for 'forbidden-lib' and 'signature-utils' to support testing scenarios. * test(node-vm): add test for resolving npm modules via symlink in additionalContextRoots Implemented a new test to verify that npm modules can be resolved correctly when additionalContextRoots points to a symlink. The test ensures that the symlinked library is accessible and that the context variable is set appropriately, enhancing the coverage for npm module resolution scenarios. * feat(node-vm): enhance npm module resolution with additional context roots Added support for resolving npm modules from additional context roots, including symlinked modules. Introduced new functions to validate module paths against allowed roots, ensuring security and proper resolution of transitive dependencies. Updated the loadNpmModule and createNpmModuleRequire functions to incorporate these changes, improving the flexibility and reliability of module loading in the NodeVM context. * feat(node-vm): improve npm module resolution for linked packages Enhanced the module resolution logic to allow internal relative requires within npm-linked packages, even when their physical location is outside declared allowed roots. Introduced a new function to find the closest package root, ensuring that internal dependencies can be resolved correctly. Updated tests to validate this behavior, confirming that the system handles linked packages as expected. * feat(node-vm): support subpath imports for npm-linked packages Enhanced the module resolution logic to allow subpath imports from npm-linked packages, ensuring that imports like `require('linked-pkg/utils')` are correctly resolved. Updated the `isModuleLinkedFromAllowedRoot` function to utilize bare-name lookup for improved accuracy. Added tests to validate this new behavior, confirming that subpath imports function as expected in the NodeVM context. * refactor(tests): remove forbidden-lib tests and update integration scenarios Eliminated tests related to the forbidden-lib package to streamline the test suite, ensuring that ancestor node_modules are not resolvable. Updated integration tests for additionalContextRoots to reflect changes in request counts and improved clarity in test descriptions. Adjusted workspace configurations to enhance overall test coverage and maintainability. * refactor(cjs-loader): simplify module resolution documentation Updated comments in the cjs-loader.js file to clarify the module resolution order, removing redundant explanations while maintaining essential details. This change enhances the readability and understanding of the module loading process in the NodeVM context. * refactor(cjs-loader): improve comments and clarify module resolution logic Updated comments in cjs-loader.js to enhance clarity regarding module resolution, specifically indicating fallback behavior when modules are not found in the collection. Adjusted the path used in createNpmModuleRequire for improved accuracy in module loading. * feat(tests): add additional-context-root-lib and update workflows Introduced the additional-context-root-lib package with its dependencies and updated relevant workflows to install this new library. Adjusted the CLI test and flaky test detector workflows to include installation steps for the additional-context-root-lib, ensuring proper setup for testing scenarios. * refactor(tests): update npm module resolution test for additionalContextRoots Revised the test case to ensure that requiring an npm package from a sibling additionalContextRoot fails as expected. Updated the test description for clarity and adjusted the script to reflect the intended behavior of module resolution, emphasizing the limitations of cross-root discovery in the NodeVM context. * refactor(tests): clean up comments in node-vm sandbox tests * refactor(tests): update fixture URLs in additional-context-roots tests Modified the URLs in the .bru fixture files to point to the local testbench server instead of an external service. This change ensures consistent test behavior and eliminates reliance on external resources during testing. * refactor(tests): enhance node-vm sandbox tests with symlink support Introduced a symlink support check in the node-vm sandbox tests to conditionally skip tests on Windows where symlink creation is restricted. Refactored the test setup to utilize a new `makePkg` function for creating package directories and files, improving code readability and maintainability. Updated relevant tests to leverage this new structure, ensuring consistent behavior across different environments. * refactor(setup): preserve specific node_modules during cleanup Added a mechanism to preserve certain `node_modules` directories during the cleanup process in the setup script. This change ensures that fixture data remains intact for testing, specifically for directories related to additional context roots. --------- Co-authored-by: lohit-bruno <[email protected]> * feat(cli): add --global-env-var to override global environment variables at runtime (#8620) * feat(cli): add support for overriding global environment variables with --global-env-var option - Introduced the --global-env-var option to allow users to overwrite global environment variables during command execution. - Updated the command handler to validate and process global environment variable overrides. - Enhanced the persistence logic to ensure that global environment variable overrides are handled correctly without leaking into the global environment file. - Added tests to verify the correct behavior of global environment variable persistence. * test(cli): enhance integration tests for global env var overrides - Added checks to ensure that runtime overrides do not persist to the global environment file. - Updated fixture scripts to reflect the expected behavior of global environment variable persistence. - Improved the substitution logic for dynamic URLs in test fixtures to ensure accurate testing of overrides. * refactor(tests): streamline CLI test arguments and error handling - Refactored CLI test cases to use a consistent argument array for command execution. - Improved error handling by consolidating error message construction for better readability. - Ensured that the tests maintain clarity while verifying global environment variable overrides. * fix: remove global env file check for global overrides * refactor(persist-variables): enhance global environment variable handling - Introduced a new `globalOverrides` option to manage global environment variable overrides more effectively. - Updated logic to ensure that both local and global overrides are correctly applied and do not persist unintended values to the global environment file. - Improved comments for clarity on the behavior of global environment variable persistence. * fix: address review comments * fix: address review comments * removed chnages which were out of scope * remove unused no-global-env fixture * refactor(tests): update integration tests for global env var overrides - Removed outdated fixture files related to global environment variable overrides. - Enhanced the test setup to dynamically create necessary workspace and collection structures. - Improved clarity in test descriptions and logic for validating that transient overrides do not persist to the global environment file. * refactor(tests): simplify global env var test setup * refactor(tests): remove outdated test for global env var persistence * feat: add markdown mode to documentation editor and upgrade rich text editor extensions * Fix: added actions for post reposne vars in yml (#8815) * feat: introduce DocsEditor component and useDocsEditingState hook to support rich text editing in collection documentation * fix: add dynamic font size adjustment for CodeMirror info display (#8817) * fix: add dynamic font size adjustment for CodeMirror info display * test: implement comprehensive E2E test suite and resolve rich text editor formatting issues * feat(envs): adding search filter to environment selector dropdown (#8277) * feat: adding search filter to environment selector dropdown * fix: making the search input sticky * test: updating tests into individual tests for environment selector search * fix: avioding searchinput refocus if already focussed * tests: ensuring dropdown open for tests and adding first printable key test * refactor: replace inline search logic with reusable SearchInput component in EnvironmentSelector * refactor: standardize environment selector locators and test actions for improved search functionality testing * test: update environment search casing, improve tab state handling in actions * refactor: decouple and centralize collection header locators and utility functions into dedicated module * refactor: migrate environment selector locators to a dedicated utilities file and update collection header references * refactor: consolidate collection header locators and update environment selector test utilities * test: add and implement closeEnvironmentSelector utility to clean up environment selector state in tests * refactor: simplify environment selector lifecycle management by centralizing open/close logic in test hooks * refactor: lift search state to environment selector and clear input on close * test: refactor EnvironmentListContent unit tests to use a wrapper component for state management and update clear button selector * fix(locators): reverting environment selector locator reference * refactor: clear search input when switching environment tabs and ensure persistent visibility of configure button * test: add global environments data and verify search functionality in environment selector --------- Co-authored-by: sachin-thakur-bruno <[email protected]> * feat(client certs): add global client certs and allow disabling individual client certs. (#8751) * feat: add client certificates to global preferences * feat(client certificates): apply global client certs on requests, allow disabling individual certs at global and collection level * fix: create list group component. modify client certificate UI to match new mockup. * test(client certs): setup client certs test suite and add CLI test cases for client certs * test(client certs): add E2E cases for collection and global client certs * fix: fix code review comments from claude * fix: count test failures using filter to remove duplicate counting. * fix: minor UI fixes to support storybook * fix: remove duplicated onboarding config from test preferences.json * fix: use testIds on test and ws responses for better test reachability. use the new test-ids on locators * fix: coderabbit fixes * fix: fix lint issues * fix: review comment changes for test cases * fix: add timeout for the fixture setup * fix: add break for grpcCurl to match first case * test: prevent stale response reads in client-cert e2e specs * fix: add separate fixture for sandbox modes in WSS to prevent stale close connection message * fix: add regex matching for ws assertions to reduce flakiness * fix: fix list group "add button"'s icon alignment * fix: add save button to collection client certificates * test: add collection client certificate precedence test case * feat(presets)/updated the requests to use segmented control (#8816) * feat(presets)/updated the requests to use segmented control * updated icons * yml migration rework (#8795) * feat: extend markdown linkify support for relative assets in rich text editor * feat: add color-scheme support for task list items in editor styles * refactor: updating file/folder structure for docs editor files * refactor: encapsulate DocsAction styling in a new StyledWrapper component * refactor: update richtext editor tests to import utilities from actions instead of utils * fix:cmd+w now works for transient tabs (#8429) * fix:cmd+w now works for transient tabs * test: verify URL is preserved after saving and closing a transient tab * test: use centralized page locators and test.step in the transient close spec * refactor: branch on transient at the save dispatch site * refactor:use if/else branches in onSaveAndClose --------- Co-authored-by: Adwait Aayush <[email protected]> * Fix: Description missing for the import export yml for the environments (#8822) * Fix: Description not there in the import export yml for the environments * Comments addressed * Comments addressed * security(ipc): confine renderer file writes to known collections (#8274) * fix(openapi):strip trailing dots from operation names on import (#8812) * fix(openapi):strip trailing dots from operation names on import * fix(openapi): strip trailing dots from environment names on import --------- Co-authored-by: Adwait Aayush <[email protected]> * feat(rich-text-editor)/scroll persist * fix:populate collection & folder docs on OpenAPI/swagger imports (#8803) * fix:populate collection & folder docs on OpenAPI/swagger imports * fix(openapi): coerce spec descriptions to strings before use * test(openapi): extract findRequestByName/findFolderByName into shared helper * fix:guard against object names --------- Co-authored-by: Adwait Aayush <[email protected]> * fix(generate-code): generate code for url interpolation (#7308) * fix(presets)/ux fixes for dropdown and icon spacing (#8827) * fix ux * updated padding * fix(secrets): block duplicate secret names to prevent value loss (#8750) * refactor: migrate documentation edit toggle to use test ID instead of class selector * refactor: migrate collection and folder documentation edit toggle to shared DocsAction component * chore: enhance claude rules & skills * feat: support drag-and-drop and alphabetical sorting for variables (#8603) * test: update doc toggle locators to use test-ids * Mock Server Implementation (#8734) * reported how many collections failed to open on workspace load (#8831) * reported how many collections failed to open on workspace load * Added the failed collection in the overview list of collections in the workspace * test: fix the draft indicator tests for collection client certs (#8824) * fix(generate-code): encode a literal colon in the path when the toggl… (#8834) * fix(e2e): Playwright failures from mock server and lazy mount (#8835) * fix: green Linux Playwright failures from mock server and lazy mount Unscoped Create clicks collided with the new mock-server button, and sidebar-created examples open in edit mode so view-mode title asserts were stale. Cross-format drops into unmounted workspace collections also failed path confinement; mount on drop and treat last-opened collections as known roots. * Update packages/bruno-electron/src/ipc/collection.js * refactor: simplify collection path retrieval in findCollectionPathByItemPath function * test: update method search test to use test-id for environment selection * fix: simplify watcher management in CollectionWatcher class * feat(presets)/updated presets design (#8828) * feat(presets)/updated presets design * fixed text * updated the text * removed styles * ci: move all linux to self hosted (#8791) * feat(docs): syntax highlighting for code blocks in rich text docs (#8670) * feat(presets)/updated dropdown with menu dropdown and label weight ux changes (#8841) * feat(presets)/updated dropdown with menu dropdown and label weight ux changes * removed the comment * used button for dropdown trigger * feat(tests): enhance CodeEditor and EditorCodeBlock tests with additional mocks and configurations (#8858) * fix:sorting now works for secrets tab (#8871) * fix(mount): hydrate websocket message uids in the cached mount path (#8862) WS message expand/collapse is keyed by the message uid, so a message without one cannot be opened at all — the toggle bails on a falsy uid and every row renders with the same undefined React key. The v1 mount path hydrated request.body.ws (via hydrateRequestWithUuid), but mount v2's uid list omitted it. With File Cache enabled the tree is built from the cache on cold start, so every WS message arrived with no uid and its body could not be expanded. It only reproduced after a restart because live edits during a session still flow through the collection watcher's v1 hydration. Since v2 seeds uids deterministically from the file path, expanded-message state now also survives a restart instead of resetting. * fix:keep sort column header from shifting when the arrow appears (#8833) * fix:keep sort column header from shifting when the arrow appears --------- Co-authored-by: Sid <[email protected]> * fix:change-version modal ui (#8735) * fix:change-version modal ui * feat: add migrate-to-YML pill to collection header (#8882) * fix(mock-server): bring the UI in line with the rest of Bruno (#8880) * fix(mock-server): bring the UI in line with the rest of Bruno * fix --------- Co-authored-by: Utkarsh <[email protected]> * fix(ws): disable message queuing when in intermediate connection states (#8879) * feat: add disabled state to SendButton based on connection status * Update packages/bruno-app/src/components/RequestPane/WsQueryUrl/index.js Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix: update WebSocket connection handling and improve run button behavior --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(proxy): update timestamp label format (#8870) * fix(proxy): update timestamp label format and enhance timestamp utility function * fix(tests): update timestamp regex to match AM/PM format in system proxy tests * fix(timestamp): enhance formatProxyTimestamp function to replace non-breaking spaces and update regex for system proxy timestamp * fix: persist additional request values in preferences general tab save (#8823) * fix (transient-request): unable to create transient request when preset is websocket (#8889) * fix(transient): updated the websocket type key from websocket to ws to match the key coming from presets * test(transient): added tests, locators, and actions to validate the default request type of transient request when a preset is selected * refactor(import): imported the REQUEST_TYPE (aliased) from common utils and removed unused imports * fixes: OpenAPI Spec Viewer: throws resolver errors for `$ref` schemas (#8892) * fix(app): global environment variables for apps (#8900) * feat(mock-server): enhance MockResponseRequestPane with method selection and other minor tweaks (#8885) * fix(auth): stop AWS V4 auth headers from leaking on cross-origin redirects (#8893) * fix: strip AWS Signature V4 headers on cross-origin redirects when authorization forwarding is disabled * fix: prevent AWS SigV4 header leakage on cross-origin redirects by isolating signature removal from authorization header forwarding * refactor: update formatting of AWS SigV4 redirect comment block for readability * refactor: simplify response text extraction in redirect authentication tests using innerText * fix(editor): allow app keybindings if that keybindings is not present in rich text editor (#8894) * fix(doc-editor)/key bindings for doc editor * fix(mock-server): improve mock response name validation (#8908) * feat(migrate): enhance migration modal to handle collection drafts (#8899) * fix(codemirror-search)/keybinding for focusing search and replace inside the search container (#8895) * fix(sidebar): prevent drag divider from disappearing on zoom-out (#8266) * fix(sidebar): prevent drag divider from disappearing on zoom-out * fix(sidebar): keep resize divider visible across tabs and zoom levels * refactor: remove AI documentation assistant and related context payload generation from documentation components (#8921) * fix(editor)/add guessed language in language dropdown picket (#8925) * fix(editor): tab indentation on code blocks (#8926) * fix(git): use removePath for failed-clone cleanup ipc/git.js imported removeDirectory from utils/filesystem, which only exports removePath. On a failed clone the cleanup branch threw "TypeError: removeDirectory is not a function", replacing the rejection and hiding why the clone actually failed. removePath removes recursively, which is the semantics this call wanted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore: restore upstream code the fork had stripped These files carried no RestWolf feature - the earlier squash-sync had rolled back upstream improvements, and the merge preserved those rollbacks because upstream's later edits did not textually conflict. - CreateCollection / CreateWorkspace: name trimming and validation messages - ExampleTab: exampleIndex lookup, matching the accessor restored in tabs.js and the snapshot serializer - insomnia converter specs, request-pane-interactivity, create-collection and create-workspace e2e specs Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore: restore remaining upstream code stripped by the fork Same pattern as the previous commit, found by diffing the merged tree against upstream/main for net deletions: - RequestTabPanel / ExampleItem: exampleIndex plumbing - insomnia-to-bruno: empty-mimeType text body handling, covered by the insomnia specs restored earlier (now passing) Remaining divergence from upstream is fork features and branding only: Azure Vault, saved auth modes, tab retention, theme colours, RestWolf branding, auto-updater, PostHog removal, and trimmed docs. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(git): add Git UI tab and branch chip Upstream ships the git engine in bruno-electron/src/utils/git.js but wires only clone to IPC, so none of it is reachable from the app. This registers the rest and adds the UI. IPC (ipc/git.js): status, init, stage, unstage, discard, commit, file diff, fetch, pull, push. Each mutating handler returns the recomputed panel state so the renderer never has to re-query. UI: a Git UI tab (left panel with commit box and changed-file list, right pane with fetch/pull/push and ahead-behind), opened from a branch chip in the collection toolbar. Both read shared state via the useGitStatus hook. Two quirks in the existing utils this works around: - pullGitChanges rejects unless given an explicit merge strategy - getUnstagedFileDiff matches absolute paths, while git status reports repo-relative ones Verified against a real repository: status, branch, remote and diffs; plus a full init/stage/commit/edit/diff/discard round trip on a scratch repo. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(theme): move accent colour into the Appearance dropdown The fork repurposed ColorPicker to take value/label/onReset for the accent colour, but the merge restored upstream's per-environment call sites, which pass a `color` prop that component no longer reads. Both environment panels therefore rendered the accent picker and edited the app accent. Removes the picker from both environment panels and from the Themes preferences pane, and puts it in the Appearance dropdown behind the palette button in the status bar, where it edits the accent for whichever theme is on screen. feat(git): branch switching in the Git UI Adds a renderer:git-checkout handler and a branch switcher in the panel footer. A checkout that would overwrite local edits is left to fail, and git's own message is shown in the panel - matching how VS Code reports it - rather than being forced or auto-stashed. Verified: create-and-switch, clean switch, and a dirty switch refused with "Your local changes to the following files would be overwritten by checkout", with the edit left intact. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(theme): keep the accent picker inside the Appearance menu .theme-menu had a fixed 325px height, so the accent row rendered past the bottom edge and overlapped the status bar. min-height lets the menu grow while keeping its size steady when the theme lists are short. The swatch's own dropdown is absolutely positioned below its trigger, which falls off-screen for a menu anchored to the status bar, so it is flipped to open upward within this section. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore: remove screenshot committed by mistake Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(git): pass remote and branch to push and pull pushGitChanges looks the branch up by name (branchSummary.branches[remoteBranch]) and rejects with "Branch undefined does not exist" when it isn't supplied, so Push failed from the panel. Both handlers now default the remote to origin and resolve the current branch. Verified against a local bare remote: commit leaves ahead=1, push clears it, a remote commit shows behind=1 after fetch, and pull brings it down. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(git): sync button and visible feedback for git operations Git operations succeed silently, so a push that worked and a push that failed looked identical - the error banner only rendered inside the sidebar's Changes section, which is collapsible and sits away from the buttons. Every operation now reports through a toast, and the error banner also shows next to the fetch/pull/push controls. Adds a Sync button that pulls before pushing, matching VS Code's ordering so a diverged branch does not hit a non-fast-forward rejection. Its label states what will move: "Sync 2 down, 1 up", "Push 3 commits", "Pull 1 commit", or "Sync Changes" when level. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(secrets): secret managers with ordered vault tiers Replaces the single enable-and-configure Azure vault in General preferences with a Secrets Manager section modelled on how Bruno configures providers: add a provider, pick Azure Key Vault, enter connection details, test the connection. Providers are listed in precedence order. Environments gain an ordered list of vault secret names on the Secrets tab, matching the vault-teller tier layout (tenant, cluster, global). Resolution is first-match-wins per key, so the most specific tier sits at the top - the same precedence as vault-teller's tenant ?? cluster ?? global. Fetching shows what each tier actually contributed: a source dropdown switches between the merged view and any single secret, and keys claimed by a higher tier are struck through with the winner named, so a shadowed value is visible rather than looking ignored. Credentials are now encrypted at rest via the existing safeStorage-backed helpers instead of sitting in plain text in preferences.json, and the client secret is never sent to the renderer. The ordered secret names persist as a VAULT_SECRETS environment variable so they travel with the collection in git; the previous VAULT_SECRET is still read so existing environments keep working. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(secrets): make the vault panel reachable in global environments The panel was passed as renderExtraButtonContent, which the table renders inline beside Save and Reset, so a block-level panel with tables was crushed into that row. It is now a sibling of the table inside a scrolling column, since neither the environment content area nor the table wrapper scrolls - without that, a fetched result pushed the table's Save button out of reach. The resolved table is capped and scrolls on its own, and the panel header carrying Apply is sticky so it stays available while reading a long tier. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(secrets): pin each vault secret to a provider Each entry on the environment's Secrets tab now carries a vault dropdown, so a tier can name which provider serves it rather than relying on lookup order. "Any vault" keeps the previous behaviour of trying each configured provider in turn. A pinned vault is honoured or reported: an unknown vault name, or a secret missing from the pinned vault, is surfaced as an error instead of falling back to another provider, which would otherwise hand back a different environment's values under the same key. The choice persists by vault name rather than local id so it still resolves for a teammate whose provider has a different id. Entries serialise as "<vault>:<secret>" in VAULT_SECRETS, with bare names still accepted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * style(secrets): fix operator indentation in the resolver Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(secrets): clear all vault secrets from an environment Reset reverts the table to the saved environment, so once fetched secrets have been saved there is nothing for it to undo and it appears to do nothing. Removing them meant deleting each row by hand. Adds a Clear secrets action beside Apply, giving the bulk add a matching bulk removal. It drops the rows from the table only, so the environment still has to be saved and a mis-click is undone by Reset. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(release): bump RestWolf to 4.0.0 Major bump for the upstream v3-to-v4 merge and the features built on it: Git UI, secret managers with ordered vault tiers, and the accent colour move. Version lives only in packages/bruno-electron/package.json - electron-builder reads it for artifact names, and scripts/release.js bumps it from there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Pooja <[email protected]> Co-authored-by: Sundram <[email protected]> Co-authored-by: Bijin A B <[email protected]> Co-authored-by: gopu-bruno <[email protected]> Co-authored-by: naman-bruno <[email protected]> Co-authored-by: ravindra-bruno <[email protected]> Co-authored-by: Abhishek Patil <[email protected]> Co-authored-by: Gopi-bruno <[email protected]> Co-authored-by: sachin-bruno <[email protected]> Co-authored-by: Sid <[email protected]> Co-authored-by: Chirag Chandrashekhar <[email protected]> Co-authored-by: shubh-bruno <[email protected]> Co-authored-by: Jiawen Geng <[email protected]> Co-authored-by: anusree-bruno <[email protected]> Co-authored-by: Rohan-Bruno <[email protected]> Co-authored-by: sachin-thakur-bruno <[email protected]> Co-authored-by: Ryan <[email protected]> Co-authored-by: shubh-bruno <[email protected]> Co-authored-by: Utkarsh <[email protected]> Co-authored-by: morsh-bruno <[email protected]> Co-authored-by: sanish chirayath <[email protected]> Co-authored-by: rajashreehj-bruno <[email protected]> Co-authored-by: adwait-bruno <[email protected]> Co-authored-by: Adwait Aayush <[email protected]> Co-authored-by: Rayan Salhab <[email protected]> Co-authored-by: sharan-bruno <[email protected]> Co-authored-by: lohit-bruno <[email protected]> Co-authored-by: arpit-bruno <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Description
BRU-2623
Curently users can only search a text in codemirror. There is no option to replace the selected text.
Adding replace and replace all feature in code mirror. Users can select a text for search and can replace the selected text by replace one-by-one or replace all. Adding the keyboard shortcuts for opening the serach and replace.
Screen.Recording.2026-06-16.at.3.39.41.PM.mov
CodeMirrorSearch/index.js
Replace functionality
replaceTextstate andreplaceVisibletogglehandleReplace— replaces the current match viaeditor.replaceRange, invalidates the search cache, and re-runs search at the same indexhandleReplaceAll— replaces all matches in reverse order (to preserve character positions) insideeditor.operation()for a single undo stepLayout
IconChevronRight) extracted as a full-height left column — spans both rows when expanded, matching VS Code's widget.toggle-replace-btn+.search-replace-rows(column of.search-row/.replace-row)IconReplaceandIconArrowsExchange2withToolHinttooltipsKeyboard & focus
keydownlistener attached in the capture phase ({ capture: true }) on the container — ensuresEscapeis intercepted before CodeMirror or the browser can act on ittype="button"added to all buttons for correct focusabilityImperative handle — exposes four methods via
useImperativeHandle:focus()setSearch(text)openReplace()close()onCloseCodeMirrorSearch/StyledWrapper.js
flex-direction: row— chevron column on the left, rows column on the right.toggle-replace-btnusesalign-self: stretchfor full-heightborderbox, fixed180pxwidth — both rows visually identical.search-rowgets aborder-bottomonly when replace is expanded.searchbar-text-btnstyles (replaced by icon buttons)CodeEditor/index.js
Cmd/Ctrl+H— replaced'replace'string command with a handler that opens the search bar and callssearchBarRef.current?.openReplace()Cmd/Ctrl+F— updated to checkcm.getSelection():setSearch(selectedText)to prefill and re-run search (works whether bar is open or closed)focus()to move cursor to the input without clearing existing search textEscextraKey — updated from baresetStatetosearchBarRef.current?.close()so marks are properly cleaned up when Esc is pressed while the editor has focusPerformance Improvements
1. Only highlight what's visible
The search still finds all matches in the document, but it only creates highlights (
markText()) for matches that are currently visible in the editor (plus a small buffer of ±100 lines). The currently selected match is always highlighted, even if it's outside the viewport.For example, in a 10,000-line file with 500 matches, the editor typically creates only 5–10 highlights instead of 500, significantly reducing DOM work. As you scroll, old highlights are removed and new ones are drawn for the visible area.
Files
components/CodeMirrorSearch/markingUtils.js2. Cache search results
Scanning the entire document with CodeMirror's
getSearchCursor()can be expensive on large files.Search results are cached and reused until something that affects the results changes:
This means actions like Next, Previous, scrolling, or component re-renders reuse the existing match list instead of rescanning the document every time.
Files
components/CodeMirrorSearch/searchUtils.js(createCacheKey)components/CodeMirrorSearch/index.js(searchCacheKey,isCacheHit)3. Debounce search while typing
Instead of performing a full document scan on every keystroke, the search waits until the user stops typing for 250 ms before running.
Typing stays responsive because intermediate keystrokes only update the input field without triggering an expensive search.
Files
components/CodeMirrorSearch/index.js(useDebounce(searchText, 250))4. Jump directly to visible matches
When drawing highlights, the code uses a binary search to quickly locate the first match inside the current viewport instead of checking every match from the beginning.
This reduces the work from scanning the entire match list to only processing the matches that are actually visible.
Files
components/CodeMirrorSearch/markingUtils.js5. Limit extremely large searches
To avoid freezing the UI on pathological searches (for example, searching for a single character in a very large minified file), the search stops after 99,999 matches.
This provides a reasonable safety limit while still supporting very large result sets.
Files
components/CodeMirrorSearch/searchUtils.js(MAX_MATCHES)6. Scroll only when it makes sense
Searching no longer automatically scrolls the editor every time results are updated.
The editor scrolls only when explicitly requested, such as:
It does not scroll during:
This prevents the editor from unexpectedly jumping away from the user's current position.
Files
components/CodeMirrorSearch/index.js(doSearch(..., shouldScroll = false))Contribution Checklist:
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